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,7 +33,8 @@ bool BoundingBox::inBox(glm::vec3 p) {
33 33
 }
34 34
 
35 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 40
 void BoundingBox::display(glm::mat4 VP, glm::vec3 colorLine, glm::vec3 colorDot) {

+ 2
- 1
src/Mesh.cpp View File

@@ -141,6 +141,7 @@ void Mesh::display(glm::mat4 MVP, ShaderTexture* shaderTexture) {
141 141
     }
142 142
 
143 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,7 +163,7 @@ void Render::buildRoomList(glm::mat4 VP, int room, glm::vec2 min, glm::vec2 max)
163 163
 
164 164
             // Check if the portal lies behind the player
165 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 167
                 continue;
168 168
             }
169 169
 
@@ -174,7 +174,7 @@ void Render::buildRoomList(glm::mat4 VP, int room, glm::vec2 min, glm::vec2 max)
174 174
 
175 175
             // Check if the portal intersects the portal leading into this room
176 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 178
                 continue;
179 179
             }
180 180
 
@@ -194,7 +194,8 @@ void Render::buildRoomList(glm::mat4 VP, int room, glm::vec2 min, glm::vec2 max)
194 194
 
195 195
             // ...only render it if it is not
196 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,9 +56,9 @@ bool Portal::showBoundingBox = false;
56 56
 
57 57
 Portal::Portal(int adj, glm::vec3 n, glm::vec3 v1, glm::vec3 v2, glm::vec3 v3,
58 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 62
     vert[0] = v1; vert[1] = v2;
63 63
     vert[2] = v3; vert[3] = v4;
64 64
 }

+ 8
- 6
src/TextureManager.cpp View File

@@ -147,10 +147,10 @@ int TextureManager::loadBufferSlot(unsigned char* image,
147 147
     orAssertGreaterThan(width, 0);
148 148
     orAssertGreaterThan(height, 0);
149 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 154
     orAssert((bpp == 8) || (bpp == 24) || (bpp == 32));
155 155
 
156 156
     if (slot < 0)
@@ -189,14 +189,16 @@ int TextureManager::loadBufferSlot(unsigned char* image,
189 189
 
190 190
     gl::glPixelStorei(gl::GL_UNPACK_ALIGNMENT, 1);
191 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 195
     if (filter) {
195 196
         // Trilinear filtering
196 197
         gl::glTexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_WRAP_S, gl::GLint(gl::GL_REPEAT));
197 198
         gl::glTexParameteri(gl::GL_TEXTURE_2D, gl::GL_TEXTURE_WRAP_T, gl::GLint(gl::GL_REPEAT));
198 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 202
         gl::glGenerateMipmap(gl::GL_TEXTURE_2D);
201 203
     } else {
202 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,9 +513,12 @@ void UI::renderImGui(ImDrawData* draw_data) {
513 513
 
514 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 523
     imguiShader.use();
521 524
     imguiShader.loadUniform(0, Window::getSize());
@@ -525,12 +528,15 @@ void UI::renderImGui(ImDrawData* draw_data) {
525 528
         const ImDrawIdx* idx_buffer_offset = 0;
526 529
 
527 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 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 540
             if (pcmd->UserCallback) {
535 541
                 pcmd->UserCallback(cmd_list, pcmd);
536 542
                 Log::get(LOG_INFO) << "renderImGui: did not draw (Callback)" << Log::endl;

+ 1
- 1
src/main.cpp View File

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

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

@@ -68,10 +68,11 @@ ShaderTexture::ShaderTexture(int w, int h) : width(w), height(h) {
68 68
     gl::glGenRenderbuffers(1, &depth);
69 69
     gl::glBindRenderbuffer(gl::GL_RENDERBUFFER, depth);
70 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 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 77
     gl::GLenum drawBuffer = gl::GL_COLOR_ATTACHMENT0;
77 78
     gl::glDrawBuffers(1, &drawBuffer);
@@ -142,7 +143,8 @@ void Shader::loadUniform(int uni, glm::mat4 mat) {
142 143
 void Shader::loadUniform(int uni, int texture, TextureStorage store) {
143 144
     if ((Render::getMode() == RenderMode::Solid)
144 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 148
     } else {
147 149
         gl::glUniform1i(getUniform(uni), TextureManager::bindTexture(texture, store));
148 150
     }
@@ -285,7 +287,8 @@ int Shader::initialize() {
285 287
     if (colorShader.addUniform("MVP") < 0)
286 288
         return -5;
287 289
 
288
-    if (transformedColorShader.compile(transformedColorShaderVertex, transformedColorShaderFragment) < 0)
290
+    if (transformedColorShader.compile(transformedColorShaderVertex,
291
+                                       transformedColorShaderFragment) < 0)
289 292
         return -6;
290 293
 
291 294
     return 0;
@@ -347,7 +350,8 @@ void Shader::drawGL(std::vector<glm::vec3>& vertices, std::vector<glm::vec2>& uv
347 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 355
     shader.vertexBuffer.bufferData(vertices);
352 356
     shader.otherBuffer.bufferData(uvs);
353 357
 }

Loading…
Cancel
Save