mirror of
https://github.com/raysan5/raylib.git
synced 2026-08-25 13:48:27 -04:00
Compare commits
3 Commits
1893226cb7
...
079cc2df09
| Author | SHA1 | Date | |
|---|---|---|---|
| 079cc2df09 | |||
| 388806f24d | |||
| b0005129c7 |
@ -68,7 +68,7 @@ int main(void)
|
|||||||
SetShaderValue(shadowShader, lightDirLoc, &lightDir, SHADER_UNIFORM_VEC3);
|
SetShaderValue(shadowShader, lightDirLoc, &lightDir, SHADER_UNIFORM_VEC3);
|
||||||
SetShaderValue(shadowShader, lightColLoc, &lightColorNormalized, SHADER_UNIFORM_VEC4);
|
SetShaderValue(shadowShader, lightColLoc, &lightColorNormalized, SHADER_UNIFORM_VEC4);
|
||||||
int ambientLoc = GetShaderLocation(shadowShader, "ambient");
|
int ambientLoc = GetShaderLocation(shadowShader, "ambient");
|
||||||
float ambient[4] = {0.1f, 0.1f, 0.1f, 1.0f};
|
float ambient[4] = { 0.1f, 0.1f, 0.1f, 1.0f };
|
||||||
SetShaderValue(shadowShader, ambientLoc, ambient, SHADER_UNIFORM_VEC4);
|
SetShaderValue(shadowShader, ambientLoc, ambient, SHADER_UNIFORM_VEC4);
|
||||||
int lightVPLoc = GetShaderLocation(shadowShader, "lightVP");
|
int lightVPLoc = GetShaderLocation(shadowShader, "lightVP");
|
||||||
int shadowMapLoc = GetShaderLocation(shadowShader, "shadowMap");
|
int shadowMapLoc = GetShaderLocation(shadowShader, "shadowMap");
|
||||||
@ -81,7 +81,7 @@ int main(void)
|
|||||||
for (int i = 0; i < robot.materialCount; i++) robot.materials[i].shader = shadowShader;
|
for (int i = 0; i < robot.materialCount; i++) robot.materials[i].shader = shadowShader;
|
||||||
|
|
||||||
int animCount = 0;
|
int animCount = 0;
|
||||||
ModelAnimation *anims = LoadModelAnimations("resources/models/robot.glb", &animCount);
|
ModelAnimation* anims = LoadModelAnimations("resources/models/robot.glb", &animCount);
|
||||||
|
|
||||||
RenderTexture2D shadowMap = LoadShadowmapRenderTexture(SHADOWMAP_RESOLUTION, SHADOWMAP_RESOLUTION);
|
RenderTexture2D shadowMap = LoadShadowmapRenderTexture(SHADOWMAP_RESOLUTION, SHADOWMAP_RESOLUTION);
|
||||||
|
|
||||||
@ -111,9 +111,11 @@ int main(void)
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
float deltaTime = GetFrameTime();
|
float deltaTime = GetFrameTime();
|
||||||
|
|
||||||
|
UpdateCamera(&camera, CAMERA_ORBITAL);
|
||||||
|
|
||||||
|
// send the updated camera position to the shader so that it can calculate the correct lighting for the scene
|
||||||
Vector3 cameraPos = camera.position;
|
Vector3 cameraPos = camera.position;
|
||||||
SetShaderValue(shadowShader, shadowShader.locs[SHADER_LOC_VECTOR_VIEW], &cameraPos, SHADER_UNIFORM_VEC3);
|
SetShaderValue(shadowShader, shadowShader.locs[SHADER_LOC_VECTOR_VIEW], &cameraPos, SHADER_UNIFORM_VEC3);
|
||||||
UpdateCamera(&camera, CAMERA_ORBITAL);
|
|
||||||
|
|
||||||
frameCounter++;
|
frameCounter++;
|
||||||
frameCounter %= (anims[0].keyframeCount);
|
frameCounter %= (anims[0].keyframeCount);
|
||||||
@ -160,6 +162,7 @@ int main(void)
|
|||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
|
|
||||||
lightViewProj = MatrixMultiply(lightView, lightProj);
|
lightViewProj = MatrixMultiply(lightView, lightProj);
|
||||||
|
|
||||||
// PASS 02: Draw the scene into main framebuffer, using the generated shadowmap
|
// PASS 02: Draw the scene into main framebuffer, using the generated shadowmap
|
||||||
|
|||||||
6
src/external/fix_win32_compatibility.h
vendored
6
src/external/fix_win32_compatibility.h
vendored
@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
* fix_win32_compatibility.h Utility to help include windows.h with raylib projects
|
* fix_win32_compatibility.h Utility to help include windows.h with raylib projects
|
||||||
*
|
*
|
||||||
* Useage: #include "fix_win32_compatibility.h" any library that uses windows.h
|
* Usage: #include "fix_win32_compatibility.h" any library that uses windows.h
|
||||||
* order is critical, this must be done before raylib
|
* order is critical, this must be done before raylib
|
||||||
*
|
*
|
||||||
* LICENSE: MIT
|
* LICENSE: MIT
|
||||||
@ -32,7 +32,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// move the windows functions to new names
|
// move the windows functions to new names
|
||||||
// note that you can't call these functions or structures from your code, but you should not neeed to
|
// note that you can't call these functions or structures from your code, but you should not need to
|
||||||
#define CloseWindow CloseWindowWin32
|
#define CloseWindow CloseWindowWin32
|
||||||
#define Rectangle RectangleWin32
|
#define Rectangle RectangleWin32
|
||||||
#define ShowCursor ShowCursorWin32
|
#define ShowCursor ShowCursorWin32
|
||||||
@ -47,7 +47,7 @@
|
|||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
// remove all our redfintions so that raylib can define them properly
|
// remove all our redefinitions so that raylib can define them properly
|
||||||
#undef CloseWindow
|
#undef CloseWindow
|
||||||
#undef Rectangle
|
#undef Rectangle
|
||||||
#undef ShowCursor
|
#undef ShowCursor
|
||||||
|
|||||||
Reference in New Issue
Block a user