chore: update gizmo materials
This commit is contained in:
12
thermion_dart/native/include/material/gizmo.S
Normal file
12
thermion_dart/native/include/material/gizmo.S
Normal file
@@ -0,0 +1,12 @@
|
||||
.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 38039
|
||||
|
||||
12
thermion_dart/native/include/material/gizmo.apple.S
Normal file
12
thermion_dart/native/include/material/gizmo.apple.S
Normal file
@@ -0,0 +1,12 @@
|
||||
.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 38039
|
||||
|
||||
BIN
thermion_dart/native/include/material/gizmo.bin
Normal file
BIN
thermion_dart/native/include/material/gizmo.bin
Normal file
Binary file not shown.
1912
thermion_dart/native/include/material/gizmo.c
Normal file
1912
thermion_dart/native/include/material/gizmo.c
Normal file
File diff suppressed because it is too large
Load Diff
13
thermion_dart/native/include/material/gizmo.h
Normal file
13
thermion_dart/native/include/material/gizmo.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#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
|
||||
@@ -85,7 +85,7 @@ namespace thermion
|
||||
/// @param layer
|
||||
/// @param loadResourcesAsync
|
||||
/// @return
|
||||
SceneAsset* loadGlbFromBuffer(const uint8_t *data, size_t length, int numInstances = 1, bool keepData = false, int priority = 4, int layer = 0, bool loadResourcesAsync = false);
|
||||
SceneAsset* loadGlbFromBuffer(const uint8_t *data, size_t length, int numInstances = 1, bool keepData = false, int priority = 4, int layer = 0, bool loadResourcesAsync = false, bool addToScene = true);
|
||||
|
||||
///
|
||||
/// Creates an instance of the given entity.
|
||||
@@ -321,6 +321,9 @@ namespace thermion
|
||||
std::vector<MaterialInstance *> _materialInstances;
|
||||
|
||||
Material *_unlitFixedSizeMaterial = nullptr;
|
||||
Material *_gizmoMaterial = nullptr;
|
||||
|
||||
SceneAsset *_gizmoGlb;
|
||||
|
||||
utils::NameComponentManager *_ncm;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "material/FileMaterialProvider.hpp"
|
||||
#include "material/UnlitMaterialProvider.hpp"
|
||||
#include "material/unlit.h"
|
||||
#include "material/gizmo.h"
|
||||
|
||||
#include "StreamBufferAdapter.hpp"
|
||||
|
||||
@@ -41,6 +42,8 @@
|
||||
#include "scene/GeometrySceneAssetBuilder.hpp"
|
||||
#include "UnprojectTexture.hpp"
|
||||
|
||||
#include "resources/gizmo_glb.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "material/image.h"
|
||||
@@ -111,6 +114,11 @@ namespace thermion
|
||||
Material::Builder()
|
||||
.package(UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_DATA, UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_SIZE)
|
||||
.build(*_engine);
|
||||
|
||||
_gizmoMaterial =
|
||||
Material::Builder()
|
||||
.package(GIZMO_GIZMO_DATA, GIZMO_GIZMO_SIZE)
|
||||
.build(*_engine);
|
||||
}
|
||||
|
||||
SceneManager::~SceneManager()
|
||||
@@ -125,6 +133,7 @@ namespace thermion
|
||||
destroyAll();
|
||||
|
||||
_engine->destroy(_unlitFixedSizeMaterial);
|
||||
_engine->destroy(_gizmoMaterial);
|
||||
_cameras.clear();
|
||||
|
||||
_grid = nullptr;
|
||||
@@ -167,9 +176,13 @@ namespace thermion
|
||||
|
||||
Gizmo *SceneManager::createGizmo(View *view, Scene *scene)
|
||||
{
|
||||
auto gizmo = std::make_unique<Gizmo>(_engine, view, scene, _unlitFixedSizeMaterial);
|
||||
if(!_gizmoGlb) {
|
||||
_gizmoGlb = loadGlbFromBuffer(GIZMO_GLB_GIZMO_DATA, GIZMO_GLB_GIZMO_SIZE, 100, true, 4, 0, false, false);
|
||||
}
|
||||
auto gizmo = std::make_unique<Gizmo>(_gizmoGlb, _engine, view, scene, _unlitFixedSizeMaterial);
|
||||
auto *raw = gizmo.get();
|
||||
_sceneAssets.push_back(std::move(gizmo));
|
||||
|
||||
return raw;
|
||||
}
|
||||
|
||||
@@ -312,7 +325,7 @@ namespace thermion
|
||||
}
|
||||
}
|
||||
|
||||
SceneAsset *SceneManager::loadGlbFromBuffer(const uint8_t *data, size_t length, int numInstances, bool keepData, int priority, int layer, bool loadResourcesAsync)
|
||||
SceneAsset *SceneManager::loadGlbFromBuffer(const uint8_t *data, size_t length, int numInstances, bool keepData, int priority, int layer, bool loadResourcesAsync, bool addToScene)
|
||||
{
|
||||
auto &rm = _engine->getRenderableManager();
|
||||
|
||||
@@ -362,10 +375,12 @@ namespace thermion
|
||||
_engine);
|
||||
|
||||
auto sceneAssetInstance = sceneAsset->createInstance();
|
||||
sceneAssetInstance->addAllEntities(_scene);
|
||||
if(addToScene) {
|
||||
sceneAssetInstance->addAllEntities(_scene);
|
||||
}
|
||||
sceneAssetInstance->setPriority(_engine->getRenderableManager(), priority);
|
||||
sceneAssetInstance->setLayer(_engine->getRenderableManager(), layer);
|
||||
|
||||
|
||||
auto *raw = sceneAsset.get();
|
||||
|
||||
_sceneAssets.push_back(std::move(sceneAsset));
|
||||
|
||||
Reference in New Issue
Block a user