native types, add create/destroy material instance, add SceneManager::LAYERS enum

This commit is contained in:
Nick Fisher
2024-09-19 09:11:20 +08:00
parent bb46241f98
commit a2618dab31

View File

@@ -23,14 +23,14 @@
#include "CustomGeometry.hpp"
#include "Gizmo.hpp"
#include "APIBoundaryTypes.h"
#include "GridOverlay.hpp"
#include "ResourceBuffer.hpp"
#include "components/CollisionComponentManager.hpp"
#include "components/AnimationComponentManager.hpp"
#include "tsl/robin_map.h"
#include "Aabb2.h"
namespace thermion_filament
{
@@ -53,6 +53,11 @@ namespace thermion_filament
const char *uberArchivePath);
~SceneManager();
enum LAYERS {
DEFAULT_ASSETS = 0,
OVERLAY = 7,
};
class HighlightOverlay {
public:
HighlightOverlay(EntityId id, SceneManager* const sceneManager, Engine* const engine, float r, float g, float b);
@@ -87,7 +92,7 @@ namespace thermion_filament
/// @return an Entity representing the FilamentAsset associated with the loaded FilamentAsset.
///
EntityId loadGlb(const char *uri, int numInstances, bool keepData);
EntityId loadGlbFromBuffer(const uint8_t *data, size_t length, int numInstances = 1, bool keepData = false);
EntityId loadGlbFromBuffer(const uint8_t *data, size_t length, int numInstances = 1, bool keepData = false, int priority = 4, int layer = 2);
EntityId createInstance(EntityId entityId);
void remove(EntityId entity);
@@ -244,10 +249,13 @@ namespace thermion_filament
uint16_t *indices,
uint32_t numIndices,
filament::RenderableManager::PrimitiveType primitiveType = RenderableManager::PrimitiveType::TRIANGLES,
const char *materialPath = nullptr,
MaterialInstance* materialInstance = nullptr,
bool keepData = false
);
MaterialInstance* createUbershaderInstance(TMaterialKey key);
void destroy(MaterialInstance* materialInstance);
friend class FilamentViewer;
Gizmo* gizmo = nullptr;
@@ -282,6 +290,8 @@ namespace thermion_filament
void setMaterialProperty(EntityId entity, int materialIndex, const char* property, float value);
void setMaterialProperty(EntityId entityId, int materialIndex, const char* property, filament::math::float4 value);
MaterialInstance* createUbershaderMaterialInstance(MaterialKey key);
private:
gltfio::AssetLoader *_assetLoader = nullptr;
const ResourceLoaderWrapperImpl *const _resourceLoaderWrapper;