style: apply clang format
This commit is contained in:
		| @@ -13,7 +13,8 @@ | ||||
| Shader::Shader(const std::string& vertexPath, const std::string& fragmentPath) | ||||
| { | ||||
| 	const uint32_t vshader = CompileShader(GL_VERTEX_SHADER, vertexPath); | ||||
| 	const uint32_t fshader = CompileShader(GL_FRAGMENT_SHADER, fragmentPath); | ||||
| 	const uint32_t fshader = | ||||
| 	    CompileShader(GL_FRAGMENT_SHADER, fragmentPath); | ||||
|  | ||||
| 	if (vshader == 0 || fshader == 0) { | ||||
| 		program_id_ = 0; | ||||
| @@ -30,7 +31,8 @@ Shader::Shader(const std::string& vertexPath, const std::string& fragmentPath) | ||||
| 	glGetProgramiv(program_id_, GL_LINK_STATUS, &ret); | ||||
| 	if (ret == GL_FALSE) { | ||||
| 		char buffer[1024]; | ||||
| 		glGetProgramInfoLog(program_id_, sizeof(buffer), nullptr, buffer); | ||||
| 		glGetProgramInfoLog(program_id_, sizeof(buffer), nullptr, | ||||
| 				    buffer); | ||||
| 		error_ = buffer; | ||||
| 		glDeleteProgram(program_id_); | ||||
| 		program_id_ = 0; | ||||
| @@ -51,13 +53,17 @@ void Shader::SetupAttribs() const | ||||
| 	int loc = glGetAttribLocation(program_id_, "vpos"); | ||||
| 	if (loc != -1) { | ||||
| 		glEnableVertexAttribArray(loc); | ||||
| 		glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), reinterpret_cast<const void*>(offsetof(Vertex, position))); | ||||
| 		glVertexAttribPointer( | ||||
| 		    loc, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), | ||||
| 		    reinterpret_cast<const void*>(offsetof(Vertex, position))); | ||||
| 	} | ||||
|  | ||||
| 	loc = glGetAttribLocation(program_id_, "vcolor"); | ||||
| 	if (loc != -1) { | ||||
| 		glEnableVertexAttribArray(loc); | ||||
| 		glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), reinterpret_cast<const void*>(offsetof(Vertex, color))); | ||||
| 		glVertexAttribPointer( | ||||
| 		    loc, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), | ||||
| 		    reinterpret_cast<const void*>(offsetof(Vertex, color))); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -112,12 +118,12 @@ std::string Shader::ReadShaderFile(const std::string& filename) | ||||
| uint32_t Shader::CompileShader(uint32_t type, const std::string& source_path) | ||||
| { | ||||
| 	std::string source = ReadShaderFile(source_path); | ||||
| 	//std::cout << "SHADER FILE: " << source << "\n"; | ||||
| 	// std::cout << "SHADER FILE: " << source << "\n"; | ||||
| 	if (source.empty()) | ||||
| 		return 0; | ||||
|  | ||||
| 	const uint32_t shader = glCreateShader(type); | ||||
| 	const char* shader_code = source.c_str(); | ||||
| 	const uint32_t shader	   = glCreateShader(type); | ||||
| 	const char*    shader_code = source.c_str(); | ||||
|  | ||||
| 	glShaderSource(shader, 1, &shader_code, nullptr); | ||||
| 	glCompileShader(shader); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user