Browse Source

- Visibility

Panagiotis Christopoulos Charitos 14 years ago
parent
commit
13ba40832f

File diff suppressed because it is too large
+ 3 - 2
build/debug/Makefile


+ 1 - 1
build/debug/gen.cfg.py

@@ -11,4 +11,4 @@ compiler = "g++"
 
 compilerFlags = "-DPLATFORM_LINUX -DMATH_INTEL_SIMD -DREVISION=\\\"`svnversion ../..`\\\" -c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -Wno-long-long -pipe -g3 -fsingle-precision-constant -msse4"
 
-linkerFlags = "-rdynamic -L../../extern/lib-x86-64-linux -Wl,-Bstatic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lGLU -Wl,-Bdynamic -lGL -ljpeg -lSDL -lpng -lpython2.6 -lboost_system -lboost_python -lboost_filesystem -lboost_thread -lfreetype"
+linkerFlags = "-rdynamic -L../../extern/lib-x86-64-linux -Wl,-Bdynamic -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -lGLEW -lGLU -lGL -ljpeg -lSDL -lpng -lpython2.6 -lboost_system -lboost_python -lboost_filesystem -lboost_thread -lfreetype"

File diff suppressed because it is too large
+ 2 - 1
build/release/Makefile


File diff suppressed because it is too large
+ 0 - 1
build/release_llvm/Makefile


+ 4 - 5
src/Renderer/Drawers/SceneDrawer.cpp

@@ -33,12 +33,11 @@ void SceneDrawer::UsrDefVarVisitor::operator()(const Type& x) const
 }
 
 
-typedef const Texture* ConstTex;
-
-template<>
-void SceneDrawer::UsrDefVarVisitor::operator()(const ConstTex& x) const
+void SceneDrawer::UsrDefVarVisitor::operator()(const RsrcPtr<Texture>* x) const
 {
-	udvr.getUniVar().set(*x, texUnit);
+	const RsrcPtr<Texture>& texPtr = *x;
+	texPtr->setRepeat(true);
+	udvr.getUniVar().set(*texPtr, texUnit);
 	++texUnit;
 }
 

+ 2 - 0
src/Renderer/Drawers/SceneDrawer.h

@@ -42,6 +42,8 @@ class SceneDrawer
 
 				template<typename Type>
 				void operator()(const Type& x) const;
+
+				void operator()(const RsrcPtr<Texture>* x) const;
 		};
 
 		const Renderer& r; ///< Keep it here cause the class wants a few stuff from it

+ 3 - 0
src/Resources/Core/RsrcLoadingRequests.cpp

@@ -1,6 +1,8 @@
 #include "RsrcLoadingRequests.h"
 #include "Texture.h"
 #include "AsyncLoader.h"
+#include "Logger.h"
+#include "Globals.h"
 
 
 //======================================================================================================================
@@ -30,5 +32,6 @@ void RsrcTextureLoadingRequest::doPostLoading()
 {
 	Texture* tex = new Texture;
 	tex->load(img);
+	INFO(tex->getGlId());
 	*pTex = tex;
 }

+ 1 - 1
src/Scene/MaterialRuntime/MaterialRuntimeUserDefinedVar.cpp

@@ -7,7 +7,7 @@
 template <>
 void MaterialRuntimeUserDefinedVar::ConstructVisitor::operator()<RsrcPtr<Texture> >(const RsrcPtr<Texture>& x) const
 {
-	udvr.data = x.get();
+	udvr.data = &x;
 }
 
 

+ 1 - 1
src/Scene/MaterialRuntime/MaterialRuntimeUserDefinedVar.h

@@ -11,7 +11,7 @@ class MaterialRuntimeUserDefinedVar
 
 	public:
 		/// The data union. The Texture resource is read-only at runtime
-		typedef boost::variant<float, Vec2, Vec3, Vec4, const Texture*, MtlUserDefinedVar::Fai> DataVariant;
+		typedef boost::variant<float, Vec2, Vec3, Vec4, const RsrcPtr<Texture>*, MtlUserDefinedVar::Fai> DataVariant;
 
 		/// The one and only constructor
 		MaterialRuntimeUserDefinedVar(const MtlUserDefinedVar& rsrc);

+ 33 - 39
src/Scene/VisibilityTester.cpp

@@ -9,6 +9,7 @@
 #include "PointLight.h"
 #include "SpotLight.h"
 #include "JobManager.h"
+#include "Logger.h"
 
 
 //======================================================================================================================
@@ -233,12 +234,9 @@ void VisibilityTester::getRenderableNodesJobCallback(void* args, const WorkerThr
 		to = nodesSize;
 	}
 
-
-	Scene::Types<ModelNode>::Iterator it = scene.getModelNodes().begin() + from;
-	while(it != scene.getModelNodes().begin() + to)
+	for(uint i = from; i < to; i++)
 	{
-		ASSERT(it != scene.getModelNodes().end());
-		ModelNode* node = *it;
+		ModelNode* node = scene.getModelNodes()[i];
 
 		// Skip if the ModeNode is not visible
 		if(!test(*node, *visTester->cam))
@@ -279,52 +277,48 @@ void VisibilityTester::getRenderableNodesJobCallback(void* args, const WorkerThr
 	//
 	// SkinNodes
 	//
+	nodesSize = scene.getSkinNodes().size();
+	count = nodesSize / threadsNum;
+	from = count * id;
+	to = count * (id + 1);
+
+	if(id == threadsNum - 1) // The last job will get the rest
+	{
+		to = nodesSize;
+	}
+
+	for(uint i = from; i < to; i++)
 	{
-		nodesSize = scene.getSkinNodes().size();
-		count = nodesSize / threadsNum;
-		from = count * id;
-		to = count * (id + 1);
+		SkinNode* node = scene.getSkinNodes()[i];
 
-		if(id == threadsNum - 1) // The last job will get the rest
+		// Skip if the SkinNode is not visible
+		if(!test(*node, *visTester->cam))
 		{
-			to = nodesSize;
+			continue;
 		}
 
-		Scene::Types<SkinNode>::Iterator it = scene.getSkinNodes().begin() + from;
-		while(it != scene.getSkinNodes().begin() + to)
-		{
-			ASSERT(it != scene.getSkinNodes().end());
-			SkinNode* node = *it;
+		node->setVisible(true);
 
-			// Skip if the SkinNode is not visible
-			if(!test(*node, *visTester->cam))
+		// Put all the patches into the visible container
+		BOOST_FOREACH(SkinPatchNode* patchNode, node->getPatcheNodes())
+		{
+			// Skip shadowless
+			if(visTester->skipShadowless && !patchNode->getCpMtl().castsShadow())
 			{
 				continue;
 			}
 
-			node->setVisible(true);
-
-			// Put all the patches into the visible container
-			BOOST_FOREACH(SkinPatchNode* patchNode, node->getPatcheNodes())
+			if(patchNode->getCpMtl().renderInBlendingStage())
 			{
-				// Skip shadowless
-				if(visTester->skipShadowless && !patchNode->getCpMtl().castsShadow())
-				{
-					continue;
-				}
-
-				if(patchNode->getCpMtl().renderInBlendingStage())
-				{
-					boost::mutex::scoped_lock lock(visTester->bsRenderableNodesMtx);
-					visTester->visibilityInfo->getVisibleBsRenderableNodes().push_back(patchNode);
-				}
-				else
-				{
-					boost::mutex::scoped_lock lock(visTester->msRenderableNodesMtx);
-					visTester->visibilityInfo->getVisibleMsRenderableNodes().push_back(patchNode);
-				}
-				patchNode->setVisible(true);
+				boost::mutex::scoped_lock lock(visTester->bsRenderableNodesMtx);
+				visTester->visibilityInfo->getVisibleBsRenderableNodes().push_back(patchNode);
 			}
+			else
+			{
+				boost::mutex::scoped_lock lock(visTester->msRenderableNodesMtx);
+				visTester->visibilityInfo->getVisibleMsRenderableNodes().push_back(patchNode);
+			}
+			patchNode->setVisible(true);
 		}
 	}
 }

+ 2 - 1
src/Scripting/Renderer/Dbg.bpi.cpp

@@ -5,6 +5,7 @@
 WRAP(Dbg)
 {
 	class_<Dbg, noncopyable>("Dbg", no_init)
-		.add_property("enabled", (bool (Dbg::*)() const)(&Dbg::isEnabled), &Dbg::setEnabled)
+		.def("isEnabled", (bool (Dbg::*)() const)(&Dbg::isEnabled))
+		.def("setEnabled", &Dbg::setEnabled)
 	;
 }

+ 8 - 4
src/Scripting/Renderer/Hdr.bpi.cpp

@@ -5,9 +5,13 @@
 WRAP(Hdr)
 {
 	class_<Hdr, noncopyable>("Hdr", no_init)
-		.add_property("blurringIterationsNum", (uint (Hdr::*)() const)(&Hdr::getBlurringIterationsNum),
-		              &Hdr::setBlurringIterationsNum)
-		.add_property("exposure", (float (Hdr::*)() const)(&Hdr::getExposure), &Hdr::setExposure)
-		.add_property("blurringDist", (float (Hdr::*)() const)(&Hdr::getBlurringDist), &Hdr::setBlurringDist)
+		.def("getBlurringIterationsNum", (uint (Hdr::*)() const)(&Hdr::getBlurringIterationsNum))
+		.def("setBlurringIterationsNum", &Hdr::setBlurringIterationsNum)
+
+		.def("getExposure", (float (Hdr::*)() const)(&Hdr::getExposure))
+		.def("setExposure", &Hdr::setExposure)
+
+		.def("getBlurringDist", (float (Hdr::*)() const)(&Hdr::getBlurringDist))
+		.def("setBlurringDist", &Hdr::setBlurringDist)
 	;
 }

Some files were not shown because too many files changed in this diff