From 8ace02c2ffd9dead6e67fb3faaaa8b8ad37ccd2a Mon Sep 17 00:00:00 2001 From: Ray San Date: Tue, 17 Oct 2017 13:30:41 +0200 Subject: [PATCH] Added new examples to build... ...and reviewed some details --- examples/Makefile | 15 ++++++++++----- examples/models/models_material_pbr.c | 12 ++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/examples/Makefile b/examples/Makefile index b80b18fe9..bd4552cbc 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -82,20 +82,20 @@ endif # Define raylib release directory for compiled library ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),WINDOWS) - RAYLIB_RELEASE = $(RAYLIB_PATH)/release/win32/mingw32 + RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/win32/mingw32 endif ifeq ($(PLATFORM_OS),LINUX) - RAYLIB_RELEASE = $(RAYLIB_PATH)/release/linux + RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/linux endif ifeq ($(PLATFORM_OS),OSX) - RAYLIB_RELEASE = $(RAYLIB_PATH)/release/osx + RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/osx endif endif ifeq ($(PLATFORM),PLATFORM_WEB) - RAYLIB_RELEASE = $(RAYLIB_PATH)/release/html5 + RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/html5 endif ifeq ($(PLATFORM),PLATFORM_RPI) - RAYLIB_RELEASE = $(RAYLIB_PATH)/release/rpi + RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/rpi endif # Define default C compiler: gcc @@ -263,6 +263,7 @@ EXAMPLES = \ textures/textures_particles_blending \ textures/textures_image_processing \ textures/textures_image_drawing \ + textures/textures_image_generation \ text/text_sprite_fonts \ text/text_bmfont_ttf \ text/text_raylib_fonts \ @@ -278,6 +279,10 @@ EXAMPLES = \ models/models_heightmap \ models/models_cubicmap \ models/models_mesh_picking \ + models/models_mesh_generation \ + models/models_yaw_pitch_roll \ + models/models_material_pbr \ + models/models_skybox \ shaders/shaders_model_shader \ shaders/shaders_shapes_textures \ shaders/shaders_custom_uniform \ diff --git a/examples/models/models_material_pbr.c b/examples/models/models_material_pbr.c index 1f0694684..9f5763488 100644 --- a/examples/models/models_material_pbr.c +++ b/examples/models/models_material_pbr.c @@ -41,10 +41,13 @@ int main() model.material = LoadMaterialPBR((Color){ 255, 255, 255, 255 }, 1.0f, 1.0f); // Define lights attributes - Light lights[MAX_LIGHTS] = { CreateLight(LIGHT_POINT, (Vector3){ LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 0, 255 }, model.material.shader), - CreateLight(LIGHT_POINT, (Vector3){ 0.0f, LIGHT_HEIGHT, LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 255, 0, 255 }, model.material.shader), - CreateLight(LIGHT_POINT, (Vector3){ -LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 0, 255, 255 }, model.material.shader), - CreateLight(LIGHT_DIRECTIONAL, (Vector3){ 0.0f, LIGHT_HEIGHT*2.0f, -LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 255, 255 }, model.material.shader) }; + // NOTE: Shader is passed to every light on creation to define shader bindings internally + Light lights[MAX_LIGHTS] = { + CreateLight(LIGHT_POINT, (Vector3){ LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 0, 255 }, model.material.shader), + CreateLight(LIGHT_POINT, (Vector3){ 0.0f, LIGHT_HEIGHT, LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 255, 0, 255 }, model.material.shader), + CreateLight(LIGHT_POINT, (Vector3){ -LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 0, 255, 255 }, model.material.shader), + CreateLight(LIGHT_DIRECTIONAL, (Vector3){ 0.0f, LIGHT_HEIGHT*2.0f, -LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 255, 255 }, model.material.shader) + }; SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode @@ -156,6 +159,7 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness) UnloadTexture(cubemap); UnloadTexture(texHDR); + // Unload already used shaders (to create specific textures) UnloadShader(shdrCubemap); UnloadShader(shdrIrradiance); UnloadShader(shdrPrefilter);