feat: Rename Gizmo material to UnlitFixedSize, and expose methods for using this material on other entities. Also exposes new methods for setting single float parameters.
This commit is contained in:
@@ -17,8 +17,6 @@
|
||||
#include <filament/IndexBuffer.h>
|
||||
#include <filament/InstanceBuffer.h>
|
||||
|
||||
#include "material/gizmo.h"
|
||||
|
||||
#include "ThermionDartApi.h"
|
||||
|
||||
namespace thermion {
|
||||
@@ -31,7 +29,7 @@ class Gizmo {
|
||||
enum Axis { X, Y, Z};
|
||||
|
||||
public:
|
||||
Gizmo(Engine *engine, View *view, Scene *scene);
|
||||
Gizmo(Engine *engine, View *view, Scene *scene, Material* material);
|
||||
~Gizmo();
|
||||
|
||||
typedef void (*PickCallback)(EntityId entityId, uint32_t x, uint32_t y, View *view);
|
||||
@@ -91,8 +89,10 @@ class Gizmo {
|
||||
Engine *_engine;
|
||||
Scene *_scene;
|
||||
View *_view;
|
||||
utils::Entity _entities[7] = { utils::Entity(), utils::Entity(), utils::Entity(), utils::Entity(), utils::Entity(), utils::Entity(), utils::Entity() };
|
||||
Material* _material;
|
||||
|
||||
utils::Entity _entities[7] = { utils::Entity(), utils::Entity(), utils::Entity(), utils::Entity(), utils::Entity(), utils::Entity(), utils::Entity() };
|
||||
|
||||
MaterialInstance* _materialInstances[7];
|
||||
math::float4 inactiveColors[3] {
|
||||
math::float4 { 1.0f, 0.0f, 0.0f, 0.5f },
|
||||
|
||||
@@ -19,9 +19,6 @@
|
||||
#include <filament/IndexBuffer.h>
|
||||
#include <filament/InstanceBuffer.h>
|
||||
|
||||
#include "material/gizmo.h"
|
||||
|
||||
|
||||
namespace thermion {
|
||||
|
||||
using namespace filament;
|
||||
|
||||
@@ -19,16 +19,17 @@
|
||||
#include <filament/InstanceBuffer.h>
|
||||
#include <utils/NameComponentManager.h>
|
||||
|
||||
#include "CustomGeometry.hpp"
|
||||
#include "tsl/robin_map.h"
|
||||
|
||||
|
||||
#include "APIBoundaryTypes.h"
|
||||
#include "CustomGeometry.hpp"
|
||||
#include "Gizmo.hpp"
|
||||
#include "GridOverlay.hpp"
|
||||
#include "ResourceBuffer.hpp"
|
||||
#include "components/CollisionComponentManager.hpp"
|
||||
#include "components/AnimationComponentManager.hpp"
|
||||
|
||||
#include "tsl/robin_map.h"
|
||||
|
||||
|
||||
namespace thermion
|
||||
{
|
||||
@@ -287,6 +288,8 @@ namespace thermion
|
||||
return _ubershaderProvider;
|
||||
}
|
||||
|
||||
MaterialInstance* createUnlitFixedSizeMaterialInstance();
|
||||
|
||||
MaterialInstance* createUnlitMaterialInstance();
|
||||
|
||||
void setVisibilityLayer(EntityId entityId, int layer);
|
||||
@@ -298,6 +301,8 @@ namespace thermion
|
||||
size_t getCameraCount();
|
||||
|
||||
Camera* getCameraAt(size_t index);
|
||||
|
||||
Gizmo *createGizmo(View *view, Scene *scene);
|
||||
|
||||
bool isGizmoEntity(utils::Entity entity);
|
||||
|
||||
@@ -321,6 +326,8 @@ namespace thermion
|
||||
std::mutex _stencilMutex;
|
||||
std::vector<MaterialInstance*> _materialInstances;
|
||||
|
||||
Material* _gizmoMaterial = nullptr;
|
||||
|
||||
utils::NameComponentManager *_ncm;
|
||||
|
||||
tsl::robin_map<
|
||||
|
||||
@@ -10,7 +10,6 @@ extern "C"
|
||||
|
||||
typedef void (*GizmoPickCallback)(EntityId entityId, uint32_t x, uint32_t y, TView* view);
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE TGizmo* Gizmo_new(TEngine *tEngine, TView *tView, TScene *tScene);
|
||||
EMSCRIPTEN_KEEPALIVE void Gizmo_pick(TGizmo *tGizmo, uint32_t x, uint32_t y, GizmoPickCallback callback);
|
||||
EMSCRIPTEN_KEEPALIVE void Gizmo_setVisibility(TGizmo *tGizmo, bool visible);
|
||||
|
||||
|
||||
@@ -198,6 +198,7 @@ extern "C"
|
||||
int skinIndex,
|
||||
int boneIndex);
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE TGizmo* SceneManager_createGizmo(TSceneManager *tSceneManager, TView *tView, TScene *tScene);
|
||||
EMSCRIPTEN_KEEPALIVE EntityId SceneManager_createGeometry(
|
||||
TSceneManager *sceneManager,
|
||||
float *vertices,
|
||||
@@ -212,6 +213,7 @@ extern "C"
|
||||
TMaterialInstance *materialInstance,
|
||||
bool keepData);
|
||||
EMSCRIPTEN_KEEPALIVE TMaterialInstance *SceneManager_createUnlitMaterialInstance(TSceneManager *sceneManager);
|
||||
EMSCRIPTEN_KEEPALIVE TMaterialInstance *SceneManager_createUnlitFixedSizeMaterialInstance(TSceneManager *sceneManager);
|
||||
EMSCRIPTEN_KEEPALIVE bool SceneManager_setTransform(TSceneManager *sceneManager, EntityId entityId, const double *const transform);
|
||||
EMSCRIPTEN_KEEPALIVE void SceneManager_queueTransformUpdates(TSceneManager *sceneManager, EntityId* entities, const double* const transforms, int numEntities);
|
||||
EMSCRIPTEN_KEEPALIVE TCamera* SceneManager_findCameraByName(TSceneManager* tSceneManager, EntityId entity, const char* name);
|
||||
@@ -295,6 +297,7 @@ extern "C"
|
||||
EMSCRIPTEN_KEEPALIVE void MaterialInstance_setDepthWrite(TMaterialInstance* materialInstance, bool enabled);
|
||||
EMSCRIPTEN_KEEPALIVE void MaterialInstance_setDepthCulling(TMaterialInstance* materialInstance, bool enabled);
|
||||
EMSCRIPTEN_KEEPALIVE void MaterialInstance_setParameterFloat2(TMaterialInstance* materialInstance, const char* name, double x, double y);
|
||||
EMSCRIPTEN_KEEPALIVE void MaterialInstance_setParameterFloat(TMaterialInstance* materialInstance, const char* name, double value);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -67,6 +67,7 @@ extern "C"
|
||||
void (*callback)(EntityId));
|
||||
EMSCRIPTEN_KEEPALIVE void SceneManager_loadGlbFromBufferRenderThread(TSceneManager *sceneManager, const uint8_t *const data, size_t length, int numInstances, bool keepData, int priority, int layer, bool loadResourcesAsync, void (*callback)(EntityId));
|
||||
EMSCRIPTEN_KEEPALIVE void SceneManager_createUnlitMaterialInstanceRenderThread(TSceneManager *sceneManager, void (*callback)(TMaterialInstance*));
|
||||
EMSCRIPTEN_KEEPALIVE void SceneManager_createUnlitFixedSizeMaterialInstanceRenderThread(TSceneManager *sceneManager, void (*callback)(TMaterialInstance*));
|
||||
EMSCRIPTEN_KEEPALIVE void load_glb_render_thread(TSceneManager *sceneManager, const char *assetPath, int numInstances, bool keepData, void (*callback)(EntityId));
|
||||
EMSCRIPTEN_KEEPALIVE void load_gltf_render_thread(TSceneManager *sceneManager, const char *assetPath, const char *relativePath, bool keepData, void (*callback)(EntityId));
|
||||
EMSCRIPTEN_KEEPALIVE void create_instance_render_thread(TSceneManager *sceneManager, EntityId entityId, void (*callback)(EntityId));
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
.global GIZMO_GIZMO_OFFSET;
|
||||
.global GIZMO_GIZMO_SIZE;
|
||||
|
||||
.global GIZMO_PACKAGE
|
||||
.section .rodata
|
||||
GIZMO_PACKAGE:
|
||||
.incbin "gizmo.bin"
|
||||
GIZMO_GIZMO_OFFSET:
|
||||
.int 0
|
||||
GIZMO_GIZMO_SIZE:
|
||||
.int 27809
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
.global _GIZMO_GIZMO_OFFSET;
|
||||
.global _GIZMO_GIZMO_SIZE;
|
||||
|
||||
.global _GIZMO_PACKAGE
|
||||
.section __TEXT,__const
|
||||
_GIZMO_PACKAGE:
|
||||
.incbin "gizmo.bin"
|
||||
_GIZMO_GIZMO_OFFSET:
|
||||
.int 0
|
||||
_GIZMO_GIZMO_SIZE:
|
||||
.int 27809
|
||||
|
||||
Binary file not shown.
@@ -1,13 +0,0 @@
|
||||
#ifndef GIZMO_H_
|
||||
#define GIZMO_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern "C" {
|
||||
extern const uint8_t GIZMO_PACKAGE[];
|
||||
extern int GIZMO_GIZMO_OFFSET;
|
||||
extern int GIZMO_GIZMO_SIZE;
|
||||
}
|
||||
#define GIZMO_GIZMO_DATA (GIZMO_PACKAGE + GIZMO_GIZMO_OFFSET)
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
12
thermion_dart/native/include/material/unlit_fixed_size.S
Normal file
12
thermion_dart/native/include/material/unlit_fixed_size.S
Normal file
@@ -0,0 +1,12 @@
|
||||
.global UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_OFFSET;
|
||||
.global UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_SIZE;
|
||||
|
||||
.global UNLIT_FIXED_SIZE_PACKAGE
|
||||
.section .rodata
|
||||
UNLIT_FIXED_SIZE_PACKAGE:
|
||||
.incbin "unlit_fixed_size.bin"
|
||||
UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_OFFSET:
|
||||
.int 0
|
||||
UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_SIZE:
|
||||
.int 28235
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
.global _UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_OFFSET;
|
||||
.global _UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_SIZE;
|
||||
|
||||
.global _UNLIT_FIXED_SIZE_PACKAGE
|
||||
.section __TEXT,__const
|
||||
_UNLIT_FIXED_SIZE_PACKAGE:
|
||||
.incbin "unlit_fixed_size.bin"
|
||||
_UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_OFFSET:
|
||||
.int 0
|
||||
_UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_SIZE:
|
||||
.int 28235
|
||||
|
||||
BIN
thermion_dart/native/include/material/unlit_fixed_size.bin
Normal file
BIN
thermion_dart/native/include/material/unlit_fixed_size.bin
Normal file
Binary file not shown.
1422
thermion_dart/native/include/material/unlit_fixed_size.c
Normal file
1422
thermion_dart/native/include/material/unlit_fixed_size.c
Normal file
File diff suppressed because it is too large
Load Diff
13
thermion_dart/native/include/material/unlit_fixed_size.h
Normal file
13
thermion_dart/native/include/material/unlit_fixed_size.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef UNLIT_FIXED_SIZE_H_
|
||||
#define UNLIT_FIXED_SIZE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern "C" {
|
||||
extern const uint8_t UNLIT_FIXED_SIZE_PACKAGE[];
|
||||
extern int UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_OFFSET;
|
||||
extern int UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_SIZE;
|
||||
}
|
||||
#define UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_DATA (UNLIT_FIXED_SIZE_PACKAGE + UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_OFFSET)
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user