Browse Source

Added new examples to build...

...and reviewed some details
pull/367/head
Ray San 7 years ago
parent
commit
8ace02c2ff
2 changed files with 18 additions and 9 deletions
  1. +10
    -5
      examples/Makefile
  2. +8
    -4
      examples/models/models_material_pbr.c

+ 10
- 5
examples/Makefile View File

@ -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 \

+ 8
- 4
examples/models/models_material_pbr.c View File

@ -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);

||||||
x
 
000:0
Loading…
Cancel
Save