Browse Source

- Documentation updates
- Adding a file to run AnKi and produce core dump in case of crash or fatal failure

Panagiotis Christopoulos Charitos 15 years ago
parent
commit
bc954ccd03
8 changed files with 71 additions and 76 deletions
  1. 1 1
      docs/doxyfile
  2. 5 0
      run.dbg.sh
  3. 1 1
      src/Core/Common.cpp
  4. 38 38
      src/Math/Mat3.h
  5. 2 2
      src/Math/Mat4.h
  6. 3 3
      src/Math/Math.h
  7. 4 3
      src/Resources/ShaderProg.cpp
  8. 17 28
      src/Resources/ShaderProg.h

+ 1 - 1
docs/doxyfile

@@ -1260,7 +1260,7 @@ SEARCH_INCLUDES        = YES
 # contain include files that are not input files but should be processed by 
 # contain include files that are not input files but should be processed by 
 # the preprocessor.
 # the preprocessor.
 
 
-INCLUDE_PATH           = ../src/Util
+INCLUDE_PATH           = ../src/Scripting/ ../src/Math/ ../src/Util/Tokenizer/ ../src/Misc/ ../src/ ../src/Renderer/ ../src/Scene/ ../src/Ui/ ../src/Resources/ ../src/Util/ ../src/Scene/Controllers/ ../src/Physics/ ../src/Renderer/BufferObjects/ ../src/Resources/Helpers/ ../src/Resources/Core/ ../src/Core/ ../src/Scripting/Math ../src/Scripting/Util ../src/Scripting/Core ../src/Scripting/Scene ../src/Scripting/Renderer
 
 
 # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
 # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
 # patterns (like *.h and *.hpp) to filter out the header-files in the 
 # patterns (like *.h and *.hpp) to filter out the header-files in the 

+ 5 - 0
run.dbg.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+LD_LIBRARY_PATH=extern/lib-x86-64-linux
+ulimit -c unlimited
+build/debug/anki

+ 1 - 1
src/Core/Common.cpp

@@ -128,7 +128,7 @@ ostream& msgSuffix(ostream& cs)
 ostream& msgSuffixFatal(ostream& cs)
 ostream& msgSuffixFatal(ostream& cs)
 {
 {
 	msgSuffix(cs);
 	msgSuffix(cs);
-	::exit(1);
+	::abort();
 	return cs;
 	return cs;
 }
 }
 
 

+ 38 - 38
src/Math/Mat3.h

@@ -14,8 +14,8 @@ class Mat3
 	public:
 	public:
 		/// @name Accessors
 		/// @name Accessors
 		/// @{
 		/// @{
-		float& operator ()(const uint i, const uint j);
-		const float& operator ()(const uint i, const uint j) const;
+		float& operator()(const uint i, const uint j);
+		const float& operator()(const uint i, const uint j) const;
 		float& operator [](const uint i);
 		float& operator [](const uint i);
 		const float& operator [](const uint i) const;
 		const float& operator [](const uint i) const;
 		/// @}
 		/// @}
@@ -34,13 +34,13 @@ class Mat3
 
 
 		/// @name Operators with Mat3
 		/// @name Operators with Mat3
 		/// @{
 		/// @{
-		Mat3  operator +(const Mat3& b) const;
+		Mat3 operator +(const Mat3& b) const;
 		Mat3& operator +=(const Mat3& b);
 		Mat3& operator +=(const Mat3& b);
-		Mat3  operator -(const Mat3& b) const;
+		Mat3 operator -(const Mat3& b) const;
 		Mat3& operator -=(const Mat3& b);
 		Mat3& operator -=(const Mat3& b);
-		Mat3  operator *(const Mat3& b) const; ///< 27 muls, 18 adds
+		Mat3 operator *(const Mat3& b) const; ///< 27 muls, 18 adds
 		Mat3& operator *=(const Mat3& b);
 		Mat3& operator *=(const Mat3& b);
-		Mat3  operator /(const Mat3& b) const;
+		Mat3 operator /(const Mat3& b) const;
 		Mat3& operator /=(const Mat3& b);
 		Mat3& operator /=(const Mat3& b);
 		bool operator ==(const Mat3& b) const;
 		bool operator ==(const Mat3& b) const;
 		bool operator !=(const Mat3& b) const;
 		bool operator !=(const Mat3& b) const;
@@ -48,51 +48,51 @@ class Mat3
 
 
 		/// @name Operators with float
 		/// @name Operators with float
 		/// @{
 		/// @{
-		Mat3  operator + (float f) const;
+		Mat3 operator +(float f) const;
 		Mat3& operator +=(float f);
 		Mat3& operator +=(float f);
-		Mat3  operator - (float f) const;
+		Mat3 operator -(float f) const;
 		Mat3& operator -=(float f);
 		Mat3& operator -=(float f);
-		Mat3  operator * (float f) const;
+		Mat3 operator *(float f) const;
 		Mat3& operator *=(float f);
 		Mat3& operator *=(float f);
-		Mat3  operator / (float f) const;
+		Mat3 operator /(float f) const;
 		Mat3& operator /=(float f);
 		Mat3& operator /=(float f);
 		/// @}
 		/// @}
 
 
 		/// @name Operators with others
 		/// @name Operators with others
 		/// @{
 		/// @{
-		Vec3  operator * (const Vec3& b) const;  ///< 9 muls, 6 adds
+		Vec3 operator *(const Vec3& b) const;  ///< 9 muls, 6 adds
 		/// @}
 		/// @}
 
 
 		/// @name Other
 		/// @name Other
 		/// @{
 		/// @{
-		void  setRows(const Vec3& a, const Vec3& b, const Vec3& c);
-		void  setRow(const uint i, const Vec3& v);
-		void  getRows(Vec3& a, Vec3& b, Vec3& c) const;
-		Vec3  getRow(const uint i) const;
-		void  setColumns(const Vec3& a, const Vec3& b, const Vec3& c);
-		void  setColumn(const uint i, const Vec3& v);
-		void  getColumns(Vec3& a, Vec3& b, Vec3& c) const;
-		Vec3  getColumn(const uint i) const;
-		Vec3  getXAxis() const;
-		Vec3  getYAxis() const;
-		Vec3  getZAxis() const;
-		void  setXAxis(const Vec3& v3);
-		void  setYAxis(const Vec3& v3);
-		void  setZAxis(const Vec3& v3);
-		void  setRotationX(float rad);
-		void  setRotationY(float rad);
-		void  setRotationZ(float rad);
-		void  rotateXAxis(float rad); ///< It rotates "this" in the axis defined by the rotation AND not the world axis
-		void  rotateYAxis(float rad);
-		void  rotateZAxis(float rad);
-		void  transpose();
-		Mat3  getTransposed() const;
-		void  reorthogonalize();
-		void  print() const;
+		void setRows(const Vec3& a, const Vec3& b, const Vec3& c);
+		void setRow(const uint i, const Vec3& v);
+		void getRows(Vec3& a, Vec3& b, Vec3& c) const;
+		Vec3 getRow(const uint i) const;
+		void setColumns(const Vec3& a, const Vec3& b, const Vec3& c);
+		void setColumn(const uint i, const Vec3& v);
+		void getColumns(Vec3& a, Vec3& b, Vec3& c) const;
+		Vec3 getColumn(const uint i) const;
+		Vec3 getXAxis() const;
+		Vec3 getYAxis() const;
+		Vec3 getZAxis() const;
+		void setXAxis(const Vec3& v3);
+		void setYAxis(const Vec3& v3);
+		void setZAxis(const Vec3& v3);
+		void setRotationX(float rad);
+		void setRotationY(float rad);
+		void setRotationZ(float rad);
+		void rotateXAxis(float rad); ///< It rotates "this" in the axis defined by the rotation AND not the world axis
+		void rotateYAxis(float rad);
+		void rotateZAxis(float rad);
+		void transpose();
+		Mat3 getTransposed() const;
+		void reorthogonalize();
+		void print() const;
 		float getDet() const;
 		float getDet() const;
-		void  invert();
-		Mat3  getInverse() const;
-		void  setIdentity();
+		void invert();
+		Mat3 getInverse() const;
+		void setIdentity();
 		static const Mat3& getZero();
 		static const Mat3& getZero();
 		static const Mat3& getIdentity();
 		static const Mat3& getIdentity();
 		/// @}
 		/// @}

+ 2 - 2
src/Math/Mat4.h

@@ -1,5 +1,5 @@
-#ifndef _MAT4_H_
-#define _MAT4_H_
+#ifndef MAT4_H
+#define MAT4_H
 
 
 #include "Common.h"
 #include "Common.h"
 #include "MathForwardDecls.h"
 #include "MathForwardDecls.h"

+ 3 - 3
src/Math/Math.h

@@ -1,6 +1,5 @@
-#ifndef _MATH_H_
-#define _MATH_H_
-
+#ifndef MATH_H
+#define MATH_H
 
 
 #include <math.h>
 #include <math.h>
 #include "Vec2.h"
 #include "Vec2.h"
@@ -14,6 +13,7 @@
 #include "MathFuncs.h"
 #include "MathFuncs.h"
 #include "Transform.h"
 #include "Transform.h"
 
 
+
 using namespace M;
 using namespace M;
 
 
 
 

+ 4 - 3
src/Resources/ShaderProg.cpp

@@ -32,9 +32,10 @@ string ShaderProg::stdSourceCode(
  * - if the current shader program is the var's shader program
  * - if the current shader program is the var's shader program
  * - if the GL driver gives the same location as the one the var has
  * - if the GL driver gives the same location as the one the var has
  */
  */
-#define STD_SET_UNI_CHECK() DEBUG_ERR(getLoc() == -1); \
-                            DEBUG_ERR(ShaderProg::getCurrentProgramGlId() != fatherSProg->getGlId()); \
-                            DEBUG_ERR(glGetUniformLocation(fatherSProg->getGlId(), getName().c_str()) != getLoc());
+#define STD_SET_UNI_CHECK() \
+	DEBUG_ERR(getLoc() == -1); \
+	DEBUG_ERR(ShaderProg::getCurrentProgramGlId() != fatherSProg->getGlId()); \
+	DEBUG_ERR(glGetUniformLocation(fatherSProg->getGlId(), getName().c_str()) != getLoc());
 
 
 
 
 void ShaderProg::UniVar::setFloat(float f) const
 void ShaderProg::UniVar::setFloat(float f) const

+ 17 - 28
src/Resources/ShaderProg.h

@@ -10,13 +10,12 @@
 
 
 
 
 
 
-/**
- * Shader program @ref Resource
- *
- * Shader program. Combines a fragment and a vertex shader. Every shader program consist of one OpenGL ID, a vector of
- * uniform variables and a vector of attribute variables. Every variable is a struct that contains the variable's name,
- * location, OpenGL data type and if it is a uniform or an attribute var.
- */
+
+/// Shader program @ref Resource
+///
+/// Shader program. Combines a fragment and a vertex shader. Every shader program consist of one OpenGL ID, a vector of
+/// uniform variables and a vector of attribute variables. Every variable is a struct that contains the variable's name,
+/// location, OpenGL data type and if it is a uniform or an attribute var.
 class ShaderProg: public Resource
 class ShaderProg: public Resource
 {
 {
 	friend class Material;
 	friend class Material;
@@ -26,9 +25,7 @@ class ShaderProg: public Resource
 	// Nested                                                                                                            =
 	// Nested                                                                                                            =
 	//====================================================================================================================
 	//====================================================================================================================
 	public:
 	public:
-		/**
-		 * Shader program variable. The type is attribute or uniform
-		 */
+		/// Shader program variable. The type is attribute or uniform
 		class Var
 		class Var
 		{
 		{
 			public:
 			public:
@@ -39,16 +36,18 @@ class ShaderProg: public Resource
 					SVT_UNIFORM    ///< SVT_UNIFORM
 					SVT_UNIFORM    ///< SVT_UNIFORM
 				};
 				};
 
 
-			PROPERTY_R(GLint, loc, getLoc) ///< GL location
-			PROPERTY_R(string, name, getName) ///< The name inside the shader program
-			PROPERTY_R(GLenum, glDataType, getGlDataType) ///< GL_FLOAT, GL_FLOAT_VEC2 etc. See http://www.opengl.org/sdk/docs/man/xhtml/glGetActiveUniform.xml
-			PROPERTY_R(Type, type, getType) ///< @ref SVT_ATTRIBUTE or @ref SVT_UNIFORM
-
-			public:
 				Var(GLint loc_, const char* name_, GLenum glDataType_, Type type_, const ShaderProg* fatherSProg_);
 				Var(GLint loc_, const char* name_, GLenum glDataType_, Type type_, const ShaderProg* fatherSProg_);
 				Var(const Var& var);
 				Var(const Var& var);
+				GLint getLoc() const {return loc;}
+				const string& getName() const {return name;}
+				GLenum getGlDataType() const {return glDataType;}
+				Type getType() const {return type;}
 
 
 			protected:
 			protected:
+				GLint loc; ///< GL location
+				string name; ///< The name inside the shader program
+				GLenum glDataType; ///< GL_FLOAT, GL_FLOAT_VEC2 etc. See http://www.opengl.org/sdk/docs/man/xhtml/glGetActiveUniform.xml
+				Type type; ///< @ref SVT_ATTRIBUTE or @ref SVT_UNIFORM
 				const ShaderProg* fatherSProg; ///< We need the ShaderProg of this variable mainly for sanity checks
 				const ShaderProg* fatherSProg; ///< We need the ShaderProg of this variable mainly for sanity checks
 		};
 		};
 
 
@@ -59,7 +58,7 @@ class ShaderProg: public Resource
 		{
 		{
 			public:
 			public:
 				UniVar(int loc_, const char* name_, GLenum glDataType_, const ShaderProg* fatherSProg_);
 				UniVar(int loc_, const char* name_, GLenum glDataType_, const ShaderProg* fatherSProg_);
-				UniVar(const UniVar& var);
+				UniVar(const UniVar& var): Var(var) {}
 
 
 				void setFloat(float f) const;
 				void setFloat(float f) const;
 				void setFloatVec(float f[], uint size = 1) const;
 				void setFloatVec(float f[], uint size = 1) const;
@@ -78,7 +77,7 @@ class ShaderProg: public Resource
 		{
 		{
 			public:
 			public:
 				AttribVar(int loc_, const char* name_, GLenum glDataType_, const ShaderProg* fatherSProg_);
 				AttribVar(int loc_, const char* name_, GLenum glDataType_, const ShaderProg* fatherSProg_);
-				AttribVar(const UniVar& var);
+				AttribVar(const AttribVar& var): Var(var) {}
 		};
 		};
 		
 		
 	private:
 	private:
@@ -219,22 +218,12 @@ inline ShaderProg::UniVar::UniVar(int loc_, const char* name_, GLenum glDataType
 {}
 {}
 
 
 
 
-inline ShaderProg::UniVar::UniVar(const UniVar& var):
-	Var(var)
-{}
-
-
 inline ShaderProg::AttribVar::AttribVar(int loc_, const char* name_, GLenum glDataType_,
 inline ShaderProg::AttribVar::AttribVar(int loc_, const char* name_, GLenum glDataType_,
                                         const ShaderProg* fatherSProg_):
                                         const ShaderProg* fatherSProg_):
 	Var(loc_, name_, glDataType_, SVT_UNIFORM, fatherSProg_)
 	Var(loc_, name_, glDataType_, SVT_UNIFORM, fatherSProg_)
 {}
 {}
 
 
 
 
-inline ShaderProg::AttribVar::AttribVar(const UniVar& var):
-	Var(var)
-{}
-
-
 inline ShaderProg::ShaderProg():
 inline ShaderProg::ShaderProg():
 	Resource(RT_SHADER_PROG),
 	Resource(RT_SHADER_PROG),
 	glId(numeric_limits<uint>::max())
 	glId(numeric_limits<uint>::max())