Browse Source

Changes in properties and scripting

Panagiotis Christopoulos Charitos 15 years ago
parent
commit
8a43824749

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


+ 12 - 5
shaders/HwSkinningTrffbGeneric.glsl

@@ -1,3 +1,6 @@
+/// @file
+///
+/// Switches: NORMAL_ENABLED, TANGENT_ENABLED
 #pragma anki vertShaderBegins
 
 in vec3 position;
@@ -11,12 +14,16 @@ const int MAX_BONES_PER_MESH = 60;
 uniform mat3 skinningRotations[MAX_BONES_PER_MESH];
 uniform vec3 skinningTranslations[MAX_BONES_PER_MESH];
 
-#pragma anki transformFeedbackVarying vPosition
+//#pragma anki transformFeedbackVarying vPosition
 out vec3 vPosition;
-#pragma anki transformFeedbackVarying vNormal
-varying vec3 vNormal;
-#pragma anki transformFeedbackVarying vTangent
-varying vec4 vTangent;
+//#pragma anki transformFeedbackVarying vNormal
+#if defined(NORMAL_ENABLED)
+	out vec3 vNormal;
+#endif
+//#pragma anki transformFeedbackVarying vTangent
+#if defined(TANGENT_ENABLED)
+	out vec4 vTangent;
+#endif
 
 
 void main()

+ 2 - 2
src/Collision/Plane.h

@@ -9,8 +9,8 @@
 /// Plane collision shape
 class Plane: public CollisionShape
 {
-	PROPERTY_RW(Vec3, normal, setNormal, getNormal)
-	PROPERTY_RW(float, offset, setOffset, getOffset)
+	PROPERTY_RW(Vec3, normal, getNormal, setNormal)
+	PROPERTY_RW(float, offset, getOffset, setOffset)
 
 	public:
 		/// Default constructor

+ 2 - 2
src/Collision/Sphere.h

@@ -12,8 +12,8 @@ class Plane;
 /// Sphere collision shape
 class Sphere: public CollisionShape
 {
-	PROPERTY_RW(Vec3, center, setCenter, getCenter)
-	PROPERTY_RW(float, radius, setRadius, getRadius)
+	PROPERTY_RW(Vec3, center, getCenter, setCenter)
+	PROPERTY_RW(float, radius, getRadius, setRadius)
 
 	public:
 		/// Default constructor

+ 2 - 2
src/Main.cpp

@@ -126,9 +126,9 @@ void init()
 	initializer.pps.hdr.enabled = true;
 	initializer.pps.hdr.renderingQuality = 0.25;
 	initializer.pps.hdr.blurringDist = 1.0;
-	initializer.pps.hdr.blurringIterations = 2;
+	initializer.pps.hdr.blurringIterationsNum = 2;
 	initializer.pps.hdr.exposure = 4.0;
-	initializer.pps.ssao.blurringIterations = 2;
+	initializer.pps.ssao.blurringIterationsNum = 2;
 	initializer.pps.ssao.enabled = true;
 	initializer.pps.ssao.renderingQuality = 0.5;
 	initializer.mainRendererQuality = 1.0;

+ 2 - 2
src/Renderer/Hdr.cpp

@@ -55,7 +55,7 @@ void Hdr::init(const RendererInitializer& initializer)
 
 	renderingQuality = initializer.pps.hdr.renderingQuality;
 	blurringDist = initializer.pps.hdr.blurringDist;
-	blurringIterations = initializer.pps.hdr.blurringIterations;
+	blurringIterationsNum = initializer.pps.hdr.blurringIterationsNum;
 	exposure = initializer.pps.hdr.exposure;
 
 	initFbo(toneFbo, toneFai);
@@ -103,7 +103,7 @@ void Hdr::run()
 	// blurring passes
 	hblurFai.setRepeat(false);
 	fai.setRepeat(false);
-	for(uint i=0; i<blurringIterations; i++)
+	for(uint i=0; i<blurringIterationsNum; i++)
 	{
 		// hpass
 		hblurFbo.bind();

+ 5 - 11
src/Renderer/Hdr.h

@@ -15,6 +15,11 @@ class Hdr: private RenderingPass
 	PROPERTY_R(Texture, toneFai, getToneFai) ///< Vertical blur pass FAI
 	PROPERTY_R(Texture, hblurFai, getHblurFai) ///< pass0Fai with the horizontal blur FAI
 	PROPERTY_R(Texture, fai, getFai) ///< The final FAI
+	PROPERTY_R(float, renderingQuality, getRenderingQuality)
+	/// The blurring iterations of the tone map
+	PROPERTY_RW(uint, blurringIterationsNum, getBlurringIterationsNum, setBlurringIterationsNum)
+	PROPERTY_RW(float, exposure, getExposure, setExposure)///< How bright is the HDR
+	PROPERTY_RW(float, blurringDist, getBlurringDist, setBlurringDist)
 
 	public:
 		Hdr(Renderer& r_, Object* parent): RenderingPass(r_, parent) {}
@@ -23,14 +28,7 @@ class Hdr: private RenderingPass
 
 		/// Setters & getters
 		/// @{
-		float getBlurringDist() {return blurringDist;}
-		void setBlurringDist(float f) {blurringDist = f;}
-		uint getBlurringIterations() {return blurringIterations;}
-		void setBlurringIterations(uint i) {blurringIterations = i;}
-		float getExposure() const {return exposure;}
-		void setExposure(float f) {exposure = f;}
 		bool isEnabled() const {return enabled;}
-		float getRenderingQuality() const {return renderingQuality;}
 		/// @}
 
 	private:
@@ -40,11 +38,7 @@ class Hdr: private RenderingPass
 		RsrcPtr<ShaderProg> toneSProg;
 		RsrcPtr<ShaderProg> hblurSProg;
 		RsrcPtr<ShaderProg> vblurSProg;
-		float blurringDist;
-		uint blurringIterations;
-		float exposure; ///< How bright is the HDR
 		bool enabled;
-		float renderingQuality;
 
 		void initFbo(Fbo& fbo, Texture& fai);
 };

+ 2 - 2
src/Renderer/RendererInitializer.h

@@ -38,7 +38,7 @@ struct RendererInitializer
 			bool enabled;
 			float renderingQuality;
 			float blurringDist;
-			float blurringIterations;
+			float blurringIterationsNum;
 			float exposure;
 		} hdr;
 
@@ -47,7 +47,7 @@ struct RendererInitializer
 		{
 			bool enabled;
 			float renderingQuality;
-			float blurringIterations;
+			float blurringIterationsNum;
 		} ssao;
 	} pps;
 

+ 2 - 2
src/Renderer/Ssao.cpp

@@ -55,7 +55,7 @@ void Ssao::init(const RendererInitializer& initializer)
 		return;
 
 	renderingQuality = initializer.pps.ssao.renderingQuality;
-	blurringIterations = initializer.pps.ssao.blurringIterations;
+	blurringIterationsNum = initializer.pps.ssao.blurringIterationsNum;
 
 	// create FBOs
 	createFbo(ssaoFbo, ssaoFai);
@@ -129,7 +129,7 @@ void Ssao::run()
 	// blurring passes
 	hblurFai.setRepeat(false);
 	fai.setRepeat(false);
-	for(uint i=0; i<blurringIterations; i++)
+	for(uint i=0; i<blurringIterationsNum; i++)
 	{
 		// hpass
 		hblurFbo.bind();

+ 1 - 1
src/Renderer/Ssao.h

@@ -34,7 +34,7 @@ class Ssao: private RenderingPass
 		Texture fai;  ///< AKA vblurFai The final FAI
 		bool enabled;
 		float renderingQuality;
-		float blurringIterations;
+		float blurringIterationsNum;
 		Fbo ssaoFbo;
 		Fbo hblurFbo;
 		Fbo vblurFbo;

+ 1 - 1
src/Resources/ShaderProg.cpp

@@ -284,7 +284,7 @@ void ShaderProg::load(const char* filename)
 	bindCustomAttribLocs(pars);
 
 	// 5) set the TRFFB varyings
-	if(pars.getOutput().getTrffbVaryings().size() > 1)
+	if(pars.getOutput().getTrffbVaryings().size() > 0)
 	{
 		const char* varsArr[128];
 		for(uint i=0; i<pars.getOutput().getTrffbVaryings().size(); i++)

+ 1 - 1
src/Scene/Controllers/SkelAnimModelNodeCtrl.h

@@ -16,7 +16,7 @@ class ModelNode;
 /// SkelAnim controls a ModelNode
 class SkelAnimModelNodeCtrl: public Controller
 {
-	PROPERTY_RW(float, step, setStep, getStep)
+	PROPERTY_RW(float, step, getStep, setStep)
 
 	public:
 		SkelAnimModelNodeCtrl(ModelNode& skelNode_);

+ 3 - 3
src/Scene/Light.h

@@ -38,9 +38,9 @@ class Light: public SceneNode
 
 	/// @name Copies of some of the resource properties. The others are camera properties or not changeable
 	/// @{
-	PROPERTY_RW(Vec3, diffuseCol, setDiffuseCol, getDiffuseCol) ///< Diffuse color
-	PROPERTY_RW(Vec3, specularCol, setSpecularCol, getSpecularCol) ///< Specular color
-	PROPERTY_RW(bool, castsShadow_, setCastsShadow, castsShadow) ///< Casts shadow
+	PROPERTY_RW(Vec3, diffuseCol, getDiffuseCol, setDiffuseCol) ///< Diffuse color
+	PROPERTY_RW(Vec3, specularCol, getSpecularCol, setSpecularCol) ///< Specular color
+	PROPERTY_RW(bool, castsShadow_, castsShadow, setCastsShadow) ///< Casts shadow
 	/// @}
 
 	public:

+ 4 - 4
src/Scene/ModelNode.h

@@ -13,10 +13,10 @@ class SkelAnimModelNodeCtrl;
 /// The model scene node
 class ModelNode: public SceneNode
 {
-	PROPERTY_RW(Vec<Vec3>, heads, setHeads, getHeads)
-	PROPERTY_RW(Vec<Vec3>, tails, setTails, getTails)
-	PROPERTY_RW(Vec<Mat3>, boneRotations, setBoneRotations, getBoneRotations)
-	PROPERTY_RW(Vec<Vec3>, boneTranslations, setBoneTranslations, getBoneTranslations)
+	PROPERTY_RW(Vec<Vec3>, heads, getHeads, setHeads)
+	PROPERTY_RW(Vec<Vec3>, tails, getTails, setTails)
+	PROPERTY_RW(Vec<Mat3>, boneRotations, getBoneRotations, setBoneRotations)
+	PROPERTY_RW(Vec<Vec3>, boneTranslations, getBoneTranslations, setBoneTranslations)
 
 	public:
 		SkelAnimModelNodeCtrl* skelAnimModelNodeCtrl; ///< @todo Clean this

+ 1 - 1
src/Scene/PointLight.h

@@ -7,7 +7,7 @@
 /// Point light. Defined by its radius
 class PointLight: public Light
 {
-	PROPERTY_RW(float, radius, setRadius, getRadius)
+	PROPERTY_RW(float, radius, getRadius, setRadius)
 
 	public:
 		PointLight(SceneNode* parent = NULL): Light(LT_POINT, parent) {}

+ 1 - 1
src/Scene/Scene.h

@@ -19,7 +19,7 @@ class ModelNode;
 class Scene: public Object
 {
 	//PROPERTY_RW(Vec3, ambientCol, setAmbientCol, getAmbientCol) ///< The global ambient color
-	PROPERTY_RW(Vec3, sunPos, setSunPos, getSunPos)
+	PROPERTY_RW(Vec3, sunPos, getSunPos, setSunPos)
 	//PROPERTY_R(Physics*, phyWorld, getPhysics) ///< Connection with bullet
 
 	public:

+ 2 - 2
src/Scene/SceneNode.h

@@ -27,8 +27,8 @@ class SceneNode: public Object
 			SNT_MODEL
 		};
 
-	PROPERTY_RW(Transform, localTransform, setLocalTransform, getLocalTransform) ///< The transformation in local space
-	PROPERTY_RW(Transform, worldTransform, setWorldTransform, getWorldTransform) ///< The transformation in world space (local combined with parent transformation)
+	PROPERTY_RW(Transform, localTransform, getLocalTransform, setLocalTransform) ///< The transformation in local space
+	PROPERTY_RW(Transform, worldTransform, getWorldTransform, setWorldTransform) ///< The transformation in world space (local combined with parent transformation)
 
 	public:
 		SceneNode* parent;

+ 3 - 3
src/Scripting/Renderer/Hdr.bpi.cpp

@@ -5,8 +5,8 @@
 WRAP(Hdr)
 {
 	class_<Hdr, noncopyable>("Hdr", no_init)
-		.add_property("blurringIterations", &Hdr::getBlurringIterations, &Hdr::setBlurringIterations)
-		.add_property("blurringDist", &Hdr::getBlurringDist, &Hdr::setBlurringDist)
-		.add_property("exposure", &Hdr::getExposure, &Hdr::setExposure)
+		BP_PROPERTY_RW("blurringIterationsNum", Hdr::getBlurringIterationsNum, Hdr::setBlurringIterationsNum)
+		BP_PROPERTY_RW("exposure", Hdr::getExposure, Hdr::setExposure)
+		BP_PROPERTY_RW("blurringDist", Hdr::getBlurringDist, Hdr::setBlurringDist)
 	;
 }

+ 8 - 1
src/Scripting/ScriptingCommon.h

@@ -1,10 +1,17 @@
 /// @file
 /// This file is included by all the *.bpi.cpp files
-
 #include <boost/python.hpp>
 
+
 using namespace boost;
 using namespace boost::python;
 
+
+/// Wrap a class
 #define WRAP(x) \
 	void boostPythonWrap##x()
+
+
+/// Boost python property read write
+#define BP_PROPERTY_RW(name__, getter__, setter__) \
+	.add_property(name__, & getter__##Value, & setter__##Value)

+ 6 - 13
src/Util/Properties.h

@@ -8,13 +8,15 @@
 /// - The get funcs are coming into two flavors, one const and one non-const. The property is read-write after all so
 ///   the non-const is acceptable
 /// - Dont use it with semicolon at the end (eg PROPERTY_RW(....);) because of a doxygen bug
-#define PROPERTY_RW(Type__, varName__, setFunc__, getFunc__) \
+#define PROPERTY_RW(Type__, varName__, getFunc__, setFunc__) \
 	private: \
 		Type__ varName__; \
 	public: \
 		void setFunc__(const Type__& x__) {varName__ = x__;} \
+		void setFunc__##Value(Type__ x__) {varName__ = x__;} \
 		const Type__& getFunc__() const {return varName__;} \
-		Type__& getFunc__() {return varName__;}
+		Type__& getFunc__() {return varName__;} \
+		Type__ getFunc__##Value() const {return varName__;}
 
 
 /// Read only private property
@@ -25,17 +27,8 @@
 	private: \
 		Type__ varName__; \
 	public: \
-		const Type__& getFunc__() const { return varName__; }
-
-
-/// Read only protected property
-///
-/// - Dont use it with semicolon at the end (eg PROPERTY_RW(....);) because of a doxygen bug
-#define PROTECTED_PROPERTY_R(Type__, varName__, getFunc__) \
-	protected: \
-		Type__ varName__; \
-	public: \
-		const Type__& getFunc__() const { return varName__; }
+		const Type__& getFunc__() const {return varName__;} \
+		Type__ getFunc__##Value() const {return varName__;}
 
 
 #endif

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