Parcourir la source

porting to 3.3 core

Panagiotis Christopoulos Charitos il y a 15 ans
Parent
commit
9c3fa74f8a

+ 21 - 49
src/Renderer/BufferObjects/Vao.cpp

@@ -1,68 +1,40 @@
 #include "Vao.h"
 #include "Vao.h"
 #include "Vbo.h"
 #include "Vbo.h"
-#include "GlException.h"
 
 
 
 
 //======================================================================================================================
 //======================================================================================================================
-// Constructor                                                                                                         =
+// attachArrayBufferVbo                                                                                                =
 //======================================================================================================================
 //======================================================================================================================
-Vao::VboInfo::VboInfo(const Vbo* vbo_, const ShaderProg::AttribVar* attribVar_, GLint size_, GLenum type_,
-                      GLboolean normalized_, GLsizei stride_, const GLvoid* pointer_):
-	vbo(vbo_),
-	attribVar(attribVar_),
-	size(size_),
-	type(type_),
-	normalized(normalized_),
-	stride(stride_),
-	pointer(pointer_)
+void Vao::attachArrayBufferVbo(const Vbo& vbo, const ShaderProg::AttribVar& attribVar, GLint size, GLenum type,
+		                           GLboolean normalized, GLsizei stride, const GLvoid* pointer)
 {
 {
-	RASSERT_THROW_EXCEPTION(vbo == NULL);
-	RASSERT_THROW_EXCEPTION(attribVar == NULL);
-	RASSERT_THROW_EXCEPTION(size < 1);
+	if(vbo.getBufferTarget() != GL_ARRAY_BUFFER)
+	{
+		throw EXCEPTION("Only GL_ARRAY_BUFFER is accepted");
+	}
+
+	bind();
+	vbo.bind();
+	glVertexAttribPointer(attribVar.getLoc(), size, type, normalized, stride, pointer);
+	glEnableVertexAttribArray(attribVar.getLoc());
+	unbind();
+
+	ON_GL_FAIL_THROW_EXCEPTION();
 }
 }
 
 
 
 
 //======================================================================================================================
 //======================================================================================================================
-// create                                                                                                              =
+// attachElementArrayBufferVbo                                                                                         =
 //======================================================================================================================
 //======================================================================================================================
-void Vao::create(const VboInfo arrayBufferVbosInfo[], uint arrayBufferVbosInfoNum, const Vbo* elementArrayBufferVbo)
+void Vao::attachElementArrayBufferVbo(const Vbo& vbo)
 {
 {
-	RASSERT_THROW_EXCEPTION(isCreated());
-	glGenVertexArrays(1, &glId);
-	bind();
-
-	// Attach the GL_ARRAY_BUFFER VBOs
-
-	for(uint i = 0; i < arrayBufferVbosInfoNum; i++)
+	if(vbo.getBufferTarget() != GL_ELEMENT_ARRAY_BUFFER)
 	{
 	{
-		const VboInfo& info = arrayBufferVbosInfo[i];
-
-		RASSERT_THROW_EXCEPTION(info.vbo == NULL);
-		RASSERT_THROW_EXCEPTION(info.attribVar == NULL);
-
-		if(info.vbo->getBufferTarget() != GL_ARRAY_BUFFER)
-		{
-			throw EXCEPTION("Only GL_ARRAY_BUFFER is accepted");
-		}
-
-		info.vbo->bind();
-		glVertexAttribPointer(info.attribVar->getLoc(), info.size, info.type, info.normalized,
-		                      info.stride, info.pointer);
-		glEnableVertexAttribArray(info.attribVar->getLoc());
-		info.vbo->unbind();
-	}
-
-	// Attach the GL_ELEMENT_ARRAY_BUFFER VBO
-	if(elementArrayBufferVbo != NULL)
-	{
-		if(elementArrayBufferVbo->getBufferTarget() != GL_ELEMENT_ARRAY_BUFFER)
-		{
-			throw EXCEPTION("Only GL_ELEMENT_ARRAY_BUFFER is accepted");
-		}
-
-		elementArrayBufferVbo->bind();
+		throw EXCEPTION("Only GL_ELEMENT_ARRAY_BUFFER is accepted");
 	}
 	}
 
 
+	bind();
+	vbo.bind();
 	unbind();
 	unbind();
 	ON_GL_FAIL_THROW_EXCEPTION();
 	ON_GL_FAIL_THROW_EXCEPTION();
 }
 }

+ 20 - 71
src/Renderer/BufferObjects/Vao.h

@@ -2,100 +2,49 @@
 #define VAO_H
 #define VAO_H
 
 
 #include <GL/glew.h>
 #include <GL/glew.h>
-#include <limits>
 #include "Exception.h"
 #include "Exception.h"
 #include "StdTypes.h"
 #include "StdTypes.h"
 #include "ShaderProg.h"
 #include "ShaderProg.h"
+#include "Object.h"
+#include "Properties.h"
+#include "GlException.h"
 
 
 
 
 class Vbo;
 class Vbo;
 
 
 
 
 /// Vertex array object
 /// Vertex array object
-class Vao
+class Vao: public Object
 {
 {
-	public:
-		/// This structs contains information for VAO bind into the VAO. Used by the @ref create method. See
-		/// glVertexAttribPointer for the interpretation of the member variables
-		struct VboInfo
-		{
-			const Vbo* vbo;
-			const ShaderProg::AttribVar* attribVar;
-			GLint size;
-			GLenum type;
-			GLboolean normalized;
-			GLsizei stride;
-			const GLvoid* pointer;
-
-			/// The one and only constructor
-			VboInfo(const Vbo* vbo_, const ShaderProg::AttribVar* attribVar_, GLint size_, GLenum type_,
-              GLboolean normalized_, GLsizei stride_, const GLvoid* pointer_);
-
-      ~VboInfo() {}
-		};
+	PROPERTY_R(uint, glId, getGlId) ///< The OpenGL id
 
 
+	public:
 		/// Default constructor
 		/// Default constructor
-		Vao(): glId(std::numeric_limits<uint>::max()) {}
+		Vao(Object* parent = NULL);
 
 
-		/// Destructor
-		~Vao();
+		/// Destroy VAO fro the OpenGL context
+		~Vao() {glDeleteVertexArrays(1, &glId);}
 
 
-		/// Safe accessor. Throws exception if not created
-		/// @exception Exception
-		uint getGlId() const;
+		/// @todo
+		void attachArrayBufferVbo(const Vbo& vbo, const ShaderProg::AttribVar& attribVar, GLint size, GLenum type,
+		                          GLboolean normalized, GLsizei stride, const GLvoid* pointer);
 
 
-		/// Create the VAO. Throws exception if already created. It requires an C-style array with size so it can be fast
-		/// @param[in] arrayBufferVbosInfo An array with information per VBO. The VBOs are GL_ARRAY_BUFFER
-		/// @param[in] arrayBufferVbosInfoNum The size of the arrayBufferVbosInfo array
-		/// @param[in] elementArrayBufferVbo The GL_ELEMENT_ARRAY_BUFFER VBO. If NULL then ignored
-		/// @exception Exception
-		void create(const VboInfo arrayBufferVbosInfo[], uint arrayBufferVbosInfoNum, const Vbo* elementArrayBufferVbo);
+		/// @todo
+		void attachElementArrayBufferVbo(const Vbo& vbo);
 
 
-		/// Bind it. Throws exception if not created
-		/// @exception Exception
-		void bind() const;
+		/// Bind it
+		void bind() const {glBindVertexArray(glId);}
 
 
 		/// Unbind all VAOs
 		/// Unbind all VAOs
 		static void unbind() {glBindVertexArray(0);}
 		static void unbind() {glBindVertexArray(0);}
-
-		/// Destroy it. Throws exception if not created
-		void destroy();
-
-		/// Return true if the VAO is already created
-		bool isCreated() const {return glId != std::numeric_limits<uint>::max();}
-
-	private:
-		uint glId; ///< The OpenGL id
 };
 };
 
 
 
 
-inline uint Vao::getGlId() const
-{
-	RASSERT_THROW_EXCEPTION(!isCreated());
-	return glId;
-}
-
-
-inline void Vao::bind() const
-{
-	RASSERT_THROW_EXCEPTION(!isCreated());
-	glBindVertexArray(glId);
-}
-
-
-inline Vao::~Vao()
-{
-	if(isCreated())
-	{
-		destroy();
-	}
-}
-
-
-inline void Vao::destroy()
+inline Vao::Vao(Object* parent):
+	Object(parent)
 {
 {
-	RASSERT_THROW_EXCEPTION(!isCreated());
-	glDeleteVertexArrays(1, &glId);
+	glGenVertexArrays(1, &glId);
+	ON_GL_FAIL_THROW_EXCEPTION();
 }
 }
 
 
 
 

+ 1 - 1
src/Renderer/MainRenderer.cpp

@@ -118,7 +118,7 @@ void MainRenderer::takeScreenshotTga(const char* filename)
 	// open file and check
 	// open file and check
 	std::fstream fs;
 	std::fstream fs;
 	fs.open(filename, std::ios::out | std::ios::binary);
 	fs.open(filename, std::ios::out | std::ios::binary);
-	if(!fs.good())
+	if(!fs.is_open())
 	{
 	{
 		throw EXCEPTION("Cannot create screenshot. File \"" + filename + "\"");
 		throw EXCEPTION("Cannot create screenshot. File \"" + filename + "\"");
 	}
 	}

+ 8 - 8
src/Renderer/Renderer.h

@@ -91,10 +91,10 @@ class Renderer: public Object
 		/// OpenGL wrapper
 		/// OpenGL wrapper
 		static void setViewport(uint x, uint y, uint w, uint h) {glViewport(x, y, w, h);}
 		static void setViewport(uint x, uint y, uint w, uint h) {glViewport(x, y, w, h);}
 
 
-		/// @todo write cmnts
-		/// @param mtl
-		/// @param sceneNode
-		/// @param cam
+		/// This functions sets the GL state using a material and a few other things
+		/// @param mtl The material containing the shader program
+		/// @param sceneNode Needed for some matrices
+		/// @param cam Needed for some matrices
 		void setupMaterial(const class Material& mtl, const SceneNode& sceneNode, const Camera& cam);
 		void setupMaterial(const class Material& mtl, const SceneNode& sceneNode, const Camera& cam);
 
 
 
 
@@ -108,15 +108,15 @@ class Renderer: public Object
 	protected:
 	protected:
 		uint framesNum; ///< Frame number
 		uint framesNum; ///< Frame number
 		const Camera* cam; ///< Current camera
 		const Camera* cam; ///< Current camera
-		static int maxColorAtachments; ///< Max color attachments a FBO can accept
-		Mat4 viewProjectionMat; ///< In case anyone needs it
+		static int maxColorAtachments; ///< Max color attachments an FBO can accept
+		Mat4 viewProjectionMat; ///< Precalculated in case anyone needs it
 
 
 	//====================================================================================================================
 	//====================================================================================================================
 	// Protected                                                                                                         =
 	// Protected                                                                                                         =
 	//====================================================================================================================
 	//====================================================================================================================
 	private:
 	private:
-		static Vbo* quadPositionsVbo;
-		static Vao* globalVao;
+		static Vbo* quadPositionsVbo; ///< The VBO for quad positions
+		static Vao* globalVao; ///< This VAO is used everywhere
 
 
 	// to be removed
 	// to be removed
 	public:
 	public:

+ 1 - 1
src/Resources/Helpers/Image.cpp

@@ -166,7 +166,7 @@ void Image::loadTga(const char* filename)
 	fs.open(filename, std::ios::in | std::ios::binary);
 	fs.open(filename, std::ios::in | std::ios::binary);
 	uint bpp;
 	uint bpp;
 
 
-	if(!fs.good())
+	if(!fs.is_open())
 	{
 	{
 		throw EXCEPTION("Cannot open file");
 		throw EXCEPTION("Cannot open file");
 	}
 	}

+ 23 - 23
src/Resources/Mesh.cpp

@@ -65,28 +65,28 @@ void Mesh::load(const char* filename)
 void Mesh::createVbos(const MeshData& meshData)
 void Mesh::createVbos(const MeshData& meshData)
 {
 {
 	vbos.vertIndeces = new Vbo(GL_ELEMENT_ARRAY_BUFFER, meshData.getVertIndeces().getSizeInBytes(),
 	vbos.vertIndeces = new Vbo(GL_ELEMENT_ARRAY_BUFFER, meshData.getVertIndeces().getSizeInBytes(),
-	                           &meshData.getVertIndeces()[0], GL_STATIC_DRAW);
+	                           &meshData.getVertIndeces()[0], GL_STATIC_DRAW, this);
 	vbos.vertCoords = new Vbo(GL_ARRAY_BUFFER, meshData.getVertCoords().getSizeInBytes(),
 	vbos.vertCoords = new Vbo(GL_ARRAY_BUFFER, meshData.getVertCoords().getSizeInBytes(),
-	                          &meshData.getVertCoords()[0], GL_STATIC_DRAW);
+	                          &meshData.getVertCoords()[0], GL_STATIC_DRAW, this);
 	vbos.vertNormals = new Vbo(GL_ARRAY_BUFFER, meshData.getVertNormals().getSizeInBytes(),
 	vbos.vertNormals = new Vbo(GL_ARRAY_BUFFER, meshData.getVertNormals().getSizeInBytes(),
-	                           &meshData.getVertNormals()[0], GL_STATIC_DRAW);
+	                           &meshData.getVertNormals()[0], GL_STATIC_DRAW, this);
 
 
 	if(meshData.getVertTangents().size() > 1)
 	if(meshData.getVertTangents().size() > 1)
 	{
 	{
 		vbos.vertTangents = new Vbo(GL_ARRAY_BUFFER, meshData.getVertTangents().getSizeInBytes(),
 		vbos.vertTangents = new Vbo(GL_ARRAY_BUFFER, meshData.getVertTangents().getSizeInBytes(),
-		                            &meshData.getVertTangents()[0], GL_STATIC_DRAW);
+		                            &meshData.getVertTangents()[0], GL_STATIC_DRAW, this);
 	}
 	}
 
 
 	if(meshData.getTexCoords().size() > 1)
 	if(meshData.getTexCoords().size() > 1)
 	{
 	{
 		vbos.texCoords = new Vbo(GL_ARRAY_BUFFER, meshData.getTexCoords().getSizeInBytes(),
 		vbos.texCoords = new Vbo(GL_ARRAY_BUFFER, meshData.getTexCoords().getSizeInBytes(),
-		                         &meshData.getTexCoords()[0], GL_STATIC_DRAW);
+		                         &meshData.getTexCoords()[0], GL_STATIC_DRAW, this);
 	}
 	}
 
 
 	if(meshData.getVertWeights().size() > 1)
 	if(meshData.getVertWeights().size() > 1)
 	{
 	{
 		vbos.vertWeights = new Vbo(GL_ARRAY_BUFFER, meshData.getVertWeights().getSizeInBytes(),
 		vbos.vertWeights = new Vbo(GL_ARRAY_BUFFER, meshData.getVertWeights().getSizeInBytes(),
-		                           &meshData.getVertWeights()[0], GL_STATIC_DRAW);
+		                           &meshData.getVertWeights()[0], GL_STATIC_DRAW, this);
 	}
 	}
 }
 }
 
 
@@ -94,53 +94,53 @@ void Mesh::createVbos(const MeshData& meshData)
 //======================================================================================================================
 //======================================================================================================================
 // createVao                                                                                                           =
 // createVao                                                                                                           =
 //======================================================================================================================
 //======================================================================================================================
-void Mesh::createVao(Vao& vao, Material& mtl)
+void Mesh::createVao(Vao* vao, Material& mtl)
 {
 {
-	Vec<Vao::VboInfo> vboInfos;
+	vao = new Vao(this);
 
 
 	if(mtl.stdAttribVars[Material::SAV_POSITION] != NULL)
 	if(mtl.stdAttribVars[Material::SAV_POSITION] != NULL)
 	{
 	{
-		vboInfos.push_back(Vao::VboInfo(vbos.vertCoords, mtl.stdAttribVars[Material::SAV_POSITION], 3, GL_FLOAT,
-		                                GL_FALSE, 0, NULL));
+		vao->attachArrayBufferVbo(*vbos.vertCoords, *mtl.stdAttribVars[Material::SAV_POSITION], 3, GL_FLOAT,
+		                          GL_FALSE, 0, NULL);
 	}
 	}
 
 
 	if(mtl.stdAttribVars[Material::SAV_NORMAL] != NULL)
 	if(mtl.stdAttribVars[Material::SAV_NORMAL] != NULL)
 	{
 	{
-		vboInfos.push_back(Vao::VboInfo(vbos.vertNormals, mtl.stdAttribVars[Material::SAV_NORMAL], 3, GL_FLOAT,
-		                                GL_FALSE, 0, NULL));
+		vao->attachArrayBufferVbo(*vbos.vertNormals, *mtl.stdAttribVars[Material::SAV_NORMAL], 3, GL_FLOAT,
+		                          GL_FALSE, 0, NULL);
 	}
 	}
 
 
 	if(mtl.stdAttribVars[Material::SAV_TANGENT] != NULL)
 	if(mtl.stdAttribVars[Material::SAV_TANGENT] != NULL)
 	{
 	{
-		vboInfos.push_back(Vao::VboInfo(vbos.vertTangents, mtl.stdAttribVars[Material::SAV_TANGENT], 4, GL_FLOAT,
-		                                GL_FALSE, 0, NULL));
+		vao->attachArrayBufferVbo(*vbos.vertTangents, *mtl.stdAttribVars[Material::SAV_TANGENT], 4, GL_FLOAT,
+		                          GL_FALSE, 0, NULL);
 	}
 	}
 
 
 	if(mtl.stdAttribVars[Material::SAV_TEX_COORDS] != NULL)
 	if(mtl.stdAttribVars[Material::SAV_TEX_COORDS] != NULL)
 	{
 	{
-		vboInfos.push_back(Vao::VboInfo(vbos.texCoords, mtl.stdAttribVars[Material::SAV_TEX_COORDS], 2, GL_FLOAT,
-		                                GL_FALSE, 0, NULL));
+		vao->attachArrayBufferVbo(*vbos.texCoords, *mtl.stdAttribVars[Material::SAV_TEX_COORDS], 2, GL_FLOAT,
+		                          GL_FALSE, 0, NULL);
 	}
 	}
 
 
 	if(mtl.stdAttribVars[Material::SAV_VERT_WEIGHT_BONES_NUM] != NULL)
 	if(mtl.stdAttribVars[Material::SAV_VERT_WEIGHT_BONES_NUM] != NULL)
 	{
 	{
-		vboInfos.push_back(Vao::VboInfo(vbos.vertWeights, mtl.stdAttribVars[Material::SAV_VERT_WEIGHT_BONES_NUM], 1,
-		                                GL_FLOAT, GL_FALSE, sizeof(MeshData::VertexWeight), BUFFER_OFFSET(0)));
+		vao->attachArrayBufferVbo(*vbos.vertWeights, *mtl.stdAttribVars[Material::SAV_VERT_WEIGHT_BONES_NUM], 1,
+		                          GL_FLOAT, GL_FALSE, sizeof(MeshData::VertexWeight), BUFFER_OFFSET(0));
 	}
 	}
 
 
 	if(mtl.stdAttribVars[Material::SAV_VERT_WEIGHT_BONE_IDS] != NULL)
 	if(mtl.stdAttribVars[Material::SAV_VERT_WEIGHT_BONE_IDS] != NULL)
 	{
 	{
-		vboInfos.push_back(Vao::VboInfo(vbos.vertWeights, mtl.stdAttribVars[Material::SAV_VERT_WEIGHT_BONE_IDS], 4,
-		                                GL_FLOAT, GL_FALSE, sizeof(MeshData::VertexWeight), BUFFER_OFFSET(4)));
+		vao->attachArrayBufferVbo(*vbos.vertWeights, *mtl.stdAttribVars[Material::SAV_VERT_WEIGHT_BONE_IDS], 4,
+		                          GL_FLOAT, GL_FALSE, sizeof(MeshData::VertexWeight), BUFFER_OFFSET(4));
 	}
 	}
 
 
 	if(mtl.stdAttribVars[Material::SAV_VERT_WEIGHT_WEIGHTS] != NULL)
 	if(mtl.stdAttribVars[Material::SAV_VERT_WEIGHT_WEIGHTS] != NULL)
 	{
 	{
-		vboInfos.push_back(Vao::VboInfo(vbos.vertWeights, mtl.stdAttribVars[Material::SAV_VERT_WEIGHT_WEIGHTS], 4,
-		                                GL_FLOAT, GL_FALSE, sizeof(MeshData::VertexWeight), BUFFER_OFFSET(20)));
+		vao->attachArrayBufferVbo(*vbos.vertWeights, *mtl.stdAttribVars[Material::SAV_VERT_WEIGHT_WEIGHTS], 4,
+		                          GL_FLOAT, GL_FALSE, sizeof(MeshData::VertexWeight), BUFFER_OFFSET(20));
 	}
 	}
 
 
-	vao.create(&vboInfos[0], vboInfos.size(), vbos.vertIndeces);
+	vao->attachElementArrayBufferVbo(*vbos.vertIndeces);
 }
 }
 
 
 
 

+ 6 - 5
src/Resources/Mesh.h

@@ -6,6 +6,7 @@
 #include "Vao.h"
 #include "Vao.h"
 #include "Resource.h"
 #include "Resource.h"
 #include "RsrcPtr.h"
 #include "RsrcPtr.h"
+#include "Object.h"
 
 
 
 
 class Material;
 class Material;
@@ -13,7 +14,7 @@ class MeshData;
 
 
 
 
 /// Mesh Resource. If the material name is empty then the mesh wont be rendered and no VBOs will be created
 /// Mesh Resource. If the material name is empty then the mesh wont be rendered and no VBOs will be created
-class Mesh: public Resource
+class Mesh: public Resource, public Object
 {
 {
 	public:
 	public:
 		/// The VBOs in a structure
 		/// The VBOs in a structure
@@ -34,10 +35,10 @@ class Mesh: public Resource
 	public:
 	public:
 		RsrcPtr<Material> material; ///< Required. If empty then mesh not renderable
 		RsrcPtr<Material> material; ///< Required. If empty then mesh not renderable
 		Vbos vbos; ///< The vertex buffer objects
 		Vbos vbos; ///< The vertex buffer objects
-		Vao vao; ///< Vertex array object
-		Vao depthVao; ///< Vertex array object for the depth material
+		Vao* vao; ///< Vertex array object
+		Vao* depthVao; ///< Vertex array object for the depth material
 
 
-		Mesh(): Resource(RT_MESH) {}
+		Mesh(): Resource(RT_MESH), Object(NULL) {}
 		~Mesh() {}
 		~Mesh() {}
 
 
 		/// Implements @ref Resource::load
 		/// Implements @ref Resource::load
@@ -48,7 +49,7 @@ class Mesh: public Resource
 
 
 	private:
 	private:
 		void createVbos(const MeshData& meshData);
 		void createVbos(const MeshData& meshData);
-		void createVao(Vao& vao, Material& mtl);
+		void createVao(Vao* vao, Material& mtl);
 };
 };
 
 
 
 

+ 1 - 1
src/Resources/ShaderProg.cpp

@@ -368,7 +368,7 @@ std::string ShaderProg::createSrcCodeToCache(const char* sProgFPathName, const c
 	std::string src = preAppendedSrcCode + src_;
 	std::string src = preAppendedSrcCode + src_;
 
 
 	std::ofstream f(newfPathName.string().c_str());
 	std::ofstream f(newfPathName.string().c_str());
-	if(!f.good())
+	if(!f.is_open())
 	{
 	{
 		throw EXCEPTION("Cannot open file for writing \"" + newfPathName.string() + "\"");
 		throw EXCEPTION("Cannot open file for writing \"" + newfPathName.string() + "\"");
 	}
 	}

+ 1 - 1
src/Resources/Skeleton.cpp

@@ -11,7 +11,7 @@ void Skeleton::load(const char* filename)
 {
 {
 	std::ifstream fs;
 	std::ifstream fs;
 	fs.open(filename);
 	fs.open(filename);
-	if(!fs.good())
+	if(!fs.is_open())
 	{
 	{
 		throw EXCEPTION("Cannot open \"" + filename + "\"");
 		throw EXCEPTION("Cannot open \"" + filename + "\"");
 	}
 	}

+ 2 - 2
src/Scene/MeshNode.h

@@ -24,8 +24,8 @@ class MeshNode: public SceneNode
 		MeshSkelNodeCtrl* meshSkelCtrl;
 		MeshSkelNodeCtrl* meshSkelCtrl;
 		// funcs
 		// funcs
 		MeshNode();
 		MeshNode();
-		virtual void render() { render(*mesh->material.get(), mesh->vao); }
-		virtual void renderDepth() { render(*mesh->material->dpMtl.get(), mesh->depthVao); }
+		virtual void render() { render(*mesh->material.get(), *mesh->vao); }
+		virtual void renderDepth() { render(*mesh->material->dpMtl.get(), *mesh->depthVao); }
 		void init(const char* filename);
 		void init(const char* filename);
 };
 };
 
 

+ 1 - 1
src/Util/Scanner.cpp

@@ -279,7 +279,7 @@ void Scanner::getAllPrintAll()
 void Scanner::loadFile(const char* filename_)
 void Scanner::loadFile(const char* filename_)
 {	
 {	
 	inFstream.open(filename_);
 	inFstream.open(filename_);
-	if(!inFstream.good())
+	if(!inFstream.is_open())
 	{
 	{
 		throw EXCEPTION("Cannot open file \"" + filename_ + '\"');
 		throw EXCEPTION("Cannot open file \"" + filename_ + '\"');
 	}
 	}