Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
print(f'{len(vertices) // 33:,} TRIANGLES')
print(f'{len(vertices) * 4 // 1024:,}KB')
print('import took {:.2f} seconds'.format(time.time() - start_import))
# STATIC BUFFER (UTILITIES)
# Skybox, 3D grid, Origin Point
# Editor Props (playerspawn, lights, sprite, path_track)
CAMERA = camera.freecam((160, -160, 160), None, 128)
render_solids = [s for s in solids if (s.center - CAMERA.position).sqrmagnitude() < 1024]
rendered_ray = []
SDL_SetRelativeMouseMode(SDL_TRUE)
SDL_CaptureMouse(SDL_TRUE)
mousepos = vector.vec2(-180, 120) # overrides start angle
keys = []
tickrate = 1 / 0.015
old_time = time.time()
event = SDL_Event()
while True:
while SDL_PollEvent(ctypes.byref(event)) != 0:
if event.type == SDL_QUIT or event.key.keysym.sym == SDLK_ESCAPE and event.type == SDL_KEYDOWN:
SDL_GL_DeleteContext(glContext)
SDL_DestroyWindow(window)
SDL_Quit()
return False
if event.type == SDL_KEYDOWN:
if event.key.keysym.sym not in keys:
keys.append(event.key.keysym.sym)
if event.type == SDL_KEYUP:
SDL_DestroyWindow(window)
SDL_Quit()
return False
if event.type == SDL_KEYDOWN:
if event.key.keysym.sym not in keys:
keys.append(event.key.keysym.sym)
if event.type == SDL_KEYUP:
while event.key.keysym.sym in keys:
keys.remove(event.key.keysym.sym)
if event.type == SDL_MOUSEBUTTONDOWN:
keys.append(event.button.button)
if event.type == SDL_MOUSEBUTTONUP:
while event.button.button in keys:
keys.remove(event.button.button)
if event.type == SDL_MOUSEMOTION:
mousepos += vector.vec2(event.motion.xrel, event.motion.yrel)
SDL_WarpMouseInWindow(window, width // 2, height // 2)
if event.type == SDL_MOUSEWHEEL:
if CAMERA.speed + event.wheel.y * 32 > 0: # speed limits
CAMERA.speed += event.wheel.y * 32
if event.type == SDL_DROPFILE:
# load event.drop.file
# .vmf -> new tab
# .lin / .prt -> match to vmf
pass
dt = time.time() - old_time
while dt >= 1 / tickrate:
# use KEYTIME to delay input repeat
# KEYTIME
CAMERA.update(mousepos, keys, 1 / tickrate)
render_solids = [s for s in solids if (s.center - CAMERA.position).magnitude() < 2048]
SDL_DestroyWindow(window)
SDL_Quit()
return False
if event.type == SDL_KEYDOWN:
if event.key.keysym.sym not in keys:
keys.append(event.key.keysym.sym)
if event.type == SDL_KEYUP:
while event.key.keysym.sym in keys:
keys.remove(event.key.keysym.sym)
if event.type == SDL_MOUSEBUTTONDOWN:
keys.append(event.button.button)
if event.type == SDL_MOUSEBUTTONUP:
while event.button.button in keys:
keys.remove(event.button.button)
if event.type == SDL_MOUSEMOTION:
mousepos += vector.vec2(event.motion.xrel, event.motion.yrel)
SDL_WarpMouseInWindow(window, width // 2, height // 2)
if event.type == SDL_MOUSEWHEEL:
if CAMERA.speed + event.wheel.y * 32 > 0: # speed limits
CAMERA.speed += event.wheel.y * 32
if event.type == SDL_DROPFILE:
# load event.drop.file
# .vmf -> new tab
# .lin / .prt -> match to vmf
pass
dt = time.time() - old_time
while dt >= 1 / tickrate:
# use KEYTIME to delay input repeat
# KEYTIME
# KEYTIME_COOLDOWN (time since key pressed with a limit of X seconds)
CAMERA.update(mousepos, keys, 1 / tickrate)
print(f'{len(solids)} brushes loaded succesfully!')
print('import took {:.2f} seconds'.format(time.time() - start_import))
# STATIC BUFFER (UTILITIES)
# Skybox, 3D grid, Origin Point
# Editor Props (playerspawn, lights, sprite, path_track)
CAMERA = camera.freecam(None, None, 128)
render_solids = [s for s in solids if (s.center - CAMERA.position).sqrmagnitude() < 1024]
rendered_ray = []
SDL_SetRelativeMouseMode(SDL_TRUE)
SDL_CaptureMouse(SDL_TRUE)
mousepos = vector.vec2()
keys = []
window_managers = {9: 'ANDROID', # Linux Mobile
4: 'COCOA', # OSX
3: 'DIRECTFB', # Linux
7: 'MIR', # Linux
11: 'OS2', # OS/2, PS/2, ArcaOS
5: 'UIKIT', # iOS (special GL requirements)
0: 'UNKNOWN',
10: 'VIVANTE', # Some Embedded GPUs
6: 'WAYLAND', # Linux
1: 'WINDOWS',
8: 'WINRT', # Windows ARM / Embedded
2: 'X11'} # Linux
# Ubuntu 16.04: UNKNOWN