Fixed little bug
This commit is contained in:
parent
a999de7fd3
commit
2b5bdc0324
|
|
@ -46,7 +46,7 @@ int main()
|
||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 450;
|
int screenHeight = 450;
|
||||||
|
|
||||||
SetConfigFlags(FLAG_MSAA_4X_HINT);
|
SetConfigFlags(FLAG_MSAA_4X_HINT); // Enable Multi Sampling Anti Aliasing 4x (if available)
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - pbr material");
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - pbr material");
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
// Define the camera to look into our 3d world
|
||||||
|
|
|
||||||
|
|
@ -25,15 +25,11 @@ int main()
|
||||||
Camera camera = {{ 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f };
|
Camera camera = {{ 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f };
|
||||||
|
|
||||||
// Load skybox model and shader
|
// Load skybox model and shader
|
||||||
#define PATH_SKYBOX_VS "resources/shaders/skybox.vs" // Path to skybox vertex shader
|
|
||||||
#define PATH_SKYBOX_FS "resources/shaders/skybox.fs" // Path to skybox fragment shader
|
|
||||||
#define PATH_TEXTURES_HDR "resources/pinetree.hdr" // Path to HDR image
|
|
||||||
|
|
||||||
Mesh cube = GenMeshCube(1.0f, 1.0f, 1.0f);
|
Mesh cube = GenMeshCube(1.0f, 1.0f, 1.0f);
|
||||||
Model skybox = LoadModelFromMesh(cube, false);
|
Model skybox = LoadModelFromMesh(cube, false);
|
||||||
skybox.material.shader = LoadShader(PATH_SKYBOX_VS, PATH_SKYBOX_FS);
|
skybox.material.shader = LoadShader("resources/shaders/skybox.vs", "resources/shaders/skybox.fs");
|
||||||
|
|
||||||
Texture2D texHDR = LoadTexture(PATH_TEXTURES_HDR);
|
Texture2D texHDR = LoadTexture("resources/pinetree.hdr");
|
||||||
skybox.material.maps[TEXMAP_CUBEMAP].tex = rlGenMapCubemap(texHDR, 512);
|
skybox.material.maps[TEXMAP_CUBEMAP].tex = rlGenMapCubemap(texHDR, 512);
|
||||||
SetShaderValuei(skybox.material.shader, GetShaderLocation(skybox.material.shader, "environmentMap"), (int[1]){ TEXMAP_CUBEMAP }, 1);
|
SetShaderValuei(skybox.material.shader, GetShaderLocation(skybox.material.shader, "environmentMap"), (int[1]){ TEXMAP_CUBEMAP }, 1);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ vec2 ParallaxMapping(vec2 texCoords, vec3 viewDir);
|
||||||
|
|
||||||
vec3 ComputeMaterialProperty(MaterialProperty property)
|
vec3 ComputeMaterialProperty(MaterialProperty property)
|
||||||
{
|
{
|
||||||
vec result = vec3(0.0, 0.0, 0.0);
|
vec3 result = vec3(0.0, 0.0, 0.0);
|
||||||
|
|
||||||
if (property.useSampler == 1) result = texture(property.sampler, texCoord).rgb;
|
if (property.useSampler == 1) result = texture(property.sampler, texCoord).rgb;
|
||||||
else result = property.color;
|
else result = property.color;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user