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 0b34b4546e
commit 4b740a9f5a

View File

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