Skip to content

Commit 69b9967

Browse files
commented out displacement rendering for now
1 parent c07633d commit 69b9967

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

src/main/python/ui/viewport.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -204,29 +204,29 @@ def paintGL(self):
204204
glVertex(-y, -x)
205205
glEnd()
206206

207-
print('-----')
207+
# print('<<< -- start frame -- >>>')
208208
for shader, params in self.draw_calls.items(): # DRAW CALLS
209-
index_map, vertex_format = params
210-
start, length = index_map
209+
# index_map, vertex_format = params
210+
start, length = params # index_map
211211
glUseProgram(shader)
212212

213-
for a in vertex_format:
214-
if a not in self.active_attribs:
215-
glEnableVertexAttribArray(a)
216-
self.active_attribs.append(a)
217-
print("added", a)
218-
for a in self.active_attribs[::]:
219-
if a not in vertex_format:
220-
glDisableVertexAttribArray(a)
221-
self.active_attribs.remove(a)
222-
print("removed", a)
213+
# for a in vertex_format:
214+
# if a not in self.active_attribs:
215+
# glEnableVertexAttribArray(a)
216+
# self.active_attribs.append(a)
217+
# print("added", a)
218+
# for a in self.active_attribs[::]:
219+
# if a not in vertex_format:
220+
# glDisableVertexAttribArray(a)
221+
# self.active_attribs.remove(a)
222+
# print("removed", a)
223223

224224
if self.GLES_MODE == True:
225225
# plug the MVP matrix into the current shader
226226
glUniformMatrix4fv(self.uniforms[shader], 1, GL_FALSE, matrix)
227227

228228
glDrawElements(GL_TRIANGLES, length, GL_UNSIGNED_INT, GLvoidp(start))
229-
print("drew")
229+
# print("<<< draw call done >>>")
230230

231231

232232
def resizeGL(self, width, height):

src/main/python/utilities/render.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ def vmf_setup(viewport, vmf_object, ctx):
107107
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, INDEX_BUFFER)
108108
glBufferData(GL_ELEMENT_ARRAY_BUFFER, len(indices) * 4,
109109
np.array(indices, dtype=np.uint32), GL_STATIC_DRAW)
110-
print("buffers pushed to GPU")
111110
# Vertex Format
112111
max_attribs = glGetIntegerv(GL_MAX_VERTEX_ATTRIBS)
113112
glEnableVertexAttribArray(0) # vertex_position
@@ -121,22 +120,20 @@ def vmf_setup(viewport, vmf_object, ctx):
121120
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 44, GLvoidp(24))
122121
glEnableVertexAttribArray(3) # editor_colour
123122
glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, 44, GLvoidp(32))
124-
print("attribs assembled")
125123

126124
# keep handles to the new GL objects
127125
# dictionaries might be more convenient
128126
viewport.buffers = [VERTEX_BUFFER, INDEX_BUFFER]
129127
viewport.programs = [program_flat_brush, program_flat_displacement,
130128
program_stripey_brush]
131129
# brushes
132-
brush_format = (0, 1, 2, 3)
133-
viewport.draw_calls[viewport.programs[0]] = ((0, brush_len), brush_format)
130+
# brush_format = (0, 1, 2, 3)
131+
viewport.draw_calls[viewport.programs[0]] = (0, brush_len) #, brush_format)
134132
# displacements
135-
disp_format = (0, 4, 2, 3)
136-
viewport.draw_calls[viewport.programs[1]] = ((brush_len + 1, disp_len), disp_format)
137-
viewport.GLES_MODE = GLES_MODE
133+
# disp_format = (0, 4, 2, 3)
134+
# viewport.draw_calls[viewport.programs[1]] = ((brush_len + 1, disp_len), disp_format)
135+
# viewport.GLES_MODE = GLES_MODE
138136
if GLES_MODE:
139137
viewport.uniforms = {program_flat_brush: uniform_brush_matrix,
140138
program_stripey_brush: uniform_stripey_matrix,
141139
program_flat_displacement: uniform_displacement_matrix}
142-
print("draw calls assembled")

src/main/python/utilities/solid.py

+4
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ def __init__(self, solid_namespace): # THIS IS FOR IMPORTING FROM VMF
199199
print(start)
200200
print(quad)
201201
raise RuntimeError("Couldn't find start of displacement! (side id {})".format(side.id))
202+
# this error seems to come from rounding errors
203+
# fix solids with vertices off grid by .1e-16
204+
# then this will catch poorly saved disps instead
205+
# .vmfs seem to stick to a .2f accuracy
202206
side_dispverts = []
203207
A, B, C, D = quad
204208
DA = D - A

0 commit comments

Comments
 (0)