Browse Source

Fixing a bug in reflections

Panagiotis Christopoulos Charitos 10 years ago
parent
commit
a062b47987

+ 1 - 1
include/anki/renderer/Clusterer.h

@@ -69,7 +69,7 @@ public:
 		U clusterCountY, U clusterCountZ);
 
 	/// Prepare for visibility tests.
-	void prepare(ThreadPool& threadpool, const SceneNode& node);
+	void prepare(ThreadPool& threadpool, const FrustumComponent& frc);
 
 	void initTestResults(const GenericMemoryPoolAllocator<U8>& alloc,
 		ClustererTestResult& rez) const;

+ 4 - 4
src/renderer/Clusterer.cpp

@@ -154,17 +154,17 @@ void Clusterer::init(const GenericMemoryPoolAllocator<U8>& alloc,
 }
 
 //==============================================================================
-void Clusterer::prepare(ThreadPool& threadPool, const SceneNode& node)
+void Clusterer::prepare(ThreadPool& threadPool, const FrustumComponent& frc)
 {
 	// Get some things
-	const FrustumComponent& frc = node.getComponent<FrustumComponent>();
 	Timestamp frcTimestamp = frc.getTimestamp();
 	const Frustum& fr = frc.getFrustum();
 	ANKI_ASSERT(fr.getType() == Frustum::Type::PERSPECTIVE);
 	const PerspectiveFrustum& pfr = static_cast<const PerspectiveFrustum&>(fr);
 
 	// Set some things
-	m_node = &node;
+	const SceneNode* node = m_node; // Save for later compare
+	m_node = &frc.getSceneNode();
 	m_frc = &frc;
 	m_near = pfr.getNear();
 	m_far = pfr.getFar();
@@ -179,7 +179,7 @@ void Clusterer::prepare(ThreadPool& threadPool, const SceneNode& node)
 	// - it's the same frustum component as before and
 	// - the component has not changed
 	Bool frustumChanged =
-		frcTimestamp >= m_planesLSpaceTimestamp || m_node != &node;
+		frcTimestamp >= m_planesLSpaceTimestamp || m_node != node;
 
 	for(U i = 0; i < threadPool.getThreadsCount(); i++)
 	{

+ 1 - 0
src/renderer/Ir.cpp

@@ -78,6 +78,7 @@ Error Ir::init(const ConfigSet& initializer)
 	config.set("lf.maxFlares", 8);
 	config.set("pps.enabled", false);
 	config.set("renderingQuality", 1.0);
+	config.set("clusterSizeZ", 1); // XXX A bug if more. Fix it
 	config.set("width", m_fbSize);
 	config.set("height", m_fbSize);
 	config.set("lodDistance", 10.0);

+ 1 - 1
src/renderer/Renderer.cpp

@@ -165,7 +165,7 @@ Error Renderer::render(SceneNode& frustumableNode, U frustumIdx,
 	}
 
 	ANKI_ASSERT(m_frc->getFrustum().getType() == Frustum::Type::PERSPECTIVE);
-	m_clusterer.prepare(getThreadPool(), frustumableNode);
+	m_clusterer.prepare(getThreadPool(), *m_frc);
 
 	// Run reflection passes
 	if(m_ir.isCreated())