WARNING: VERY BREAKING CHANGE: Renamed some enum values for consistency

Some enums values have been renamed to be more consistent and also provide a more detailed description:
 - ShaderLocationIndex:    LOC_VERTEX_POSITION -> SHADER_SHADER_LOC_VERTEX_POSITION
 - ShaderUniformDataType:  UNIFORM_VEC2 -> SHADER_UNIFORM_VEC2
 - MaterialMapType: MAP_ALBEDO -> MATERIAL_MAP_ALBEDO
 - PixelFormat: UNCOMPRESSED_GRAYSCALE -> PIXELFORMAT_UNCOMPRESSED_GRAYSCALE
This commit is contained in:
Ray 2021-03-14 11:05:51 +01:00
commit 01e28263be
33 changed files with 724 additions and 722 deletions

View file

@ -31,7 +31,7 @@ int main(void)
// NOTE: By default each cube is mapped to one part of texture atlas // NOTE: By default each cube is mapped to one part of texture atlas
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position

View file

@ -32,7 +32,7 @@ int main(void)
// NOTE: By default each cube is mapped to one part of texture atlas // NOTE: By default each cube is mapped to one part of texture atlas
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
// Get map image data to be used for collision detection // Get map image data to be used for collision detection
Color *mapPixels = LoadImageColors(imMap); Color *mapPixels = LoadImageColors(imMap);

View file

@ -29,7 +29,7 @@ int main(void)
Mesh mesh = GenMeshHeightmap(image, (Vector3){ 16, 8, 16 }); // Generate heightmap mesh (RAM and VRAM) Mesh mesh = GenMeshHeightmap(image, (Vector3){ 16, 8, 16 }); // Generate heightmap mesh (RAM and VRAM)
Model model = LoadModelFromMesh(mesh); // Load model from generated mesh Model model = LoadModelFromMesh(mesh); // Load model from generated mesh
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
Vector3 mapPosition = { -8.0f, 0.0f, -8.0f }; // Define model position Vector3 mapPosition = { -8.0f, 0.0f, -8.0f }; // Define model position
UnloadImage(image); // Unload heightmap image from RAM, already uploaded to VRAM UnloadImage(image); // Unload heightmap image from RAM, already uploaded to VRAM

View file

@ -39,7 +39,7 @@ int main(void)
Model model = LoadModel("resources/models/castle.obj"); // Load model Model model = LoadModel("resources/models/castle.obj"); // Load model
Texture2D texture = LoadTexture("resources/models/castle_diffuse.png"); // Load model texture Texture2D texture = LoadTexture("resources/models/castle_diffuse.png"); // Load model texture
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
@ -76,7 +76,7 @@ int main(void)
{ {
UnloadModel(model); // Unload previous model UnloadModel(model); // Unload previous model
model = LoadModel(droppedFiles[0]); // Load new model model = LoadModel(droppedFiles[0]); // Load new model
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set current map diffuse texture model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set current map diffuse texture
bounds = MeshBoundingBox(model.meshes[0]); bounds = MeshBoundingBox(model.meshes[0]);
@ -87,7 +87,7 @@ int main(void)
// Unload current model texture and load new one // Unload current model texture and load new one
UnloadTexture(texture); UnloadTexture(texture);
texture = LoadTexture(droppedFiles[0]); texture = LoadTexture(droppedFiles[0]);
model.materials[0].maps[MAP_DIFFUSE].texture = texture; model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
} }
} }

View file

@ -78,7 +78,7 @@ int main(void)
// Send to material PBR shader camera view position // Send to material PBR shader camera view position
float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z }; float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z };
SetShaderValue(model.materials[0].shader, model.materials[0].shader.locs[LOC_VECTOR_VIEW], cameraPos, UNIFORM_VEC3); SetShaderValue(model.materials[0].shader, model.materials[0].shader.locs[SHADER_LOC_VECTOR_VIEW], cameraPos, SHADER_UNIFORM_VEC3);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@ -128,54 +128,54 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
// Get required locations points for PBR material // Get required locations points for PBR material
// NOTE: Those location names must be available and used in the shader code // NOTE: Those location names must be available and used in the shader code
mat.shader.locs[LOC_MAP_ALBEDO] = GetShaderLocation(mat.shader, "albedo.sampler"); mat.shader.locs[SHADER_LOC_MAP_ALBEDO] = GetShaderLocation(mat.shader, "albedo.sampler");
mat.shader.locs[LOC_MAP_METALNESS] = GetShaderLocation(mat.shader, "metalness.sampler"); mat.shader.locs[SHADER_LOC_MAP_METALNESS] = GetShaderLocation(mat.shader, "metalness.sampler");
mat.shader.locs[LOC_MAP_NORMAL] = GetShaderLocation(mat.shader, "normals.sampler"); mat.shader.locs[SHADER_LOC_MAP_NORMAL] = GetShaderLocation(mat.shader, "normals.sampler");
mat.shader.locs[LOC_MAP_ROUGHNESS] = GetShaderLocation(mat.shader, "roughness.sampler"); mat.shader.locs[SHADER_LOC_MAP_ROUGHNESS] = GetShaderLocation(mat.shader, "roughness.sampler");
mat.shader.locs[LOC_MAP_OCCLUSION] = GetShaderLocation(mat.shader, "occlusion.sampler"); mat.shader.locs[SHADER_LOC_MAP_OCCLUSION] = GetShaderLocation(mat.shader, "occlusion.sampler");
//mat.shader.locs[LOC_MAP_EMISSION] = GetShaderLocation(mat.shader, "emission.sampler"); //mat.shader.locs[SHADER_LOC_MAP_EMISSION] = GetShaderLocation(mat.shader, "emission.sampler");
//mat.shader.locs[LOC_MAP_HEIGHT] = GetShaderLocation(mat.shader, "height.sampler"); //mat.shader.locs[SHADER_LOC_MAP_HEIGHT] = GetShaderLocation(mat.shader, "height.sampler");
mat.shader.locs[LOC_MAP_IRRADIANCE] = GetShaderLocation(mat.shader, "irradianceMap"); mat.shader.locs[SHADER_LOC_MAP_IRRADIANCE] = GetShaderLocation(mat.shader, "irradianceMap");
mat.shader.locs[LOC_MAP_PREFILTER] = GetShaderLocation(mat.shader, "prefilterMap"); mat.shader.locs[SHADER_LOC_MAP_PREFILTER] = GetShaderLocation(mat.shader, "prefilterMap");
mat.shader.locs[LOC_MAP_BRDF] = GetShaderLocation(mat.shader, "brdfLUT"); mat.shader.locs[SHADER_LOC_MAP_BRDF] = GetShaderLocation(mat.shader, "brdfLUT");
// Set view matrix location // Set view matrix location
mat.shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(mat.shader, "matModel"); mat.shader.locs[SHADER_LOC_MATRIX_MODEL] = GetShaderLocation(mat.shader, "matModel");
//mat.shader.locs[LOC_MATRIX_VIEW] = GetShaderLocation(mat.shader, "view"); //mat.shader.locs[SHADER_LOC_MATRIX_VIEW] = GetShaderLocation(mat.shader, "view");
mat.shader.locs[LOC_VECTOR_VIEW] = GetShaderLocation(mat.shader, "viewPos"); mat.shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(mat.shader, "viewPos");
// Set PBR standard maps // Set PBR standard maps
mat.maps[MAP_ALBEDO].texture = LoadTexture("resources/pbr/trooper_albedo.png"); mat.maps[MATERIAL_MAP_ALBEDO].texture = LoadTexture("resources/pbr/trooper_albedo.png");
mat.maps[MAP_NORMAL].texture = LoadTexture("resources/pbr/trooper_normals.png"); mat.maps[MATERIAL_MAP_NORMAL].texture = LoadTexture("resources/pbr/trooper_normals.png");
mat.maps[MAP_METALNESS].texture = LoadTexture("resources/pbr/trooper_metalness.png"); mat.maps[MATERIAL_MAP_METALNESS].texture = LoadTexture("resources/pbr/trooper_metalness.png");
mat.maps[MAP_ROUGHNESS].texture = LoadTexture("resources/pbr/trooper_roughness.png"); mat.maps[MATERIAL_MAP_ROUGHNESS].texture = LoadTexture("resources/pbr/trooper_roughness.png");
mat.maps[MAP_OCCLUSION].texture = LoadTexture("resources/pbr/trooper_ao.png"); mat.maps[MATERIAL_MAP_OCCLUSION].texture = LoadTexture("resources/pbr/trooper_ao.png");
// Set textures filtering for better quality // Set textures filtering for better quality
SetTextureFilter(mat.maps[MAP_ALBEDO].texture, FILTER_BILINEAR); SetTextureFilter(mat.maps[MATERIAL_MAP_ALBEDO].texture, FILTER_BILINEAR);
SetTextureFilter(mat.maps[MAP_NORMAL].texture, FILTER_BILINEAR); SetTextureFilter(mat.maps[MATERIAL_MAP_NORMAL].texture, FILTER_BILINEAR);
SetTextureFilter(mat.maps[MAP_METALNESS].texture, FILTER_BILINEAR); SetTextureFilter(mat.maps[MATERIAL_MAP_METALNESS].texture, FILTER_BILINEAR);
SetTextureFilter(mat.maps[MAP_ROUGHNESS].texture, FILTER_BILINEAR); SetTextureFilter(mat.maps[MATERIAL_MAP_ROUGHNESS].texture, FILTER_BILINEAR);
SetTextureFilter(mat.maps[MAP_OCCLUSION].texture, FILTER_BILINEAR); SetTextureFilter(mat.maps[MATERIAL_MAP_OCCLUSION].texture, FILTER_BILINEAR);
// Enable sample usage in shader for assigned textures // Enable sample usage in shader for assigned textures
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "albedo.useSampler"), (int[1]){ 1 }, UNIFORM_INT); SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "albedo.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "normals.useSampler"), (int[1]){ 1 }, UNIFORM_INT); SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "normals.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "metalness.useSampler"), (int[1]){ 1 }, UNIFORM_INT); SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "metalness.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "roughness.useSampler"), (int[1]){ 1 }, UNIFORM_INT); SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "roughness.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "occlusion.useSampler"), (int[1]){ 1 }, UNIFORM_INT); SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "occlusion.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
int renderModeLoc = GetShaderLocation(mat.shader, "renderMode"); int renderModeLoc = GetShaderLocation(mat.shader, "renderMode");
SetShaderValue(mat.shader, renderModeLoc, (int[1]){ 0 }, UNIFORM_INT); SetShaderValue(mat.shader, renderModeLoc, (int[1]){ 0 }, SHADER_UNIFORM_INT);
// Set up material properties color // Set up material properties color
mat.maps[MAP_ALBEDO].color = albedo; mat.maps[MATERIAL_MAP_ALBEDO].color = albedo;
mat.maps[MAP_NORMAL].color = (Color){ 128, 128, 255, 255 }; mat.maps[MATERIAL_MAP_NORMAL].color = (Color){ 128, 128, 255, 255 };
mat.maps[MAP_METALNESS].value = metalness; mat.maps[MATERIAL_MAP_METALNESS].value = metalness;
mat.maps[MAP_ROUGHNESS].value = roughness; mat.maps[MATERIAL_MAP_ROUGHNESS].value = roughness;
mat.maps[MAP_OCCLUSION].value = 1.0f; mat.maps[MATERIAL_MAP_OCCLUSION].value = 1.0f;
mat.maps[MAP_EMISSION].value = 0.5f; mat.maps[MATERIAL_MAP_EMISSION].value = 0.5f;
mat.maps[MAP_HEIGHT].value = 0.5f; mat.maps[MATERIAL_MAP_HEIGHT].value = 0.5f;
// Generate cubemap from panorama texture // Generate cubemap from panorama texture
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------
@ -186,8 +186,8 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB #else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
Shader shdrCubemap = LoadShader("resources/shaders/glsl100/cubemap.vs", "resources/shaders/glsl100/cubemap.fs"); Shader shdrCubemap = LoadShader("resources/shaders/glsl100/cubemap.vs", "resources/shaders/glsl100/cubemap.fs");
#endif #endif
SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, UNIFORM_INT); SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
TextureCubemap cubemap = GenTextureCubemap(shdrCubemap, panorama, CUBEMAP_SIZE, UNCOMPRESSED_R32G32B32); TextureCubemap cubemap = GenTextureCubemap(shdrCubemap, panorama, CUBEMAP_SIZE, PIXELFORMAT_UNCOMPRESSED_R32G32B32);
UnloadTexture(panorama); UnloadTexture(panorama);
UnloadShader(shdrCubemap); UnloadShader(shdrCubemap);
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------
@ -200,8 +200,8 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB #else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
Shader shdrIrradiance = LoadShader("resources/shaders/glsl100/skybox.vs", "resources/shaders/glsl100/irradiance.fs"); Shader shdrIrradiance = LoadShader("resources/shaders/glsl100/skybox.vs", "resources/shaders/glsl100/irradiance.fs");
#endif #endif
SetShaderValue(shdrIrradiance, GetShaderLocation(shdrIrradiance, "environmentMap"), (int[1]){ 0 }, UNIFORM_INT); SetShaderValue(shdrIrradiance, GetShaderLocation(shdrIrradiance, "environmentMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
mat.maps[MAP_IRRADIANCE].texture = GenTextureIrradiance(shdrIrradiance, cubemap, IRRADIANCE_SIZE); mat.maps[MATERIAL_MAP_IRRADIANCE].texture = GenTextureIrradiance(shdrIrradiance, cubemap, IRRADIANCE_SIZE);
UnloadShader(shdrIrradiance); UnloadShader(shdrIrradiance);
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------
@ -213,8 +213,8 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
#else #else
Shader shdrPrefilter = LoadShader("resources/shaders/glsl100/skybox.vs", "resources/shaders/glsl100/prefilter.fs"); Shader shdrPrefilter = LoadShader("resources/shaders/glsl100/skybox.vs", "resources/shaders/glsl100/prefilter.fs");
#endif #endif
SetShaderValue(shdrPrefilter, GetShaderLocation(shdrPrefilter, "environmentMap"), (int[1]){ 0 }, UNIFORM_INT); SetShaderValue(shdrPrefilter, GetShaderLocation(shdrPrefilter, "environmentMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
mat.maps[MAP_PREFILTER].texture = GenTexturePrefilter(shdrPrefilter, cubemap, PREFILTERED_SIZE); mat.maps[MATERIAL_MAP_PREFILTER].texture = GenTexturePrefilter(shdrPrefilter, cubemap, PREFILTERED_SIZE);
UnloadTexture(cubemap); UnloadTexture(cubemap);
UnloadShader(shdrPrefilter); UnloadShader(shdrPrefilter);
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------
@ -226,7 +226,7 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
#else #else
Shader shdrBRDF = LoadShader("resources/shaders/glsl100/brdf.vs", "resources/shaders/glsl100/brdf.fs"); Shader shdrBRDF = LoadShader("resources/shaders/glsl100/brdf.vs", "resources/shaders/glsl100/brdf.fs");
#endif #endif
mat.maps[MAP_BRDF].texture = GenTextureBRDF(shdrBRDF, BRDF_SIZE); mat.maps[MATERIAL_MAP_BRDG].texture = GenTextureBRDF(shdrBRDF, BRDF_SIZE);
UnloadShader(shdrBRDF); UnloadShader(shdrBRDF);
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------

View file

@ -39,7 +39,7 @@ int main(void)
models[7] = LoadModelFromMesh(GenMeshPoly(5, 2.0f)); models[7] = LoadModelFromMesh(GenMeshPoly(5, 2.0f));
// Set checked texture as default diffuse component for all models material // Set checked texture as default diffuse component for all models material
for (int i = 0; i < NUM_MODELS; i++) models[i].materials[0].maps[MAP_DIFFUSE].texture = texture; for (int i = 0; i < NUM_MODELS; i++) models[i].materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = { { 5.0f, 5.0f, 5.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0 }; Camera camera = { { 5.0f, 5.0f, 5.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0 };

View file

@ -37,7 +37,7 @@ int main(void)
Model tower = LoadModel("resources/models/turret.obj"); // Load OBJ model Model tower = LoadModel("resources/models/turret.obj"); // Load OBJ model
Texture2D texture = LoadTexture("resources/models/turret_diffuse.png"); // Load model texture Texture2D texture = LoadTexture("resources/models/turret_diffuse.png"); // Load model texture
tower.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture tower.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set model diffuse texture
Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position
BoundingBox towerBBox = MeshBoundingBox(tower.meshes[0]); // Get mesh bounding box BoundingBox towerBBox = MeshBoundingBox(tower.meshes[0]); // Get mesh bounding box

View file

@ -37,9 +37,9 @@ int main(void)
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB #else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
skybox.materials[0].shader = LoadShader("resources/shaders/glsl100/skybox.vs", "resources/shaders/glsl100/skybox.fs"); skybox.materials[0].shader = LoadShader("resources/shaders/glsl100/skybox.vs", "resources/shaders/glsl100/skybox.fs");
#endif #endif
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "environmentMap"), (int[1]){ MAP_CUBEMAP }, UNIFORM_INT); SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "environmentMap"), (int[1]){ MATERIAL_MAP_CUBEMAP }, SHADER_UNIFORM_INT);
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "doGamma"), (int[1]) { useHDR ? 1 : 0 }, UNIFORM_INT); SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "doGamma"), (int[1]) { useHDR ? 1 : 0 }, SHADER_UNIFORM_INT);
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "vflipped"), (int[1]){ useHDR ? 1 : 0 }, UNIFORM_INT); SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "vflipped"), (int[1]){ useHDR ? 1 : 0 }, SHADER_UNIFORM_INT);
// Load cubemap shader and setup required shader locations // Load cubemap shader and setup required shader locations
#if defined(PLATFORM_DESKTOP) #if defined(PLATFORM_DESKTOP)
@ -47,7 +47,7 @@ int main(void)
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB #else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
Shader shdrCubemap = LoadShader("resources/shaders/glsl100/cubemap.vs", "resources/shaders/glsl100/cubemap.fs"); Shader shdrCubemap = LoadShader("resources/shaders/glsl100/cubemap.vs", "resources/shaders/glsl100/cubemap.fs");
#endif #endif
SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, UNIFORM_INT); SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
char skyboxFileName[256] = { 0 }; char skyboxFileName[256] = { 0 };
@ -61,15 +61,15 @@ int main(void)
// Generate cubemap (texture with 6 quads-cube-mapping) from panorama HDR texture // Generate cubemap (texture with 6 quads-cube-mapping) from panorama HDR texture
// NOTE 1: New texture is generated rendering to texture, shader calculates the sphere->cube coordinates mapping // NOTE 1: New texture is generated rendering to texture, shader calculates the sphere->cube coordinates mapping
// NOTE 2: It seems on some Android devices WebGL, fbo does not properly support a FLOAT-based attachment, // NOTE 2: It seems on some Android devices WebGL, fbo does not properly support a FLOAT-based attachment,
// despite texture can be successfully created.. so using UNCOMPRESSED_R8G8B8A8 instead of UNCOMPRESSED_R32G32B32A32 // despite texture can be successfully created.. so using PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 instead of PIXELFORMAT_UNCOMPRESSED_R32G32B32A32
skybox.materials[0].maps[MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, UNCOMPRESSED_R8G8B8A8); skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
UnloadTexture(panorama); // Texture not required anymore, cubemap already generated UnloadTexture(panorama); // Texture not required anymore, cubemap already generated
} }
else else
{ {
Image img = LoadImage("resources/skybox.png"); Image img = LoadImage("resources/skybox.png");
skybox.materials[0].maps[MAP_CUBEMAP].texture = LoadTextureCubemap(img, CUBEMAP_LAYOUT_AUTO_DETECT); // CUBEMAP_LAYOUT_PANORAMA skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = LoadTextureCubemap(img, CUBEMAP_LAYOUT_AUTO_DETECT); // CUBEMAP_LAYOUT_PANORAMA
UnloadImage(img); UnloadImage(img);
} }
@ -96,19 +96,19 @@ int main(void)
if (IsFileExtension(droppedFiles[0], ".png;.jpg;.hdr;.bmp;.tga")) if (IsFileExtension(droppedFiles[0], ".png;.jpg;.hdr;.bmp;.tga"))
{ {
// Unload current cubemap texture and load new one // Unload current cubemap texture and load new one
UnloadTexture(skybox.materials[0].maps[MAP_CUBEMAP].texture); UnloadTexture(skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture);
if (useHDR) if (useHDR)
{ {
Texture2D panorama = LoadTexture(droppedFiles[0]); Texture2D panorama = LoadTexture(droppedFiles[0]);
// Generate cubemap from panorama texture // Generate cubemap from panorama texture
skybox.materials[0].maps[MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, UNCOMPRESSED_R8G8B8A8); skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
UnloadTexture(panorama); UnloadTexture(panorama);
} }
else else
{ {
Image img = LoadImage(droppedFiles[0]); Image img = LoadImage(droppedFiles[0]);
skybox.materials[0].maps[MAP_CUBEMAP].texture = LoadTextureCubemap(img, CUBEMAP_LAYOUT_AUTO_DETECT); skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = LoadTextureCubemap(img, CUBEMAP_LAYOUT_AUTO_DETECT);
UnloadImage(img); UnloadImage(img);
} }
@ -149,7 +149,7 @@ int main(void)
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadShader(skybox.materials[0].shader); UnloadShader(skybox.materials[0].shader);
UnloadTexture(skybox.materials[0].maps[MAP_CUBEMAP].texture); UnloadTexture(skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture);
UnloadModel(skybox); // Unload skybox model UnloadModel(skybox); // Unload skybox model

View file

@ -35,9 +35,9 @@ int main(void)
// Model loading // Model loading
Model model = LoadModel("resources/plane.obj"); // Load OBJ model Model model = LoadModel("resources/plane.obj"); // Load OBJ model
model.materials[0].maps[MAP_DIFFUSE].texture = LoadTexture("resources/plane_diffuse.png"); // Set map diffuse texture model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = LoadTexture("resources/plane_diffuse.png"); // Set map diffuse texture
GenTextureMipmaps(&model.materials[0].maps[MAP_DIFFUSE].texture); GenTextureMipmaps(&model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture);
Camera camera = { 0 }; Camera camera = { 0 };
camera.position = (Vector3){ 0.0f, 60.0f, -120.0f };// Camera position perspective camera.position = (Vector3){ 0.0f, 60.0f, -120.0f };// Camera position perspective
@ -169,7 +169,7 @@ int main(void)
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Unload all loaded data // Unload all loaded data
UnloadTexture(model.materials[0].maps[MAP_DIFFUSE].texture); UnloadTexture(model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture);
UnloadModel(model); UnloadModel(model);
UnloadRenderTexture(framebuffer); UnloadRenderTexture(framebuffer);

View file

@ -163,21 +163,21 @@ Light CreateLight(int type, Vector3 position, Vector3 target, Color color, Shade
void UpdateLightValues(Shader shader, Light light) void UpdateLightValues(Shader shader, Light light)
{ {
// Send to shader light enabled state and type // Send to shader light enabled state and type
SetShaderValue(shader, light.enabledLoc, &light.enabled, UNIFORM_INT); SetShaderValue(shader, light.enabledLoc, &light.enabled, SHADER_UNIFORM_INT);
SetShaderValue(shader, light.typeLoc, &light.type, UNIFORM_INT); SetShaderValue(shader, light.typeLoc, &light.type, SHADER_UNIFORM_INT);
// Send to shader light position values // Send to shader light position values
float position[3] = { light.position.x, light.position.y, light.position.z }; float position[3] = { light.position.x, light.position.y, light.position.z };
SetShaderValue(shader, light.posLoc, position, UNIFORM_VEC3); SetShaderValue(shader, light.posLoc, position, SHADER_UNIFORM_VEC3);
// Send to shader light target position values // Send to shader light target position values
float target[3] = { light.target.x, light.target.y, light.target.z }; float target[3] = { light.target.x, light.target.y, light.target.z };
SetShaderValue(shader, light.targetLoc, target, UNIFORM_VEC3); SetShaderValue(shader, light.targetLoc, target, SHADER_UNIFORM_VEC3);
// Send to shader light color values // Send to shader light color values
float color[4] = { (float)light.color.r/(float)255, (float)light.color.g/(float)255, float color[4] = { (float)light.color.r/(float)255, (float)light.color.g/(float)255,
(float)light.color.b/(float)255, (float)light.color.a/(float)255 }; (float)light.color.b/(float)255, (float)light.color.a/(float)255 };
SetShaderValue(shader, light.colorLoc, color, UNIFORM_VEC4); SetShaderValue(shader, light.colorLoc, color, SHADER_UNIFORM_VEC4);
} }
#endif // RLIGHTS_IMPLEMENTATION #endif // RLIGHTS_IMPLEMENTATION

View file

@ -163,21 +163,21 @@ Light CreateLight(int type, Vector3 position, Vector3 target, Color color, Shade
void UpdateLightValues(Shader shader, Light light) void UpdateLightValues(Shader shader, Light light)
{ {
// Send to shader light enabled state and type // Send to shader light enabled state and type
SetShaderValue(shader, light.enabledLoc, &light.enabled, UNIFORM_INT); SetShaderValue(shader, light.enabledLoc, &light.enabled, SHADER_UNIFORM_INT);
SetShaderValue(shader, light.typeLoc, &light.type, UNIFORM_INT); SetShaderValue(shader, light.typeLoc, &light.type, SHADER_UNIFORM_INT);
// Send to shader light position values // Send to shader light position values
float position[3] = { light.position.x, light.position.y, light.position.z }; float position[3] = { light.position.x, light.position.y, light.position.z };
SetShaderValue(shader, light.posLoc, position, UNIFORM_VEC3); SetShaderValue(shader, light.posLoc, position, SHADER_UNIFORM_VEC3);
// Send to shader light target position values // Send to shader light target position values
float target[3] = { light.target.x, light.target.y, light.target.z }; float target[3] = { light.target.x, light.target.y, light.target.z };
SetShaderValue(shader, light.targetLoc, target, UNIFORM_VEC3); SetShaderValue(shader, light.targetLoc, target, SHADER_UNIFORM_VEC3);
// Send to shader light color values // Send to shader light color values
float color[4] = { (float)light.color.r/(float)255, (float)light.color.g/(float)255, float color[4] = { (float)light.color.r/(float)255, (float)light.color.g/(float)255,
(float)light.color.b/(float)255, (float)light.color.a/(float)255 }; (float)light.color.b/(float)255, (float)light.color.a/(float)255 };
SetShaderValue(shader, light.colorLoc, color, UNIFORM_VEC4); SetShaderValue(shader, light.colorLoc, color, SHADER_UNIFORM_VEC4);
} }
#endif // RLIGHTS_IMPLEMENTATION #endif // RLIGHTS_IMPLEMENTATION

View file

@ -65,20 +65,20 @@ int main(void)
Texture texture = LoadTexture("resources/texel_checker.png"); Texture texture = LoadTexture("resources/texel_checker.png");
// Assign texture to default model material // Assign texture to default model material
modelA.materials[0].maps[MAP_DIFFUSE].texture = texture; modelA.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
modelB.materials[0].maps[MAP_DIFFUSE].texture = texture; modelB.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
modelC.materials[0].maps[MAP_DIFFUSE].texture = texture; modelC.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/base_lighting.vs", GLSL_VERSION), Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/base_lighting.vs", GLSL_VERSION),
TextFormat("resources/shaders/glsl%i/lighting.fs", GLSL_VERSION)); TextFormat("resources/shaders/glsl%i/lighting.fs", GLSL_VERSION));
// Get some shader loactions // Get some shader loactions
shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel"); shader.locs[SHADER_LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel");
shader.locs[LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos"); shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos");
// ambient light level // ambient light level
int ambientLoc = GetShaderLocation(shader, "ambient"); int ambientLoc = GetShaderLocation(shader, "ambient");
SetShaderValue(shader, ambientLoc, (float[4]){ 0.2f, 0.2f, 0.2f, 1.0f }, UNIFORM_VEC4); SetShaderValue(shader, ambientLoc, (float[4]){ 0.2f, 0.2f, 0.2f, 1.0f }, SHADER_UNIFORM_VEC4);
float angle = 6.282f; float angle = 6.282f;
@ -133,7 +133,7 @@ int main(void)
// Update the light shader with the camera view position // Update the light shader with the camera view position
float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z }; float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z };
SetShaderValue(shader, shader.locs[LOC_VECTOR_VIEW], cameraPos, UNIFORM_VEC3); SetShaderValue(shader, shader.locs[SHADER_LOC_VECTOR_VIEW], cameraPos, SHADER_UNIFORM_VEC3);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw

View file

@ -45,7 +45,7 @@ int main(void)
Model model = LoadModel("resources/models/barracks.obj"); // Load OBJ model Model model = LoadModel("resources/models/barracks.obj"); // Load OBJ model
Texture2D texture = LoadTexture("resources/models/barracks_diffuse.png"); // Load model texture (diffuse map) Texture2D texture = LoadTexture("resources/models/barracks_diffuse.png"); // Load model texture (diffuse map)
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set model diffuse texture
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
@ -79,7 +79,7 @@ int main(void)
swirlCenter[1] = screenHeight - mousePosition.y; swirlCenter[1] = screenHeight - mousePosition.y;
// Send new value to the shader to be used on drawing // Send new value to the shader to be used on drawing
SetShaderValue(shader, swirlCenterLoc, swirlCenter, UNIFORM_VEC2); SetShaderValue(shader, swirlCenterLoc, swirlCenter, SHADER_UNIFORM_VEC2);
UpdateCamera(&camera); // Update camera UpdateCamera(&camera); // Update camera
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View file

@ -62,23 +62,23 @@ int main(void)
Texture texture = LoadTexture("resources/texel_checker.png"); Texture texture = LoadTexture("resources/texel_checker.png");
// Assign texture to default model material // Assign texture to default model material
modelA.materials[0].maps[MAP_DIFFUSE].texture = texture; modelA.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
modelB.materials[0].maps[MAP_DIFFUSE].texture = texture; modelB.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
modelC.materials[0].maps[MAP_DIFFUSE].texture = texture; modelC.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
// Load shader and set up some uniforms // Load shader and set up some uniforms
Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/base_lighting.vs", GLSL_VERSION), Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/base_lighting.vs", GLSL_VERSION),
TextFormat("resources/shaders/glsl%i/fog.fs", GLSL_VERSION)); TextFormat("resources/shaders/glsl%i/fog.fs", GLSL_VERSION));
shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel"); shader.locs[SHADER_LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel");
shader.locs[LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos"); shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos");
// Ambient light level // Ambient light level
int ambientLoc = GetShaderLocation(shader, "ambient"); int ambientLoc = GetShaderLocation(shader, "ambient");
SetShaderValue(shader, ambientLoc, (float[4]){ 0.2f, 0.2f, 0.2f, 1.0f }, UNIFORM_VEC4); SetShaderValue(shader, ambientLoc, (float[4]){ 0.2f, 0.2f, 0.2f, 1.0f }, SHADER_UNIFORM_VEC4);
float fogDensity = 0.15f; float fogDensity = 0.15f;
int fogDensityLoc = GetShaderLocation(shader, "fogDensity"); int fogDensityLoc = GetShaderLocation(shader, "fogDensity");
SetShaderValue(shader, fogDensityLoc, &fogDensity, UNIFORM_FLOAT); SetShaderValue(shader, fogDensityLoc, &fogDensity, SHADER_UNIFORM_FLOAT);
// NOTE: All models share the same shader // NOTE: All models share the same shader
modelA.materials[0].shader = shader; modelA.materials[0].shader = shader;
@ -112,14 +112,14 @@ int main(void)
if (fogDensity < 0.0) fogDensity = 0.0; if (fogDensity < 0.0) fogDensity = 0.0;
} }
SetShaderValue(shader, fogDensityLoc, &fogDensity, UNIFORM_FLOAT); SetShaderValue(shader, fogDensityLoc, &fogDensity, SHADER_UNIFORM_FLOAT);
// Rotate the torus // Rotate the torus
modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateX(-0.025)); modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateX(-0.025));
modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateZ(0.012)); modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateZ(0.012));
// Update the light shader with the camera view position // Update the light shader with the camera view position
SetShaderValue(shader, shader.locs[LOC_VECTOR_VIEW], &camera.position.x, UNIFORM_VEC3); SetShaderValue(shader, shader.locs[SHADER_LOC_VECTOR_VIEW], &camera.position.x, SHADER_UNIFORM_VEC3);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw

View file

@ -44,7 +44,7 @@ int main(void)
int timeLoc = GetShaderLocation(shader, "time"); int timeLoc = GetShaderLocation(shader, "time");
float resolution[2] = { (float)screenWidth, (float)screenHeight }; float resolution[2] = { (float)screenWidth, (float)screenHeight };
SetShaderValue(shader, resolutionLoc, resolution, UNIFORM_VEC2); SetShaderValue(shader, resolutionLoc, resolution, SHADER_UNIFORM_VEC2);
float totalTime = 0.0f; float totalTime = 0.0f;
bool shaderAutoReloading = false; bool shaderAutoReloading = false;
@ -62,8 +62,8 @@ int main(void)
float mousePos[2] = { mouse.x, mouse.y }; float mousePos[2] = { mouse.x, mouse.y };
// Set shader required uniform values // Set shader required uniform values
SetShaderValue(shader, timeLoc, &totalTime, UNIFORM_FLOAT); SetShaderValue(shader, timeLoc, &totalTime, SHADER_UNIFORM_FLOAT);
SetShaderValue(shader, mouseLoc, mousePos, UNIFORM_VEC2); SetShaderValue(shader, mouseLoc, mousePos, SHADER_UNIFORM_VEC2);
// Hot shader reloading // Hot shader reloading
if (shaderAutoReloading || (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) if (shaderAutoReloading || (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)))
@ -87,7 +87,7 @@ int main(void)
timeLoc = GetShaderLocation(shader, "time"); timeLoc = GetShaderLocation(shader, "time");
// Reset required uniforms // Reset required uniforms
SetShaderValue(shader, resolutionLoc, resolution, UNIFORM_VEC2); SetShaderValue(shader, resolutionLoc, resolution, SHADER_UNIFORM_VEC2);
} }
fragShaderFileModTime = currentFragShaderModTime; fragShaderFileModTime = currentFragShaderModTime;

View file

@ -65,11 +65,11 @@ int main(void)
// Tell the shader what the screen dimensions, zoom, offset and c are // Tell the shader what the screen dimensions, zoom, offset and c are
float screenDims[2] = { (float)screenWidth, (float)screenHeight }; float screenDims[2] = { (float)screenWidth, (float)screenHeight };
SetShaderValue(shader, GetShaderLocation(shader, "screenDims"), screenDims, UNIFORM_VEC2); SetShaderValue(shader, GetShaderLocation(shader, "screenDims"), screenDims, SHADER_UNIFORM_VEC2);
SetShaderValue(shader, cLoc, c, UNIFORM_VEC2); SetShaderValue(shader, cLoc, c, SHADER_UNIFORM_VEC2);
SetShaderValue(shader, zoomLoc, &zoom, UNIFORM_FLOAT); SetShaderValue(shader, zoomLoc, &zoom, SHADER_UNIFORM_FLOAT);
SetShaderValue(shader, offsetLoc, offset, UNIFORM_VEC2); SetShaderValue(shader, offsetLoc, offset, SHADER_UNIFORM_VEC2);
// Create a RenderTexture2D to be used for render to texture // Create a RenderTexture2D to be used for render to texture
RenderTexture2D target = LoadRenderTexture(screenWidth, screenHeight); RenderTexture2D target = LoadRenderTexture(screenWidth, screenHeight);
@ -101,7 +101,7 @@ int main(void)
else if (IsKeyPressed(KEY_FIVE)) c[0] = POINTS_OF_INTEREST[4][0], c[1] = POINTS_OF_INTEREST[4][1]; else if (IsKeyPressed(KEY_FIVE)) c[0] = POINTS_OF_INTEREST[4][0], c[1] = POINTS_OF_INTEREST[4][1];
else if (IsKeyPressed(KEY_SIX)) c[0] = POINTS_OF_INTEREST[5][0], c[1] = POINTS_OF_INTEREST[5][1]; else if (IsKeyPressed(KEY_SIX)) c[0] = POINTS_OF_INTEREST[5][0], c[1] = POINTS_OF_INTEREST[5][1];
SetShaderValue(shader, cLoc, c, UNIFORM_VEC2); SetShaderValue(shader, cLoc, c, SHADER_UNIFORM_VEC2);
} }
if (IsKeyPressed(KEY_SPACE)) pause = !pause; // Pause animation (c change) if (IsKeyPressed(KEY_SPACE)) pause = !pause; // Pause animation (c change)
@ -130,15 +130,15 @@ int main(void)
} }
else offsetSpeed = (Vector2){ 0.0f, 0.0f }; else offsetSpeed = (Vector2){ 0.0f, 0.0f };
SetShaderValue(shader, zoomLoc, &zoom, UNIFORM_FLOAT); SetShaderValue(shader, zoomLoc, &zoom, SHADER_UNIFORM_FLOAT);
SetShaderValue(shader, offsetLoc, offset, UNIFORM_VEC2); SetShaderValue(shader, offsetLoc, offset, SHADER_UNIFORM_VEC2);
// Increment c value with time // Increment c value with time
float amount = GetFrameTime()*incrementSpeed*0.0005f; float amount = GetFrameTime()*incrementSpeed*0.0005f;
c[0] += amount; c[0] += amount;
c[1] += amount; c[1] += amount;
SetShaderValue(shader, cLoc, c, UNIFORM_VEC2); SetShaderValue(shader, cLoc, c, SHADER_UNIFORM_VEC2);
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View file

@ -51,7 +51,7 @@ int main(void)
Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION)); Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION));
model.materials[0].shader = shader; // Set shader effect to 3d model model.materials[0].shader = shader; // Set shader effect to 3d model
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Bind texture to model model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Bind texture to model
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position

View file

@ -106,7 +106,7 @@ int main(void)
// Send new value to the shader to be used on drawing. // Send new value to the shader to be used on drawing.
// NOTE: We are sending RGB triplets w/o the alpha channel // NOTE: We are sending RGB triplets w/o the alpha channel
SetShaderValueV(shader, paletteLoc, palettes[currentPalette], UNIFORM_IVEC3, COLORS_PER_PALETTE); SetShaderValueV(shader, paletteLoc, palettes[currentPalette], SHADER_UNIFORM_IVEC3, COLORS_PER_PALETTE);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw

View file

@ -74,7 +74,7 @@ int main(void)
Model model = LoadModel("resources/models/church.obj"); // Load OBJ model Model model = LoadModel("resources/models/church.obj"); // Load OBJ model
Texture2D texture = LoadTexture("resources/models/church_diffuse.png"); // Load model texture (diffuse map) Texture2D texture = LoadTexture("resources/models/church_diffuse.png"); // Load model texture (diffuse map)
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set model diffuse texture
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position

View file

@ -49,7 +49,7 @@ int main(void)
int resolutionLoc = GetShaderLocation(shader, "resolution"); int resolutionLoc = GetShaderLocation(shader, "resolution");
float resolution[2] = { (float)screenWidth, (float)screenHeight }; float resolution[2] = { (float)screenWidth, (float)screenHeight };
SetShaderValue(shader, resolutionLoc, resolution, UNIFORM_VEC2); SetShaderValue(shader, resolutionLoc, resolution, SHADER_UNIFORM_VEC2);
float runTime = 0.0f; float runTime = 0.0f;
@ -70,9 +70,9 @@ int main(void)
runTime += deltaTime; runTime += deltaTime;
// Set shader required uniform values // Set shader required uniform values
SetShaderValue(shader, viewEyeLoc, cameraPos, UNIFORM_VEC3); SetShaderValue(shader, viewEyeLoc, cameraPos, SHADER_UNIFORM_VEC3);
SetShaderValue(shader, viewCenterLoc, cameraTarget, UNIFORM_VEC3); SetShaderValue(shader, viewCenterLoc, cameraTarget, SHADER_UNIFORM_VEC3);
SetShaderValue(shader, runTimeLoc, &runTime, UNIFORM_FLOAT); SetShaderValue(shader, runTimeLoc, &runTime, SHADER_UNIFORM_FLOAT);
// Check if screen is resized // Check if screen is resized
if (IsWindowResized()) if (IsWindowResized())
@ -80,7 +80,7 @@ int main(void)
screenWidth = GetScreenWidth(); screenWidth = GetScreenWidth();
screenHeight = GetScreenHeight(); screenHeight = GetScreenHeight();
float resolution[2] = { (float)screenWidth, (float)screenHeight }; float resolution[2] = { (float)screenWidth, (float)screenHeight };
SetShaderValue(shader, resolutionLoc, resolution, UNIFORM_VEC2); SetShaderValue(shader, resolutionLoc, resolution, SHADER_UNIFORM_VEC2);
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show more