time[0] = rl.GetTime() rl.SetShaderValue(shader, timeLoc, time, rl.UNIFORM_FLOAT) #//---------------------------------------------------------------------------------- #// Draw #//---------------------------------------------------------------------------------- rl.BeginDrawing() rl.ClearBackground(RAYWHITE) rl.BeginShaderMode( shader) #// Enable our custom shader for next shapes/textures drawings rl.DrawTexture( texture, 0, 0, WHITE) #// Drawing BLANK texture, all magic happens on shader rl.EndShaderMode() #// Disable our custom shader, return to default shader rl.DrawText(b"BACKGROUND is PAINTED and ANIMATED on SHADER!", 10, 10, 20, MAROON) rl.EndDrawing() #//---------------------------------------------------------------------------------- #// De-Initialization #//-------------------------------------------------------------------------------------- rl.UnloadTexture(texture) #// Unload the texture rl.CloseWindow() #// Close window and OpenGL context
rl.GetShaderLocation(skybox.materials[0].shader, b"environmentMap"), ffi.new('int[]', [rl.MAP_CUBEMAP]), rl.UNIFORM_INT) shdrCubemap = rl.LoadShader(b'resources/shaders/cubemap.vs', b'resources/shaders/cubemap.fs') rl.SetShaderValue(shdrCubemap, rl.GetShaderLocation(shdrCubemap, b'equirectangularMap'), ffi.new('int[]', [0]), rl.UNIFORM_INT) texHDR = rl.LoadTexture(b'resources/dresden_square.hdr') skybox.materials[0].maps[rl.MAP_CUBEMAP].texture = rl.GenTextureCubemap( shdrCubemap, texHDR, 512, rl.UNCOMPRESSED_R32G32B32) rl.UnloadTexture(texHDR) rl.UnloadShader(shdrCubemap) rl.SetCameraMode(camera[0], rl.CAMERA_FIRST_PERSON) rl.SetTargetFPS(60) while not rl.WindowShouldClose(): rl.UpdateCamera(camera) rl.BeginDrawing() rl.ClearBackground(RAYWHITE) rl.BeginMode3D(camera[0]) rl.DrawModel(skybox, [0, 0, 0], 1.0, WHITE) rl.DrawGrid(10, 1.0) for x in range(10): for y in range(10):
ffi.new('float[]', [camera.position.x]), rl.UNIFORM_VEC3) rl.BeginDrawing() rl.ClearBackground([int(255 * i) for i in fog_color]) rl.BeginMode3D(camera[0]) rl.DrawModel(model, [0] * 3, 1, WHITE) rl.DrawModel(model2, [-2.6, 0, 0], 1, WHITE) rl.DrawModel(model3, [2.6, 0, 0], 1, WHITE) for i in range(-20, 20, 2): rl.DrawModel(model, [i, 0, 2], 1, WHITE) rl.DrawGizmo([1000, 1000, 1000]) rl.EndMode3D() rl.DrawFPS(10, 10) rl.DrawText(f'Up/Down to change fog density: {fogDensity}'.encode('utf-8'), 10, 30, 20, WHITE) rl.EndDrawing() rl.CloseWindow() rl.UnloadModel(model) rl.UnloadModel(model2) rl.UnloadModel(model3) rl.UnloadTexture(texture) rl.UnloadShader(shader)