Kaynağa Gözat

ANKI IS MOVING TO C++11 (I HOPE I WONT REGRET IT)

Panagiotis Christopoulos Charitos 14 yıl önce
ebeveyn
işleme
6e5b2553c3
4 değiştirilmiş dosya ile 17 ekleme ve 14 silme
  1. 3 2
      CMakeLists.txt
  2. 0 2
      anki/scene/Light.cpp
  3. 12 8
      anki/scene/Light.h
  4. 2 2
      anki/util/StringList.cpp

+ 3 - 2
CMakeLists.txt

@@ -120,13 +120,14 @@ ANKI_ADD_LIB(${BOOST_INCLUDE_DIR} ${BOOST_LIBRARY_DIR} ${BOOST_INCLUDE_DIR}/boos
 #
 # Defines & flags
 #
-ADD_DEFINITIONS("-DANKI_MATH_INTEL_SIMD -DGLEW_MX -pedantic-errors -pedantic -ansi -Wall -Winline -W -Wwrite-strings -Wno-unused -Wfatal-errors -Werror -Wno-long-long -msse4")
+ADD_DEFINITIONS("-DANKI_MATH_INTEL_SIMD -DGLEW_MX -pedantic-errors -pedantic -ansi -Wall -Winline -W -Wwrite-strings -Wno-unused -Wfatal-errors -Werror -Wno-long-long -msse4 -std=c++0x")
 
 # Add a few compiler specific stuff 
 IF(${CMAKE_CXX_COMPILER} MATCHES ".*clang\\+\\+$")	
 	# Do nothing
 ELSE()
-	ADD_DEFINITIONS("-fsingle-precision-constant")
+	# Dont use it. It produces warnings with -std=c++0x
+	#ADD_DEFINITIONS("-fsingle-precision-constant")
 ENDIF()
 
 IF(${CMAKE_SYSTEM_NAME} STREQUAL Linux)

+ 0 - 2
anki/scene/Light.cpp

@@ -5,8 +5,6 @@
 namespace anki {
 
 
-//==============================================================================
-// Destructor                                                                  =
 //==============================================================================
 Light::~Light()
 {}

+ 12 - 8
anki/scene/Light.h

@@ -6,6 +6,7 @@
 #include "anki/resource/Resource.h"
 #include "anki/resource/LightRsrc.h"
 #include "anki/scene/VisibilityInfo.h"
+#include "anki/scene/Renderable.h"
 
 
 namespace anki {
@@ -27,7 +28,7 @@ namespace anki {
 /// Specular intensity of light:    Sl
 /// Specular intensity of material: Sm
 /// @endcode
-class Light: public SceneNode, public VisibilityInfo
+class Light: public SceneNode, public VisibilityInfo/*, public Renderable*/
 {
 	public:
 		enum LightType
@@ -36,7 +37,9 @@ class Light: public SceneNode, public VisibilityInfo
 			LT_SPOT
 		};
 
-		Light(LightType type, Scene& scene, ulong flags, SceneNode* parent);
+		Light(LightType t, Scene& scene, ulong flags, SceneNode* parent)
+			: SceneNode(SNT_LIGHT, scene, flags, parent), type(t)
+		{}
 
 		virtual ~Light();
 
@@ -57,9 +60,16 @@ class Light: public SceneNode, public VisibilityInfo
 		void setCastShadow(bool x) {castsShadowFlag = x;}
 		/// @}
 
+		/// Implements Renderable::getMaterialRuntime
+		/*MaterialRuntime& getMaterialRuntime()
+		{
+			return *mtlr;
+		}*/
+
 		void init(const char* filename);
 
 	protected:
+		//boost::scoped_ptr<MaterialRuntime> mtlr;
 		LightRsrcResourcePointer lightData;
 		Vec3 diffuseCol; ///< Diffuse color
 		Vec3 specularCol; ///< Specular color
@@ -70,12 +80,6 @@ class Light: public SceneNode, public VisibilityInfo
 };
 
 
-inline Light::Light(LightType t, Scene& scene, ulong flags, SceneNode* parent)
-:	SceneNode(SNT_LIGHT, scene, flags, parent),
- 	type(t)
-{}
-
-
 } // end namespace
 
 

+ 2 - 2
anki/util/StringList.cpp

@@ -34,9 +34,9 @@ StringList StringList::splitString(const StringType& s, const char* seperators)
 	StringList out;
 	Tok tok(s, sep);
 
-	for(Tok::const_iterator it = tok.begin(); it != tok.end(); ++it)
+	for(auto s: tok)
 	{
-		out.push_back(*it);
+		out.push_back(s);
 	}
 
 	return out;