Browse Source

Fixed indentation [skip ci]

Thomas Buck 9 years ago
parent
commit
45288518bf
8 changed files with 41 additions and 26 deletions
  1. 2
    1
      src/BoundingBox.cpp
  2. 2
    1
      src/Mesh.cpp
  3. 4
    3
      src/Render.cpp
  4. 3
    3
      src/RoomData.cpp
  5. 8
    6
      src/TextureManager.cpp
  6. 12
    6
      src/UI.cpp
  7. 1
    1
      src/main.cpp
  8. 9
    5
      src/system/Shader.cpp

+ 2
- 1
src/BoundingBox.cpp View File

33
 }
33
 }
34
 
34
 
35
 bool BoundingBox::inBoxPlane(glm::vec3 p) {
35
 bool BoundingBox::inBoxPlane(glm::vec3 p) {
36
-    return ((p.x >= corner[0].x) && (p.x <= corner[7].x) && (p.z >= corner[0].z) && (p.z <= corner[7].z));
36
+    return ((p.x >= corner[0].x) && (p.x <= corner[7].x) && (p.z >= corner[0].z)
37
+            && (p.z <= corner[7].z));
37
 }
38
 }
38
 
39
 
39
 void BoundingBox::display(glm::mat4 VP, glm::vec3 colorLine, glm::vec3 colorDot) {
40
 void BoundingBox::display(glm::mat4 VP, glm::vec3 colorLine, glm::vec3 colorDot) {

+ 2
- 1
src/Mesh.cpp View File

141
     }
141
     }
142
 
142
 
143
     if (indicesColorBuff.size() > 0)
143
     if (indicesColorBuff.size() > 0)
144
-        Shader::drawGL(verticesColorBuff, colorsBuff, indicesColorBuff, MVP, gl::GL_TRIANGLES, shaderTexture);
144
+        Shader::drawGL(verticesColorBuff, colorsBuff, indicesColorBuff, MVP, gl::GL_TRIANGLES,
145
+                       shaderTexture);
145
 }
146
 }
146
 
147
 

+ 4
- 3
src/Render.cpp View File

163
 
163
 
164
             // Check if the portal lies behind the player
164
             // Check if the portal lies behind the player
165
             if (!((newMin.z <= newMin.w) && (newMin.z >= -newMin.w)
165
             if (!((newMin.z <= newMin.w) && (newMin.z >= -newMin.w)
166
-                && (newMax.z <= newMax.w) && (newMax.z >= -newMax.w))) {
166
+                  && (newMax.z <= newMax.w) && (newMax.z >= -newMax.w))) {
167
                 continue;
167
                 continue;
168
             }
168
             }
169
 
169
 
174
 
174
 
175
             // Check if the portal intersects the portal leading into this room
175
             // Check if the portal intersects the portal leading into this room
176
             if (!((min.x < (newMax.x / newMax.w)) && (max.x > (newMin.x / newMin.w))
176
             if (!((min.x < (newMax.x / newMax.w)) && (max.x > (newMin.x / newMin.w))
177
-                && (min.y < (newMax.y / newMax.w)) && (max.y > (newMin.y / newMin.w)))) {
177
+                  && (min.y < (newMax.y / newMax.w)) && (max.y > (newMin.y / newMin.w)))) {
178
                 continue;
178
                 continue;
179
             }
179
             }
180
 
180
 
194
 
194
 
195
             // ...only render it if it is not
195
             // ...only render it if it is not
196
             if (!found) {
196
             if (!found) {
197
-                buildRoomList(VP, portal.getAdjoiningRoom(), glm::vec2(newMin) / newMin.w, glm::vec2(newMax) / newMax.w);
197
+                buildRoomList(VP, portal.getAdjoiningRoom(), glm::vec2(newMin) / newMin.w,
198
+                              glm::vec2(newMax) / newMax.w);
198
             }
199
             }
199
         }
200
         }
200
     }
201
     }

+ 3
- 3
src/RoomData.cpp View File

56
 
56
 
57
 Portal::Portal(int adj, glm::vec3 n, glm::vec3 v1, glm::vec3 v2, glm::vec3 v3,
57
 Portal::Portal(int adj, glm::vec3 n, glm::vec3 v1, glm::vec3 v2, glm::vec3 v3,
58
                glm::vec3 v4) : adjoiningRoom(adj), normal(n), bbox(v1, v3),
58
                glm::vec3 v4) : adjoiningRoom(adj), normal(n), bbox(v1, v3),
59
-                               bboxNormal(v1 + ((v3 - v1) / 2.0f),
60
-                                          v1 + ((v3 - v1) / 2.0f)
61
-                                             + (normal * 1024.0f)) {
59
+    bboxNormal(v1 + ((v3 - v1) / 2.0f),
60
+               v1 + ((v3 - v1) / 2.0f)
61
+               + (normal * 1024.0f)) {
62
     vert[0] = v1; vert[1] = v2;
62
     vert[0] = v1; vert[1] = v2;
63
     vert[2] = v3; vert[3] = v4;
63
     vert[2] = v3; vert[3] = v4;
64
 }
64
 }

+ 8
- 6
src/TextureManager.cpp View File

147
     orAssertGreaterThan(width, 0);
147
     orAssertGreaterThan(width, 0);
148
     orAssertGreaterThan(height, 0);
148
     orAssertGreaterThan(height, 0);
149
     orAssert((mode == ColorMode::RGB)
149
     orAssert((mode == ColorMode::RGB)
150
-           || (mode == ColorMode::BGR)
151
-           || (mode == ColorMode::ARGB)
152
-           || (mode == ColorMode::RGBA)
153
-           || (mode ==  ColorMode::BGRA));
150
+             || (mode == ColorMode::BGR)
151
+             || (mode == ColorMode::ARGB)
152
+             || (mode == ColorMode::RGBA)
153
+             || (mode ==  ColorMode::BGRA));
154
     orAssert((bpp == 8) || (bpp == 24) || (bpp == 32));
154
     orAssert((bpp == 8) || (bpp == 24) || (bpp == 32));
155
 
155
 
156
     if (slot < 0)
156
     if (slot < 0)
189
 
189
 
190
     gl::glPixelStorei(gl::GL_UNPACK_ALIGNMENT, 1);
190
     gl::glPixelStorei(gl::GL_UNPACK_ALIGNMENT, 1);
191
     bindTexture(slot, s);
191
     bindTexture(slot, s);
192
-    gl::glTexImage2D(gl::GL_TEXTURE_2D, 0, gl::GLint(gl::GL_RGBA), width, height, 0, glcMode, gl::GL_UNSIGNED_BYTE, image);
192
+    gl::glTexImage2D(gl::GL_TEXTURE_2D, 0, gl::GLint(gl::GL_RGBA), width, height, 0, glcMode,
193
+                     gl::GL_UNSIGNED_BYTE, image);
193
 
194
 
194
     if (filter) {
195
     if (filter) {
195
         // Trilinear filtering
196
         // Trilinear filtering
196
         gl::glTexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_WRAP_S, gl::GLint(gl::GL_REPEAT));
197
         gl::glTexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_WRAP_S, gl::GLint(gl::GL_REPEAT));
197
         gl::glTexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_WRAP_T, gl::GLint(gl::GL_REPEAT));
198
         gl::glTexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_WRAP_T, gl::GLint(gl::GL_REPEAT));
198
         gl::glTexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_MAG_FILTER, gl::GLint(gl::GL_LINEAR));
199
         gl::glTexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_MAG_FILTER, gl::GLint(gl::GL_LINEAR));
199
-        gl::glTexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_MIN_FILTER, gl::GLint(gl::GL_LINEAR_MIPMAP_LINEAR));
200
+        gl::glTexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_MIN_FILTER,
201
+                            gl::GLint(gl::GL_LINEAR_MIPMAP_LINEAR));
200
         gl::glGenerateMipmap(gl::GL_TEXTURE_2D);
202
         gl::glGenerateMipmap(gl::GL_TEXTURE_2D);
201
     } else {
203
     } else {
202
         gl::glTexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_MIN_FILTER, gl::GLint(gl::GL_NEAREST));
204
         gl::glTexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_MIN_FILTER, gl::GLint(gl::GL_NEAREST));

+ 12
- 6
src/UI.cpp View File

513
 
513
 
514
     gl::glBindBuffer(gl::GL_ARRAY_BUFFER, vboHandle);
514
     gl::glBindBuffer(gl::GL_ARRAY_BUFFER, vboHandle);
515
 
515
 
516
-    gl::glVertexAttribPointer(attribPos, 2, gl::GL_FLOAT, gl::GL_FALSE, sizeof(ImDrawVert), OFFSETOF(ImDrawVert, pos));
517
-    gl::glVertexAttribPointer(attribUV, 2, gl::GL_FLOAT, gl::GL_FALSE, sizeof(ImDrawVert), OFFSETOF(ImDrawVert, uv));
518
-    gl::glVertexAttribPointer(attribCol, 4, gl::GL_UNSIGNED_BYTE, gl::GL_TRUE, sizeof(ImDrawVert), OFFSETOF(ImDrawVert, col));
516
+    gl::glVertexAttribPointer(attribPos, 2, gl::GL_FLOAT, gl::GL_FALSE, sizeof(ImDrawVert),
517
+                              OFFSETOF(ImDrawVert, pos));
518
+    gl::glVertexAttribPointer(attribUV, 2, gl::GL_FLOAT, gl::GL_FALSE, sizeof(ImDrawVert),
519
+                              OFFSETOF(ImDrawVert, uv));
520
+    gl::glVertexAttribPointer(attribCol, 4, gl::GL_UNSIGNED_BYTE, gl::GL_TRUE, sizeof(ImDrawVert),
521
+                              OFFSETOF(ImDrawVert, col));
519
 
522
 
520
     imguiShader.use();
523
     imguiShader.use();
521
     imguiShader.loadUniform(0, Window::getSize());
524
     imguiShader.loadUniform(0, Window::getSize());
525
         const ImDrawIdx* idx_buffer_offset = 0;
528
         const ImDrawIdx* idx_buffer_offset = 0;
526
 
529
 
527
         gl::glBindBuffer(gl::GL_ARRAY_BUFFER, vboHandle);
530
         gl::glBindBuffer(gl::GL_ARRAY_BUFFER, vboHandle);
528
-        gl::glBufferData(gl::GL_ARRAY_BUFFER, cmd_list->VtxBuffer.size() * sizeof(ImDrawVert), &cmd_list->VtxBuffer.front(), gl::GL_STREAM_DRAW);
531
+        gl::glBufferData(gl::GL_ARRAY_BUFFER, cmd_list->VtxBuffer.size() * sizeof(ImDrawVert),
532
+                         &cmd_list->VtxBuffer.front(), gl::GL_STREAM_DRAW);
529
 
533
 
530
         gl::glBindBuffer(gl::GL_ELEMENT_ARRAY_BUFFER, elementHandle);
534
         gl::glBindBuffer(gl::GL_ELEMENT_ARRAY_BUFFER, elementHandle);
531
-        gl::glBufferData(gl::GL_ELEMENT_ARRAY_BUFFER, cmd_list->IdxBuffer.size() * sizeof(ImDrawIdx), &cmd_list->IdxBuffer.front(), gl::GL_STREAM_DRAW);
535
+        gl::glBufferData(gl::GL_ELEMENT_ARRAY_BUFFER, cmd_list->IdxBuffer.size() * sizeof(ImDrawIdx),
536
+                         &cmd_list->IdxBuffer.front(), gl::GL_STREAM_DRAW);
532
 
537
 
533
-        for (const ImDrawCmd* pcmd = cmd_list->CmdBuffer.begin(); pcmd != cmd_list->CmdBuffer.end(); pcmd++) {
538
+        for (const ImDrawCmd* pcmd = cmd_list->CmdBuffer.begin(); pcmd != cmd_list->CmdBuffer.end();
539
+             pcmd++) {
534
             if (pcmd->UserCallback) {
540
             if (pcmd->UserCallback) {
535
                 pcmd->UserCallback(cmd_list, pcmd);
541
                 pcmd->UserCallback(cmd_list, pcmd);
536
                 Log::get(LOG_INFO) << "renderImGui: did not draw (Callback)" << Log::endl;
542
                 Log::get(LOG_INFO) << "renderImGui: did not draw (Callback)" << Log::endl;

+ 1
- 1
src/main.cpp View File

94
     // Register global OpenGL after-callback for all GL functions except glGetError
94
     // Register global OpenGL after-callback for all GL functions except glGetError
95
     glbinding::setCallbackMaskExcept(glbinding::CallbackMask::After
95
     glbinding::setCallbackMaskExcept(glbinding::CallbackMask::After
96
                                      | glbinding::CallbackMask::ParametersAndReturnValue,
96
                                      | glbinding::CallbackMask::ParametersAndReturnValue,
97
-                                     { "glGetError" });
97
+    { "glGetError" });
98
     glbinding::setAfterCallback(glErrorCallback);
98
     glbinding::setAfterCallback(glErrorCallback);
99
     glbinding::setUnresolvedCallback(glUnresolvedCallback);
99
     glbinding::setUnresolvedCallback(glUnresolvedCallback);
100
 #endif
100
 #endif

+ 9
- 5
src/system/Shader.cpp View File

68
     gl::glGenRenderbuffers(1, &depth);
68
     gl::glGenRenderbuffers(1, &depth);
69
     gl::glBindRenderbuffer(gl::GL_RENDERBUFFER, depth);
69
     gl::glBindRenderbuffer(gl::GL_RENDERBUFFER, depth);
70
     gl::glRenderbufferStorage(gl::GL_RENDERBUFFER, gl::GL_DEPTH_COMPONENT, width, height);
70
     gl::glRenderbufferStorage(gl::GL_RENDERBUFFER, gl::GL_DEPTH_COMPONENT, width, height);
71
-    gl::glFramebufferRenderbuffer(gl::GL_FRAMEBUFFER, gl::GL_DEPTH_ATTACHMENT, gl::GL_RENDERBUFFER, depth);
71
+    gl::glFramebufferRenderbuffer(gl::GL_FRAMEBUFFER, gl::GL_DEPTH_ATTACHMENT, gl::GL_RENDERBUFFER,
72
+                                  depth);
72
 
73
 
73
     gl::glFramebufferTexture(gl::GL_FRAMEBUFFER, gl::GL_COLOR_ATTACHMENT0,
74
     gl::glFramebufferTexture(gl::GL_FRAMEBUFFER, gl::GL_COLOR_ATTACHMENT0,
74
-                         TextureManager::getTextureID(texture, TextureStorage::SYSTEM), 0);
75
+                             TextureManager::getTextureID(texture, TextureStorage::SYSTEM), 0);
75
 
76
 
76
     gl::GLenum drawBuffer = gl::GL_COLOR_ATTACHMENT0;
77
     gl::GLenum drawBuffer = gl::GL_COLOR_ATTACHMENT0;
77
     gl::glDrawBuffers(1, &drawBuffer);
78
     gl::glDrawBuffers(1, &drawBuffer);
142
 void Shader::loadUniform(int uni, int texture, TextureStorage store) {
143
 void Shader::loadUniform(int uni, int texture, TextureStorage store) {
143
     if ((Render::getMode() == RenderMode::Solid)
144
     if ((Render::getMode() == RenderMode::Solid)
144
         && (store == TextureStorage::GAME)) {
145
         && (store == TextureStorage::GAME)) {
145
-        gl::glUniform1i(getUniform(uni), TextureManager::bindTexture(TEXTURE_SPLASH, TextureStorage::SYSTEM));
146
+        gl::glUniform1i(getUniform(uni), TextureManager::bindTexture(TEXTURE_SPLASH,
147
+                        TextureStorage::SYSTEM));
146
     } else {
148
     } else {
147
         gl::glUniform1i(getUniform(uni), TextureManager::bindTexture(texture, store));
149
         gl::glUniform1i(getUniform(uni), TextureManager::bindTexture(texture, store));
148
     }
150
     }
285
     if (colorShader.addUniform("MVP") < 0)
287
     if (colorShader.addUniform("MVP") < 0)
286
         return -5;
288
         return -5;
287
 
289
 
288
-    if (transformedColorShader.compile(transformedColorShaderVertex, transformedColorShaderFragment) < 0)
290
+    if (transformedColorShader.compile(transformedColorShaderVertex,
291
+                                       transformedColorShaderFragment) < 0)
289
         return -6;
292
         return -6;
290
 
293
 
291
     return 0;
294
     return 0;
347
     drawGLOnly(indices, MVP, texture, store, mode, target, shader);
350
     drawGLOnly(indices, MVP, texture, store, mode, target, shader);
348
 }
351
 }
349
 
352
 
350
-void Shader::drawGLBuffer(std::vector<glm::vec3>& vertices, std::vector<glm::vec2>& uvs, Shader& shader) {
353
+void Shader::drawGLBuffer(std::vector<glm::vec3>& vertices, std::vector<glm::vec2>& uvs,
354
+                          Shader& shader) {
351
     shader.vertexBuffer.bufferData(vertices);
355
     shader.vertexBuffer.bufferData(vertices);
352
     shader.otherBuffer.bufferData(uvs);
356
     shader.otherBuffer.bufferData(uvs);
353
 }
357
 }

Loading…
Cancel
Save