Browse Source

Port SimpleScene to the new format

Panagiotis Christopoulos Charitos 3 months ago
parent
commit
e657877847
28 changed files with 60 additions and 1116 deletions
  1. 0 1
      AnKi/Resource.h
  2. 0 202
      AnKi/Resource/ModelResource.cpp
  3. 0 143
      AnKi/Resource/ModelResource.h
  4. 0 1
      AnKi/Resource/ParticleEmitterResource.cpp
  5. 0 1
      AnKi/Resource/ResourceManager.cpp
  6. 0 2
      AnKi/Resource/Resources.def.h
  7. 0 1
      AnKi/Scene.h
  8. 0 389
      AnKi/Scene/Components/ModelComponent.cpp
  9. 0 93
      AnKi/Scene/Components/ModelComponent.h
  10. 0 2
      AnKi/Scene/Components/SceneComponentClasses.def.h
  11. 0 1
      AnKi/Scene/SceneGraph.cpp
  12. 0 1
      AnKi/Scene/SceneNode.cpp
  13. 27 190
      AnKi/Script/Scene.cpp
  14. 0 16
      AnKi/Script/Scene.xml
  15. 0 8
      Samples/SimpleScene/Assets/Mesh_0_backWall_24a9b01d8fc47286.ankimdl
  16. 0 8
      Samples/SimpleScene/Assets/Mesh_1_ceiling_3aa8abc0da9fdec8.ankimdl
  17. BIN
      Samples/SimpleScene/Assets/Mesh_2_be53007bec464649.ankimesh
  18. 0 8
      Samples/SimpleScene/Assets/Mesh_2_floor_cc46c84f817f093a.ankimdl
  19. 0 8
      Samples/SimpleScene/Assets/Mesh_3_leftWall_acf66dd2ebcb73e6.ankimdl
  20. 0 8
      Samples/SimpleScene/Assets/Mesh_4_light_82ddb9b3263c8f6e.ankimdl
  21. 0 8
      Samples/SimpleScene/Assets/Mesh_5_rightWall_46f15190068c514a.ankimdl
  22. BIN
      Samples/SimpleScene/Assets/Mesh_6.001_2550937d23ca3066.ankimesh
  23. 0 8
      Samples/SimpleScene/Assets/Mesh_6.001_shortBox_4122029d89b53875.ankimdl
  24. BIN
      Samples/SimpleScene/Assets/Mesh_6_a078cf217893be6f.ankimesh
  25. BIN
      Samples/SimpleScene/Assets/Mesh_7.001_95b61c94f8a0ad1c.ankimesh
  26. 0 8
      Samples/SimpleScene/Assets/Mesh_7.001_tallBox_287bd3c185e6905a.ankimdl
  27. BIN
      Samples/SimpleScene/Assets/Mesh_7_4b76b132380d8a62.ankimesh
  28. 33 9
      Samples/SimpleScene/Assets/Scene.lua

+ 0 - 1
AnKi/Resource.h

@@ -17,7 +17,6 @@
 #include <AnKi/Resource/GenericResource.h>
 #include <AnKi/Resource/SkeletonResource.h>
 #include <AnKi/Resource/DummyResource.h>
-#include <AnKi/Resource/ModelResource.h>
 #include <AnKi/Resource/ShaderProgramResource.h>
 
 #include <AnKi/Resource/MeshBinaryLoader.h>

+ 0 - 202
AnKi/Resource/ModelResource.cpp

@@ -1,202 +0,0 @@
-// Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#include <AnKi/Resource/ModelResource.h>
-#include <AnKi/Resource/ResourceManager.h>
-#include <AnKi/Resource/MeshResource.h>
-#include <AnKi/Util/Xml.h>
-#include <AnKi/Util/Logger.h>
-#include <AnKi/Core/App.h>
-
-namespace anki {
-
-void ModelPatch::getGeometryInfo(U32 lod, ModelPatchGeometryInfo& inf) const
-{
-	lod = min<U32>(lod, m_meshLodCount - 1);
-
-	inf.m_indexUgbOffset = m_lodInfos[lod].m_indexUgbOffset;
-	inf.m_indexType = IndexType::kU16;
-	inf.m_indexCount = m_lodInfos[lod].m_indexCount;
-
-	for(VertexStreamId stream : EnumIterable(VertexStreamId::kMeshRelatedFirst, VertexStreamId::kMeshRelatedCount))
-	{
-		inf.m_vertexUgbOffsets[stream] = m_lodInfos[lod].m_vertexUgbOffsets[stream];
-	}
-
-	if(!!(m_mtl->getRenderingTechniques() & RenderingTechniqueBit::kAllRt))
-	{
-		inf.m_blas = m_mesh->getBottomLevelAccelerationStructure(lod, m_submeshIdx);
-	}
-
-	if(m_lodInfos[lod].m_meshletCount != kMaxU32)
-	{
-		ANKI_ASSERT(m_lodInfos[lod].m_meshletBoundingVolumesUgbOffset != kMaxPtrSize);
-		inf.m_meshletCount = m_lodInfos[lod].m_meshletCount;
-		inf.m_meshletBoundingVolumesUgbOffset = m_lodInfos[lod].m_meshletBoundingVolumesUgbOffset;
-		inf.m_meshletGometryDescriptorsUgbOffset = m_lodInfos[lod].m_meshletGometryDescriptorsUgbOffset;
-	}
-	else
-	{
-		inf.m_meshletCount = 0;
-		inf.m_meshletBoundingVolumesUgbOffset = kMaxPtrSize;
-		inf.m_meshletGometryDescriptorsUgbOffset = kMaxPtrSize;
-	}
-}
-
-Error ModelPatch::init([[maybe_unused]] ModelResource* model, CString meshFName, const CString& mtlFName, U32 subMeshIndex, Bool async)
-{
-#if ANKI_ASSERTIONS_ENABLED
-	m_model = model;
-#endif
-
-	m_submeshIdx = (subMeshIndex == kMaxU32) ? 0 : subMeshIndex;
-
-	// Load material
-	ANKI_CHECK(ResourceManager::getSingleton().loadResource(mtlFName, m_mtl, async));
-
-	// Load mesh
-	ANKI_CHECK(ResourceManager::getSingleton().loadResource(meshFName, m_mesh, async));
-
-	if(subMeshIndex != kMaxU32 && subMeshIndex >= m_mesh->getSubMeshCount())
-	{
-		ANKI_RESOURCE_LOGE("Wrong subMeshIndex given");
-		return Error::kUserData;
-	}
-
-	// Init cached data
-	if(subMeshIndex == kMaxU32)
-	{
-		m_aabb = m_mesh->getBoundingShape();
-	}
-	else
-	{
-		U32 firstIndex, indexCount, firstMeshlet, meshletCount;
-		m_mesh->getSubMeshInfo(0, subMeshIndex, firstIndex, indexCount, firstMeshlet, meshletCount, m_aabb);
-	}
-
-	m_meshLodCount = m_mesh->getLodCount();
-
-	for(U32 l = 0; l < m_meshLodCount; ++l)
-	{
-		Lod& lod = m_lodInfos[l];
-		Aabb aabb;
-		U32 firstIndex, firstMeshlet, meshletCount;
-		m_mesh->getSubMeshInfo(l, (subMeshIndex == kMaxU32) ? 0 : subMeshIndex, firstIndex, lod.m_indexCount, firstMeshlet, meshletCount, aabb);
-
-		U32 totalIndexCount;
-		IndexType indexType;
-		m_mesh->getIndexBufferInfo(l, lod.m_indexUgbOffset, totalIndexCount, indexType);
-		lod.m_indexUgbOffset += firstIndex * getIndexSize(indexType);
-
-		for(VertexStreamId stream : EnumIterable(VertexStreamId::kMeshRelatedFirst, VertexStreamId::kMeshRelatedCount))
-		{
-			if(m_mesh->isVertexStreamPresent(stream))
-			{
-				U32 vertCount;
-				m_mesh->getVertexBufferInfo(l, stream, lod.m_vertexUgbOffsets[stream], vertCount);
-			}
-			else
-			{
-				lod.m_vertexUgbOffsets[stream] = kMaxPtrSize;
-			}
-		}
-
-		if(GrManager::getSingleton().getDeviceCapabilities().m_meshShaders || g_meshletRenderingCVar)
-		{
-			U32 dummy;
-			m_mesh->getMeshletBufferInfo(l, lod.m_meshletBoundingVolumesUgbOffset, lod.m_meshletGometryDescriptorsUgbOffset, dummy);
-
-			lod.m_meshletBoundingVolumesUgbOffset += firstMeshlet * sizeof(MeshletBoundingVolume);
-			lod.m_meshletGometryDescriptorsUgbOffset += firstMeshlet * sizeof(MeshletGeometryDescriptor);
-			lod.m_meshletCount = meshletCount;
-		}
-	}
-
-	return Error::kNone;
-}
-
-Error ModelResource::load(const ResourceFilename& filename, Bool async)
-{
-	// Load
-	//
-	ResourceXmlDocument doc;
-	ANKI_CHECK(openFileParseXml(filename, doc));
-
-	XmlElement rootEl;
-	ANKI_CHECK(doc.getChildElement("model", rootEl));
-
-	// <modelPatches>
-	XmlElement modelPatchesEl;
-	ANKI_CHECK(rootEl.getChildElement("modelPatches", modelPatchesEl));
-
-	XmlElement modelPatchEl;
-	ANKI_CHECK(modelPatchesEl.getChildElement("modelPatch", modelPatchEl));
-
-	// Count
-	U32 count = 0;
-	do
-	{
-		++count;
-		// Move to next
-		ANKI_CHECK(modelPatchEl.getNextSiblingElement("modelPatch", modelPatchEl));
-	} while(modelPatchEl);
-
-	// Check number of model patches
-	if(count < 1)
-	{
-		ANKI_RESOURCE_LOGE("Zero number of model patches");
-		return Error::kUserData;
-	}
-
-	m_modelPatches.resize(count);
-
-	count = 0;
-	ANKI_CHECK(modelPatchesEl.getChildElement("modelPatch", modelPatchEl));
-	do
-	{
-		XmlElement materialEl;
-		ANKI_CHECK(modelPatchEl.getChildElement("material", materialEl));
-
-		XmlElement meshEl;
-		ANKI_CHECK(modelPatchEl.getChildElement("mesh", meshEl));
-		CString meshFname;
-		ANKI_CHECK(meshEl.getText(meshFname));
-
-		U32 subMeshIndex;
-		Bool subMeshIndexPresent;
-		ANKI_CHECK(meshEl.getAttributeNumberOptional("subMeshIndex", subMeshIndex, subMeshIndexPresent));
-		if(!subMeshIndexPresent)
-		{
-			subMeshIndex = kMaxU32;
-		}
-
-		CString cstr;
-		ANKI_CHECK(materialEl.getText(cstr));
-
-		ANKI_CHECK(m_modelPatches[count].init(this, meshFname, cstr, subMeshIndex, async));
-
-		if(count > 0 && m_modelPatches[count].supportsSkinning() != m_modelPatches[count - 1].supportsSkinning())
-		{
-			ANKI_RESOURCE_LOGE("All model patches should support skinning or all shouldn't support skinning");
-			return Error::kUserData;
-		}
-
-		// Move to next
-		ANKI_CHECK(modelPatchEl.getNextSiblingElement("modelPatch", modelPatchEl));
-		++count;
-	} while(modelPatchEl);
-	ANKI_ASSERT(count == m_modelPatches.getSize());
-
-	// Calculate compound bounding volume
-	m_boundingVolume = m_modelPatches[0].m_aabb;
-	for(auto it = m_modelPatches.getBegin() + 1; it != m_modelPatches.getEnd(); ++it)
-	{
-		m_boundingVolume = m_boundingVolume.getCompoundShape((*it).m_aabb);
-	}
-
-	return Error::kNone;
-}
-
-} // end namespace anki

+ 0 - 143
AnKi/Resource/ModelResource.h

@@ -1,143 +0,0 @@
-// Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#pragma once
-
-#include <AnKi/Resource/ResourceObject.h>
-#include <AnKi/Gr.h>
-#include <AnKi/Collision/Aabb.h>
-#include <AnKi/Resource/RenderingKey.h>
-#include <AnKi/Resource/MeshResource.h>
-#include <AnKi/Resource/MaterialResource.h>
-
-namespace anki {
-
-/// @addtogroup resource
-/// @{
-
-/// @memberof ModelResource
-/// Part of the information required render the model.
-class ModelPatchGeometryInfo
-{
-public:
-	PtrSize m_indexUgbOffset;
-	U32 m_indexCount;
-	IndexType m_indexType;
-
-	/// Offset to the vertex buffer or kMaxPtrSize if stream is not present.
-	Array<PtrSize, U32(VertexStreamId::kMeshRelatedCount)> m_vertexUgbOffsets;
-
-	PtrSize m_meshletBoundingVolumesUgbOffset = kMaxPtrSize;
-	PtrSize m_meshletGometryDescriptorsUgbOffset = kMaxPtrSize;
-	U32 m_meshletCount;
-
-	AccelerationStructurePtr m_blas;
-};
-
-/// Model patch class. Its very important class and it binds a material with a mesh.
-class ModelPatch
-{
-	friend class ModelResource;
-
-public:
-	const MaterialResourcePtr& getMaterial() const
-	{
-		return m_mtl;
-	}
-
-	const MeshResourcePtr& getMesh() const
-	{
-		return m_mesh;
-	}
-
-	const Aabb& getBoundingShape() const
-	{
-		return m_aabb;
-	}
-
-	void getGeometryInfo(U32 lod, ModelPatchGeometryInfo& inf) const;
-
-private:
-	class Lod
-	{
-	public:
-		PtrSize m_indexUgbOffset = kMaxPtrSize;
-		U32 m_indexCount = kMaxU32;
-
-		Array<PtrSize, U32(VertexStreamId::kMeshRelatedCount)> m_vertexUgbOffsets = {};
-
-		PtrSize m_meshletBoundingVolumesUgbOffset = kMaxPtrSize;
-		PtrSize m_meshletGometryDescriptorsUgbOffset = kMaxPtrSize;
-		U32 m_meshletCount = kMaxU32;
-	};
-
-#if ANKI_ASSERTIONS_ENABLED
-	ModelResource* m_model = nullptr;
-#endif
-	MaterialResourcePtr m_mtl;
-	MeshResourcePtr m_mesh; ///< Just keep the references.
-
-	Array<Lod, kMaxLodCount> m_lodInfos;
-	Aabb m_aabb;
-	U32 m_meshLodCount = 0;
-	U32 m_submeshIdx = kMaxU32;
-
-	[[nodiscard]] Bool supportsSkinning() const
-	{
-		return m_mesh->isVertexStreamPresent(VertexStreamId::kBoneIds) && m_mtl->supportsSkinning();
-	}
-
-	Error init(ModelResource* model, CString meshFName, const CString& mtlFName, U32 subMeshIndex, Bool async);
-};
-
-/// Model is an entity that acts as a container for other resources. Models are all the non static objects in a map.
-///
-/// XML file format:
-/// @code
-/// <model>
-/// 	<modelPatches>
-/// 		<modelPatch>
-/// 			<mesh [subMeshIndex=int]>path/to/mesh.ankimesh</mesh>
-/// 			<material>path/to/material.ankimtl</material>
-/// 		</modelPatch>
-/// 		...
-/// 		<modelPatch>...</modelPatch>
-/// 	</modelPatches>
-/// </model>
-/// @endcode
-///
-/// Notes:
-/// - If the materials need texture coords then mesh should have them
-/// - If the subMeshIndex is not present then assume the whole mesh
-class ModelResource : public ResourceObject
-{
-public:
-	ModelResource(CString fname, U32 uuid)
-		: ResourceObject(fname, uuid)
-	{
-	}
-
-	~ModelResource() = default;
-
-	ConstWeakArray<ModelPatch> getModelPatches() const
-	{
-		return m_modelPatches;
-	}
-
-	/// The volume that includes all the geometry of all model patches.
-	const Aabb& getBoundingVolume() const
-	{
-		return m_boundingVolume;
-	}
-
-	Error load(const ResourceFilename& filename, Bool async);
-
-private:
-	ResourceDynamicArray<ModelPatch> m_modelPatches;
-	Aabb m_boundingVolume;
-};
-/// @}
-
-} // end namespace anki

+ 0 - 1
AnKi/Resource/ParticleEmitterResource.cpp

@@ -5,7 +5,6 @@
 
 #include <AnKi/Resource/ParticleEmitterResource.h>
 #include <AnKi/Resource/ResourceManager.h>
-#include <AnKi/Resource/ModelResource.h>
 #include <AnKi/Util/StringList.h>
 #include <AnKi/Util/Xml.h>
 #include <cstring>

+ 0 - 1
AnKi/Resource/ResourceManager.cpp

@@ -14,7 +14,6 @@
 #include <AnKi/Resource/MaterialResource.h>
 #include <AnKi/Resource/MeshResource.h>
 #include <AnKi/Resource/CpuMeshResource.h>
-#include <AnKi/Resource/ModelResource.h>
 #include <AnKi/Resource/ScriptResource.h>
 #include <AnKi/Resource/DummyResource.h>
 #include <AnKi/Resource/ParticleEmitterResource.h>

+ 0 - 2
AnKi/Resource/Resources.def.h

@@ -21,8 +21,6 @@ ANKI_INSTANTIATE_RESOURCE(SkeletonResource)
 ANKI_INSTANSIATE_RESOURCE_DELIMITER()
 ANKI_INSTANTIATE_RESOURCE(ParticleEmitterResource)
 ANKI_INSTANSIATE_RESOURCE_DELIMITER()
-ANKI_INSTANTIATE_RESOURCE(ModelResource)
-ANKI_INSTANSIATE_RESOURCE_DELIMITER()
 ANKI_INSTANTIATE_RESOURCE(ScriptResource)
 ANKI_INSTANSIATE_RESOURCE_DELIMITER()
 ANKI_INSTANTIATE_RESOURCE(DummyResource)

+ 0 - 1
AnKi/Scene.h

@@ -15,7 +15,6 @@
 #include <AnKi/Scene/Components/JointComponent.h>
 #include <AnKi/Scene/Components/LensFlareComponent.h>
 #include <AnKi/Scene/Components/LightComponent.h>
-#include <AnKi/Scene/Components/ModelComponent.h>
 #include <AnKi/Scene/Components/MoveComponent.h>
 #include <AnKi/Scene/Components/ParticleEmitterComponent.h>
 #include <AnKi/Scene/Components/PlayerControllerComponent.h>

+ 0 - 389
AnKi/Scene/Components/ModelComponent.cpp

@@ -1,389 +0,0 @@
-// Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#include <AnKi/Scene/Components/ModelComponent.h>
-#include <AnKi/Scene/SceneNode.h>
-#include <AnKi/Scene/SceneGraph.h>
-#include <AnKi/Scene/Components/MoveComponent.h>
-#include <AnKi/Scene/Components/SkinComponent.h>
-#include <AnKi/Resource/ModelResource.h>
-#include <AnKi/Resource/ResourceManager.h>
-#include <AnKi/Shaders/Include/GpuSceneFunctions.h>
-#include <AnKi/Core/App.h>
-
-namespace anki {
-
-ModelComponent::ModelComponent(SceneNode* node)
-	: SceneComponent(node, kClassType)
-{
-	m_gpuSceneTransforms.allocate();
-}
-
-ModelComponent::~ModelComponent()
-{
-}
-
-void ModelComponent::freeGpuScene()
-{
-	GpuSceneBuffer::getSingleton().deferredFree(m_gpuSceneConstants);
-
-	for(PatchInfo& patch : m_patchInfos)
-	{
-		patch.m_gpuSceneMeshLods.free();
-		patch.m_gpuSceneRenderable.free();
-		patch.m_gpuSceneRenderableAabbDepth.free();
-		patch.m_gpuSceneRenderableAabbForward.free();
-		patch.m_gpuSceneRenderableAabbGBuffer.free();
-		patch.m_gpuSceneRenderableAabbRt.free();
-
-		for(RenderingTechnique t : EnumIterable<RenderingTechnique>())
-		{
-			RenderStateBucketContainer::getSingleton().removeUser(patch.m_renderStateBucketIndices[t]);
-		}
-	}
-}
-
-void ModelComponent::loadModelResource(CString filename)
-{
-	ModelResourcePtr rsrc;
-	const Error err = ResourceManager::getSingleton().loadResource(filename, rsrc);
-	if(err)
-	{
-		ANKI_SCENE_LOGE("Failed to load model resource");
-		return;
-	}
-
-	m_resourceChanged = true;
-
-	m_model = std::move(rsrc);
-	const U32 modelPatchCount = m_model->getModelPatches().getSize();
-
-	// Init
-	freeGpuScene();
-	m_patchInfos.resize(modelPatchCount);
-	m_presentRenderingTechniques = RenderingTechniqueBit::kNone;
-
-	// Allocate all uniforms so you can make one allocation
-	U32 uniformsSize = 0;
-	for(U32 i = 0; i < modelPatchCount; ++i)
-	{
-		const U32 size = U32(m_model->getModelPatches()[i].getMaterial()->getPrefilledLocalConstants().getSizeInBytes());
-		ANKI_ASSERT((size % 4) == 0);
-		uniformsSize += size;
-	}
-
-	m_gpuSceneConstants = GpuSceneBuffer::getSingleton().allocate(uniformsSize, 4);
-	uniformsSize = 0;
-
-	// Init the patches
-	for(U32 i = 0; i < modelPatchCount; ++i)
-	{
-		PatchInfo& out = m_patchInfos[i];
-		const ModelPatch& in = m_model->getModelPatches()[i];
-
-		out.m_techniques = in.getMaterial()->getRenderingTechniques();
-		m_castsShadow = m_castsShadow || in.getMaterial()->castsShadow();
-		m_presentRenderingTechniques |= in.getMaterial()->getRenderingTechniques();
-
-		out.m_gpuSceneConstantsOffset = m_gpuSceneConstants.getOffset() + uniformsSize;
-		uniformsSize += U32(in.getMaterial()->getPrefilledLocalConstants().getSizeInBytes());
-
-		out.m_gpuSceneMeshLods.allocate();
-		out.m_gpuSceneRenderable.allocate();
-
-		for(RenderingTechnique t : EnumBitsIterable<RenderingTechnique, RenderingTechniqueBit>(out.m_techniques))
-		{
-			switch(t)
-			{
-			case RenderingTechnique::kGBuffer:
-				out.m_gpuSceneRenderableAabbGBuffer.allocate();
-				break;
-			case RenderingTechnique::kForward:
-				out.m_gpuSceneRenderableAabbForward.allocate();
-				break;
-			case RenderingTechnique::kDepth:
-				out.m_gpuSceneRenderableAabbDepth.allocate();
-				break;
-			case RenderingTechnique::kRtShadow:
-			case RenderingTechnique::kRtMaterialFetch:
-				out.m_gpuSceneRenderableAabbRt.allocate();
-				break;
-			default:
-				ANKI_ASSERT(0);
-			}
-		}
-	}
-}
-
-void ModelComponent::update(SceneComponentUpdateInfo& info, Bool& updated)
-{
-	if(!isEnabled()) [[unlikely]]
-	{
-		updated = false;
-		return;
-	}
-
-	const Bool resourceUpdated = m_resourceChanged;
-	m_resourceChanged = false;
-	const Bool moved = info.m_node->movedThisFrame() || m_firstTimeUpdate;
-	const Bool movedLastFrame = m_movedLastFrame || m_firstTimeUpdate;
-	m_firstTimeUpdate = false;
-	m_movedLastFrame = moved;
-	const Bool hasSkin = m_skinComponent != nullptr && m_skinComponent->isEnabled();
-
-	updated = resourceUpdated || moved || movedLastFrame;
-
-	// Upload GpuSceneMeshLod, uniforms and GpuSceneRenderable
-	if(resourceUpdated) [[unlikely]]
-	{
-		// Upload the mesh views
-		const U32 modelPatchCount = m_model->getModelPatches().getSize();
-		for(U32 i = 0; i < modelPatchCount; ++i)
-		{
-			const ModelPatch& patch = m_model->getModelPatches()[i];
-			const MeshResource& mesh = *patch.getMesh();
-			const MaterialResource& mtl = *patch.getMaterial();
-
-			Array<GpuSceneMeshLod, kMaxLodCount> meshLods;
-
-			for(U32 l = 0; l < mesh.getLodCount(); ++l)
-			{
-				GpuSceneMeshLod& meshLod = meshLods[l];
-				meshLod = {};
-				meshLod.m_positionScale = mesh.getPositionsScale();
-				meshLod.m_positionTranslation = mesh.getPositionsTranslation();
-
-				ModelPatchGeometryInfo inf;
-				patch.getGeometryInfo(l, inf);
-
-				ANKI_ASSERT((inf.m_indexUgbOffset % getIndexSize(inf.m_indexType)) == 0);
-				meshLod.m_firstIndex = U32(inf.m_indexUgbOffset / getIndexSize(inf.m_indexType));
-				meshLod.m_indexCount = inf.m_indexCount;
-
-				for(VertexStreamId stream = VertexStreamId::kMeshRelatedFirst; stream < VertexStreamId::kMeshRelatedCount; ++stream)
-				{
-					if(mesh.isVertexStreamPresent(stream))
-					{
-						const PtrSize elementSize = getFormatInfo(kMeshRelatedVertexStreamFormats[stream]).m_texelSize;
-						ANKI_ASSERT((inf.m_vertexUgbOffsets[stream] % elementSize) == 0);
-						meshLod.m_vertexOffsets[U32(stream)] = U32(inf.m_vertexUgbOffsets[stream] / elementSize);
-					}
-					else
-					{
-						meshLod.m_vertexOffsets[U32(stream)] = kMaxU32;
-					}
-				}
-
-				if(inf.m_blas)
-				{
-					const U64 address = inf.m_blas->getGpuAddress();
-					memcpy(&meshLod.m_blasAddress, &address, sizeof(meshLod.m_blasAddress));
-					meshLod.m_tlasInstanceMask = 0xFFFFFFFF;
-				}
-
-				if(inf.m_meshletCount)
-				{
-					ANKI_ASSERT((inf.m_meshletBoundingVolumesUgbOffset % sizeof(MeshletBoundingVolume)) == 0);
-					meshLod.m_firstMeshletBoundingVolume = U32(inf.m_meshletBoundingVolumesUgbOffset / sizeof(MeshletBoundingVolume));
-					ANKI_ASSERT((inf.m_meshletGometryDescriptorsUgbOffset % sizeof(MeshletGeometryDescriptor)) == 0);
-					meshLod.m_firstMeshletGeometryDescriptor = U32(inf.m_meshletGometryDescriptorsUgbOffset / sizeof(MeshletGeometryDescriptor));
-					meshLod.m_meshletCount = inf.m_meshletCount;
-				}
-
-				meshLod.m_renderableIndex = m_patchInfos[i].m_gpuSceneRenderable.getIndex();
-				meshLod.m_lod = l;
-			}
-
-			// Copy the last LOD to the rest just in case
-			for(U32 l = mesh.getLodCount(); l < kMaxLodCount; ++l)
-			{
-				meshLods[l] = meshLods[l - 1];
-			}
-
-			m_patchInfos[i].m_gpuSceneMeshLods.uploadToGpuScene(meshLods);
-
-			// Upload the GpuSceneRenderable
-			GpuSceneRenderable gpuRenderable = {};
-			gpuRenderable.m_worldTransformsIndex = m_gpuSceneTransforms.getIndex() * 2;
-			gpuRenderable.m_constantsOffset = m_patchInfos[i].m_gpuSceneConstantsOffset;
-			gpuRenderable.m_meshLodsIndex = m_patchInfos[i].m_gpuSceneMeshLods.getIndex() * kMaxLodCount;
-			gpuRenderable.m_boneTransformsOffset = (hasSkin) ? m_skinComponent->getBoneTransformsGpuSceneOffset() : 0;
-			gpuRenderable.m_particleEmitterIndex = kMaxU32;
-			if(!!(mtl.getRenderingTechniques() & RenderingTechniqueBit::kRtShadow))
-			{
-				const RenderingKey key(RenderingTechnique::kRtShadow, 0, false, false, false);
-				const MaterialVariant& variant = mtl.getOrCreateVariant(key);
-				gpuRenderable.m_rtShadowsShaderHandleIndex = variant.getRtShaderGroupHandleIndex();
-			}
-			if(!!(mtl.getRenderingTechniques() & RenderingTechniqueBit::kRtMaterialFetch))
-			{
-				const RenderingKey key(RenderingTechnique::kRtMaterialFetch, 0, false, false, false);
-				const MaterialVariant& variant = mtl.getOrCreateVariant(key);
-				gpuRenderable.m_rtMaterialFetchShaderHandleIndex = variant.getRtShaderGroupHandleIndex();
-			}
-			gpuRenderable.m_uuid = SceneGraph::getSingleton().getNewUuid();
-			m_patchInfos[i].m_gpuSceneRenderable.uploadToGpuScene(gpuRenderable);
-		}
-
-		// Upload the uniforms
-		DynamicArray<U32, MemoryPoolPtrWrapper<StackMemoryPool>> allConstants(info.m_framePool);
-		allConstants.resize(m_gpuSceneConstants.getAllocatedSize() / 4);
-		U32 count = 0;
-		for(U32 i = 0; i < modelPatchCount; ++i)
-		{
-			const ModelPatch& patch = m_model->getModelPatches()[i];
-			const MaterialResource& mtl = *patch.getMaterial();
-			memcpy(&allConstants[count], mtl.getPrefilledLocalConstants().getBegin(), mtl.getPrefilledLocalConstants().getSizeInBytes());
-
-			count += U32(mtl.getPrefilledLocalConstants().getSizeInBytes() / 4);
-		}
-
-		ANKI_ASSERT(count * 4 == m_gpuSceneConstants.getAllocatedSize());
-		GpuSceneMicroPatcher::getSingleton().newCopy(*info.m_framePool, m_gpuSceneConstants.getOffset(), m_gpuSceneConstants.getAllocatedSize(),
-													 &allConstants[0]);
-	}
-
-	// Upload transforms
-	if(moved || movedLastFrame) [[unlikely]]
-	{
-		Array<Mat3x4, 2> trfs;
-		trfs[0] = Mat3x4(info.m_node->getWorldTransform());
-		trfs[1] = Mat3x4(info.m_node->getPreviousWorldTransform());
-		m_gpuSceneTransforms.uploadToGpuScene(trfs);
-	}
-
-	// Scene bounds update
-	const Bool aabbUpdated = moved || resourceUpdated || m_skinComponent;
-	if(aabbUpdated) [[unlikely]]
-	{
-		const Aabb aabbWorld = computeAabbWorldSpace(info.m_node->getWorldTransform());
-		SceneGraph::getSingleton().updateSceneBounds(aabbWorld.getMin().xyz(), aabbWorld.getMax().xyz());
-	}
-
-	// Update the buckets
-	const Bool bucketsNeedUpdate = resourceUpdated || moved != movedLastFrame;
-	if(bucketsNeedUpdate)
-	{
-		const U32 modelPatchCount = m_model->getModelPatches().getSize();
-		for(U32 i = 0; i < modelPatchCount; ++i)
-		{
-			// Refresh the render state buckets
-			for(RenderingTechnique t : EnumIterable<RenderingTechnique>())
-			{
-				RenderStateBucketContainer::getSingleton().removeUser(m_patchInfos[i].m_renderStateBucketIndices[t]);
-
-				if(!(RenderingTechniqueBit(1 << t) & m_patchInfos[i].m_techniques))
-				{
-					continue;
-				}
-
-				// Fill the state
-				RenderingKey key;
-				key.setLod(0); // Materials don't care
-				key.setRenderingTechnique(t);
-				key.setSkinned(hasSkin);
-				key.setVelocity(moved);
-				key.setMeshletRendering(GrManager::getSingleton().getDeviceCapabilities().m_meshShaders || g_meshletRenderingCVar);
-
-				const MaterialVariant& mvariant = m_model->getModelPatches()[i].getMaterial()->getOrCreateVariant(key);
-
-				RenderStateInfo state;
-				state.m_primitiveTopology = PrimitiveTopology::kTriangles;
-				state.m_indexedDrawcall = true;
-				state.m_program = mvariant.getShaderProgram();
-
-				ModelPatchGeometryInfo inf;
-				m_model->getModelPatches()[i].getGeometryInfo(0, inf);
-				const Bool wantsMesletCount = key.getMeshletRendering() && !(RenderingTechniqueBit(1 << t) & RenderingTechniqueBit::kAllRt);
-				m_patchInfos[i].m_renderStateBucketIndices[t] =
-					RenderStateBucketContainer::getSingleton().addUser(state, t, (wantsMesletCount) ? inf.m_meshletCount : 0);
-			}
-		}
-	}
-
-	// Upload the AABBs to the GPU scene
-	const Bool gpuSceneAabbsNeedUpdate = aabbUpdated || bucketsNeedUpdate;
-	if(gpuSceneAabbsNeedUpdate)
-	{
-		const Aabb aabbWorld = computeAabbWorldSpace(info.m_node->getWorldTransform());
-
-		const U32 modelPatchCount = m_model->getModelPatches().getSize();
-		for(U32 i = 0; i < modelPatchCount; ++i)
-		{
-			// Do raster techniques
-			for(RenderingTechnique t :
-				EnumBitsIterable<RenderingTechnique, RenderingTechniqueBit>(m_patchInfos[i].m_techniques & ~RenderingTechniqueBit::kAllRt))
-			{
-				const GpuSceneRenderableBoundingVolume gpuVolume = initGpuSceneRenderableBoundingVolume(
-					aabbWorld.getMin().xyz(), aabbWorld.getMax().xyz(), m_patchInfos[i].m_gpuSceneRenderable.getIndex(),
-					m_patchInfos[i].m_renderStateBucketIndices[t].get());
-
-				switch(t)
-				{
-				case RenderingTechnique::kGBuffer:
-					m_patchInfos[i].m_gpuSceneRenderableAabbGBuffer.uploadToGpuScene(gpuVolume);
-					break;
-				case RenderingTechnique::kDepth:
-					m_patchInfos[i].m_gpuSceneRenderableAabbDepth.uploadToGpuScene(gpuVolume);
-					break;
-				case RenderingTechnique::kForward:
-					m_patchInfos[i].m_gpuSceneRenderableAabbForward.uploadToGpuScene(gpuVolume);
-					break;
-				default:
-					ANKI_ASSERT(0);
-				}
-			}
-
-			// Do RT techniques
-			if(!!(m_patchInfos[i].m_techniques & RenderingTechniqueBit::kAllRt))
-			{
-				const U32 bucket = 0;
-				const GpuSceneRenderableBoundingVolume gpuVolume = initGpuSceneRenderableBoundingVolume(
-					aabbWorld.getMin().xyz(), aabbWorld.getMax().xyz(), m_patchInfos[i].m_gpuSceneRenderable.getIndex(), bucket);
-
-				m_patchInfos[i].m_gpuSceneRenderableAabbRt.uploadToGpuScene(gpuVolume);
-			}
-		}
-	}
-}
-
-void ModelComponent::onOtherComponentRemovedOrAdded(SceneComponent* other, Bool added)
-{
-	ANKI_ASSERT(other);
-
-	if(other->getType() != SceneComponentType::kSkin)
-	{
-		return;
-	}
-
-	const Bool alreadyHasSkinComponent = m_skinComponent != nullptr;
-	if(added && !alreadyHasSkinComponent)
-	{
-		m_skinComponent = static_cast<SkinComponent*>(other);
-		m_resourceChanged = true;
-	}
-	else if(!added && other == m_skinComponent)
-	{
-		m_skinComponent = nullptr;
-		m_resourceChanged = true;
-	}
-}
-
-Aabb ModelComponent::computeAabbWorldSpace(const Transform& worldTransform) const
-{
-	Aabb aabbLocal;
-	if(m_skinComponent == nullptr) [[likely]]
-	{
-		aabbLocal = m_model->getBoundingVolume();
-	}
-	else
-	{
-		aabbLocal = m_skinComponent->getBoneBoundingVolumeLocalSpace().getCompoundShape(m_model->getBoundingVolume());
-	}
-
-	return aabbLocal.getTransformed(worldTransform);
-}
-
-} // end namespace anki

+ 0 - 93
AnKi/Scene/Components/ModelComponent.h

@@ -1,93 +0,0 @@
-// Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#pragma once
-
-#include <AnKi/Scene/Components/SceneComponent.h>
-#include <AnKi/Scene/RenderStateBucket.h>
-#include <AnKi/Scene/GpuSceneArray.h>
-#include <AnKi/Resource/Forward.h>
-#include <AnKi/Util/WeakArray.h>
-#include <AnKi/Collision/Aabb.h>
-
-namespace anki {
-
-/// @addtogroup scene
-/// @{
-
-/// Holds geometry and material information.
-class ModelComponent final : public SceneComponent
-{
-	ANKI_SCENE_COMPONENT(ModelComponent)
-
-public:
-	ModelComponent(SceneNode* node);
-
-	~ModelComponent();
-
-	void loadModelResource(CString filename);
-
-	const ModelResourcePtr& getModelResource() const
-	{
-		return m_model;
-	}
-
-	Bool isEnabled() const
-	{
-		return m_model.isCreated();
-	}
-
-	Bool getCastsShadow() const
-	{
-		return m_castsShadow;
-	}
-
-private:
-	class PatchInfo
-	{
-	public:
-		U32 m_gpuSceneConstantsOffset = kMaxU32;
-
-		GpuSceneArrays::MeshLod::Allocation m_gpuSceneMeshLods;
-		GpuSceneArrays::Renderable::Allocation m_gpuSceneRenderable;
-		GpuSceneArrays::RenderableBoundingVolumeGBuffer::Allocation m_gpuSceneRenderableAabbGBuffer;
-		GpuSceneArrays::RenderableBoundingVolumeDepth::Allocation m_gpuSceneRenderableAabbDepth;
-		GpuSceneArrays::RenderableBoundingVolumeForward::Allocation m_gpuSceneRenderableAabbForward;
-		GpuSceneArrays::RenderableBoundingVolumeRt::Allocation m_gpuSceneRenderableAabbRt;
-
-		Array<RenderStateBucketIndex, U32(RenderingTechnique::kCount)> m_renderStateBucketIndices;
-		RenderingTechniqueBit m_techniques;
-	};
-
-	SkinComponent* m_skinComponent = nullptr;
-
-	ModelResourcePtr m_model;
-
-	// GPU scene part 1
-	GpuSceneBufferAllocation m_gpuSceneConstants;
-	GpuSceneArrays::Transform::Allocation m_gpuSceneTransforms;
-
-	// Other stuff
-	Bool m_resourceChanged : 1 = true;
-	Bool m_castsShadow : 1 = false;
-	Bool m_movedLastFrame : 1 = true;
-	Bool m_firstTimeUpdate : 1 = true; ///< Extra flag in case the component is added in a node that hasn't been moved.
-
-	RenderingTechniqueBit m_presentRenderingTechniques = RenderingTechniqueBit::kNone;
-
-	// GPU scene part 2
-	SceneDynamicArray<PatchInfo> m_patchInfos;
-
-	void freeGpuScene();
-
-	void update(SceneComponentUpdateInfo& info, Bool& updated) override;
-
-	void onOtherComponentRemovedOrAdded(SceneComponent* other, Bool added) override;
-
-	Aabb computeAabbWorldSpace(const Transform& worldTransform) const;
-};
-/// @}
-
-} // end namespace anki

+ 0 - 2
AnKi/Scene/Components/SceneComponentClasses.def.h

@@ -31,8 +31,6 @@ ANKI_SCENE_COMPONENT_SEPARATOR
 
 ANKI_DEFINE_SCENE_COMPONENT(Material, 100.0f)
 ANKI_SCENE_COMPONENT_SEPARATOR
-ANKI_DEFINE_SCENE_COMPONENT(Model, 100.0f)
-ANKI_SCENE_COMPONENT_SEPARATOR
 ANKI_DEFINE_SCENE_COMPONENT(ParticleEmitter, 100.0f)
 ANKI_SCENE_COMPONENT_SEPARATOR
 ANKI_DEFINE_SCENE_COMPONENT(Decal, 100.0f)

+ 0 - 1
AnKi/Scene/SceneGraph.cpp

@@ -23,7 +23,6 @@
 #include <AnKi/Scene/Components/JointComponent.h>
 #include <AnKi/Scene/Components/LensFlareComponent.h>
 #include <AnKi/Scene/Components/LightComponent.h>
-#include <AnKi/Scene/Components/ModelComponent.h>
 #include <AnKi/Scene/Components/MoveComponent.h>
 #include <AnKi/Scene/Components/ParticleEmitterComponent.h>
 #include <AnKi/Scene/Components/PlayerControllerComponent.h>

+ 0 - 1
AnKi/Scene/SceneNode.cpp

@@ -16,7 +16,6 @@
 #include <AnKi/Scene/Components/JointComponent.h>
 #include <AnKi/Scene/Components/LensFlareComponent.h>
 #include <AnKi/Scene/Components/LightComponent.h>
-#include <AnKi/Scene/Components/ModelComponent.h>
 #include <AnKi/Scene/Components/MoveComponent.h>
 #include <AnKi/Scene/Components/ParticleEmitterComponent.h>
 #include <AnKi/Scene/Components/PlayerControllerComponent.h>

+ 27 - 190
AnKi/Script/Scene.cpp

@@ -40,7 +40,7 @@ static EventManager* getEventManager(lua_State* l)
 
 using WeakArraySceneNodePtr = WeakArray<SceneNode*>;
 
-LuaUserDataTypeInfo luaUserDataTypeInfoLightComponentType = {1705216774773193669, "LightComponentType", 0, nullptr, nullptr};
+LuaUserDataTypeInfo luaUserDataTypeInfoLightComponentType = {6206133836153136512, "LightComponentType", 0, nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<LightComponentType>()
@@ -75,7 +75,8 @@ static inline void wrapLightComponentType(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoBodyComponentCollisionShapeType = {655862457130768896, "BodyComponentCollisionShapeType", 0, nullptr, nullptr};
+LuaUserDataTypeInfo luaUserDataTypeInfoBodyComponentCollisionShapeType = {2101311552635064966, "BodyComponentCollisionShapeType", 0, nullptr,
+																		  nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<BodyComponentCollisionShapeType>()
@@ -119,7 +120,7 @@ static inline void wrapBodyComponentCollisionShapeType(lua_State* l)
 }
 
 LuaUserDataTypeInfo luaUserDataTypeInfoWeakArraySceneNodePtr = {
-	3313685462671490673, "WeakArraySceneNodePtr", LuaUserData::computeSizeForGarbageCollected<WeakArraySceneNodePtr>(), nullptr, nullptr};
+	6151684403601409780, "WeakArraySceneNodePtr", LuaUserData::computeSizeForGarbageCollected<WeakArraySceneNodePtr>(), nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<WeakArraySceneNodePtr>()
@@ -237,7 +238,7 @@ static inline void wrapWeakArraySceneNodePtr(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoLightComponent = {5525591367996120980, "LightComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoLightComponent = {1168355668964602089, "LightComponent",
 														 LuaUserData::computeSizeForGarbageCollected<LightComponent>(), nullptr, nullptr};
 
 template<>
@@ -848,7 +849,7 @@ static inline void wrapLightComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoDecalComponent = {-3496490616109595414, "DecalComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoDecalComponent = {-7371831488065499415, "DecalComponent",
 														 LuaUserData::computeSizeForGarbageCollected<DecalComponent>(), nullptr, nullptr};
 
 template<>
@@ -970,7 +971,7 @@ static inline void wrapDecalComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoLensFlareComponent = {8343332549488008242, "LensFlareComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoLensFlareComponent = {-7298340444981222053, "LensFlareComponent",
 															 LuaUserData::computeSizeForGarbageCollected<LensFlareComponent>(), nullptr, nullptr};
 
 template<>
@@ -1133,7 +1134,7 @@ static inline void wrapLensFlareComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoBodyComponent = {-9073165845536614590, "BodyComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoBodyComponent = {7978234134318632844, "BodyComponent",
 														LuaUserData::computeSizeForGarbageCollected<BodyComponent>(), nullptr, nullptr};
 
 template<>
@@ -1443,7 +1444,7 @@ static inline void wrapBodyComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoTriggerComponent = {-6183500062696695809, "TriggerComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoTriggerComponent = {2808989255191418359, "TriggerComponent",
 														   LuaUserData::computeSizeForGarbageCollected<TriggerComponent>(), nullptr, nullptr};
 
 template<>
@@ -1557,7 +1558,7 @@ static inline void wrapTriggerComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoFogDensityComponent = {-7152888456323500040, "FogDensityComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoFogDensityComponent = {7663103238216056190, "FogDensityComponent",
 															  LuaUserData::computeSizeForGarbageCollected<FogDensityComponent>(), nullptr, nullptr};
 
 template<>
@@ -1663,7 +1664,7 @@ static inline void wrapFogDensityComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoCameraComponent = {3377927193506206528, "CameraComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoCameraComponent = {-3047531355007612535, "CameraComponent",
 														  LuaUserData::computeSizeForGarbageCollected<CameraComponent>(), nullptr, nullptr};
 
 template<>
@@ -1745,8 +1746,8 @@ static inline void wrapCameraComponent(lua_State* l)
 }
 
 LuaUserDataTypeInfo luaUserDataTypeInfoGlobalIlluminationProbeComponent = {
-	8463230767507270345, "GlobalIlluminationProbeComponent", LuaUserData::computeSizeForGarbageCollected<GlobalIlluminationProbeComponent>(), nullptr,
-	nullptr};
+	-1542937361096598697, "GlobalIlluminationProbeComponent", LuaUserData::computeSizeForGarbageCollected<GlobalIlluminationProbeComponent>(),
+	nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<GlobalIlluminationProbeComponent>()
@@ -1942,7 +1943,7 @@ static inline void wrapGlobalIlluminationProbeComponent(lua_State* l)
 }
 
 LuaUserDataTypeInfo luaUserDataTypeInfoReflectionProbeComponent = {
-	1607944270322761426, "ReflectionProbeComponent", LuaUserData::computeSizeForGarbageCollected<ReflectionProbeComponent>(), nullptr, nullptr};
+	-5775990258474066730, "ReflectionProbeComponent", LuaUserData::computeSizeForGarbageCollected<ReflectionProbeComponent>(), nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<ReflectionProbeComponent>()
@@ -1958,7 +1959,7 @@ static inline void wrapReflectionProbeComponent(lua_State* l)
 }
 
 LuaUserDataTypeInfo luaUserDataTypeInfoParticleEmitterComponent = {
-	5707635792619582103, "ParticleEmitterComponent", LuaUserData::computeSizeForGarbageCollected<ParticleEmitterComponent>(), nullptr, nullptr};
+	-4976236030670301177, "ParticleEmitterComponent", LuaUserData::computeSizeForGarbageCollected<ParticleEmitterComponent>(), nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<ParticleEmitterComponent>()
@@ -2020,70 +2021,7 @@ static inline void wrapParticleEmitterComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoModelComponent = {4960763752009423851, "ModelComponent",
-														 LuaUserData::computeSizeForGarbageCollected<ModelComponent>(), nullptr, nullptr};
-
-template<>
-const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<ModelComponent>()
-{
-	return luaUserDataTypeInfoModelComponent;
-}
-
-/// Pre-wrap method ModelComponent::loadModelResource.
-static inline int pwrapModelComponentloadModelResource(lua_State* l)
-{
-	[[maybe_unused]] LuaUserData* ud;
-	[[maybe_unused]] void* voidp;
-	[[maybe_unused]] PtrSize size;
-
-	if(LuaBinder::checkArgsCount(l, 2)) [[unlikely]]
-	{
-		return -1;
-	}
-
-	// Get "this" as "self"
-	if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoModelComponent, ud))
-	{
-		return -1;
-	}
-
-	ModelComponent* self = ud->getData<ModelComponent>();
-
-	// Pop arguments
-	const char* arg0;
-	if(LuaBinder::checkString(l, 2, arg0)) [[unlikely]]
-	{
-		return -1;
-	}
-
-	// Call the method
-	self->loadModelResource(arg0);
-
-	return 0;
-}
-
-/// Wrap method ModelComponent::loadModelResource.
-static int wrapModelComponentloadModelResource(lua_State* l)
-{
-	int res = pwrapModelComponentloadModelResource(l);
-	if(res >= 0)
-	{
-		return res;
-	}
-
-	lua_error(l);
-	return 0;
-}
-
-/// Wrap class ModelComponent.
-static inline void wrapModelComponent(lua_State* l)
-{
-	LuaBinder::createClass(l, &luaUserDataTypeInfoModelComponent);
-	LuaBinder::pushLuaCFuncMethod(l, "loadModelResource", wrapModelComponentloadModelResource);
-	lua_settop(l, 0);
-}
-
-LuaUserDataTypeInfo luaUserDataTypeInfoMeshComponent = {-7599728640014352259, "MeshComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoMeshComponent = {-9054491431494561014, "MeshComponent",
 														LuaUserData::computeSizeForGarbageCollected<MeshComponent>(), nullptr, nullptr};
 
 template<>
@@ -2146,7 +2084,7 @@ static inline void wrapMeshComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoMaterialComponent = {1355466570762771132, "MaterialComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoMaterialComponent = {-6001790615088507422, "MaterialComponent",
 															LuaUserData::computeSizeForGarbageCollected<MaterialComponent>(), nullptr, nullptr};
 
 template<>
@@ -2256,7 +2194,7 @@ static inline void wrapMaterialComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoSkinComponent = {-7996777685958623301, "SkinComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoSkinComponent = {-8726082595272407756, "SkinComponent",
 														LuaUserData::computeSizeForGarbageCollected<SkinComponent>(), nullptr, nullptr};
 
 template<>
@@ -2319,7 +2257,7 @@ static inline void wrapSkinComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoSkyboxComponent = {-8896621779961213756, "SkyboxComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoSkyboxComponent = {2091570007609746680, "SkyboxComponent",
 														  LuaUserData::computeSizeForGarbageCollected<SkyboxComponent>(), nullptr, nullptr};
 
 template<>
@@ -2810,7 +2748,7 @@ static inline void wrapSkyboxComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoSceneNode = {3754927209486510352, "SceneNode", LuaUserData::computeSizeForGarbageCollected<SceneNode>(),
+LuaUserDataTypeInfo luaUserDataTypeInfoSceneNode = {6187537764740648313, "SceneNode", LuaUserData::computeSizeForGarbageCollected<SceneNode>(),
 													nullptr, nullptr};
 
 template<>
@@ -3855,58 +3793,6 @@ static int wrapSceneNodenewParticleEmitterComponent(lua_State* l)
 	return 0;
 }
 
-/// Pre-wrap method SceneNode::newComponent<ModelComponent>.
-static inline int pwrapSceneNodenewModelComponent(lua_State* l)
-{
-	[[maybe_unused]] LuaUserData* ud;
-	[[maybe_unused]] void* voidp;
-	[[maybe_unused]] PtrSize size;
-
-	if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
-	{
-		return -1;
-	}
-
-	// Get "this" as "self"
-	if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoSceneNode, ud))
-	{
-		return -1;
-	}
-
-	SceneNode* self = ud->getData<SceneNode>();
-
-	// Call the method
-	ModelComponent* ret = self->newComponent<ModelComponent>();
-
-	// Push return value
-	if(ret == nullptr) [[unlikely]]
-	{
-		lua_pushstring(l, "Glue code returned nullptr");
-		return -1;
-	}
-
-	voidp = lua_newuserdata(l, sizeof(LuaUserData));
-	ud = static_cast<LuaUserData*>(voidp);
-	luaL_setmetatable(l, "ModelComponent");
-	extern LuaUserDataTypeInfo luaUserDataTypeInfoModelComponent;
-	ud->initPointed(&luaUserDataTypeInfoModelComponent, ret);
-
-	return 1;
-}
-
-/// Wrap method SceneNode::newComponent<ModelComponent>.
-static int wrapSceneNodenewModelComponent(lua_State* l)
-{
-	int res = pwrapSceneNodenewModelComponent(l);
-	if(res >= 0)
-	{
-		return res;
-	}
-
-	lua_error(l);
-	return 0;
-}
-
 /// Pre-wrap method SceneNode::newComponent<MeshComponent>.
 static inline int pwrapSceneNodenewMeshComponent(lua_State* l)
 {
@@ -4575,52 +4461,6 @@ static int wrapSceneNodegetFirstParticleEmitterComponent(lua_State* l)
 	return 0;
 }
 
-/// Pre-wrap method SceneNode::getFirstComponentOfType<ModelComponent>.
-static inline int pwrapSceneNodegetFirstModelComponent(lua_State* l)
-{
-	[[maybe_unused]] LuaUserData* ud;
-	[[maybe_unused]] void* voidp;
-	[[maybe_unused]] PtrSize size;
-
-	if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
-	{
-		return -1;
-	}
-
-	// Get "this" as "self"
-	if(LuaBinder::checkUserData(l, 1, luaUserDataTypeInfoSceneNode, ud))
-	{
-		return -1;
-	}
-
-	SceneNode* self = ud->getData<SceneNode>();
-
-	// Call the method
-	ModelComponent& ret = self->getFirstComponentOfType<ModelComponent>();
-
-	// Push return value
-	voidp = lua_newuserdata(l, sizeof(LuaUserData));
-	ud = static_cast<LuaUserData*>(voidp);
-	luaL_setmetatable(l, "ModelComponent");
-	extern LuaUserDataTypeInfo luaUserDataTypeInfoModelComponent;
-	ud->initPointed(&luaUserDataTypeInfoModelComponent, &ret);
-
-	return 1;
-}
-
-/// Wrap method SceneNode::getFirstComponentOfType<ModelComponent>.
-static int wrapSceneNodegetFirstModelComponent(lua_State* l)
-{
-	int res = pwrapSceneNodegetFirstModelComponent(l);
-	if(res >= 0)
-	{
-		return res;
-	}
-
-	lua_error(l);
-	return 0;
-}
-
 /// Pre-wrap method SceneNode::getFirstComponentOfType<MeshComponent>.
 static inline int pwrapSceneNodegetFirstMeshComponent(lua_State* l)
 {
@@ -4830,7 +4670,6 @@ static inline void wrapSceneNode(lua_State* l)
 	LuaBinder::pushLuaCFuncMethod(l, "newReflectionProbeComponent", wrapSceneNodenewReflectionProbeComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "newBodyComponent", wrapSceneNodenewBodyComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "newParticleEmitterComponent", wrapSceneNodenewParticleEmitterComponent);
-	LuaBinder::pushLuaCFuncMethod(l, "newModelComponent", wrapSceneNodenewModelComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "newMeshComponent", wrapSceneNodenewMeshComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "newMaterialComponent", wrapSceneNodenewMaterialComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "newSkinComponent", wrapSceneNodenewSkinComponent);
@@ -4845,7 +4684,6 @@ static inline void wrapSceneNode(lua_State* l)
 	LuaBinder::pushLuaCFuncMethod(l, "getFirstReflectionProbeComponent", wrapSceneNodegetFirstReflectionProbeComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "getFirstBodyComponent", wrapSceneNodegetFirstBodyComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "getFirstParticleEmitterComponent", wrapSceneNodegetFirstParticleEmitterComponent);
-	LuaBinder::pushLuaCFuncMethod(l, "getFirstModelComponent", wrapSceneNodegetFirstModelComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "getFirstMeshComponent", wrapSceneNodegetFirstMeshComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "getFirstMaterialComponent", wrapSceneNodegetFirstMaterialComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "getFirstSkinComponent", wrapSceneNodegetFirstSkinComponent);
@@ -4853,7 +4691,7 @@ static inline void wrapSceneNode(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoSceneGraph = {-344565074435104509, "SceneGraph", LuaUserData::computeSizeForGarbageCollected<SceneGraph>(),
+LuaUserDataTypeInfo luaUserDataTypeInfoSceneGraph = {-4227639901763694526, "SceneGraph", LuaUserData::computeSizeForGarbageCollected<SceneGraph>(),
 													 nullptr, nullptr};
 
 template<>
@@ -5039,7 +4877,7 @@ static inline void wrapSceneGraph(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoEvent = {-7213519083778952731, "Event", LuaUserData::computeSizeForGarbageCollected<Event>(), nullptr,
+LuaUserDataTypeInfo luaUserDataTypeInfoEvent = {-5087053072849455196, "Event", LuaUserData::computeSizeForGarbageCollected<Event>(), nullptr,
 												nullptr};
 
 template<>
@@ -5104,7 +4942,7 @@ static inline void wrapEvent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoLightEvent = {-7500641618326072918, "LightEvent", LuaUserData::computeSizeForGarbageCollected<LightEvent>(),
+LuaUserDataTypeInfo luaUserDataTypeInfoLightEvent = {1008992105105927788, "LightEvent", LuaUserData::computeSizeForGarbageCollected<LightEvent>(),
 													 nullptr, nullptr};
 
 template<>
@@ -5223,7 +5061,7 @@ static inline void wrapLightEvent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoScriptEvent = {-4651637831792818432, "ScriptEvent", LuaUserData::computeSizeForGarbageCollected<ScriptEvent>(),
+LuaUserDataTypeInfo luaUserDataTypeInfoScriptEvent = {-6564037159457118038, "ScriptEvent", LuaUserData::computeSizeForGarbageCollected<ScriptEvent>(),
 													  nullptr, nullptr};
 
 template<>
@@ -5239,7 +5077,7 @@ static inline void wrapScriptEvent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoJitterMoveEvent = {4333832701995217077, "JitterMoveEvent",
+LuaUserDataTypeInfo luaUserDataTypeInfoJitterMoveEvent = {-6608557523474619704, "JitterMoveEvent",
 														  LuaUserData::computeSizeForGarbageCollected<JitterMoveEvent>(), nullptr, nullptr};
 
 template<>
@@ -5314,7 +5152,7 @@ static inline void wrapJitterMoveEvent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoAnimationEvent = {4989625889996658889, "AnimationEvent",
+LuaUserDataTypeInfo luaUserDataTypeInfoAnimationEvent = {-7864411020435003692, "AnimationEvent",
 														 LuaUserData::computeSizeForGarbageCollected<AnimationEvent>(), nullptr, nullptr};
 
 template<>
@@ -5330,7 +5168,7 @@ static inline void wrapAnimationEvent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoEventManager = {-8182166887483462514, "EventManager",
+LuaUserDataTypeInfo luaUserDataTypeInfoEventManager = {-3654862218911070552, "EventManager",
 													   LuaUserData::computeSizeForGarbageCollected<EventManager>(), nullptr, nullptr};
 
 template<>
@@ -5745,7 +5583,6 @@ void wrapModuleScene(lua_State* l)
 	wrapGlobalIlluminationProbeComponent(l);
 	wrapReflectionProbeComponent(l);
 	wrapParticleEmitterComponent(l);
-	wrapModelComponent(l);
 	wrapMeshComponent(l);
 	wrapMaterialComponent(l);
 	wrapSkinComponent(l);

+ 0 - 16
AnKi/Script/Scene.xml

@@ -274,16 +274,6 @@ using WeakArraySceneNodePtr = WeakArray<SceneNode*>;
 			</methods>
 		</class>
 
-		<class name="ModelComponent">
-			<methods>
-				<method name="loadModelResource">
-					<args>
-						<arg>CString</arg>
-					</args>
-				</method>
-			</methods>
-		</class>
-
 		<class name="MeshComponent">
 			<methods>
 				<method name="setMeshFilename">
@@ -446,9 +436,6 @@ using WeakArraySceneNodePtr = WeakArray<SceneNode*>;
 				<method name="newComponent&lt;ParticleEmitterComponent&gt;" alias="newParticleEmitterComponent">
 					<return>ParticleEmitterComponent*</return>
 				</method>
-				<method name="newComponent&lt;ModelComponent&gt;" alias="newModelComponent">
-					<return>ModelComponent*</return>
-				</method>
 				<method name="newComponent&lt;MeshComponent&gt;" alias="newMeshComponent">
 					<return>MeshComponent*</return>
 				</method>
@@ -492,9 +479,6 @@ using WeakArraySceneNodePtr = WeakArray<SceneNode*>;
 				<method name="getFirstComponentOfType&lt;ParticleEmitterComponent&gt;" alias="getFirstParticleEmitterComponent">
 					<return>ParticleEmitterComponent&amp;</return>
 				</method>
-				<method name="getFirstComponentOfType&lt;ModelComponent&gt;" alias="getFirstModelComponent">
-					<return>ModelComponent&amp;</return>
-				</method>
 				<method name="getFirstComponentOfType&lt;MeshComponent&gt;" alias="getFirstMeshComponent">
 					<return>MeshComponent&amp;</return>
 				</method>

+ 0 - 8
Samples/SimpleScene/Assets/Mesh_0_backWall_24a9b01d8fc47286.ankimdl

@@ -1,8 +0,0 @@
-<model>
-	<modelPatches>
-		<modelPatch>
-			<mesh>Assets/Mesh_0_d56f58fc33de003f.ankimesh</mesh>
-			<material>Assets/backWall_361f28d87a6738d3.ankimtl</material>
-		</modelPatch>
-	</modelPatches>
-</model>

+ 0 - 8
Samples/SimpleScene/Assets/Mesh_1_ceiling_3aa8abc0da9fdec8.ankimdl

@@ -1,8 +0,0 @@
-<model>
-	<modelPatches>
-		<modelPatch>
-			<mesh>Assets/Mesh_1_266a0dd9d2092f46.ankimesh</mesh>
-			<material>Assets/ceiling_3fd94cde277a48e1.ankimtl</material>
-		</modelPatch>
-	</modelPatches>
-</model>

BIN
Samples/SimpleScene/Assets/Mesh_2_be53007bec464649.ankimesh


+ 0 - 8
Samples/SimpleScene/Assets/Mesh_2_floor_cc46c84f817f093a.ankimdl

@@ -1,8 +0,0 @@
-<model>
-	<modelPatches>
-		<modelPatch>
-			<mesh>Assets/Mesh_2_be53007bec464649.ankimesh</mesh>
-			<material>Assets/floor_71cbd2644e53ab8c.ankimtl</material>
-		</modelPatch>
-	</modelPatches>
-</model>

+ 0 - 8
Samples/SimpleScene/Assets/Mesh_3_leftWall_acf66dd2ebcb73e6.ankimdl

@@ -1,8 +0,0 @@
-<model>
-	<modelPatches>
-		<modelPatch>
-			<mesh>Assets/Mesh_3_c026fdb5b74773ed.ankimesh</mesh>
-			<material>Assets/leftWall_fe97b196ed148fca.ankimtl</material>
-		</modelPatch>
-	</modelPatches>
-</model>

+ 0 - 8
Samples/SimpleScene/Assets/Mesh_4_light_82ddb9b3263c8f6e.ankimdl

@@ -1,8 +0,0 @@
-<model>
-	<modelPatches>
-		<modelPatch>
-			<mesh>Assets/Mesh_4_4d4aae6c030c4fd5.ankimesh</mesh>
-			<material>Assets/light_1544a10dffc35038.ankimtl</material>
-		</modelPatch>
-	</modelPatches>
-</model>

+ 0 - 8
Samples/SimpleScene/Assets/Mesh_5_rightWall_46f15190068c514a.ankimdl

@@ -1,8 +0,0 @@
-<model>
-	<modelPatches>
-		<modelPatch>
-			<mesh>Assets/Mesh_5_629309b27fa549a7.ankimesh</mesh>
-			<material>Assets/rightWall_d627c19b8205864.ankimtl</material>
-		</modelPatch>
-	</modelPatches>
-</model>

BIN
Samples/SimpleScene/Assets/Mesh_6.001_2550937d23ca3066.ankimesh


+ 0 - 8
Samples/SimpleScene/Assets/Mesh_6.001_shortBox_4122029d89b53875.ankimdl

@@ -1,8 +0,0 @@
-<model>
-	<modelPatches>
-		<modelPatch>
-			<mesh>Assets/Mesh_6.001_2550937d23ca3066.ankimesh</mesh>
-			<material>Assets/shortBox_122467965d493dab.ankimtl</material>
-		</modelPatch>
-	</modelPatches>
-</model>

BIN
Samples/SimpleScene/Assets/Mesh_6_a078cf217893be6f.ankimesh


BIN
Samples/SimpleScene/Assets/Mesh_7.001_95b61c94f8a0ad1c.ankimesh


+ 0 - 8
Samples/SimpleScene/Assets/Mesh_7.001_tallBox_287bd3c185e6905a.ankimdl

@@ -1,8 +0,0 @@
-<model>
-	<modelPatches>
-		<modelPatch>
-			<mesh>Assets/Mesh_7.001_95b61c94f8a0ad1c.ankimesh</mesh>
-			<material>Assets/tallBox_15316a0c94bdf7f6.ankimtl</material>
-		</modelPatch>
-	</modelPatches>
-</model>

BIN
Samples/SimpleScene/Assets/Mesh_7_4b76b132380d8a62.ankimesh


+ 33 - 9
Samples/SimpleScene/Assets/Scene.lua

@@ -1,9 +1,12 @@
--- Generated by: C:\src\anki\out\build\x64-Release-VK\Binaries\GltfImporter.exe CornellBox.gltf .. -rpath Assets -texrpath Assets -v -j 0 -light-scale 0.01839878467931728
+-- Generated by: ../../../build_dbg/Binaries/GltfImporter CornellBox.gltf . -rpath Assets -texrpath Assets -v -j 0 -light-scale 0.01839878467931728
 local scene = getSceneGraph()
 local events = getEventManager()
 
 node = scene:newSceneNode("Mesh_0")
-node:newModelComponent():loadModelResource("Assets/Mesh_0_backWall_24a9b01d8fc47286.ankimdl")
+node:newMeshComponent():setMeshFilename("Assets/Mesh_0_d56f58fc33de003f.ankimesh")
+mtlc = node:newMaterialComponent()
+mtlc:setMaterialFilename("Assets/backWall_361f28d87a6738d3.ankimtl")
+mtlc:setSubmeshIndex(0)
 trf = Transform.new()
 trf:setOrigin(Vec3.new(0.000000, 0.000000, 0.000000))
 rot = Mat3.new()
@@ -13,7 +16,10 @@ trf:setScale(Vec3.new(5.000000, 5.000000, 5.000000))
 node:setLocalTransform(trf)
 
 node = scene:newSceneNode("Mesh_1")
-node:newModelComponent():loadModelResource("Assets/Mesh_1_ceiling_3aa8abc0da9fdec8.ankimdl")
+node:newMeshComponent():setMeshFilename("Assets/Mesh_1_266a0dd9d2092f46.ankimesh")
+mtlc = node:newMaterialComponent()
+mtlc:setMaterialFilename("Assets/ceiling_3fd94cde277a48e1.ankimtl")
+mtlc:setSubmeshIndex(0)
 trf = Transform.new()
 trf:setOrigin(Vec3.new(0.000000, 0.000000, 0.000000))
 rot = Mat3.new()
@@ -23,7 +29,10 @@ trf:setScale(Vec3.new(5.000000, 5.000000, 5.000000))
 node:setLocalTransform(trf)
 
 node = scene:newSceneNode("Mesh_2")
-node:newModelComponent():loadModelResource("Assets/Mesh_2_floor_cc46c84f817f093a.ankimdl")
+node:newMeshComponent():setMeshFilename("Assets/Mesh_2_be53007bec464649.ankimesh")
+mtlc = node:newMaterialComponent()
+mtlc:setMaterialFilename("Assets/floor_71cbd2644e53ab8c.ankimtl")
+mtlc:setSubmeshIndex(0)
 trf = Transform.new()
 trf:setOrigin(Vec3.new(0.000000, 0.000000, 0.000000))
 rot = Mat3.new()
@@ -33,7 +42,10 @@ trf:setScale(Vec3.new(5.000000, 5.000000, 5.000000))
 node:setLocalTransform(trf)
 
 node = scene:newSceneNode("Mesh_3")
-node:newModelComponent():loadModelResource("Assets/Mesh_3_leftWall_acf66dd2ebcb73e6.ankimdl")
+node:newMeshComponent():setMeshFilename("Assets/Mesh_3_c026fdb5b74773ed.ankimesh")
+mtlc = node:newMaterialComponent()
+mtlc:setMaterialFilename("Assets/leftWall_fe97b196ed148fca.ankimtl")
+mtlc:setSubmeshIndex(0)
 trf = Transform.new()
 trf:setOrigin(Vec3.new(0.000000, 0.000000, 0.000000))
 rot = Mat3.new()
@@ -43,7 +55,10 @@ trf:setScale(Vec3.new(5.000000, 5.000000, 5.000000))
 node:setLocalTransform(trf)
 
 node = scene:newSceneNode("Mesh_4")
-node:newModelComponent():loadModelResource("Assets/Mesh_4_light_82ddb9b3263c8f6e.ankimdl")
+node:newMeshComponent():setMeshFilename("Assets/Mesh_4_4d4aae6c030c4fd5.ankimesh")
+mtlc = node:newMaterialComponent()
+mtlc:setMaterialFilename("Assets/light_1544a10dffc35038.ankimtl")
+mtlc:setSubmeshIndex(0)
 trf = Transform.new()
 trf:setOrigin(Vec3.new(0.000000, 0.000000, 0.000000))
 rot = Mat3.new()
@@ -53,7 +68,10 @@ trf:setScale(Vec3.new(5.000000, 5.000000, 5.000000))
 node:setLocalTransform(trf)
 
 node = scene:newSceneNode("Mesh_5")
-node:newModelComponent():loadModelResource("Assets/Mesh_5_rightWall_46f15190068c514a.ankimdl")
+node:newMeshComponent():setMeshFilename("Assets/Mesh_5_629309b27fa549a7.ankimesh")
+mtlc = node:newMaterialComponent()
+mtlc:setMaterialFilename("Assets/rightWall_d627c19b8205864.ankimtl")
+mtlc:setSubmeshIndex(0)
 trf = Transform.new()
 trf:setOrigin(Vec3.new(0.000000, 0.000000, 0.000000))
 rot = Mat3.new()
@@ -63,7 +81,10 @@ trf:setScale(Vec3.new(5.000000, 5.000000, 5.000000))
 node:setLocalTransform(trf)
 
 node = scene:newSceneNode("Mesh_7")
-node:newModelComponent():loadModelResource("Assets/Mesh_7.001_tallBox_287bd3c185e6905a.ankimdl")
+node:newMeshComponent():setMeshFilename("Assets/Mesh_7.001_95b61c94f8a0ad1c.ankimesh")
+mtlc = node:newMaterialComponent()
+mtlc:setMaterialFilename("Assets/tallBox_15316a0c94bdf7f6.ankimtl")
+mtlc:setSubmeshIndex(0)
 trf = Transform.new()
 trf:setOrigin(Vec3.new(-1.675000, 3.600000, -1.450001))
 rot = Mat3.new()
@@ -73,7 +94,10 @@ trf:setScale(Vec3.new(5.000000, 5.000000, 5.000000))
 node:setLocalTransform(trf)
 
 node = scene:newSceneNode("Mesh_6")
-node:newModelComponent():loadModelResource("Assets/Mesh_6.001_shortBox_4122029d89b53875.ankimdl")
+node:newMeshComponent():setMeshFilename("Assets/Mesh_6.001_2550937d23ca3066.ankimesh")
+mtlc = node:newMaterialComponent()
+mtlc:setMaterialFilename("Assets/shortBox_122467965d493dab.ankimtl")
+mtlc:setSubmeshIndex(0)
 trf = Transform.new()
 trf:setOrigin(Vec3.new(1.637500, 1.800000, 1.862499))
 rot = Mat3.new()