mirror of
https://github.com/raysan5/raylib.git
synced 2026-04-10 01:09:10 -04:00
Compare commits
5 Commits
da9e881092
...
8783e66e21
| Author | SHA1 | Date | |
|---|---|---|---|
| 8783e66e21 | |||
| 7ae46fb2e6 | |||
| 04c5dc4493 | |||
| bca4f83a02 | |||
| 7fef65a3fe |
@ -37,6 +37,7 @@ struct Light {
|
||||
uniform Light lights[MAX_LIGHTS];
|
||||
uniform vec4 ambient;
|
||||
uniform vec3 viewPos;
|
||||
uniform vec4 fogColor;
|
||||
uniform float fogDensity;
|
||||
|
||||
void main()
|
||||
@ -77,10 +78,6 @@ void main()
|
||||
// Fog calculation
|
||||
float dist = length(viewPos - fragPosition);
|
||||
|
||||
// these could be parameters...
|
||||
const vec4 fogColor = vec4(0.5, 0.5, 0.5, 1.0);
|
||||
//const float fogDensity = 0.16;
|
||||
|
||||
// Exponential fog
|
||||
float fogFactor = 1.0/exp((dist*fogDensity)*(dist*fogDensity));
|
||||
|
||||
|
||||
@ -72,8 +72,13 @@ int main(void)
|
||||
shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos");
|
||||
|
||||
// Ambient light level
|
||||
Vector4 ambient = (Vector4){ 0.2f, 0.2f, 0.2f, 1.0f };
|
||||
int ambientLoc = GetShaderLocation(shader, "ambient");
|
||||
SetShaderValue(shader, ambientLoc, (float[4]){ 0.2f, 0.2f, 0.2f, 1.0f }, SHADER_UNIFORM_VEC4);
|
||||
SetShaderValue(shader, ambientLoc, &ambient, SHADER_UNIFORM_VEC4);
|
||||
|
||||
Vector4 fogColor = ColorNormalize(GRAY);
|
||||
int fogColorLoc = GetShaderLocation(shader, "fogColor");
|
||||
SetShaderValue(shader, fogColorLoc, &fogColor, SHADER_UNIFORM_VEC4);
|
||||
|
||||
float fogDensity = 0.15f;
|
||||
int fogDensityLoc = GetShaderLocation(shader, "fogDensity");
|
||||
|
||||
2358
src/external/rlsw.h
vendored
2358
src/external/rlsw.h
vendored
File diff suppressed because it is too large
Load Diff
10
src/rcore.c
10
src/rcore.c
@ -682,6 +682,16 @@ void InitWindow(int width, int height, const char *title)
|
||||
TRACELOG(LOG_WARNING, "SYSTEM: Failed to initialize platform");
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize render dimensions for embedded platforms
|
||||
// NOTE: On desktop platforms (GLFW, SDL, etc.), CORE.Window.render.width/height are set during window creation
|
||||
// On embedded platforms with no window manager, InitPlatform() doesn't set these values, so they should be initialized
|
||||
// here from screen dimensions (which are set from the InitWindow parameters)
|
||||
if ((CORE.Window.render.width == 0) || (CORE.Window.render.height == 0))
|
||||
{
|
||||
CORE.Window.render.width = CORE.Window.screen.width;
|
||||
CORE.Window.render.height = CORE.Window.screen.height;
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
|
||||
// Initialize rlgl default data (buffers and shaders)
|
||||
|
||||
Reference in New Issue
Block a user