update materials

This commit is contained in:
Nick Fisher
2025-04-02 22:15:38 +08:00
parent 508c184f1a
commit 178da458ad
19 changed files with 4376 additions and 14733 deletions

View File

@@ -1,69 +0,0 @@
#ifndef UNLIT_MATERIAL_PROVIDER_HPP
#define UNLIT_MATERIAL_PROVIDER_HPP
#include <filament/gltfio/MaterialProvider.h>
#include <filament/Material.h>
#include <filament/MaterialInstance.h>
#include <filament/Texture.h>
#include <filament/TextureSampler.h>
#include <math/mat3.h>
#include <math/vec3.h>
#include <math/vec4.h>
namespace thermion {
class UnlitMaterialProvider : public filament::gltfio::MaterialProvider {
private:
filament::Material* mUnlitMaterial;
const filament::Material* mMaterials[1];
filament::Engine* mEngine;
public:
UnlitMaterialProvider(filament::Engine* engine, const void* const data, const size_t size) : mEngine(engine) {
mUnlitMaterial = filament::Material::Builder()
.package(data, size)
.build(*engine);
mMaterials[0] = mUnlitMaterial;
}
~UnlitMaterialProvider() {
mEngine->destroy(mUnlitMaterial);
}
filament::MaterialInstance* createMaterialInstance(filament::gltfio::MaterialKey* config,
filament::gltfio::UvMap* uvmap,
const char* label = "unlit",
const char* extras = nullptr) override {
auto instance = mUnlitMaterial->createInstance();
instance->setParameter("baseColorIndex", -1);
instance->setParameter("uvScale", filament::math::float2 { 1.0f, 1.0f });
return instance;
}
filament::Material* getMaterial(filament::gltfio::MaterialKey* config,
filament::gltfio::UvMap* uvmap,
const char* label = "unlit") override {
return mUnlitMaterial;
}
const filament::Material* const* getMaterials() const noexcept override {
return mMaterials;
}
size_t getMaterialsCount() const noexcept override {
return 1;
}
void destroyMaterials() override {
// Materials are destroyed in the destructor
}
bool needsDummyData(filament::VertexAttribute attrib) const noexcept override {
// For unlit material, we don't need dummy data for any attribute
return false;
}
};
} // namespace thermion
#endif // UNLIT_MATERIAL_PROVIDER_HPP

View File

@@ -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 45867

View File

@@ -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 45867

File diff suppressed because it is too large Load Diff

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +0,0 @@
.global UNLIT_UNLIT_OFFSET;
.global UNLIT_UNLIT_SIZE;
.global UNLIT_PACKAGE
.section .rodata
UNLIT_PACKAGE:
.incbin "unlit.bin"
UNLIT_UNLIT_OFFSET:
.int 0
UNLIT_UNLIT_SIZE:
.int 157994

View File

@@ -1,12 +0,0 @@
.global _UNLIT_UNLIT_OFFSET;
.global _UNLIT_UNLIT_SIZE;
.global _UNLIT_PACKAGE
.section __TEXT,__const
_UNLIT_PACKAGE:
.incbin "unlit.bin"
_UNLIT_UNLIT_OFFSET:
.int 0
_UNLIT_UNLIT_SIZE:
.int 157994

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +0,0 @@
#ifndef UNLIT_H_
#define UNLIT_H_
#include <stdint.h>
extern "C" {
extern const uint8_t UNLIT_PACKAGE[];
extern int UNLIT_UNLIT_OFFSET;
extern int UNLIT_UNLIT_SIZE;
}
#define UNLIT_UNLIT_DATA (UNLIT_PACKAGE + UNLIT_UNLIT_OFFSET)
#endif

View File

@@ -8,5 +8,5 @@ UNLIT_FIXED_SIZE_PACKAGE:
UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_OFFSET:
.int 0
UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_SIZE:
.int 45915
.int 45907

View File

@@ -8,5 +8,5 @@ _UNLIT_FIXED_SIZE_PACKAGE:
_UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_OFFSET:
.int 0
_UNLIT_FIXED_SIZE_UNLIT_FIXED_SIZE_SIZE:
.int 45915
.int 45907

File diff suppressed because it is too large Load Diff