diff options
Diffstat (limited to 'examples/shaders_standard_lighting.lua')
| -rw-r--r-- | examples/shaders_standard_lighting.lua | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/examples/shaders_standard_lighting.lua b/examples/shaders_standard_lighting.lua index 7c354d54..2f3700ff 100644 --- a/examples/shaders_standard_lighting.lua +++ b/examples/shaders_standard_lighting.lua @@ -27,9 +27,9 @@ InitWindow(screenWidth, screenHeight, "raylib [shaders] example - model shader") -- Define the camera to look into our 3d world local camera = Camera(Vector3(4.0, 4.0, 4.0), Vector3(0.0, 1.5, 0.0), Vector3(0.0, 1.0, 0.0), 45.0) -local position = Vector3(0.0, 0.0, 0.0) -- Set model position local dwarf = LoadModel("resources/model/dwarf.obj") -- Load OBJ model +local position = Vector3(0.0, 0.0, 0.0) -- Set model position local material = LoadStandardMaterial() @@ -37,30 +37,30 @@ material.texDiffuse = LoadTexture("resources/model/dwarf_diffuse.png") -- Load material.texNormal = LoadTexture("resources/model/dwarf_normal.png") -- Load model normal texture material.texSpecular = LoadTexture("resources/model/dwarf_specular.png") -- Load model specular texture material.colDiffuse = WHITE -material.colAmbient = (Color)(0, 0, 10, 255) +material.colAmbient = Color(0, 0, 10, 255) material.colSpecular = WHITE material.glossiness = 50.0 dwarf.material = material -- Apply material to model -local spotLight = CreateLight(LIGHT_SPOT, (Vector3)(3.0, 5.0, 2.0), (Color)(255, 255, 255, 255)) -spotLight.target = (Vector3)(0.0, 0.0, 0.0) +local spotLight = CreateLight(LightType.SPOT, Vector3(3.0, 5.0, 2.0), Color(255, 255, 255, 255)) +spotLight.target = Vector3(0.0, 0.0, 0.0) spotLight.intensity = 2.0 -spotLight.diffuse = (Color)(255, 100, 100, 255) +spotLight.diffuse = Color(255, 100, 100, 255) spotLight.coneAngle = 60.0 -local dirLight = CreateLight(LIGHT_DIRECTIONAL, (Vector3)(0.0, -3.0, -3.0), (Color)(255, 255, 255, 255)) -dirLight.target = (Vector3)(1.0, -2.0, -2.0) +local dirLight = CreateLight(LightType.DIRECTIONAL, Vector3(0.0, -3.0, -3.0), Color(255, 255, 255, 255)) +dirLight.target = Vector3(1.0, -2.0, -2.0) dirLight.intensity = 2.0 -dirLight.diffuse = (Color)(100, 255, 100, 255) +dirLight.diffuse = Color(100, 255, 100, 255) -local pointLight = CreateLight(LIGHT_POINT, (Vector3)(0.0, 4.0, 5.0), (Color)(255, 255, 255, 255)) +local pointLight = CreateLight(LightType.POINT, Vector3(0.0, 4.0, 5.0), Color(255, 255, 255, 255)) pointLight.intensity = 2.0 -pointLight.diffuse = (Color)(100, 100, 255, 255) +pointLight.diffuse = Color(100, 100, 255, 255) pointLight.radius = 3.0 -- Setup orbital camera -SetCameraMode(CameraMode.ORBITAL) -- Set an orbital camera mode +SetCameraMode(CameraMode.ORBITAL) -- Set an orbital camera mode SetCameraPosition(camera.position) -- Set internal camera position to match our camera position SetCameraTarget(camera.target) -- Set internal camera target to match our camera target @@ -71,7 +71,7 @@ SetTargetFPS(60) -- Set our game to run at 60 frames-per-s while not WindowShouldClose() do -- Detect window close button or ESC key -- Update --------------------------------------------------------------------------------------- - UpdateCamera(camera) -- Update internal camera and our camera + camera = UpdateCamera(camera) -- Update internal camera and our camera --------------------------------------------------------------------------------------- -- Draw |
