Pārlūkot izejas kodu

Remove the previous particle emitter

Panagiotis Christopoulos Charitos 1 nedēļu atpakaļ
vecāks
revīzija
cb3b5ba0d4

+ 4 - 5
AnKi/Editor/EditorUi.cpp

@@ -1744,7 +1744,7 @@ void EditorUi::comboWithFilter(CString text, const TItemArray& items, CString se
 {
 	if(ImGui::BeginCombo(text.cstr(), selectedItemIn.cstr()))
 	{
-		if (ImGui::IsWindowAppearing())
+		if(ImGui::IsWindowAppearing())
 		{
 			ImGui::SetKeyboardFocusHere();
 			filter.Clear();
@@ -1752,7 +1752,7 @@ void EditorUi::comboWithFilter(CString text, const TItemArray& items, CString se
 
 		ImGui::SetNextItemWidth(-1.0f);
 		if(ImGui::InputTextWithHint("##Filter", ICON_MDI_MAGNIFY " Search incl,-excl", filter.InputBuf, IM_ARRAYSIZE(filter.InputBuf),
-								ImGuiInputTextFlags_EscapeClearsAll))
+									ImGuiInputTextFlags_EscapeClearsAll))
 		{
 			filter.Build();
 		}
@@ -1760,7 +1760,7 @@ void EditorUi::comboWithFilter(CString text, const TItemArray& items, CString se
 		for(U32 i = 0; i < items.getSize(); ++i)
 		{
 			CString item = items[i];
-			if (!filter.PassFilter(item.cstr()))
+			if(!filter.PassFilter(item.cstr()))
 			{
 				continue;
 			}
@@ -2109,8 +2109,7 @@ void EditorUi::objectPicking()
 DynamicArray<CString> EditorUi::gatherResourceFilenames(CString filenameContains)
 {
 	DynamicArray<CString> out;
-	ResourceFilesystem::getSingleton().iterateAllFilenames([&](CString fname){
-
+	ResourceFilesystem::getSingleton().iterateAllFilenames([&](CString fname) {
 		if(fname.find(filenameContains) != CString::kNpos)
 		{
 			out.emplaceBack(fname);

+ 3 - 3
AnKi/Math/Vec2.h

@@ -1476,11 +1476,11 @@ public:
 	}
 
 	// Perspective divide. Divide the xyzw of this to the w of this. This method will handle some edge cases.
-	[[nodiscard]] TVec perspectiveDivide() const requires(kTComponentCount == 4)
+	[[nodiscard]] TVec perspectiveDivide() const requires(kTComponentCount == 4 && !kIsInteger)
 	{
 		auto invw = T(1) / this->w; // This may become (+-)inf
-		invw = (invw > 1e+11) ? 1e+11 : invw; // Clamp
-		invw = (invw < -1e+11) ? -1e+11 : invw; // Clamp
+		invw = (invw > T(1e+11)) ? T(1e+11) : invw; // Clamp
+		invw = (invw < T(-1e+11)) ? T(-1e+11) : invw; // Clamp
 		return (*this) * invw;
 	}
 

+ 0 - 1
AnKi/Renderer/Utils/Drawer.cpp

@@ -69,7 +69,6 @@ void RenderableDrawer::setState(const RenderableDrawerArguments& args, CommandBu
 	cmdb.bindSrv(ANKI_MATERIAL_REGISTER_RENDERABLES, 0, GpuSceneArrays::Renderable::getSingleton().getBufferView());
 	cmdb.bindSrv(ANKI_MATERIAL_REGISTER_MESH_LODS, 0, GpuSceneArrays::MeshLod::getSingleton().getBufferView());
 	cmdb.bindSrv(ANKI_MATERIAL_REGISTER_TRANSFORMS, 0, GpuSceneArrays::Transform::getSingleton().getBufferView());
-	cmdb.bindSrv(ANKI_MATERIAL_REGISTER_PARTICLE_EMITTERS, 0, GpuSceneArrays::ParticleEmitter::getSingleton().getBufferViewSafe());
 	cmdb.bindSrv(ANKI_MATERIAL_REGISTER_PARTICLE_EMITTERS2, 0, GpuSceneArrays::ParticleEmitter2::getSingleton().getBufferViewSafe());
 
 	cmdb.bindSampler(ANKI_MATERIAL_REGISTER_NEAREST_CLAMP_SAMPLER, 0, getRenderer().getSamplers().m_nearestNearestClamp.get());

+ 6 - 7
AnKi/Renderer/Utils/GpuVisibility.cpp

@@ -745,16 +745,15 @@ void GpuVisibility::populateRenderGraphInternal(Bool distanceBased, BaseGpuVisib
 				cmdb.bindShaderProgram(m_gatherGrProg.get());
 
 				cmdb.bindSrv(0, 0, GpuSceneArrays::Renderable::getSingleton().getBufferView());
-				cmdb.bindSrv(1, 0, GpuSceneArrays::ParticleEmitter::getSingleton().getBufferViewSafe());
-				cmdb.bindSrv(2, 0, GpuSceneArrays::ParticleEmitter2::getSingleton().getBufferViewSafe());
-				cmdb.bindSrv(3, 0, GpuSceneArrays::MeshLod::getSingleton().getBufferView());
+				cmdb.bindSrv(1, 0, GpuSceneArrays::ParticleEmitter2::getSingleton().getBufferViewSafe());
+				cmdb.bindSrv(2, 0, GpuSceneArrays::MeshLod::getSingleton().getBufferView());
 
-				cmdb.bindSrv(4, 0, stage1Mem.m_visibleRenderables);
-				cmdb.bindSrv(5, 0, stage1Mem.m_counters);
-				cmdb.bindSrv(6, 0, stage1Mem.m_renderablePrefixSums);
+				cmdb.bindSrv(3, 0, stage1Mem.m_visibleRenderables);
+				cmdb.bindSrv(4, 0, stage1Mem.m_counters);
+				cmdb.bindSrv(5, 0, stage1Mem.m_renderablePrefixSums);
 
 				WeakArray<UVec2> firstDrawIndirectArgAndCount =
-					allocateAndBindSrvStructuredBuffer<UVec2>(cmdb, 7, 0, out.m_legacy.m_bucketIndirectArgsRanges.getSize());
+					allocateAndBindSrvStructuredBuffer<UVec2>(cmdb, 6, 0, out.m_legacy.m_bucketIndirectArgsRanges.getSize());
 				for(U32 ibucket = 0; ibucket < out.m_legacy.m_bucketIndirectArgsRanges.getSize(); ++ibucket)
 				{
 					firstDrawIndirectArgAndCount[ibucket].x() = out.m_legacy.m_bucketIndirectArgsRanges[ibucket].m_firstInstance;

+ 0 - 1
AnKi/Resource.h

@@ -6,7 +6,6 @@
 #pragma once
 
 #include <AnKi/Resource/ResourceManager.h>
-#include <AnKi/Resource/ParticleEmitterResource.h>
 #include <AnKi/Resource/ParticleEmitterResource2.h>
 #include <AnKi/Resource/AnimationResource.h>
 #include <AnKi/Resource/ScriptResource.h>

+ 0 - 140
AnKi/Resource/ParticleEmitterResource.cpp

@@ -1,140 +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/ParticleEmitterResource.h>
-#include <AnKi/Resource/ResourceManager.h>
-#include <AnKi/Util/StringList.h>
-#include <AnKi/Util/Xml.h>
-#include <cstring>
-
-namespace anki {
-
-template<typename T>
-static Error getXmlVal(const XmlElement& el, const CString& tag, T& out, Bool& found)
-{
-	return el.getAttributeNumberOptional(tag, out, found);
-}
-
-template<>
-Error getXmlVal(const XmlElement& el, const CString& tag, Vec3& out, Bool& found)
-{
-	return el.getAttributeNumbersOptional(tag, out, found);
-}
-
-Error ParticleEmitterResource::load(const ResourceFilename& filename, Bool async)
-{
-	ResourceXmlDocument doc;
-	ANKI_CHECK(openFileParseXml(filename, doc));
-	XmlElement rootEl; // Root element
-	ANKI_CHECK(doc.getChildElement("particleEmitter", rootEl));
-
-#define ANKI_XML(varName, VarName) \
-	ANKI_CHECK(readVar(rootEl, #varName, m_particle.m_min##VarName, m_particle.m_max##VarName, &m_particle.m_min##VarName))
-
-	ANKI_XML(life, Life);
-	ANKI_XML(mass, Mass);
-	ANKI_XML(initialSize, InitialSize);
-	ANKI_XML(finalSize, FinalSize);
-	ANKI_XML(initialAlpha, InitialAlpha);
-	ANKI_XML(finalAlpha, FinalAlpha);
-	ANKI_XML(forceDirection, ForceDirection);
-	ANKI_XML(forceMagnitude, ForceMagnitude);
-	ANKI_XML(gravity, Gravity);
-	ANKI_XML(startingPosition, StartingPosition);
-
-#undef ANKI_XML
-
-	XmlElement el;
-	ANKI_CHECK(rootEl.getChildElement("maxNumberOfParticles", el));
-	ANKI_CHECK(el.getAttributeNumber("value", m_maxNumOfParticles));
-
-	ANKI_CHECK(rootEl.getChildElement("emissionPeriod", el));
-	ANKI_CHECK(el.getAttributeNumber("value", m_emissionPeriod));
-
-	ANKI_CHECK(rootEl.getChildElement("particlesPerEmission", el));
-	ANKI_CHECK(el.getAttributeNumber("value", m_particlesPerEmission));
-
-	ANKI_CHECK(rootEl.getChildElementOptional("usePhysicsEngine", el));
-	if(el)
-	{
-		ANKI_CHECK(el.getAttributeNumber("value", m_usePhysicsEngine));
-	}
-
-	ANKI_CHECK(rootEl.getChildElementOptional("emitterBoundingVolume", el));
-	if(el)
-	{
-		ANKI_CHECK(el.getAttributeNumbers("min", m_emitterBoundingVolumeMin));
-		ANKI_CHECK(el.getAttributeNumbers("max", m_emitterBoundingVolumeMax));
-	}
-
-	CString cstr;
-	ANKI_CHECK(rootEl.getChildElement("material", el));
-	ANKI_CHECK(el.getAttributeText("value", cstr));
-	ANKI_CHECK(ResourceManager::getSingleton().loadResource(cstr, m_material, async));
-
-	return Error::kNone;
-}
-
-template<typename T>
-Error ParticleEmitterResource::readVar(const XmlElement& rootEl, CString varName, T& minVal, T& maxVal, const T* defaultVal)
-{
-	XmlElement el;
-
-	// <varName>
-	ANKI_CHECK(rootEl.getChildElementOptional(varName, el));
-	if(!el && !defaultVal)
-	{
-		ANKI_RESOURCE_LOGE("<%s> is missing", varName.cstr());
-		return Error::kUserData;
-	}
-
-	if(!el)
-	{
-		maxVal = minVal = *defaultVal;
-		return Error::kNone;
-	}
-
-	// value tag
-	Bool found;
-	ANKI_CHECK(getXmlVal(el, "value", minVal, found));
-	if(found)
-	{
-		maxVal = minVal;
-		return Error::kNone;
-	}
-
-	// min & max value tags
-	ANKI_CHECK(getXmlVal(el, "min", minVal, found));
-	if(!found)
-	{
-		ANKI_RESOURCE_LOGE("tag min is missing for <%s>", varName.cstr());
-		return Error::kUserData;
-	}
-
-	ANKI_CHECK(getXmlVal(el, "max", maxVal, found));
-	if(!found)
-	{
-		ANKI_RESOURCE_LOGE("tag max is missing for <%s>", varName.cstr());
-		return Error::kUserData;
-	}
-
-	if(minVal > maxVal)
-	{
-		ANKI_RESOURCE_LOGE("min tag should have less value than max for <%s>", varName.cstr());
-		return Error::kUserData;
-	}
-
-	return Error::kNone;
-}
-
-void ParticleEmitterResource::getRenderingInfo(const RenderingKey& key_, ShaderProgramPtr& prog) const
-{
-	RenderingKey key = key_;
-	key.setLod(min<U32>(key.getLod(), m_lodCount - 1));
-	const MaterialVariant& variant = m_material->getOrCreateVariant(key);
-	prog = variant.getShaderProgram();
-}
-
-} // end namespace anki

+ 0 - 140
AnKi/Resource/ParticleEmitterResource.h

@@ -1,140 +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/Resource/RenderingKey.h>
-#include <AnKi/Resource/MaterialResource.h>
-#include <AnKi/Math.h>
-#include <AnKi/Gr.h>
-
-namespace anki {
-
-class XmlElement;
-
-/// @addtogroup resource
-/// @{
-
-/// The particle emitter properties. Different class from ParticleEmitterResource so it can be inherited
-class ParticleEmitterProperties
-{
-public:
-	/// @name Particle specific properties
-	/// @{
-	class
-	{
-	public:
-		Second m_minLife = 10.0;
-		Second m_maxLife = 10.0;
-
-		F32 m_minMass = 1.0f;
-		F32 m_maxMass = 1.0f;
-
-		F32 m_minInitialSize = 1.0f;
-		F32 m_maxInitialSize = 1.0f;
-		F32 m_minFinalSize = 1.0f;
-		F32 m_maxFinalSize = 1.0f;
-
-		F32 m_minInitialAlpha = 1.0f;
-		F32 m_maxInitialAlpha = 1.0f;
-		F32 m_minFinalAlpha = 1.0f;
-		F32 m_maxFinalAlpha = 1.0f;
-
-		Vec3 m_minForceDirection = Vec3(0.0f, 1.0f, 0.0f);
-		Vec3 m_maxForceDirection = Vec3(0.0f, 1.0f, 0.0f);
-		F32 m_minForceMagnitude = 0.0f;
-		F32 m_maxForceMagnitude = 0.0f;
-
-		/// If not set then it uses the world's default
-		Vec3 m_minGravity = Vec3(kMaxF32);
-		Vec3 m_maxGravity = Vec3(kMaxF32);
-
-		/// This position is relevant to the particle emitter pos
-		Vec3 m_minStartingPosition = Vec3(0.0);
-		Vec3 m_maxStartingPosition = Vec3(0.0);
-	} m_particle;
-	/// @}
-
-	/// @name Emitter specific properties
-	/// @{
-	U32 m_maxNumOfParticles = 16; ///< The size of the particles vector. Required
-
-	F32 m_emissionPeriod = 1.0; ///< How often the emitter emits new particles. In secs. Required
-
-	U32 m_particlesPerEmission = 1; ///< How many particles are emitted every emission. Required
-
-	Bool m_usePhysicsEngine = false; ///< Use Jolt for the simulation
-
-	Vec3 m_emitterBoundingVolumeMin = Vec3(0.0f); ///< Limit the size of the emitter. Mainly for visibility tests.
-
-	Vec3 m_emitterBoundingVolumeMax = Vec3(0.0f); ///< Limit the size of the emitter. Mainly for visibility tests.
-	/// @}
-
-	ParticleEmitterProperties()
-	{
-	}
-
-	ParticleEmitterProperties(const ParticleEmitterProperties& b)
-	{
-		*this = b;
-	}
-
-	ParticleEmitterProperties& operator=(const ParticleEmitterProperties& b)
-	{
-		memcpy(this, &b, sizeof(*this));
-		return *this;
-	}
-
-	Bool forceEnabled() const
-	{
-		return m_particle.m_maxForceMagnitude > 0.0f;
-	}
-
-	Bool wordGravityEnabled() const
-	{
-		return m_particle.m_maxGravity.x() < kMaxF32;
-	}
-};
-
-/// This is the properties of the particle emitter resource
-class ParticleEmitterResource : public ResourceObject, private ParticleEmitterProperties
-{
-public:
-	ParticleEmitterResource(CString fname, U32 uuid)
-		: ResourceObject(fname, uuid)
-	{
-	}
-
-	~ParticleEmitterResource() = default;
-
-	const ParticleEmitterProperties& getProperties() const
-	{
-		return *this;
-	}
-
-	const MaterialResourcePtr& getMaterial() const
-	{
-		return m_material;
-	}
-
-	/// Get program for rendering.
-	void getRenderingInfo(const RenderingKey& key, ShaderProgramPtr& prog) const;
-
-	/// Load it
-	Error load(const ResourceFilename& filename, Bool async);
-
-private:
-	MaterialResourcePtr m_material;
-	U8 m_lodCount = 1; ///< Cache the value from the material
-
-	void loadInternal(const XmlElement& el);
-
-	template<typename T>
-	Error readVar(const XmlElement& rootEl, CString varName, T& minVal, T& maxVal, const T* defaultVal);
-};
-/// @}
-
-} // end namespace anki

+ 0 - 1
AnKi/Resource/ResourceManager.cpp

@@ -16,7 +16,6 @@
 #include <AnKi/Resource/CpuMeshResource.h>
 #include <AnKi/Resource/ScriptResource.h>
 #include <AnKi/Resource/DummyResource.h>
-#include <AnKi/Resource/ParticleEmitterResource.h>
 #include <AnKi/Resource/ParticleEmitterResource2.h>
 #include <AnKi/Resource/ImageResource.h>
 #include <AnKi/Resource/GenericResource.h>

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

@@ -19,8 +19,6 @@ ANKI_INSTANTIATE_RESOURCE(CpuMeshResource)
 ANKI_INSTANSIATE_RESOURCE_DELIMITER()
 ANKI_INSTANTIATE_RESOURCE(SkeletonResource)
 ANKI_INSTANSIATE_RESOURCE_DELIMITER()
-ANKI_INSTANTIATE_RESOURCE(ParticleEmitterResource)
-ANKI_INSTANSIATE_RESOURCE_DELIMITER()
 ANKI_INSTANTIATE_RESOURCE(ParticleEmitterResource2)
 ANKI_INSTANSIATE_RESOURCE_DELIMITER()
 ANKI_INSTANTIATE_RESOURCE(ScriptResource)

+ 0 - 1
AnKi/Scene.h

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

+ 0 - 1
AnKi/Scene/Components/MaterialComponent.cpp

@@ -304,7 +304,6 @@ void MaterialComponent::update(SceneComponentUpdateInfo& info, Bool& updated)
 		gpuRenderable.m_meshLodsIndex =
 			(prioritizeEmitter) ? m_emitterComponent->getGpuSceneMeshLodIndex(m_submeshIdx) : m_meshComponent->getGpuSceneMeshLodsIndex(m_submeshIdx);
 		gpuRenderable.m_boneTransformsOffset = (m_skinComponent) ? m_skinComponent->getBoneTransformsGpuSceneOffset() : 0;
-		gpuRenderable.m_particleEmitterIndex = kMaxU32;
 		gpuRenderable.m_particleEmitterIndex2 = (prioritizeEmitter) ? m_emitterComponent->getGpuSceneParticleEmitter2Index() : kMaxU32;
 		if(!!(mtl.getRenderingTechniques() & RenderingTechniqueBit::kRtShadow))
 		{

+ 1 - 1
AnKi/Scene/Components/ParticleEmitter2Component.h

@@ -8,7 +8,7 @@
 #include <AnKi/Scene/Components/SceneComponent.h>
 #include <AnKi/Scene/RenderStateBucket.h>
 #include <AnKi/Scene/GpuSceneArray.h>
-#include <AnKi/Resource/ParticleEmitterResource.h>
+#include <AnKi/Resource/ParticleEmitterResource2.h>
 #include <AnKi/GpuMemory/UnifiedGeometryBuffer.h>
 #include <AnKi/Collision/Aabb.h>
 #include <AnKi/Util/WeakArray.h>

+ 0 - 592
AnKi/Scene/Components/ParticleEmitterComponent.cpp

@@ -1,592 +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/ParticleEmitterComponent.h>
-#include <AnKi/Scene/SceneGraph.h>
-#include <AnKi/Scene/SceneNode.h>
-#include <AnKi/Scene/Components/MoveComponent.h>
-#include <AnKi/Resource/ParticleEmitterResource.h>
-#include <AnKi/Resource/ResourceManager.h>
-#include <AnKi/Physics/PhysicsBody.h>
-#include <AnKi/Physics/PhysicsCollisionShape.h>
-#include <AnKi/Physics/PhysicsWorld.h>
-#include <AnKi/Math.h>
-#include <AnKi/Shaders/Include/GpuSceneFunctions.h>
-#include <AnKi/GpuMemory/RebarTransientMemoryPool.h>
-
-namespace anki {
-
-static Vec3 getRandom(const Vec3& min, const Vec3& max)
-{
-	Vec3 out;
-	out.x() = mix(min.x(), max.x(), getRandomRange(0.0f, 1.0f));
-	out.y() = mix(min.y(), max.y(), getRandomRange(0.0f, 1.0f));
-	out.z() = mix(min.z(), max.z(), getRandomRange(0.0f, 1.0f));
-	return out;
-}
-
-/// Particle base
-class ParticleEmitterComponent::ParticleBase
-{
-public:
-	Second m_timeOfBirth; ///< Keep the time of birth for nice effects
-	Second m_timeOfDeath = -1.0; ///< Time of death. If < 0.0 then dead
-
-	F32 m_initialSize;
-	F32 m_finalSize;
-	F32 m_crntSize;
-
-	F32 m_initialAlpha;
-	F32 m_finalAlpha;
-	F32 m_crntAlpha;
-
-	Vec3 m_crntPosition;
-
-	Bool isDead() const
-	{
-		return m_timeOfDeath < 0.0;
-	}
-
-	/// Kill the particle
-	void killCommon()
-	{
-		ANKI_ASSERT(m_timeOfDeath > 0.0);
-		m_timeOfDeath = -1.0;
-	}
-
-	/// Revive the particle
-	void reviveCommon(const ParticleEmitterProperties& props, Second crntTime)
-	{
-		ANKI_ASSERT(isDead());
-
-		// life
-		m_timeOfDeath = crntTime + getRandomRange(props.m_particle.m_minLife, props.m_particle.m_maxLife);
-		m_timeOfBirth = crntTime;
-
-		// Size
-		m_initialSize = getRandomRange(props.m_particle.m_minInitialSize, props.m_particle.m_maxInitialSize);
-		m_finalSize = getRandomRange(props.m_particle.m_minFinalSize, props.m_particle.m_maxFinalSize);
-
-		// Alpha
-		m_initialAlpha = getRandomRange(props.m_particle.m_minInitialAlpha, props.m_particle.m_maxInitialAlpha);
-		m_finalAlpha = getRandomRange(props.m_particle.m_minFinalAlpha, props.m_particle.m_maxFinalAlpha);
-	}
-
-	/// Common sumulation code
-	void simulateCommon(Second crntTime)
-	{
-		const F32 lifeFactor = F32((crntTime - m_timeOfBirth) / (m_timeOfDeath - m_timeOfBirth));
-
-		m_crntSize = mix(m_initialSize, m_finalSize, lifeFactor);
-		m_crntAlpha = mix(m_initialAlpha, m_finalAlpha, lifeFactor);
-	}
-};
-
-/// Simple particle for simple simulation
-class ParticleEmitterComponent::SimpleParticle : public ParticleEmitterComponent::ParticleBase
-{
-public:
-	Vec3 m_velocity = Vec3(0.0f);
-	Vec3 m_acceleration = Vec3(0.0f);
-
-	void kill()
-	{
-		killCommon();
-	}
-
-	void revive(const ParticleEmitterProperties& props, const Transform& trf, Second crntTime)
-	{
-		reviveCommon(props, crntTime);
-		m_velocity = Vec3(0.0f);
-
-		m_acceleration = getRandom(props.m_particle.m_minGravity, props.m_particle.m_maxGravity);
-
-		// Set the initial position
-		m_crntPosition = getRandom(props.m_particle.m_minStartingPosition, props.m_particle.m_maxStartingPosition);
-		m_crntPosition += trf.getOrigin().xyz();
-	}
-
-	void simulate(Second prevUpdateTime, Second crntTime)
-	{
-		simulateCommon(crntTime);
-
-		const F32 dt = F32(crntTime - prevUpdateTime);
-
-#if 0
-		const Vec3 xp = m_crntPosition;
-		const Vec3 xc = m_acceleration * (dt * dt) + m_velocity * dt + xp;
-
-		m_crntPosition = xc;
-
-		m_velocity += m_acceleration * dt;
-#else
-		m_velocity += m_acceleration * dt;
-		m_crntPosition += m_velocity * dt;
-#endif
-	}
-};
-
-/// Particle for Jolt simulations
-class ParticleEmitterComponent::PhysicsParticle : public ParticleEmitterComponent::ParticleBase
-{
-public:
-	PhysicsBodyPtr m_body;
-
-	PhysicsParticle(const PhysicsBodyInitInfo& init, ParticleEmitterComponent* component)
-	{
-		m_body = PhysicsWorld::getSingleton().newPhysicsBody(init);
-		m_body->setUserData(component);
-		m_body->activate(false);
-	}
-
-	void kill()
-	{
-		killCommon();
-		m_body->activate(false);
-	}
-
-	void revive(const ParticleEmitterProperties& props, const Transform& trf, Second crntTime)
-	{
-		reviveCommon(props, crntTime);
-
-		// pre calculate
-		const Bool forceFlag = props.forceEnabled();
-		const Bool worldGravFlag = props.wordGravityEnabled();
-
-		// Activate it
-		m_body->activate(true);
-		m_body->setLinearVelocity(Vec3(0.0f));
-		m_body->setAngularVelocity(Vec3(0.0f));
-		m_body->clearForcesAndTorque();
-
-		// force
-		if(forceFlag)
-		{
-			Vec3 forceDir = getRandom(props.m_particle.m_minForceDirection, props.m_particle.m_maxForceDirection).normalize();
-
-			// The forceDir depends on the particle emitter rotation
-			forceDir = trf.getRotation().getRotationPart() * forceDir;
-
-			const F32 forceMag = getRandomRange(props.m_particle.m_minForceMagnitude, props.m_particle.m_maxForceMagnitude);
-			m_body->applyForce(forceDir * forceMag, Vec3(0.0f));
-		}
-
-		// gravity
-		if(!worldGravFlag)
-		{
-			// TODO m_body->setGravity(getRandom(props.m_particle.m_minGravity, props.m_particle.m_maxGravity));
-		}
-
-		// Starting pos. In local space
-		Vec3 pos = getRandom(props.m_particle.m_minStartingPosition, props.m_particle.m_maxStartingPosition);
-		pos = trf.transform(pos);
-
-		m_body->setPositionAndRotation(pos, trf.getRotation().getRotationPart());
-		m_crntPosition = pos;
-	}
-
-	void simulate([[maybe_unused]] Second prevUpdateTime, Second crntTime)
-	{
-		simulateCommon(crntTime);
-		m_crntPosition = m_body->getTransform().getOrigin().xyz();
-	}
-};
-
-ParticleEmitterComponent::ParticleEmitterComponent(SceneNode* node)
-	: SceneComponent(node, kClassType)
-{
-	// Allocate and populate a quad
-	const U32 vertCount = 4;
-	const U32 indexCount = 6;
-
-	m_quadPositions = UnifiedGeometryBuffer::getSingleton().allocateFormat(kMeshRelatedVertexStreamFormats[VertexStreamId::kPosition], vertCount);
-	m_quadUvs = UnifiedGeometryBuffer::getSingleton().allocateFormat(kMeshRelatedVertexStreamFormats[VertexStreamId::kUv], vertCount);
-	m_quadIndices = UnifiedGeometryBuffer::getSingleton().allocateFormat(Format::kR16_Uint, indexCount);
-
-	static_assert(kMeshRelatedVertexStreamFormats[VertexStreamId::kPosition] == Format::kR16G16B16A16_Unorm);
-	WeakArray<U16Vec4> transientPositions;
-	const BufferView positionsAlloc = RebarTransientMemoryPool::getSingleton().allocateCopyBuffer(vertCount, transientPositions);
-	transientPositions[0] = U16Vec4(0, 0, 0, 0);
-	transientPositions[1] = U16Vec4(kMaxU16, 0, 0, 0);
-	transientPositions[2] = U16Vec4(kMaxU16, kMaxU16, 0, 0);
-	transientPositions[3] = U16Vec4(0, kMaxU16, 0, 0);
-
-	static_assert(kMeshRelatedVertexStreamFormats[VertexStreamId::kUv] == Format::kR32G32_Sfloat);
-	WeakArray<Vec2> transientUvs;
-	const BufferView uvsAlloc = RebarTransientMemoryPool::getSingleton().allocateCopyBuffer(vertCount, transientUvs);
-	transientUvs[0] = Vec2(0.0f);
-	transientUvs[1] = Vec2(1.0f, 0.0f);
-	transientUvs[2] = Vec2(1.0f, 1.0f);
-	transientUvs[3] = Vec2(0.0f, 1.0f);
-
-	WeakArray<U16> transientIndices;
-	const BufferView indicesAlloc = RebarTransientMemoryPool::getSingleton().allocateCopyBuffer(indexCount, transientIndices);
-	transientIndices[0] = 0;
-	transientIndices[1] = 1;
-	transientIndices[2] = 3;
-	transientIndices[3] = 1;
-	transientIndices[4] = 2;
-	transientIndices[5] = 3;
-
-	CommandBufferInitInfo cmdbInit("Particle quad upload");
-	cmdbInit.m_flags |= CommandBufferFlag::kSmallBatch;
-	CommandBufferPtr cmdb = GrManager::getSingleton().newCommandBuffer(cmdbInit);
-	Buffer* dstBuff = &UnifiedGeometryBuffer::getSingleton().getBuffer();
-	cmdb->copyBufferToBuffer(positionsAlloc, m_quadPositions);
-	cmdb->copyBufferToBuffer(uvsAlloc, m_quadUvs);
-	cmdb->copyBufferToBuffer(indicesAlloc, m_quadIndices);
-	BufferBarrierInfo barrier;
-	barrier.m_bufferView = BufferView(dstBuff);
-	barrier.m_previousUsage = BufferUsageBit::kCopyDestination;
-	barrier.m_nextUsage = dstBuff->getBufferUsage();
-	cmdb->setPipelineBarrier({}, {&barrier, 1}, {});
-	cmdb->endRecording();
-
-	GrManager::getSingleton().submit(cmdb.get());
-}
-
-ParticleEmitterComponent::~ParticleEmitterComponent()
-{
-}
-
-void ParticleEmitterComponent::loadParticleEmitterResource(CString filename)
-{
-	// Load
-	ParticleEmitterResourcePtr rsrc;
-	const Error err = ResourceManager::getSingleton().loadResource(filename, rsrc);
-	if(err)
-	{
-		ANKI_SCENE_LOGE("Failed to load particle emitter");
-		return;
-	}
-
-	m_particleEmitterResource = std::move(rsrc);
-
-	m_props = m_particleEmitterResource->getProperties();
-	m_resourceUpdated = true;
-
-	// Cleanup
-	m_simpleParticles.destroy();
-	m_physicsParticles.destroy();
-	GpuSceneBuffer::getSingleton().deferredFree(m_gpuScenePositions);
-	GpuSceneBuffer::getSingleton().deferredFree(m_gpuSceneScales);
-	GpuSceneBuffer::getSingleton().deferredFree(m_gpuSceneAlphas);
-	GpuSceneBuffer::getSingleton().deferredFree(m_gpuSceneConstants);
-
-	for(RenderStateBucketIndex& idx : m_renderStateBuckets)
-	{
-		RenderStateBucketContainer::getSingleton().removeUser(idx);
-	}
-
-	// Init particles
-	m_simulationType = (m_props.m_usePhysicsEngine) ? SimulationType::kPhysicsEngine : SimulationType::kSimple;
-	if(m_simulationType == SimulationType::kPhysicsEngine)
-	{
-		PhysicsCollisionShapePtr collisionShape = PhysicsWorld::getSingleton().newSphereCollisionShape(m_props.m_particle.m_minInitialSize / 2.0f);
-
-		PhysicsBodyInitInfo binit;
-		binit.m_layer = PhysicsLayer::kDebris;
-		binit.m_shape = collisionShape.get();
-
-		m_physicsParticles.resizeStorage(m_props.m_maxNumOfParticles);
-		for(U32 i = 0; i < m_props.m_maxNumOfParticles; i++)
-		{
-			binit.m_mass = getRandomRange(m_props.m_particle.m_minMass, m_props.m_particle.m_maxMass);
-			m_physicsParticles.emplaceBack(binit, this);
-		}
-	}
-	else
-	{
-		m_simpleParticles.resize(m_props.m_maxNumOfParticles);
-	}
-
-	// GPU scene allocations
-	m_gpuScenePositions = GpuSceneBuffer::getSingleton().allocate(sizeof(Vec3) * m_props.m_maxNumOfParticles, alignof(F32));
-	m_gpuSceneAlphas = GpuSceneBuffer::getSingleton().allocate(sizeof(F32) * m_props.m_maxNumOfParticles, alignof(F32));
-	m_gpuSceneScales = GpuSceneBuffer::getSingleton().allocate(sizeof(F32) * m_props.m_maxNumOfParticles, alignof(F32));
-	m_gpuSceneConstants = GpuSceneBuffer::getSingleton().allocate(
-		m_particleEmitterResource->getMaterial()->getPrefilledLocalConstants().getSizeInBytes(), alignof(U32));
-
-	// Allocate buckets
-	for(RenderingTechnique t :
-		EnumBitsIterable<RenderingTechnique, RenderingTechniqueBit>(m_particleEmitterResource->getMaterial()->getRenderingTechniques()))
-	{
-		RenderingKey key;
-		key.setRenderingTechnique(t);
-		ShaderProgramPtr prog;
-		m_particleEmitterResource->getRenderingInfo(key, prog);
-
-		RenderStateInfo state;
-		state.m_program = prog;
-		state.m_primitiveTopology = PrimitiveTopology::kTriangles;
-		m_renderStateBuckets[t] = RenderStateBucketContainer::getSingleton().addUser(state, t, 0);
-	}
-}
-
-void ParticleEmitterComponent::update(SceneComponentUpdateInfo& info, Bool& updated)
-{
-	if(!m_particleEmitterResource.isCreated()) [[unlikely]]
-	{
-		updated = false;
-	}
-
-	updated = true;
-	Vec3* positions;
-	F32* scales;
-	F32* alphas;
-
-	Aabb aabbWorld;
-	if(m_simulationType == SimulationType::kSimple)
-	{
-		simulate(info.m_previousTime, info.m_currentTime, info.m_node->getWorldTransform(), WeakArray<SimpleParticle>(m_simpleParticles), positions,
-				 scales, alphas, aabbWorld);
-	}
-	else
-	{
-		ANKI_ASSERT(m_simulationType == SimulationType::kPhysicsEngine);
-		simulate(info.m_previousTime, info.m_currentTime, info.m_node->getWorldTransform(), WeakArray<PhysicsParticle>(m_physicsParticles), positions,
-				 scales, alphas, aabbWorld);
-	}
-
-	// Upload particles to the GPU scene
-	GpuSceneMicroPatcher& patcher = GpuSceneMicroPatcher::getSingleton();
-	if(m_aliveParticleCount > 0)
-	{
-		patcher.newCopy(m_gpuScenePositions, sizeof(Vec3) * m_aliveParticleCount, positions);
-		patcher.newCopy(m_gpuSceneScales, sizeof(F32) * m_aliveParticleCount, scales);
-		patcher.newCopy(m_gpuSceneAlphas, sizeof(F32) * m_aliveParticleCount, alphas);
-	}
-
-	if(m_resourceUpdated)
-	{
-		// Upload GpuSceneParticleEmitter
-		GpuSceneParticleEmitter particles = {};
-		particles.m_vertexOffsets[U32(VertexStreamId::kParticlePosition)] = m_gpuScenePositions.getOffset();
-		particles.m_vertexOffsets[U32(VertexStreamId::kParticleColor)] = m_gpuSceneAlphas.getOffset();
-		particles.m_vertexOffsets[U32(VertexStreamId::kParticleScale)] = m_gpuSceneScales.getOffset();
-		particles.m_aliveParticleCount = m_aliveParticleCount;
-		if(!m_gpuSceneParticleEmitter.isValid())
-		{
-			m_gpuSceneParticleEmitter.allocate();
-		}
-		m_gpuSceneParticleEmitter.uploadToGpuScene(particles);
-
-		// Upload uniforms
-		patcher.newCopy(m_gpuSceneConstants, m_particleEmitterResource->getMaterial()->getPrefilledLocalConstants().getSizeInBytes(),
-						m_particleEmitterResource->getMaterial()->getPrefilledLocalConstants().getBegin());
-
-		// Upload mesh LODs
-		GpuSceneMeshLod meshLod = {};
-		meshLod.m_vertexOffsets[U32(VertexStreamId::kPosition)] =
-			m_quadPositions.getOffset() / getFormatInfo(kMeshRelatedVertexStreamFormats[VertexStreamId::kPosition]).m_texelSize;
-		meshLod.m_vertexOffsets[U32(VertexStreamId::kUv)] =
-			m_quadUvs.getOffset() / getFormatInfo(kMeshRelatedVertexStreamFormats[VertexStreamId::kUv]).m_texelSize;
-		meshLod.m_indexCount = 6;
-		meshLod.m_firstIndex = m_quadIndices.getOffset() / sizeof(U16);
-		meshLod.m_positionScale = 1.0f;
-		meshLod.m_positionTranslation = Vec3(-0.5f, -0.5f, 0.0f);
-		Array<GpuSceneMeshLod, kMaxLodCount> meshLods;
-		meshLods.fill(meshLod);
-		if(!m_gpuSceneMeshLods.isValid())
-		{
-			m_gpuSceneMeshLods.allocate();
-		}
-		m_gpuSceneMeshLods.uploadToGpuScene(meshLods);
-
-		// Upload the GpuSceneRenderable
-		GpuSceneRenderable renderable = {};
-		renderable.m_boneTransformsOffset = 0;
-		renderable.m_constantsOffset = m_gpuSceneConstants.getOffset();
-		renderable.m_meshLodsIndex = m_gpuSceneMeshLods.getIndex() * kMaxLodCount;
-		renderable.m_particleEmitterIndex = m_gpuSceneParticleEmitter.getIndex();
-		renderable.m_particleEmitterIndex2 = kMaxU32;
-		renderable.m_worldTransformsIndex = 0;
-		renderable.m_uuid = SceneGraph::getSingleton().getNewUuid();
-		if(!m_gpuSceneRenderable.isValid())
-		{
-			m_gpuSceneRenderable.allocate();
-		}
-		m_gpuSceneRenderable.uploadToGpuScene(renderable);
-	}
-
-	if(!m_resourceUpdated)
-	{
-		// Always upload GpuSceneParticleEmitter
-
-		GpuSceneParticleEmitter particles = {};
-		particles.m_vertexOffsets[U32(VertexStreamId::kParticlePosition)] = m_gpuScenePositions.getOffset();
-		particles.m_vertexOffsets[U32(VertexStreamId::kParticleColor)] = m_gpuSceneAlphas.getOffset();
-		particles.m_vertexOffsets[U32(VertexStreamId::kParticleScale)] = m_gpuSceneScales.getOffset();
-		particles.m_aliveParticleCount = m_aliveParticleCount;
-		if(!m_gpuSceneParticleEmitter.isValid())
-		{
-			m_gpuSceneParticleEmitter.allocate();
-		}
-		m_gpuSceneParticleEmitter.uploadToGpuScene(particles);
-	}
-
-	// Upload the GpuSceneRenderableBoundingVolume always
-	for(RenderingTechnique t : EnumIterable<RenderingTechnique>())
-	{
-		if(!!(RenderingTechniqueBit(1 << t) & m_particleEmitterResource->getMaterial()->getRenderingTechniques()))
-		{
-			const GpuSceneRenderableBoundingVolume gpuVolume = initGpuSceneRenderableBoundingVolume(
-				aabbWorld.getMin().xyz(), aabbWorld.getMax().xyz(), m_gpuSceneRenderable.getIndex(), m_renderStateBuckets[t].get());
-			switch(t)
-			{
-			case RenderingTechnique::kGBuffer:
-				if(!m_gpuSceneRenderableAabbGBuffer.isValid())
-				{
-					m_gpuSceneRenderableAabbGBuffer.allocate();
-				}
-				m_gpuSceneRenderableAabbGBuffer.uploadToGpuScene(gpuVolume);
-				break;
-			case RenderingTechnique::kDepth:
-				if(!m_gpuSceneRenderableAabbDepth.isValid())
-				{
-					m_gpuSceneRenderableAabbDepth.allocate();
-				}
-				m_gpuSceneRenderableAabbDepth.uploadToGpuScene(gpuVolume);
-				break;
-			case RenderingTechnique::kForward:
-				if(!m_gpuSceneRenderableAabbForward.isValid())
-				{
-					m_gpuSceneRenderableAabbForward.allocate();
-				}
-				m_gpuSceneRenderableAabbForward.uploadToGpuScene(gpuVolume);
-				break;
-			default:
-				ANKI_ASSERT(0);
-			}
-		}
-		else if(!!(RenderingTechniqueBit(1 << t) & RenderingTechniqueBit::kAllRt))
-		{
-			continue;
-		}
-		else
-		{
-			switch(t)
-			{
-			case RenderingTechnique::kGBuffer:
-				m_gpuSceneRenderableAabbGBuffer.free();
-				break;
-			case RenderingTechnique::kDepth:
-				m_gpuSceneRenderableAabbDepth.free();
-				break;
-			case RenderingTechnique::kForward:
-				m_gpuSceneRenderableAabbForward.free();
-				break;
-			default:
-				ANKI_ASSERT(0);
-			}
-		}
-	}
-
-	m_resourceUpdated = false;
-}
-
-template<typename TParticle>
-void ParticleEmitterComponent::simulate(Second prevUpdateTime, Second crntTime, const Transform& worldTransform, WeakArray<TParticle> particles,
-										Vec3*& positions, F32*& scales, F32*& alphas, Aabb& aabbWorld)
-{
-	// - Deactivate the dead particles
-	// - Calc the AABB
-	// - Calc the instancing stuff
-
-	Vec3 aabbMin(kMaxF32);
-	Vec3 aabbMax(kMinF32);
-	m_aliveParticleCount = 0;
-
-	positions =
-		static_cast<Vec3*>(SceneGraph::getSingleton().getFrameMemoryPool().allocate(m_props.m_maxNumOfParticles * sizeof(Vec3), alignof(Vec3)));
-	scales = static_cast<F32*>(SceneGraph::getSingleton().getFrameMemoryPool().allocate(m_props.m_maxNumOfParticles * sizeof(F32), alignof(F32)));
-	alphas = static_cast<F32*>(SceneGraph::getSingleton().getFrameMemoryPool().allocate(m_props.m_maxNumOfParticles * sizeof(F32), alignof(F32)));
-
-	F32 maxParticleSize = -1.0f;
-
-	for(TParticle& particle : particles)
-	{
-		if(particle.isDead())
-		{
-			// if its already dead so dont deactivate it again
-			continue;
-		}
-
-		if(particle.m_timeOfDeath < crntTime)
-		{
-			// Just died
-			particle.kill();
-		}
-		else
-		{
-			// It's alive
-
-			// This will calculate a new world transformation
-			particle.simulate(prevUpdateTime, crntTime);
-
-			const Vec3& origin = particle.m_crntPosition;
-
-			aabbMin = aabbMin.min(origin);
-			aabbMax = aabbMax.max(origin);
-
-			positions[m_aliveParticleCount] = origin;
-
-			scales[m_aliveParticleCount] = particle.m_crntSize;
-			maxParticleSize = max(maxParticleSize, particle.m_crntSize);
-
-			alphas[m_aliveParticleCount] = clamp(particle.m_crntAlpha, 0.0f, 1.0f);
-
-			++m_aliveParticleCount;
-		}
-	}
-
-	// AABB
-	if(m_aliveParticleCount != 0)
-	{
-		ANKI_ASSERT(maxParticleSize > 0.0f);
-		const Vec3 min = aabbMin - maxParticleSize;
-		const Vec3 max = aabbMax + maxParticleSize;
-		aabbWorld = Aabb(min, max);
-	}
-	else
-	{
-		aabbWorld = Aabb(Vec3(0.0f), Vec3(0.001f));
-		positions = nullptr;
-		alphas = scales = nullptr;
-	}
-
-	//
-	// Emit new particles
-	//
-	if(m_timeLeftForNextEmission <= 0.0)
-	{
-		U particleCount = 0; // How many particles I am allowed to emmit
-		for(TParticle& particle : particles)
-		{
-			if(!particle.isDead())
-			{
-				// its alive so skip it
-				continue;
-			}
-
-			particle.revive(m_props, worldTransform, crntTime);
-
-			// do the rest
-			++particleCount;
-			if(particleCount >= m_props.m_particlesPerEmission)
-			{
-				break;
-			}
-		} // end for all particles
-
-		m_timeLeftForNextEmission = m_props.m_emissionPeriod;
-	} // end if can emit
-	else
-	{
-		m_timeLeftForNextEmission -= crntTime - prevUpdateTime;
-	}
-}
-
-} // end namespace anki

+ 0 - 89
AnKi/Scene/Components/ParticleEmitterComponent.h

@@ -1,89 +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/ParticleEmitterResource.h>
-#include <AnKi/GpuMemory/UnifiedGeometryBuffer.h>
-#include <AnKi/Collision/Aabb.h>
-#include <AnKi/Util/WeakArray.h>
-
-namespace anki {
-
-// Forward
-class RenderableQueueElement;
-
-/// @addtogroup scene
-/// @{
-
-/// Interface for particle emitters.
-class ParticleEmitterComponent : public SceneComponent
-{
-	ANKI_SCENE_COMPONENT(ParticleEmitterComponent)
-
-public:
-	ParticleEmitterComponent(SceneNode* node);
-
-	~ParticleEmitterComponent();
-
-	void loadParticleEmitterResource(CString filename);
-
-	Bool isEnabled() const
-	{
-		return m_particleEmitterResource.isCreated();
-	}
-
-private:
-	class ParticleBase;
-	class SimpleParticle;
-	class PhysicsParticle;
-
-	enum class SimulationType : U8
-	{
-		kUndefined,
-		kSimple,
-		kPhysicsEngine
-	};
-
-	ParticleEmitterProperties m_props;
-
-	ParticleEmitterResourcePtr m_particleEmitterResource;
-	SceneDynamicArray<SimpleParticle> m_simpleParticles;
-	SceneDynamicArray<PhysicsParticle> m_physicsParticles;
-	Second m_timeLeftForNextEmission = 0.0;
-	U32 m_aliveParticleCount = 0;
-
-	UnifiedGeometryBufferAllocation m_quadPositions;
-	UnifiedGeometryBufferAllocation m_quadUvs;
-	UnifiedGeometryBufferAllocation m_quadIndices;
-
-	GpuSceneBufferAllocation m_gpuScenePositions;
-	GpuSceneBufferAllocation m_gpuSceneAlphas;
-	GpuSceneBufferAllocation m_gpuSceneScales;
-	GpuSceneBufferAllocation m_gpuSceneConstants;
-	GpuSceneArrays::ParticleEmitter::Allocation m_gpuSceneParticleEmitter;
-	GpuSceneArrays::Renderable::Allocation m_gpuSceneRenderable;
-	GpuSceneArrays::MeshLod::Allocation m_gpuSceneMeshLods;
-	GpuSceneArrays::RenderableBoundingVolumeGBuffer::Allocation m_gpuSceneRenderableAabbGBuffer;
-	GpuSceneArrays::RenderableBoundingVolumeDepth::Allocation m_gpuSceneRenderableAabbDepth;
-	GpuSceneArrays::RenderableBoundingVolumeForward::Allocation m_gpuSceneRenderableAabbForward;
-
-	Array<RenderStateBucketIndex, U32(RenderingTechnique::kCount)> m_renderStateBuckets;
-
-	Bool m_resourceUpdated = true;
-	SimulationType m_simulationType = SimulationType::kUndefined;
-
-	void update(SceneComponentUpdateInfo& info, Bool& updated) override;
-
-	template<typename TParticle>
-	void simulate(Second prevUpdateTime, Second crntTime, const Transform& worldTransform, WeakArray<TParticle> particles, Vec3*& positions,
-				  F32*& scales, F32*& alphas, Aabb& aabbWorld);
-};
-/// @}
-
-} // end namespace anki

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

@@ -36,8 +36,6 @@ ANKI_SCENE_COMPONENT_SEPARATOR
 
 ANKI_DEFINE_SCENE_COMPONENT(Material, 100.0f, true, TEXTURE_BOX)
 ANKI_SCENE_COMPONENT_SEPARATOR
-ANKI_DEFINE_SCENE_COMPONENT(ParticleEmitter, 100.0f, false, CREATION)
-ANKI_SCENE_COMPONENT_SEPARATOR
 ANKI_DEFINE_SCENE_COMPONENT(Decal, 100.0f, false, LIQUID_SPOT)
 ANKI_SCENE_COMPONENT_SEPARATOR
 ANKI_DEFINE_SCENE_COMPONENT(Camera, 100.0f, false, CAMERA)

+ 0 - 2
AnKi/Scene/GpuSceneArrays.def.h

@@ -17,8 +17,6 @@ ANKI_CAT_TYPE(Transform, ANKI_TRF_ARR, 0, g_cvarSceneMinGpuSceneTransforms)
 ANKI_CAT_SEPARATOR
 ANKI_CAT_TYPE(MeshLod, ANKI_MESH_ARR, 0, g_cvarSceneMinGpuSceneMeshes)
 ANKI_CAT_SEPARATOR
-ANKI_CAT_TYPE(ParticleEmitter, GpuSceneParticleEmitter, 0, g_cvarSceneMinGpuSceneParticleEmitters)
-ANKI_CAT_SEPARATOR
 ANKI_CAT_TYPE(ParticleEmitter2, GpuSceneParticleEmitter2, 0, g_cvarSceneMinGpuSceneParticleEmitters)
 ANKI_CAT_SEPARATOR
 ANKI_CAT_TYPE(LightVisibleRenderablesHash, GpuSceneLightVisibleRenderablesHash, 0, g_cvarSceneMinGpuSceneLights)

+ 0 - 1
AnKi/Scene/SceneGraph.cpp

@@ -24,7 +24,6 @@
 #include <AnKi/Scene/Components/LensFlareComponent.h>
 #include <AnKi/Scene/Components/LightComponent.h>
 #include <AnKi/Scene/Components/MoveComponent.h>
-#include <AnKi/Scene/Components/ParticleEmitterComponent.h>
 #include <AnKi/Scene/Components/ParticleEmitter2Component.h>
 #include <AnKi/Scene/Components/PlayerControllerComponent.h>
 #include <AnKi/Scene/Components/ReflectionProbeComponent.h>

+ 0 - 1
AnKi/Scene/SceneNode.cpp

@@ -17,7 +17,6 @@
 #include <AnKi/Scene/Components/LensFlareComponent.h>
 #include <AnKi/Scene/Components/LightComponent.h>
 #include <AnKi/Scene/Components/MoveComponent.h>
-#include <AnKi/Scene/Components/ParticleEmitterComponent.h>
 #include <AnKi/Scene/Components/ParticleEmitter2Component.h>
 #include <AnKi/Scene/Components/PlayerControllerComponent.h>
 #include <AnKi/Scene/Components/ReflectionProbeComponent.h>

+ 26 - 151
AnKi/Script/Scene.cpp

@@ -40,7 +40,7 @@ static EventManager* getEventManager(lua_State* l)
 
 using WeakArraySceneNodePtr = WeakArray<SceneNode*>;
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoLightComponentType = {-5594775432067847771, "LightComponentType", 0, nullptr, nullptr};
+LuaUserDataTypeInfo g_luaUserDataTypeInfoLightComponentType = {8883833963603776844, "LightComponentType", 0, nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<LightComponentType>()
@@ -75,7 +75,7 @@ static inline void wrapLightComponentType(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoBodyComponentCollisionShapeType = {5886730633021150151, "BodyComponentCollisionShapeType", 0, nullptr,
+LuaUserDataTypeInfo g_luaUserDataTypeInfoBodyComponentCollisionShapeType = {-743054377546005880, "BodyComponentCollisionShapeType", 0, nullptr,
 																			nullptr};
 
 template<>
@@ -119,7 +119,7 @@ static inline void wrapBodyComponentCollisionShapeType(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoParticleGeometryType = {-1970280843451934837, "ParticleGeometryType", 0, nullptr, nullptr};
+LuaUserDataTypeInfo g_luaUserDataTypeInfoParticleGeometryType = {3501894269140929267, "ParticleGeometryType", 0, nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<ParticleGeometryType>()
@@ -150,7 +150,7 @@ static inline void wrapParticleGeometryType(lua_State* l)
 }
 
 LuaUserDataTypeInfo g_luaUserDataTypeInfoWeakArraySceneNodePtr = {
-	3153302682457725628, "WeakArraySceneNodePtr", LuaUserData::computeSizeForGarbageCollected<WeakArraySceneNodePtr>(), nullptr, nullptr};
+	4335461385005213018, "WeakArraySceneNodePtr", LuaUserData::computeSizeForGarbageCollected<WeakArraySceneNodePtr>(), nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<WeakArraySceneNodePtr>()
@@ -241,7 +241,7 @@ static inline void wrapWeakArraySceneNodePtr(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoLightComponent = {-6661654181898649904, "LightComponent",
+LuaUserDataTypeInfo g_luaUserDataTypeInfoLightComponent = {-6500253729278174060, "LightComponent",
 														   LuaUserData::computeSizeForGarbageCollected<LightComponent>(), nullptr, nullptr};
 
 template<>
@@ -683,7 +683,7 @@ static inline void wrapLightComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoDecalComponent = {-5520034723432182506, "DecalComponent",
+LuaUserDataTypeInfo g_luaUserDataTypeInfoDecalComponent = {7461869045807802232, "DecalComponent",
 														   LuaUserData::computeSizeForGarbageCollected<DecalComponent>(), nullptr, nullptr};
 
 template<>
@@ -983,7 +983,7 @@ static inline void wrapDecalComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoLensFlareComponent = {1436135364773864160, "LensFlareComponent",
+LuaUserDataTypeInfo g_luaUserDataTypeInfoLensFlareComponent = {-1671714856343530297, "LensFlareComponent",
 															   LuaUserData::computeSizeForGarbageCollected<LensFlareComponent>(), nullptr, nullptr};
 
 template<>
@@ -1107,7 +1107,7 @@ static inline void wrapLensFlareComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoBodyComponent = {4859266942639207558, "BodyComponent",
+LuaUserDataTypeInfo g_luaUserDataTypeInfoBodyComponent = {-6114328480320689603, "BodyComponent",
 														  LuaUserData::computeSizeForGarbageCollected<BodyComponent>(), nullptr, nullptr};
 
 template<>
@@ -1293,7 +1293,7 @@ static inline void wrapBodyComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoTriggerComponent = {-8532250760246815794, "TriggerComponent",
+LuaUserDataTypeInfo g_luaUserDataTypeInfoTriggerComponent = {6259200188713924542, "TriggerComponent",
 															 LuaUserData::computeSizeForGarbageCollected<TriggerComponent>(), nullptr, nullptr};
 
 template<>
@@ -1381,7 +1381,7 @@ static inline void wrapTriggerComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoFogDensityComponent = {-6273562933061222924, "FogDensityComponent",
+LuaUserDataTypeInfo g_luaUserDataTypeInfoFogDensityComponent = {-6081545287313525532, "FogDensityComponent",
 																LuaUserData::computeSizeForGarbageCollected<FogDensityComponent>(), nullptr, nullptr};
 
 template<>
@@ -1461,7 +1461,7 @@ static inline void wrapFogDensityComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoCameraComponent = {5614357661140762094, "CameraComponent",
+LuaUserDataTypeInfo g_luaUserDataTypeInfoCameraComponent = {-8752504247568203789, "CameraComponent",
 															LuaUserData::computeSizeForGarbageCollected<CameraComponent>(), nullptr, nullptr};
 
 template<>
@@ -1530,7 +1530,7 @@ static inline void wrapCameraComponent(lua_State* l)
 }
 
 LuaUserDataTypeInfo g_luaUserDataTypeInfoGlobalIlluminationProbeComponent = {
-	-3401910529701313771, "GlobalIlluminationProbeComponent", LuaUserData::computeSizeForGarbageCollected<GlobalIlluminationProbeComponent>(),
+	-2166472116600041460, "GlobalIlluminationProbeComponent", LuaUserData::computeSizeForGarbageCollected<GlobalIlluminationProbeComponent>(),
 	nullptr, nullptr};
 
 template<>
@@ -1675,7 +1675,7 @@ static inline void wrapGlobalIlluminationProbeComponent(lua_State* l)
 }
 
 LuaUserDataTypeInfo g_luaUserDataTypeInfoReflectionProbeComponent = {
-	1875218110388114974, "ReflectionProbeComponent", LuaUserData::computeSizeForGarbageCollected<ReflectionProbeComponent>(), nullptr, nullptr};
+	-3775485616878016046, "ReflectionProbeComponent", LuaUserData::computeSizeForGarbageCollected<ReflectionProbeComponent>(), nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<ReflectionProbeComponent>()
@@ -1690,58 +1690,8 @@ static inline void wrapReflectionProbeComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoParticleEmitterComponent = {
-	2925717460779801052, "ParticleEmitterComponent", LuaUserData::computeSizeForGarbageCollected<ParticleEmitterComponent>(), nullptr, nullptr};
-
-template<>
-const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<ParticleEmitterComponent>()
-{
-	return g_luaUserDataTypeInfoParticleEmitterComponent;
-}
-
-// Wrap method ParticleEmitterComponent::loadParticleEmitterResource.
-static inline int wrapParticleEmitterComponentloadParticleEmitterResource(lua_State* l)
-{
-	[[maybe_unused]] LuaUserData* ud;
-	[[maybe_unused]] void* voidp;
-	[[maybe_unused]] PtrSize size;
-
-	if(LuaBinder::checkArgsCount(l, ANKI_FILE, __LINE__, ANKI_FUNC, 2)) [[unlikely]]
-	{
-		return lua_error(l);
-	}
-
-	// Get "this" as "self"
-	if(LuaBinder::checkUserData(l, ANKI_FILE, __LINE__, ANKI_FUNC, 1, g_luaUserDataTypeInfoParticleEmitterComponent, ud)) [[unlikely]]
-	{
-		return lua_error(l);
-	}
-
-	ParticleEmitterComponent* self = ud->getData<ParticleEmitterComponent>();
-
-	// Pop arguments
-	const char* arg0;
-	if(LuaBinder::checkString(l, ANKI_FILE, __LINE__, ANKI_FUNC, 2, arg0)) [[unlikely]]
-	{
-		return lua_error(l);
-	}
-
-	// Call the method
-	self->loadParticleEmitterResource(arg0);
-
-	return 0;
-}
-
-// Wrap class ParticleEmitterComponent.
-static inline void wrapParticleEmitterComponent(lua_State* l)
-{
-	LuaBinder::createClass(l, &g_luaUserDataTypeInfoParticleEmitterComponent);
-	LuaBinder::pushLuaCFuncMethod(l, "loadParticleEmitterResource", wrapParticleEmitterComponentloadParticleEmitterResource);
-	lua_settop(l, 0);
-}
-
 LuaUserDataTypeInfo g_luaUserDataTypeInfoParticleEmitter2Component = {
-	5715853988873556419, "ParticleEmitter2Component", LuaUserData::computeSizeForGarbageCollected<ParticleEmitter2Component>(), nullptr, nullptr};
+	5415924879090887907, "ParticleEmitter2Component", LuaUserData::computeSizeForGarbageCollected<ParticleEmitter2Component>(), nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<ParticleEmitter2Component>()
@@ -1905,7 +1855,7 @@ static inline void wrapParticleEmitter2Component(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoMeshComponent = {7129233230963760247, "MeshComponent",
+LuaUserDataTypeInfo g_luaUserDataTypeInfoMeshComponent = {-955486054454123453, "MeshComponent",
 														  LuaUserData::computeSizeForGarbageCollected<MeshComponent>(), nullptr, nullptr};
 
 template<>
@@ -1962,7 +1912,7 @@ static inline void wrapMeshComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoMaterialComponent = {-5240416883337639304, "MaterialComponent",
+LuaUserDataTypeInfo g_luaUserDataTypeInfoMaterialComponent = {5779564989184267452, "MaterialComponent",
 															  LuaUserData::computeSizeForGarbageCollected<MaterialComponent>(), nullptr, nullptr};
 
 template<>
@@ -2060,7 +2010,7 @@ static inline void wrapMaterialComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoSkinComponent = {3016724804384428667, "SkinComponent",
+LuaUserDataTypeInfo g_luaUserDataTypeInfoSkinComponent = {1579439021821664875, "SkinComponent",
 														  LuaUserData::computeSizeForGarbageCollected<SkinComponent>(), nullptr, nullptr};
 
 template<>
@@ -2117,7 +2067,7 @@ static inline void wrapSkinComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoSkyboxComponent = {-3538427196989067145, "SkyboxComponent",
+LuaUserDataTypeInfo g_luaUserDataTypeInfoSkyboxComponent = {-45964514990740925, "SkyboxComponent",
 															LuaUserData::computeSizeForGarbageCollected<SkyboxComponent>(), nullptr, nullptr};
 
 template<>
@@ -2478,7 +2428,7 @@ static inline void wrapSkyboxComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoSceneNode = {-1325538657283171084, "SceneNode", LuaUserData::computeSizeForGarbageCollected<SceneNode>(),
+LuaUserDataTypeInfo g_luaUserDataTypeInfoSceneNode = {1240711600262384409, "SceneNode", LuaUserData::computeSizeForGarbageCollected<SceneNode>(),
 													  nullptr, nullptr};
 
 template<>
@@ -3211,45 +3161,6 @@ static inline int wrapSceneNodenewBodyComponent(lua_State* l)
 	return 1;
 }
 
-// Wrap method SceneNode::newComponent<ParticleEmitterComponent>.
-static inline int wrapSceneNodenewParticleEmitterComponent(lua_State* l)
-{
-	[[maybe_unused]] LuaUserData* ud;
-	[[maybe_unused]] void* voidp;
-	[[maybe_unused]] PtrSize size;
-
-	if(LuaBinder::checkArgsCount(l, ANKI_FILE, __LINE__, ANKI_FUNC, 1)) [[unlikely]]
-	{
-		return lua_error(l);
-	}
-
-	// Get "this" as "self"
-	if(LuaBinder::checkUserData(l, ANKI_FILE, __LINE__, ANKI_FUNC, 1, g_luaUserDataTypeInfoSceneNode, ud)) [[unlikely]]
-	{
-		return lua_error(l);
-	}
-
-	SceneNode* self = ud->getData<SceneNode>();
-
-	// Call the method
-	ParticleEmitterComponent* ret = self->newComponent<ParticleEmitterComponent>();
-
-	// Push return value
-	if(ret == nullptr) [[unlikely]]
-	{
-		lua_pushnil(l);
-		return 1;
-	}
-
-	voidp = lua_newuserdata(l, sizeof(LuaUserData));
-	ud = static_cast<LuaUserData*>(voidp);
-	luaL_setmetatable(l, "ParticleEmitterComponent");
-	extern LuaUserDataTypeInfo g_luaUserDataTypeInfoParticleEmitterComponent;
-	ud->initPointed(&g_luaUserDataTypeInfoParticleEmitterComponent, ret);
-
-	return 1;
-}
-
 // Wrap method SceneNode::newComponent<ParticleEmitter2Component>.
 static inline int wrapSceneNodenewParticleEmitter2Component(lua_State* l)
 {
@@ -3742,39 +3653,6 @@ static inline int wrapSceneNodegetFirstBodyComponent(lua_State* l)
 	return 1;
 }
 
-// Wrap method SceneNode::getFirstComponentOfType<ParticleEmitterComponent>.
-static inline int wrapSceneNodegetFirstParticleEmitterComponent(lua_State* l)
-{
-	[[maybe_unused]] LuaUserData* ud;
-	[[maybe_unused]] void* voidp;
-	[[maybe_unused]] PtrSize size;
-
-	if(LuaBinder::checkArgsCount(l, ANKI_FILE, __LINE__, ANKI_FUNC, 1)) [[unlikely]]
-	{
-		return lua_error(l);
-	}
-
-	// Get "this" as "self"
-	if(LuaBinder::checkUserData(l, ANKI_FILE, __LINE__, ANKI_FUNC, 1, g_luaUserDataTypeInfoSceneNode, ud)) [[unlikely]]
-	{
-		return lua_error(l);
-	}
-
-	SceneNode* self = ud->getData<SceneNode>();
-
-	// Call the method
-	ParticleEmitterComponent& ret = self->getFirstComponentOfType<ParticleEmitterComponent>();
-
-	// Push return value
-	voidp = lua_newuserdata(l, sizeof(LuaUserData));
-	ud = static_cast<LuaUserData*>(voidp);
-	luaL_setmetatable(l, "ParticleEmitterComponent");
-	extern LuaUserDataTypeInfo g_luaUserDataTypeInfoParticleEmitterComponent;
-	ud->initPointed(&g_luaUserDataTypeInfoParticleEmitterComponent, &ret);
-
-	return 1;
-}
-
 // Wrap method SceneNode::getFirstComponentOfType<MeshComponent>.
 static inline int wrapSceneNodegetFirstMeshComponent(lua_State* l)
 {
@@ -3931,7 +3809,6 @@ static inline void wrapSceneNode(lua_State* l)
 	LuaBinder::pushLuaCFuncMethod(l, "newGlobalIlluminationProbeComponent", wrapSceneNodenewGlobalIlluminationProbeComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "newReflectionProbeComponent", wrapSceneNodenewReflectionProbeComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "newBodyComponent", wrapSceneNodenewBodyComponent);
-	LuaBinder::pushLuaCFuncMethod(l, "newParticleEmitterComponent", wrapSceneNodenewParticleEmitterComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "newParticleEmitter2Component", wrapSceneNodenewParticleEmitter2Component);
 	LuaBinder::pushLuaCFuncMethod(l, "newMeshComponent", wrapSceneNodenewMeshComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "newMaterialComponent", wrapSceneNodenewMaterialComponent);
@@ -3946,7 +3823,6 @@ static inline void wrapSceneNode(lua_State* l)
 	LuaBinder::pushLuaCFuncMethod(l, "getFirstGlobalIlluminationProbeComponent", wrapSceneNodegetFirstGlobalIlluminationProbeComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "getFirstReflectionProbeComponent", wrapSceneNodegetFirstReflectionProbeComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "getFirstBodyComponent", wrapSceneNodegetFirstBodyComponent);
-	LuaBinder::pushLuaCFuncMethod(l, "getFirstParticleEmitterComponent", wrapSceneNodegetFirstParticleEmitterComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "getFirstMeshComponent", wrapSceneNodegetFirstMeshComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "getFirstMaterialComponent", wrapSceneNodegetFirstMaterialComponent);
 	LuaBinder::pushLuaCFuncMethod(l, "getFirstSkinComponent", wrapSceneNodegetFirstSkinComponent);
@@ -3954,7 +3830,7 @@ static inline void wrapSceneNode(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoSceneGraph = {8901208207670225695, "SceneGraph", LuaUserData::computeSizeForGarbageCollected<SceneGraph>(),
+LuaUserDataTypeInfo g_luaUserDataTypeInfoSceneGraph = {3092405975297111449, "SceneGraph", LuaUserData::computeSizeForGarbageCollected<SceneGraph>(),
 													   nullptr, nullptr};
 
 template<>
@@ -4100,7 +3976,7 @@ static inline void wrapSceneGraph(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoEvent = {-7252054505959214788, "Event", LuaUserData::computeSizeForGarbageCollected<Event>(), nullptr,
+LuaUserDataTypeInfo g_luaUserDataTypeInfoEvent = {397171990357190159, "Event", LuaUserData::computeSizeForGarbageCollected<Event>(), nullptr,
 												  nullptr};
 
 template<>
@@ -4152,7 +4028,7 @@ static inline void wrapEvent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoLightEvent = {-8586733957439759552, "LightEvent", LuaUserData::computeSizeForGarbageCollected<LightEvent>(),
+LuaUserDataTypeInfo g_luaUserDataTypeInfoLightEvent = {-6604334744815273195, "LightEvent", LuaUserData::computeSizeForGarbageCollected<LightEvent>(),
 													   nullptr, nullptr};
 
 template<>
@@ -4245,7 +4121,7 @@ static inline void wrapLightEvent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoScriptEvent = {3521092713286297735, "ScriptEvent",
+LuaUserDataTypeInfo g_luaUserDataTypeInfoScriptEvent = {-3249903773223814176, "ScriptEvent",
 														LuaUserData::computeSizeForGarbageCollected<ScriptEvent>(), nullptr, nullptr};
 
 template<>
@@ -4261,7 +4137,7 @@ static inline void wrapScriptEvent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoJitterMoveEvent = {-8794680355368287829, "JitterMoveEvent",
+LuaUserDataTypeInfo g_luaUserDataTypeInfoJitterMoveEvent = {4843500102588903730, "JitterMoveEvent",
 															LuaUserData::computeSizeForGarbageCollected<JitterMoveEvent>(), nullptr, nullptr};
 
 template<>
@@ -4323,7 +4199,7 @@ static inline void wrapJitterMoveEvent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoAnimationEvent = {-8172624010586710412, "AnimationEvent",
+LuaUserDataTypeInfo g_luaUserDataTypeInfoAnimationEvent = {6283131482372442117, "AnimationEvent",
 														   LuaUserData::computeSizeForGarbageCollected<AnimationEvent>(), nullptr, nullptr};
 
 template<>
@@ -4339,7 +4215,7 @@ static inline void wrapAnimationEvent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo g_luaUserDataTypeInfoEventManager = {1713399154262730355, "EventManager",
+LuaUserDataTypeInfo g_luaUserDataTypeInfoEventManager = {-637636176468263007, "EventManager",
 														 LuaUserData::computeSizeForGarbageCollected<EventManager>(), nullptr, nullptr};
 
 template<>
@@ -4669,7 +4545,6 @@ void wrapModuleScene(lua_State* l)
 	wrapCameraComponent(l);
 	wrapGlobalIlluminationProbeComponent(l);
 	wrapReflectionProbeComponent(l);
-	wrapParticleEmitterComponent(l);
 	wrapParticleEmitter2Component(l);
 	wrapMeshComponent(l);
 	wrapMaterialComponent(l);

+ 0 - 16
AnKi/Script/Scene.xml

@@ -285,16 +285,6 @@ using WeakArraySceneNodePtr = WeakArray<SceneNode*>;
 			<methods></methods>
 		</class>
 
-		<class name="ParticleEmitterComponent">
-			<methods>
-				<method name="loadParticleEmitterResource">
-					<args>
-						<arg>CString</arg>
-					</args>
-				</method>
-			</methods>
-		</class>
-
 		<class name="ParticleEmitter2Component">
 			<methods>
 				<method name="setParticleEmitterFilename">
@@ -481,9 +471,6 @@ using WeakArraySceneNodePtr = WeakArray<SceneNode*>;
 				<method name="newComponent&lt;BodyComponent&gt;" alias="newBodyComponent">
 					<return canBeNullptr="1">BodyComponent*</return>
 				</method>
-				<method name="newComponent&lt;ParticleEmitterComponent&gt;" alias="newParticleEmitterComponent">
-					<return canBeNullptr="1">ParticleEmitterComponent*</return>
-				</method>
 				<method name="newComponent&lt;ParticleEmitter2Component&gt;" alias="newParticleEmitter2Component">
 					<return canBeNullptr="1">ParticleEmitter2Component*</return>
 				</method>
@@ -527,9 +514,6 @@ using WeakArraySceneNodePtr = WeakArray<SceneNode*>;
 				<method name="getFirstComponentOfType&lt;BodyComponent&gt;" alias="getFirstBodyComponent">
 					<return>BodyComponent&amp;</return>
 				</method>
-				<method name="getFirstComponentOfType&lt;ParticleEmitterComponent&gt;" alias="getFirstParticleEmitterComponent">
-					<return>ParticleEmitterComponent&amp;</return>
-				</method>
 				<method name="getFirstComponentOfType&lt;MeshComponent&gt;" alias="getFirstMeshComponent">
 					<return>MeshComponent&amp;</return>
 				</method>

+ 1 - 1
AnKi/Shaders/Dbg.ankiprog

@@ -373,7 +373,7 @@ RWStructuredBuffer<U32> g_lodAndRenderableIndices : register(u2);
 	const GpuSceneRenderableBoundingVolume bvol = SBUFF(g_renderableBoundingVolumes, bvolIdx);
 	const GpuSceneRenderable renderable = SBUFF(g_renderables, bvol.m_renderableIndex);
 
-	const Bool isParticleEmitter = renderable.m_particleEmitterIndex < kMaxU32 || renderable.m_particleEmitterIndex2 < kMaxU32;
+	const Bool isParticleEmitter = renderable.m_particleEmitterIndex2 < kMaxU32;
 	if(isParticleEmitter)
 	{
 		// Can't draw particle emitters as is

+ 0 - 94
AnKi/Shaders/ForwardShadingParticles.ankiprog

@@ -1,94 +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 anki mutator ANIMATED_TEXTURE 0 1
-#pragma anki mutator LIGHT 0 1
-
-#pragma anki technique ForwardLegacy vert pixel
-
-#include <AnKi/Shaders/ForwardShadingCommon.hlsl>
-
-struct VertIn
-{
-	U32 m_svVertexId : SV_VERTEXID;
-	U32 m_svInstanceId : SV_INSTANCEID;
-};
-
-struct VertOut
-{
-	nointerpolation U32 m_constantsOffset : UNIS_OFFSET;
-	nointerpolation F32 m_alpha : ALPHA;
-	Vec2 m_uv : TEXCOORD;
-	Vec3 m_worldPos : WORLD_POS;
-	Vec4 m_svPosition : SV_POSITION;
-};
-
-#pragma anki struct AnKiLocalConstants
-#pragma anki member F32 m_animationPeriod
-#pragma anki member Vec4 m_colorScale
-#pragma anki member Vec4 m_colorBias
-#pragma anki member U32 m_diffuseMap
-#pragma anki struct_end
-
-#if ANKI_VERTEX_SHADER
-VertOut main(VertIn input)
-{
-	const GpuScenePerDraw instance = getGpuScenePerDraw();
-	const GpuSceneParticleEmitter particles = g_particleEmitters[instance.m_particleEmitterIndex];
-	const GpuSceneMeshLod meshLod = g_meshLods[instance.m_meshLodIndex];
-
-	const U32 particleId = input.m_svInstanceId;
-
-	U32 idx = particles.m_vertexOffsets[(U32)VertexStreamId::kParticlePosition] + particleId * sizeof(Vec3);
-	const Vec3 particlePos = g_gpuScene.Load<Vec3>(idx);
-	idx = particles.m_vertexOffsets[(U32)VertexStreamId::kParticleScale] + particleId * sizeof(F32);
-	const F32 particleScale = g_gpuScene.Load<F32>(idx);
-	idx = particles.m_vertexOffsets[(U32)VertexStreamId::kParticleColor] + particleId * sizeof(F32);
-	const F32 particleAlpha = g_gpuScene.Load<F32>(idx);
-
-	VertOut output;
-
-	output.m_uv = g_unifiedGeom_R32G32_Sfloat[meshLod.m_vertexOffsets[(U32)VertexStreamId::kUv] + input.m_svVertexId];
-
-	const Vec3 localPos =
-		g_unifiedGeom_R16G16B16A16_Unorm[meshLod.m_vertexOffsets[(U32)VertexStreamId::kPosition] + input.m_svVertexId] * meshLod.m_positionScale
-		+ meshLod.m_positionTranslation;
-
-	// Apply the particle scale, rotate the mesh to face the camera (billboard) and finally apply the particle position
-	output.m_worldPos = mul(g_globalConstants.m_cameraTransform, Vec4(localPos * particleScale, 0.0)) + particlePos;
-
-	output.m_svPosition = mul(g_globalConstants.m_viewProjectionMatrix, Vec4(output.m_worldPos, 1.0));
-
-	output.m_alpha = particleAlpha;
-	output.m_constantsOffset = instance.m_constantsOffset;
-
-	return output;
-}
-#endif // ANKI_VERTEX_SHADER
-
-#if ANKI_PIXEL_SHADER
-PixelOut main(VertOut input)
-{
-	PixelOut output = (PixelOut)0;
-	const AnKiLocalConstants localConstants = loadAnKiLocalConstants(g_gpuScene, WaveReadLaneFirst(input.m_constantsOffset));
-
-#	if ANIMATED_TEXTURE == 1
-	Vec4 texCol = readAnimatedTextureRgba(getBindlessTexture2DArrayVec4(localConstants.m_diffuseMap), g_globalSampler,
-										  localConstants.m_animationPeriod, input.m_uv, g_globalRendererConstants.m_time);
-#	else
-	Vec4 texCol = getBindlessTexture2DVec4(localConstants.m_diffuseMap).Sample(g_globalSampler, input.m_uv);
-#	endif
-
-#	if LIGHT
-	texCol.rgb = computeLightColorLow(texCol.rgb, input.m_worldPos, input.m_svPosition);
-#	endif
-
-	Vec4 colScale = localConstants.m_colorScale;
-	colScale.a *= input.m_alpha;
-	particleAlpha(texCol, colScale, localConstants.m_colorBias, output);
-
-	return output;
-}
-#endif // ANKI_PIXEL_SHADER

+ 1 - 1
AnKi/Shaders/GpuVisibilityStage1.ankiprog

@@ -182,7 +182,7 @@ Bool isVisible(GpuSceneRenderableBoundingVolume bvolume)
 		const U32 meshLodIndex = renderable.m_meshLodsIndex + lod;
 		const GpuSceneMeshLod meshLod = SBUFF(g_meshLods, meshLodIndex);
 
-		const Bool isParticleEmitter = renderable.m_particleEmitterIndex < kMaxU32 || renderable.m_particleEmitterIndex2 < kMaxU32;
+		const Bool isParticleEmitter = renderable.m_particleEmitterIndex2 < kMaxU32;
 		ANKI_MAYBE_UNUSED(isParticleEmitter);
 
 		const Bool hasMeshlets = meshLod.m_meshletCount != 0u;

+ 10 - 20
AnKi/Shaders/GpuVisibilityStage2And3.ankiprog

@@ -36,16 +36,15 @@ struct DrawIndirectArgsWithPadding
 
 // GPU scene
 StructuredBuffer<GpuSceneRenderable> g_renderables : register(t0);
-StructuredBuffer<GpuSceneParticleEmitter> g_particleEmitters : register(t1);
-StructuredBuffer<GpuSceneParticleEmitter2> g_particleEmitters2 : register(t2);
-StructuredBuffer<GpuSceneMeshLod> g_meshLods : register(t3);
+StructuredBuffer<GpuSceneParticleEmitter2> g_particleEmitters2 : register(t1);
+StructuredBuffer<GpuSceneMeshLod> g_meshLods : register(t2);
 
-StructuredBuffer<GpuVisibilityVisibleRenderableDesc> g_visibleRenderables : register(t4);
-StructuredBuffer<U32> g_counters : register(t5);
-StructuredBuffer<U32> g_renderablePrefixSums : register(t6);
+StructuredBuffer<GpuVisibilityVisibleRenderableDesc> g_visibleRenderables : register(t3);
+StructuredBuffer<U32> g_counters : register(t4);
+StructuredBuffer<U32> g_renderablePrefixSums : register(t5);
 
 // One for each bucket. Points to the 1st indirect args struct. 2nd element contains the max count
-StructuredBuffer<UVec2> g_firstDrawIndirectArgAndCount : register(t7);
+StructuredBuffer<UVec2> g_firstDrawIndirectArgAndCount : register(t6);
 
 // These 3 have the same size
 RWStructuredBuffer<GpuScenePerDraw> g_perDraw : register(u0);
@@ -73,7 +72,7 @@ RWStructuredBuffer<U32> g_outOfMemoryBuffer : register(u3);
 	const U32 meshLodIndex = renderable.m_meshLodsIndex + lod;
 	const GpuSceneMeshLod meshLod = SBUFF(g_meshLods, meshLodIndex);
 
-	const Bool isParticleEmitter = renderable.m_particleEmitterIndex < kMaxU32 || renderable.m_particleEmitterIndex2 < kMaxU32;
+	const Bool isParticleEmitter = renderable.m_particleEmitterIndex2 < kMaxU32;
 
 	U32 bucketLocalIndex;
 	InterlockedAdd(SBUFF(g_mdiDrawCounts, renderStateBucket), 1u, bucketLocalIndex);
@@ -98,16 +97,8 @@ RWStructuredBuffer<U32> g_outOfMemoryBuffer : register(u3);
 
 		if(isParticleEmitter)
 		{
-			if(renderable.m_particleEmitterIndex < kMaxU32)
-			{
-				const GpuSceneParticleEmitter emitter = SBUFF(g_particleEmitters, renderable.m_particleEmitterIndex);
-				indirect.m_instanceCount = emitter.m_aliveParticleCount;
-			}
-			else
-			{
-				const GpuSceneParticleEmitter2 emitter = SBUFF(g_particleEmitters2, renderable.m_particleEmitterIndex2);
-				indirect.m_instanceCount = emitter.m_aliveParticleCount;
-			}
+			const GpuSceneParticleEmitter2 emitter = SBUFF(g_particleEmitters2, renderable.m_particleEmitterIndex2);
+			indirect.m_instanceCount = emitter.m_aliveParticleCount;
 		}
 		else
 		{
@@ -119,8 +110,7 @@ RWStructuredBuffer<U32> g_outOfMemoryBuffer : register(u3);
 		GpuScenePerDraw perDraw;
 		perDraw.m_worldTransformsIndex = renderable.m_worldTransformsIndex;
 		perDraw.m_isParticleEmitter = isParticleEmitter;
-		perDraw.m_particleEmitterIndex =
-			(renderable.m_particleEmitterIndex < kMaxU32) ? renderable.m_particleEmitterIndex : renderable.m_particleEmitterIndex2;
+		perDraw.m_particleEmitterIndex = renderable.m_particleEmitterIndex2;
 		perDraw.m_constantsOffset = renderable.m_constantsOffset;
 		perDraw.m_meshLodIndex = meshLodIndex;
 		perDraw.m_boneTransformsOffset = renderable.m_boneTransformsOffset;

+ 0 - 8
AnKi/Shaders/Include/GpuSceneTypes.h

@@ -24,7 +24,6 @@ struct GpuSceneRenderable
 	U32 m_constantsOffset;
 	U32 m_meshLodsIndex; // Points to the array of GpuSceneMeshLod. kMaxLodCount are reserved for each renderable.
 	U32 m_boneTransformsOffset; // Array of Mat3x4 or 0 if its not a skin.
-	U32 m_particleEmitterIndex; // Index to the GpuSceneParticleEmitter array or kMaxU32 if it's not an emitter.
 	U32 m_particleEmitterIndex2; // Index to the GpuSceneParticleEmitter2 array or kMaxU32 if it's not an emitter.
 	U32 m_rtShadowsShaderHandleIndex; // The index of the shader handle in the array of library's handles.
 	U32 m_rtMaterialFetchShaderHandleIndex; // The index of the shader handle in the array of library's handles.
@@ -91,13 +90,6 @@ struct GpuSceneMeshLod
 };
 static_assert(sizeof(GpuSceneMeshLod) == sizeof(Vec4) * 5);
 
-struct GpuSceneParticleEmitter
-{
-	U32 m_vertexOffsets[(U32)VertexStreamId::kParticleRelatedCount];
-	U32 m_aliveParticleCount;
-};
-static_assert(sizeof(GpuSceneParticleEmitter) == sizeof(Vec4) * 2);
-
 // Contains common properties for all particle emitters. Primary use is for the simulation
 struct GpuSceneParticleEmitter2
 {

+ 23 - 19
AnKi/Shaders/Include/MaterialTypes.h

@@ -22,36 +22,40 @@ struct MaterialGlobalConstants
 static_assert(sizeof(MaterialGlobalConstants) == 15 * sizeof(Vec4));
 
 #define ANKI_MATERIAL_REGISTER_TILINEAR_REPEAT_SAMPLER 0
+#define ANKI_MATERIAL_REGISTER_NEAREST_CLAMP_SAMPLER 1
+
 #define ANKI_MATERIAL_REGISTER_GLOBAL_CONSTANTS 0
-#define ANKI_MATERIAL_REGISTER_GPU_SCENE 0
 
-#define ANKI_MATERIAL_REGISTER_MESHLET_BOUNDING_VOLUMES 1 ///< Points to the unified geom buffer
-#define ANKI_MATERIAL_REGISTER_MESHLET_GEOMETRY_DESCRIPTORS 2 ///< Points to the unified geom buffer
+#define ANKI_MATERIAL_REGISTER_GPU_SCENE 0
+#define ANKI_MATERIAL_REGISTER_MESHLET_BOUNDING_VOLUMES 1 // Points to the unified geom buffer
+#define ANKI_MATERIAL_REGISTER_MESHLET_GEOMETRY_DESCRIPTORS 2 // Points to the unified geom buffer
 #define ANKI_MATERIAL_REGISTER_MESHLET_INSTANCES 3
 #define ANKI_MATERIAL_REGISTER_RENDERABLES 4
 #define ANKI_MATERIAL_REGISTER_MESH_LODS 5
-#define ANKI_MATERIAL_REGISTER_PARTICLE_EMITTERS 6
-#define ANKI_MATERIAL_REGISTER_PARTICLE_EMITTERS2 7
-#define ANKI_MATERIAL_REGISTER_TRANSFORMS 8
-#define ANKI_MATERIAL_REGISTER_NEAREST_CLAMP_SAMPLER 1
-#define ANKI_MATERIAL_REGISTER_FIRST_MESHLET 9
-#define ANKI_MATERIAL_REGISTER_PER_DRAW 10
-#define ANKI_MATERIAL_REGISTER_PER_DRAW_OFFSET 11
+#define ANKI_MATERIAL_REGISTER_PARTICLE_EMITTERS2 6
+#define ANKI_MATERIAL_REGISTER_TRANSFORMS 7
+#define ANKI_MATERIAL_REGISTER_FIRST_MESHLET 8
+#define ANKI_MATERIAL_REGISTER_PER_DRAW 9
+#define ANKI_MATERIAL_REGISTER_PER_DRAW_OFFSET 10
 
 // For FW shading:
 #define ANKI_MATERIAL_REGISTER_LINEAR_CLAMP_SAMPLER 2
 #define ANKI_MATERIAL_REGISTER_SHADOW_SAMPLER 3
+
 #define ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_CONSTANTS 1
-#define ANKI_MATERIAL_REGISTER_SCENE_DEPTH 12
-#define ANKI_MATERIAL_REGISTER_LIGHT_VOLUME 13
-#define ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_POINT_LIGHTS 14
-#define ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_SPOT_LIGHTS 15
-#define ANKI_MATERIAL_REGISTER_SHADOW_ATLAS 16
-#define ANKI_MATERIAL_REGISTER_CLUSTERS 17
-
-#define ANKI_MATERIAL_REGISTER_UNIFIED_GEOMETRY 18
+
+#define ANKI_MATERIAL_REGISTER_SCENE_DEPTH 11
+#define ANKI_MATERIAL_REGISTER_LIGHT_VOLUME 12
+#define ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_POINT_LIGHTS 13
+#define ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_SPOT_LIGHTS 14
+#define ANKI_MATERIAL_REGISTER_SHADOW_ATLAS 15
+#define ANKI_MATERIAL_REGISTER_CLUSTERS 16
+
+// UGB last
+
+#define ANKI_MATERIAL_REGISTER_UNIFIED_GEOMETRY 17
 // Always last because it's variable. Texture buffer bindings pointing to unified geom buffer:
 // !!WARNING!! Remember to update the UnifiedGeometryTypes.def.h if you change that one
-#define ANKI_MATERIAL_REGISTER_UNIFIED_GEOMETRY_TYPED_BUFFER_START 19
+#define ANKI_MATERIAL_REGISTER_UNIFIED_GEOMETRY_TYPED_BUFFER_START 18
 
 ANKI_END_NAMESPACE

+ 6 - 6
AnKi/Shaders/Include/UnifiedGeometryTypes.def.h

@@ -11,17 +11,17 @@
 
 // !!!! ALL FORMATS NEED TO BE MORE THAN 4 BYTES, else we can't address large typed buffers !!!!
 
-ANKI_UNIFIED_GEOM_FORMAT(R32G32_Sfloat, Vec2, 19)
+ANKI_UNIFIED_GEOM_FORMAT(R32G32_Sfloat, Vec2, 18)
 ANKI_UNIFIED_GEOM_FORMAT_SEPERATOR
-ANKI_UNIFIED_GEOM_FORMAT(R32G32B32_Sfloat, Vec3, 20)
+ANKI_UNIFIED_GEOM_FORMAT(R32G32B32_Sfloat, Vec3, 19)
 ANKI_UNIFIED_GEOM_FORMAT_SEPERATOR
-ANKI_UNIFIED_GEOM_FORMAT(R32G32B32A32_Sfloat, Vec4, 21)
+ANKI_UNIFIED_GEOM_FORMAT(R32G32B32A32_Sfloat, Vec4, 20)
 ANKI_UNIFIED_GEOM_FORMAT_SEPERATOR
-ANKI_UNIFIED_GEOM_FORMAT(R16G16B16A16_Unorm, Vec4, 22)
+ANKI_UNIFIED_GEOM_FORMAT(R16G16B16A16_Unorm, Vec4, 21)
 ANKI_UNIFIED_GEOM_FORMAT_SEPERATOR
-ANKI_UNIFIED_GEOM_FORMAT(R8G8B8A8_Snorm, Vec4, 23)
+ANKI_UNIFIED_GEOM_FORMAT(R8G8B8A8_Snorm, Vec4, 22)
 ANKI_UNIFIED_GEOM_FORMAT_SEPERATOR
-ANKI_UNIFIED_GEOM_FORMAT(R8G8B8A8_Uint, UVec4, 24)
+ANKI_UNIFIED_GEOM_FORMAT(R8G8B8A8_Uint, UVec4, 23)
 
 #undef ANKI_UNIFIED_GEOM_FORMAT
 #undef ANKI_UNIFIED_GEOM_FORMAT_SEPERATOR

+ 0 - 1
AnKi/Shaders/MaterialShadersCommon.hlsl

@@ -30,7 +30,6 @@ StructuredBuffer<MeshletGeometryDescriptor> g_meshletGeometryDescriptors : regis
 StructuredBuffer<GpuSceneMeshletInstance> g_meshletInstances : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_MESHLET_INSTANCES));
 StructuredBuffer<GpuSceneRenderable> g_renderables : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_RENDERABLES));
 StructuredBuffer<GpuSceneMeshLod> g_meshLods : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_MESH_LODS));
-StructuredBuffer<GpuSceneParticleEmitter> g_particleEmitters : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_PARTICLE_EMITTERS));
 StructuredBuffer<GpuSceneParticleEmitter2> g_particleEmitters2 : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_PARTICLE_EMITTERS2));
 StructuredBuffer<Mat3x4> g_transforms : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_TRANSFORMS));
 SamplerState g_nearestClampSampler : register(ANKI_REG(s, ANKI_MATERIAL_REGISTER_NEAREST_CLAMP_SAMPLER));

+ 2 - 2
AnKi/Shaders/RtSbtBuild.ankiprog

@@ -72,8 +72,8 @@ ANKI_FAST_CONSTANTS(RtShadowsSbtBuildConstants, g_consts)
 	// Copy the GpuScenePerDraw
 	GpuScenePerDraw perDraw;
 	perDraw.m_worldTransformsIndex = renderable.m_worldTransformsIndex;
-	perDraw.m_particleEmitterIndex = renderable.m_particleEmitterIndex;
-	perDraw.m_isParticleEmitter = renderable.m_particleEmitterIndex != kMaxU32;
+	perDraw.m_particleEmitterIndex = renderable.m_particleEmitterIndex2;
+	perDraw.m_isParticleEmitter = renderable.m_particleEmitterIndex2 != kMaxU32;
 	perDraw.m_constantsOffset = renderable.m_constantsOffset;
 	perDraw.m_meshLodIndex = renderable.m_meshLodsIndex + lod;
 	perDraw.m_boneTransformsOffset = 0;

+ 5 - 4
Tests/Gr/Gr.cpp

@@ -1220,7 +1220,7 @@ static void drawOffscreenDrawcalls([[maybe_unused]] GrManager& gr, ShaderProgram
 }
 #endif
 
-static void drawOffscreen([[maybe_unused]] GrManager& gr)
+[[maybe_unused]] static void drawOffscreen([[maybe_unused]] GrManager& gr)
 {
 #if 0
 	//
@@ -1572,7 +1572,7 @@ ANKI_TEST(Gr, 3DTextures)
 #endif
 }
 
-static RenderTargetDesc newRTDescr(CString name)
+[[maybe_unused]] static RenderTargetDesc newRTDescr(CString name)
 {
 	RenderTargetDesc texInf(name);
 	texInf.m_width = texInf.m_height = 16;
@@ -2706,7 +2706,7 @@ RWTexture2D<float4> g_uav : register(u0);
 		U32 sbtRecordSize;
 		{
 			const U32 handleSize = GrManager::getSingleton().getDeviceCapabilities().m_shaderGroupHandleSize;
-			sbtRecordSize = getAlignedRoundUp(GrManager::getSingleton().getDeviceCapabilities().m_sbtRecordAlignment, handleSize + sizeof(Vec3));
+			sbtRecordSize = getAlignedRoundUp(GrManager::getSingleton().getDeviceCapabilities().m_sbtRecordAlignment, handleSize + U32(sizeof(Vec3)));
 
 			ConstWeakArray<U8> handles = prog->getShaderGroupHandles();
 
@@ -2893,7 +2893,8 @@ float4 main(float4 svPosition : SV_POSITION) : SV_TARGET0
 	commonDestroy();
 }
 
-static void createCubeBuffers(GrManager& gr, Vec3 min, Vec3 max, BufferPtr& indexBuffer, BufferPtr& vertBuffer, Bool turnInsideOut = false)
+[[maybe_unused]] static void createCubeBuffers(GrManager& gr, Vec3 min, Vec3 max, BufferPtr& indexBuffer, BufferPtr& vertBuffer,
+											   Bool turnInsideOut = false)
 {
 	BufferInitInfo inf;
 	inf.m_mapAccess = BufferMapAccessBit::kWrite;