Browse Source

Some code style refactoring #15

Panagiotis Christopoulos Charitos 3 years ago
parent
commit
00e447b049

+ 3 - 3
AnKi/Scene/Components/FogDensityComponent.h

@@ -21,7 +21,7 @@ class FogDensityComponent : public SceneComponent
 	ANKI_SCENE_COMPONENT(FogDensityComponent)
 
 public:
-	static constexpr F32 MIN_SHAPE_SIZE = 1.0_cm;
+	static constexpr F32 kMinShapeSize = 1.0_cm;
 
 	FogDensityComponent(SceneNode* node)
 		: SceneComponent(node, getStaticClassId())
@@ -32,7 +32,7 @@ public:
 
 	void setBoxVolumeSize(Vec3 sizeXYZ)
 	{
-		sizeXYZ = sizeXYZ.max(Vec3(MIN_SHAPE_SIZE));
+		sizeXYZ = sizeXYZ.max(Vec3(kMinShapeSize));
 		m_aabbMin = -sizeXYZ / 2.0f;
 		m_aabbMax = sizeXYZ / 2.0f;
 		m_isBox = true;
@@ -53,7 +53,7 @@ public:
 
 	void setSphereVolumeRadius(F32 radius)
 	{
-		m_sphereRadius = max(MIN_SHAPE_SIZE, radius);
+		m_sphereRadius = max(kMinShapeSize, radius);
 		m_isBox = false;
 		m_markedForUpdate = true;
 	}

+ 3 - 3
AnKi/Scene/Components/GpuParticleEmitterComponent.cpp

@@ -99,15 +99,15 @@ Error GpuParticleEmitterComponent::loadParticleEmitterResource(CString filename)
 		BufferInitInfo buffInit("GpuParticlesRand");
 		buffInit.m_mapAccess = BufferMapAccessBit::kWrite;
 		buffInit.m_usage = BufferUsageBit::kAllStorage;
-		buffInit.m_size = sizeof(U32) + MAX_RAND_FACTORS * sizeof(F32);
+		buffInit.m_size = sizeof(U32) + kMaxRandFactors * sizeof(F32);
 		m_randFactorsBuff = m_node->getSceneGraph().getGrManager().newBuffer(buffInit);
 
 		F32* randFactors = static_cast<F32*>(m_randFactorsBuff->map(0, kMaxPtrSize, BufferMapAccessBit::kWrite));
 
-		*reinterpret_cast<U32*>(randFactors) = MAX_RAND_FACTORS;
+		*reinterpret_cast<U32*>(randFactors) = kMaxRandFactors;
 		++randFactors;
 
-		const F32* randFactorsEnd = randFactors + MAX_RAND_FACTORS;
+		const F32* randFactorsEnd = randFactors + kMaxRandFactors;
 		for(; randFactors < randFactorsEnd; ++randFactors)
 		{
 			*randFactors = getRandomRange(0.0f, 1.0f);

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

@@ -61,7 +61,7 @@ public:
 	}
 
 private:
-	static constexpr U32 MAX_RAND_FACTORS = 32;
+	static constexpr U32 kMaxRandFactors = 32;
 
 	SceneNode* m_node;
 	ShaderProgramResourcePtr m_prog;

+ 5 - 5
AnKi/Scene/Components/LightComponent.cpp

@@ -21,7 +21,7 @@ LightComponent::LightComponent(SceneNode* node)
 	: SceneComponent(node, getStaticClassId())
 	, m_node(node)
 	, m_uuid(node->getSceneGraph().getNewUuid())
-	, m_type(LightComponentType::POINT)
+	, m_type(LightComponentType::kPoint)
 	, m_shadow(false)
 	, m_markedForUpdate(true)
 {
@@ -40,7 +40,7 @@ Error LightComponent::update(SceneComponentUpdateInfo& info, Bool& updated)
 	updated = m_markedForUpdate;
 	m_markedForUpdate = false;
 
-	if(updated && m_type == LightComponentType::SPOT)
+	if(updated && m_type == LightComponentType::kSpot)
 	{
 
 		const Mat4 biasMat4(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
@@ -57,7 +57,7 @@ Error LightComponent::update(SceneComponentUpdateInfo& info, Bool& updated)
 	}
 
 	// Update the scene bounds always
-	if(m_type == LightComponentType::DIRECTIONAL)
+	if(m_type == LightComponentType::kDirectional)
 	{
 		info.m_node->getSceneGraph().getOctree().getActualSceneBounds(m_dir.m_sceneMin, m_dir.m_sceneMax);
 	}
@@ -69,7 +69,7 @@ void LightComponent::setupDirectionalLightQueueElement(const FrustumComponent& f
 													   DirectionalLightQueueElement& el,
 													   WeakArray<FrustumComponent> cascadeFrustumComponents) const
 {
-	ANKI_ASSERT(m_type == LightComponentType::DIRECTIONAL);
+	ANKI_ASSERT(m_type == LightComponentType::kDirectional);
 	ANKI_ASSERT(cascadeFrustumComponents.getSize() <= MAX_SHADOW_CASCADES);
 
 	const U32 shadowCascadeCount = cascadeFrustumComponents.getSize();
@@ -237,7 +237,7 @@ void LightComponent::draw(RenderQueueDrawContext& ctx) const
 	Vec3 color = m_diffColor.xyz();
 	color /= max(max(color.x(), color.y()), color.z());
 
-	ImageResourcePtr imageResource = (m_type == LightComponentType::POINT) ? m_pointDebugImage : m_spotDebugImage;
+	ImageResourcePtr imageResource = (m_type == LightComponentType::kPoint) ? m_pointDebugImage : m_spotDebugImage;
 	m_node->getSceneGraph().getDebugDrawer().drawBillboardTexture(
 		ctx.m_projectionMatrix, ctx.m_viewMatrix, m_worldtransform.getOrigin().xyz(), color.xyz1(),
 		ctx.m_debugDrawFlags.get(RenderQueueDebugDrawFlag::kDitheredDepthTestOn), imageResource->getTextureView(),

+ 8 - 8
AnKi/Scene/Components/LightComponent.h

@@ -16,12 +16,12 @@ namespace anki {
 
 enum class LightComponentType : U8
 {
-	POINT,
-	SPOT,
-	DIRECTIONAL, ///< Basically the sun.
+	kPoint,
+	kSpot,
+	kDirectional, ///< Basically the sun.
 
-	COUNT,
-	FIRST = 0
+	kCount,
+	kFirst = 0
 };
 
 /// Light component. Contains all the info of lights.
@@ -38,7 +38,7 @@ public:
 
 	void setLightComponentType(LightComponentType type)
 	{
-		ANKI_ASSERT(type >= LightComponentType::FIRST && type < LightComponentType::COUNT);
+		ANKI_ASSERT(type >= LightComponentType::kFirst && type < LightComponentType::kCount);
 		m_type = type;
 		m_markedForUpdate = true;
 	}
@@ -139,7 +139,7 @@ public:
 
 	void setupPointLightQueueElement(PointLightQueueElement& el) const
 	{
-		ANKI_ASSERT(m_type == LightComponentType::POINT);
+		ANKI_ASSERT(m_type == LightComponentType::kPoint);
 		el.m_uuid = m_uuid;
 		el.m_worldPosition = m_worldtransform.getOrigin().xyz();
 		el.m_radius = m_point.m_radius;
@@ -154,7 +154,7 @@ public:
 
 	void setupSpotLightQueueElement(SpotLightQueueElement& el) const
 	{
-		ANKI_ASSERT(m_type == LightComponentType::SPOT);
+		ANKI_ASSERT(m_type == LightComponentType::kSpot);
 		el.m_uuid = m_uuid;
 		el.m_worldTransform = Mat4(m_worldtransform);
 		el.m_textureMatrix = m_spot.m_textureMat;

+ 9 - 9
AnKi/Scene/Components/ParticleEmitterComponent.cpp

@@ -225,8 +225,8 @@ Error ParticleEmitterComponent::loadParticleEmitterResource(CString filename)
 	m_physicsParticles.destroy(m_node->getAllocator());
 
 	// Init particles
-	m_simulationType = (m_props.m_usePhysicsEngine) ? SimulationType::PHYSICS_ENGINE : SimulationType::SIMPLE;
-	if(m_simulationType == SimulationType::PHYSICS_ENGINE)
+	m_simulationType = (m_props.m_usePhysicsEngine) ? SimulationType::kPhysicsEngine : SimulationType::kSimple;
+	if(m_simulationType == SimulationType::kPhysicsEngine)
 	{
 		PhysicsCollisionShapePtr collisionShape = m_node->getSceneGraph().getPhysicsWorld().newInstance<PhysicsSphere>(
 			m_props.m_particle.m_minInitialSize / 2.0f);
@@ -246,7 +246,7 @@ Error ParticleEmitterComponent::loadParticleEmitterResource(CString filename)
 		m_simpleParticles.create(m_node->getAllocator(), m_props.m_maxNumOfParticles);
 	}
 
-	m_vertBuffSize = m_props.m_maxNumOfParticles * VERTEX_SIZE;
+	m_vertBuffSize = m_props.m_maxNumOfParticles * kVertexSize;
 
 	return Error::kNone;
 }
@@ -261,13 +261,13 @@ Error ParticleEmitterComponent::update(SceneComponentUpdateInfo& info, Bool& upd
 
 	updated = true;
 
-	if(m_simulationType == SimulationType::SIMPLE)
+	if(m_simulationType == SimulationType::kSimple)
 	{
 		simulate(info.m_previousTime, info.m_currentTime, WeakArray<SimpleParticle>(m_simpleParticles));
 	}
 	else
 	{
-		ANKI_ASSERT(m_simulationType == SimulationType::PHYSICS_ENGINE);
+		ANKI_ASSERT(m_simulationType == SimulationType::kPhysicsEngine);
 		simulate(info.m_previousTime, info.m_currentTime, WeakArray<PhysicsParticle>(m_physicsParticles));
 	}
 
@@ -308,7 +308,7 @@ void ParticleEmitterComponent::simulate(Second prevUpdateTime, Second crntTime,
 			// It's alive
 
 			// Do checks
-			ANKI_ASSERT((ptrToNumber(verts) + VERTEX_SIZE - ptrToNumber(m_verts)) <= m_vertBuffSize);
+			ANKI_ASSERT((ptrToNumber(verts) + kVertexSize - ptrToNumber(m_verts)) <= m_vertBuffSize);
 
 			// This will calculate a new world transformation
 			particle.simulate(prevUpdateTime, crntTime);
@@ -392,9 +392,9 @@ void ParticleEmitterComponent::draw(RenderQueueDrawContext& ctx) const
 	{
 		// Load verts
 		StagingGpuMemoryToken token;
-		void* gpuStorage = ctx.m_stagingGpuAllocator->allocateFrame(m_aliveParticleCount * VERTEX_SIZE,
+		void* gpuStorage = ctx.m_stagingGpuAllocator->allocateFrame(m_aliveParticleCount * kVertexSize,
 																	StagingGpuMemoryType::VERTEX, token);
-		memcpy(gpuStorage, m_verts, m_aliveParticleCount * VERTEX_SIZE);
+		memcpy(gpuStorage, m_verts, m_aliveParticleCount * kVertexSize);
 
 		// Program
 		ShaderProgramPtr prog;
@@ -407,7 +407,7 @@ void ParticleEmitterComponent::draw(RenderQueueDrawContext& ctx) const
 		cmdb->setVertexAttribute(U32(VertexAttributeId::ALPHA), 0, Format::kR32Sfloat, sizeof(Vec3) + sizeof(F32));
 
 		// Vertex buff
-		cmdb->bindVertexBuffer(0, token.m_buffer, token.m_offset, VERTEX_SIZE, VertexStepRate::kInstance);
+		cmdb->bindVertexBuffer(0, token.m_buffer, token.m_offset, kVertexSize, VertexStepRate::kInstance);
 
 		// Uniforms
 		Array<Mat3x4, 1> trf = {Mat3x4::getIdentity()};

+ 5 - 5
AnKi/Scene/Components/ParticleEmitterComponent.h

@@ -66,12 +66,12 @@ private:
 
 	enum class SimulationType : U8
 	{
-		UNDEFINED,
-		SIMPLE,
-		PHYSICS_ENGINE
+		kUndefined,
+		kSimple,
+		kPhysicsEngine
 	};
 
-	static constexpr U32 VERTEX_SIZE = 5 * sizeof(F32);
+	static constexpr U32 kVertexSize = 5 * sizeof(F32);
 
 	SceneNode* m_node = nullptr;
 
@@ -91,7 +91,7 @@ private:
 
 	ImageResourcePtr m_dbgImage;
 
-	SimulationType m_simulationType = SimulationType::UNDEFINED;
+	SimulationType m_simulationType = SimulationType::kUndefined;
 
 	template<typename TParticle>
 	void simulate(Second prevUpdateTime, Second crntTime, WeakArray<TParticle> particles);

+ 8 - 8
AnKi/Scene/Components/RenderComponent.h

@@ -17,10 +17,10 @@ namespace anki {
 
 enum class RenderComponentFlag : U8
 {
-	NONE = 0,
-	CASTS_SHADOW = 1 << 0,
-	FORWARD_SHADING = 1 << 1,
-	SORT_LAST = 1 << 2, ///< Push it last when sorting the visibles.
+	kNone = 0,
+	kCastsShadow = 1 << 0,
+	kForwardShading = 1 << 1,
+	kSortLast = 1 << 2, ///< Push it last when sorting the visibles.
 };
 ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(RenderComponentFlag)
 
@@ -56,9 +56,9 @@ public:
 	void setFlagsFromMaterial(const MaterialResourcePtr& mtl)
 	{
 		RenderComponentFlag flags = !!(mtl->getRenderingTechniques() & RenderingTechniqueBit::FORWARD)
-										? RenderComponentFlag::FORWARD_SHADING
-										: RenderComponentFlag::NONE;
-		flags |= (mtl->castsShadow()) ? RenderComponentFlag::CASTS_SHADOW : RenderComponentFlag::NONE;
+										? RenderComponentFlag::kForwardShading
+										: RenderComponentFlag::kNone;
+		flags |= (mtl->castsShadow()) ? RenderComponentFlag::kCastsShadow : RenderComponentFlag::kNone;
 		setFlags(flags);
 	}
 
@@ -112,7 +112,7 @@ private:
 	U64 m_mergeKey = kMaxU64;
 	FillRayTracingInstanceQueueElementCallback m_rtCallback = nullptr;
 	const void* m_rtCallbackUserData = nullptr;
-	RenderComponentFlag m_flags = RenderComponentFlag::NONE;
+	RenderComponentFlag m_flags = RenderComponentFlag::kNone;
 };
 /// @}
 

+ 5 - 5
AnKi/Scene/Components/SceneComponent.cpp

@@ -7,17 +7,17 @@
 
 namespace anki {
 
-constexpr U32 MAX_SCENE_COMPONENT_CLASSES = 64;
-static_assert(MAX_SCENE_COMPONENT_CLASSES < 128, "It can oly be 7 bits because of SceneComponent::m_classId");
-static SceneComponentRtti* g_rttis[MAX_SCENE_COMPONENT_CLASSES] = {};
+constexpr U32 kMaxSceneComponentClasses = 64;
+static_assert(kMaxSceneComponentClasses < 128, "It can oly be 7 bits because of SceneComponent::m_classId");
+static SceneComponentRtti* g_rttis[kMaxSceneComponentClasses] = {};
 static U32 g_rttiCount = 0;
 
 SceneComponentRtti::SceneComponentRtti(const char* name, U32 size, U32 alignment, Constructor constructor)
 {
-	if(g_rttiCount >= MAX_SCENE_COMPONENT_CLASSES)
+	if(g_rttiCount >= kMaxSceneComponentClasses)
 	{
 		// No special logging because this function is called before main
-		printf("Reached maximum component count. Increase MAX_SCENE_COMPONENT_CLASSES\n");
+		printf("Reached maximum component count. Increase kMaxSceneComponentClasses\n");
 		exit(-1);
 	}
 

+ 2 - 2
AnKi/Scene/Components/SkinComponent.h

@@ -40,7 +40,7 @@ class SkinComponent : public SceneComponent
 	ANKI_SCENE_COMPONENT(SkinComponent)
 
 public:
-	static constexpr U32 MAX_ANIMATION_TRACKS = 4;
+	static constexpr U32 kMaxAnimationTracks = 4;
 
 	SkinComponent(SceneNode* node);
 
@@ -103,7 +103,7 @@ private:
 	Array<DynamicArray<Mat4>, 2> m_boneTrfs;
 	DynamicArray<Trf> m_animationTrfs;
 	Aabb m_boneBoundingVolume = Aabb(Vec3(-1.0f), Vec3(1.0f));
-	Array<Track, MAX_ANIMATION_TRACKS> m_tracks;
+	Array<Track, kMaxAnimationTracks> m_tracks;
 	Second m_absoluteTime = 0.0;
 	U8 m_crntBoneTrfs = 0;
 	U8 m_prevBoneTrfs = 1;

+ 16 - 16
AnKi/Scene/DebugDrawer.cpp

@@ -19,19 +19,19 @@ void allocateAndPopulateDebugBox(StagingGpuMemoryPool& stagingGpuAllocator, Stag
 	Vec3* verts = static_cast<Vec3*>(
 		stagingGpuAllocator.allocateFrame(sizeof(Vec3) * 8, StagingGpuMemoryType::VERTEX, vertsToken));
 
-	const F32 SIZE = 1.0f;
-	verts[0] = Vec3(SIZE, SIZE, SIZE); // front top right
-	verts[1] = Vec3(-SIZE, SIZE, SIZE); // front top left
-	verts[2] = Vec3(-SIZE, -SIZE, SIZE); // front bottom left
-	verts[3] = Vec3(SIZE, -SIZE, SIZE); // front bottom right
-	verts[4] = Vec3(SIZE, SIZE, -SIZE); // back top right
-	verts[5] = Vec3(-SIZE, SIZE, -SIZE); // back top left
-	verts[6] = Vec3(-SIZE, -SIZE, -SIZE); // back bottom left
-	verts[7] = Vec3(SIZE, -SIZE, -SIZE); // back bottom right
-
-	const U INDEX_COUNT = 12 * 2;
+	constexpr F32 kSize = 1.0f;
+	verts[0] = Vec3(kSize, kSize, kSize); // front top right
+	verts[1] = Vec3(-kSize, kSize, kSize); // front top left
+	verts[2] = Vec3(-kSize, -kSize, kSize); // front bottom left
+	verts[3] = Vec3(kSize, -kSize, kSize); // front bottom right
+	verts[4] = Vec3(kSize, kSize, -kSize); // back top right
+	verts[5] = Vec3(-kSize, kSize, -kSize); // back top left
+	verts[6] = Vec3(-kSize, -kSize, -kSize); // back bottom left
+	verts[7] = Vec3(kSize, -kSize, -kSize); // back bottom right
+
+	constexpr U kIndexCount = 12 * 2;
 	U16* indices = static_cast<U16*>(
-		stagingGpuAllocator.allocateFrame(sizeof(U16) * INDEX_COUNT, StagingGpuMemoryType::VERTEX, indicesToken));
+		stagingGpuAllocator.allocateFrame(sizeof(U16) * kIndexCount, StagingGpuMemoryType::VERTEX, indicesToken));
 
 	U c = 0;
 	indices[c++] = 0;
@@ -61,8 +61,8 @@ void allocateAndPopulateDebugBox(StagingGpuMemoryPool& stagingGpuAllocator, Stag
 	indices[c++] = 3;
 	indices[c++] = 7;
 
-	ANKI_ASSERT(c == INDEX_COUNT);
-	indexCount = INDEX_COUNT;
+	ANKI_ASSERT(c == kIndexCount);
+	indexCount = kIndexCount;
 }
 
 Error DebugDrawer2::init(ResourceManager* rsrcManager)
@@ -93,11 +93,11 @@ Error DebugDrawer2::init(ResourceManager* rsrcManager)
 	}
 
 	{
-		constexpr U INDEX_COUNT = 12 * 2;
+		constexpr U kIndexCount = 12 * 2;
 
 		BufferInitInfo bufferInit("DebugCube");
 		bufferInit.m_usage = BufferUsageBit::kVertex;
-		bufferInit.m_size = sizeof(U16) * INDEX_COUNT;
+		bufferInit.m_size = sizeof(U16) * kIndexCount;
 		bufferInit.m_mapAccess = BufferMapAccessBit::kWrite;
 		m_cubeIndicesBuffer = rsrcManager->getGrManager().newBuffer(bufferInit);
 

+ 4 - 4
AnKi/Scene/Events/LightEvent.cpp

@@ -18,10 +18,10 @@ Error LightEvent::init(Second startTime, Second duration, SceneNode* light)
 
 	switch(lightc.getLightComponentType())
 	{
-	case LightComponentType::POINT:
+	case LightComponentType::kPoint:
 		m_originalRadius = lightc.getRadius();
 		break;
-	case LightComponentType::SPOT:
+	case LightComponentType::kSpot:
 		ANKI_ASSERT("TODO");
 		break;
 	default:
@@ -46,10 +46,10 @@ Error LightEvent::update([[maybe_unused]] Second prevUpdateTime, Second crntTime
 	{
 		switch(lightc.getLightComponentType())
 		{
-		case LightComponentType::POINT:
+		case LightComponentType::kPoint:
 			lightc.setRadius(m_originalRadius + factor * m_radiusMultiplier);
 			break;
-		case LightComponentType::SPOT:
+		case LightComponentType::kSpot:
 			ANKI_ASSERT("TODO");
 			break;
 		default:

+ 3 - 3
AnKi/Scene/LightNode.cpp

@@ -117,7 +117,7 @@ PointLightNode::PointLightNode(SceneGraph* scene, CString name)
 	newComponent<OnMovedFeedbackComponent>();
 
 	LightComponent* lc = newComponent<LightComponent>();
-	lc->setLightComponentType(LightComponentType::POINT);
+	lc->setLightComponentType(LightComponentType::kPoint);
 
 	newComponent<LensFlareComponent>();
 	newComponent<OnLightShapeUpdatedFeedbackComponent>();
@@ -233,7 +233,7 @@ SpotLightNode::SpotLightNode(SceneGraph* scene, CString name)
 	newComponent<OnMovedFeedbackComponent>();
 
 	LightComponent* lc = newComponent<LightComponent>();
-	lc->setLightComponentType(LightComponentType::SPOT);
+	lc->setLightComponentType(LightComponentType::kSpot);
 
 	newComponent<LensFlareComponent>();
 
@@ -314,7 +314,7 @@ DirectionalLightNode::DirectionalLightNode(SceneGraph* scene, CString name)
 	newComponent<FeedbackComponent>();
 
 	LightComponent* lc = newComponent<LightComponent>();
-	lc->setLightComponentType(LightComponentType::DIRECTIONAL);
+	lc->setLightComponentType(LightComponentType::kDirectional);
 
 	SpatialComponent* spatialc = newComponent<SpatialComponent>();
 

+ 4 - 4
AnKi/Scene/ModelNode.cpp

@@ -299,10 +299,10 @@ void ModelNode::draw(RenderQueueDrawContext& ctx, ConstWeakArray<void*> userData
 
 			// Set non uniform scale. Add a margin to avoid flickering
 			Mat3 nonUniScale = Mat3::getZero();
-			constexpr F32 MARGIN = 1.02f;
-			nonUniScale(0, 0) = scale.x() * MARGIN;
-			nonUniScale(1, 1) = scale.y() * MARGIN;
-			nonUniScale(2, 2) = scale.z() * MARGIN;
+			constexpr F32 kMargin = 1.02f;
+			nonUniScale(0, 0) = scale.x() * kMargin;
+			nonUniScale(1, 1) = scale.y() * kMargin;
+			nonUniScale(2, 2) = scale.z() * kMargin;
 
 			mvps[i] = ctx.m_viewProjectionMatrix * Mat4(tsl.xyz1(), Mat3::getIdentity() * nonUniScale, 1.0f);
 		}

+ 12 - 12
AnKi/Scene/Octree.cpp

@@ -187,48 +187,48 @@ void Octree::placeRecursive(const Aabb& volume, OctreePlaceable* placeable, Leaf
 	if(vMin.x() > center.x())
 	{
 		// Only right
-		maskX = LeafMask::RIGHT;
+		maskX = LeafMask::kRight;
 	}
 	else if(vMax.x() < center.x())
 	{
 		// Only left
-		maskX = LeafMask::LEFT;
+		maskX = LeafMask::kLeft;
 	}
 	else
 	{
-		maskX = LeafMask::ALL;
+		maskX = LeafMask::kAll;
 	}
 
 	LeafMask maskY;
 	if(vMin.y() > center.y())
 	{
 		// Only top
-		maskY = LeafMask::TOP;
+		maskY = LeafMask::kTop;
 	}
 	else if(vMax.y() < center.y())
 	{
 		// Only bottom
-		maskY = LeafMask::BOTTOM;
+		maskY = LeafMask::kBottom;
 	}
 	else
 	{
-		maskY = LeafMask::ALL;
+		maskY = LeafMask::kAll;
 	}
 
 	LeafMask maskZ;
 	if(vMin.z() > center.z())
 	{
 		// Only front
-		maskZ = LeafMask::FRONT;
+		maskZ = LeafMask::kFront;
 	}
 	else if(vMax.z() < center.z())
 	{
 		// Only back
-		maskZ = LeafMask::BACK;
+		maskZ = LeafMask::kBack;
 	}
 	else
 	{
-		maskZ = LeafMask::ALL;
+		maskZ = LeafMask::kAll;
 	}
 
 	const LeafMask maskUnion = maskX & maskY & maskZ;
@@ -270,7 +270,7 @@ void Octree::computeChildAabb(LeafMask child, const Vec3& parentAabbMin, const V
 	const Vec3& M = parentAabbMax;
 	const Vec3& c = parentAabbCenter;
 
-	if(!!(child & LeafMask::RIGHT))
+	if(!!(child & LeafMask::kRight))
 	{
 		// Right
 		childAabbMin.x() = c.x();
@@ -283,7 +283,7 @@ void Octree::computeChildAabb(LeafMask child, const Vec3& parentAabbMin, const V
 		childAabbMax.x() = c.x();
 	}
 
-	if(!!(child & LeafMask::TOP))
+	if(!!(child & LeafMask::kTop))
 	{
 		// Top
 		childAabbMin.y() = c.y();
@@ -296,7 +296,7 @@ void Octree::computeChildAabb(LeafMask child, const Vec3& parentAabbMin, const V
 		childAabbMax.y() = c.y();
 	}
 
-	if(!!(child & LeafMask::FRONT))
+	if(!!(child & LeafMask::kFront))
 	{
 		// Front
 		childAabbMin.z() = c.z();

+ 19 - 18
AnKi/Scene/Octree.h

@@ -174,26 +174,27 @@ private:
 #endif
 	};
 
-	/// P: Stands for positive and N: Negative
+	/// Pos: Stands for positive and Neg: Negative
 	enum class LeafMask : U8
 	{
-		PX_PY_PZ = 1 << 0,
-		PX_PY_NZ = 1 << 1,
-		PX_NY_PZ = 1 << 2,
-		PX_NY_NZ = 1 << 3,
-		NX_PY_PZ = 1 << 4,
-		NX_PY_NZ = 1 << 5,
-		NX_NY_PZ = 1 << 6,
-		NX_NY_NZ = 1 << 7,
-
-		NONE = 0,
-		ALL = PX_PY_PZ | PX_PY_NZ | PX_NY_PZ | PX_NY_NZ | NX_PY_PZ | NX_PY_NZ | NX_NY_PZ | NX_NY_NZ,
-		RIGHT = PX_PY_PZ | PX_PY_NZ | PX_NY_PZ | PX_NY_NZ,
-		LEFT = NX_PY_PZ | NX_PY_NZ | NX_NY_PZ | NX_NY_NZ,
-		TOP = PX_PY_PZ | PX_PY_NZ | NX_PY_PZ | NX_PY_NZ,
-		BOTTOM = PX_NY_PZ | PX_NY_NZ | NX_NY_PZ | NX_NY_NZ,
-		FRONT = PX_PY_PZ | PX_NY_PZ | NX_PY_PZ | NX_NY_PZ,
-		BACK = PX_PY_NZ | PX_NY_NZ | NX_PY_NZ | NX_NY_NZ,
+		kPosXPosYPosZ = 1 << 0,
+		kPosXPosYNegZ = 1 << 1,
+		kPosXNegYPosZ = 1 << 2,
+		kPosXNegYNegZ = 1 << 3,
+		kNegXPosYPosZ = 1 << 4,
+		kNegXPosYNegZ = 1 << 5,
+		kNegXNegYPosZ = 1 << 6,
+		kNegXNegYNegZ = 1 << 7,
+
+		kNone = 0,
+		kAll = kPosXPosYPosZ | kPosXPosYNegZ | kPosXNegYPosZ | kPosXNegYNegZ | kNegXPosYPosZ | kNegXPosYNegZ
+			   | kNegXNegYPosZ | kNegXNegYNegZ,
+		kRight = kPosXPosYPosZ | kPosXPosYNegZ | kPosXNegYPosZ | kPosXNegYNegZ,
+		kLeft = kNegXPosYPosZ | kNegXPosYNegZ | kNegXNegYPosZ | kNegXNegYNegZ,
+		kTop = kPosXPosYPosZ | kPosXPosYNegZ | kNegXPosYPosZ | kNegXPosYNegZ,
+		kBottom = kPosXNegYPosZ | kPosXNegYNegZ | kNegXNegYPosZ | kNegXNegYNegZ,
+		kFront = kPosXPosYPosZ | kPosXNegYPosZ | kNegXPosYPosZ | kNegXNegYPosZ,
+		kBack = kPosXPosYNegZ | kPosXNegYNegZ | kNegXPosYNegZ | kNegXNegYNegZ,
 	};
 	ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS_FRIEND(LeafMask)
 

+ 1 - 1
AnKi/Scene/PhysicsDebugNode.cpp

@@ -16,7 +16,7 @@ PhysicsDebugNode::PhysicsDebugNode(SceneGraph* scene, CString name)
 	, m_physDbgDrawer(&scene->getDebugDrawer())
 {
 	RenderComponent* rcomp = newComponent<RenderComponent>();
-	rcomp->setFlags(RenderComponentFlag::NONE);
+	rcomp->setFlags(RenderComponentFlag::kNone);
 	rcomp->initRaster(
 		[](RenderQueueDrawContext& ctx, ConstWeakArray<void*> userData) {
 			static_cast<PhysicsDebugNode*>(userData[0])->draw(ctx);

+ 8 - 8
AnKi/Scene/Visibility.cpp

@@ -303,7 +303,7 @@ void VisibilityTestTask::test(ThreadHive& hive, U32 taskId)
 		wantNode |= !!(frustumFlags & FrustumComponentVisibilityTestFlag::kRenderComponents) && getComponent(node, rc);
 
 		wantNode |= !!(frustumFlags & FrustumComponentVisibilityTestFlag::kShadowCasterRenderComponents)
-					&& getComponent(node, rc) && !!(rc->getFlags() & RenderComponentFlag::CASTS_SHADOW);
+					&& getComponent(node, rc) && !!(rc->getFlags() & RenderComponentFlag::kCastsShadow);
 
 		const RenderComponent* rtRc = nullptr;
 		wantNode |= !!(frustumFlags & FrustumComponentVisibilityTestFlag::kAllRayTracing) && getComponent(node, rtRc)
@@ -363,7 +363,7 @@ void VisibilityTestTask::test(ThreadHive& hive, U32 taskId)
 
 		node.iterateComponentsOfType<RenderComponent>([&](const RenderComponent& rc) {
 			RenderableQueueElement* el;
-			if(!!(rc.getFlags() & RenderComponentFlag::FORWARD_SHADING))
+			if(!!(rc.getFlags() & RenderComponentFlag::kForwardShading))
 			{
 				el = result.m_forwardShadingRenderables.newElement(alloc);
 			}
@@ -376,7 +376,7 @@ void VisibilityTestTask::test(ThreadHive& hive, U32 taskId)
 
 			// Compute distance from the frustum
 			const Plane& nearPlane = primaryFrc.getViewPlanes()[FrustumPlaneType::kNear];
-			el->m_distanceFromCamera = !!(rc.getFlags() & RenderComponentFlag::SORT_LAST)
+			el->m_distanceFromCamera = !!(rc.getFlags() & RenderComponentFlag::kSortLast)
 										   ? primaryFrc.getFar()
 										   : max(0.0f, testPlane(nearPlane, spatialc->getAabbWorldSpace()));
 
@@ -384,7 +384,7 @@ void VisibilityTestTask::test(ThreadHive& hive, U32 taskId)
 
 			// Add to early Z
 			if(wantsEarlyZ && el->m_distanceFromCamera < m_frcCtx->m_visCtx->m_earlyZDist
-			   && !(rc.getFlags() & RenderComponentFlag::FORWARD_SHADING))
+			   && !(rc.getFlags() & RenderComponentFlag::kForwardShading))
 			{
 				RenderableQueueElement* el2 = result.m_earlyZRenderables.newElement(alloc);
 				*el2 = *el;
@@ -406,7 +406,7 @@ void VisibilityTestTask::test(ThreadHive& hive, U32 taskId)
 		{
 			// Check if it casts shadow
 			Bool castsShadow = lc->getShadowEnabled();
-			if(castsShadow && lc->getLightComponentType() != LightComponentType::DIRECTIONAL)
+			if(castsShadow && lc->getLightComponentType() != LightComponentType::kDirectional)
 			{
 				// Extra check
 
@@ -419,7 +419,7 @@ void VisibilityTestTask::test(ThreadHive& hive, U32 taskId)
 
 			switch(lc->getLightComponentType())
 			{
-			case LightComponentType::POINT:
+			case LightComponentType::kPoint:
 			{
 				PointLightQueueElement* el = result.m_pointLights.newElement(alloc);
 				lc->setupPointLightQueueElement(*el);
@@ -443,7 +443,7 @@ void VisibilityTestTask::test(ThreadHive& hive, U32 taskId)
 
 				break;
 			}
-			case LightComponentType::SPOT:
+			case LightComponentType::kSpot:
 			{
 				SpotLightQueueElement* el = result.m_spotLights.newElement(alloc);
 				lc->setupSpotLightQueueElement(*el);
@@ -461,7 +461,7 @@ void VisibilityTestTask::test(ThreadHive& hive, U32 taskId)
 
 				break;
 			}
-			case LightComponentType::DIRECTIONAL:
+			case LightComponentType::kDirectional:
 			{
 				ANKI_ASSERT(lc->getShadowEnabled() == true && "Only with shadow for now");
 

+ 5 - 7
AnKi/Scene/VisibilityInternal.h

@@ -18,9 +18,7 @@ namespace anki {
 /// @addtogroup scene
 /// @{
 
-constexpr U32 MAX_SPATIALS_PER_VIS_TEST = 48; ///< Num of spatials to test in a single ThreadHive task.
-constexpr U32 SW_RASTERIZER_WIDTH = 80;
-constexpr U32 SW_RASTERIZER_HEIGHT = 50;
+constexpr U32 kMaxSpatialsPerVisTest = 48; ///< Num of spatials to test in a single ThreadHive task.
 
 /// Sort objects on distance
 template<typename T>
@@ -61,7 +59,7 @@ public:
 };
 
 /// Storage for a single element type.
-template<typename T, U32 INITIAL_STORAGE_SIZE = 32, U32 STORAGE_GROW_RATE = 4>
+template<typename T, U32 kInitialStorage = 32, U32 kStorageGrowRate = 4>
 class TRenderQueueElementStorage
 {
 public:
@@ -73,7 +71,7 @@ public:
 	{
 		if(ANKI_UNLIKELY(m_elementCount + 1 > m_elementStorage))
 		{
-			m_elementStorage = max(INITIAL_STORAGE_SIZE, m_elementStorage * STORAGE_GROW_RATE);
+			m_elementStorage = max(kInitialStorage, m_elementStorage * kStorageGrowRate);
 
 			const T* oldElements = m_elements;
 			m_elements = alloc.allocate(m_elementStorage);
@@ -190,7 +188,7 @@ public:
 	void gather(ThreadHive& hive);
 
 private:
-	Array<SpatialComponent*, MAX_SPATIALS_PER_VIS_TEST> m_spatials;
+	Array<SpatialComponent*, kMaxSpatialsPerVisTest> m_spatials;
 	U32 m_spatialCount = 0;
 
 	/// Submit tasks to test the m_spatials.
@@ -205,7 +203,7 @@ class VisibilityTestTask
 public:
 	FrustumVisibilityContext* m_frcCtx = nullptr;
 
-	Array<SpatialComponent*, MAX_SPATIALS_PER_VIS_TEST> m_spatialsToTest;
+	Array<SpatialComponent*, kMaxSpatialsPerVisTest> m_spatialsToTest;
 	U32 m_spatialToTestCount = 0;
 
 	VisibilityTestTask(FrustumVisibilityContext* frcCtx)