Reviewed makefile and examples building

This commit is contained in:
raysan5 2021-10-17 21:00:52 +02:00
parent cf12992b6a
commit f437f7b405
5 changed files with 127 additions and 71 deletions

View File

@ -304,7 +304,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# we can compile same code for ALL platforms with no change required, but, working on bigger
# projects, code needs to be refactored to avoid a blocking while() loop, moving Update and Draw
# logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference.
# NOTE: Additional compilate flags for TOTAL_MEMORY, FORCE_FILESYSTEM and resources loading
# are specified per-example for optimization
@ -514,7 +514,6 @@ PHYSICS = \
physics/physics_restitution \
physics/physics_shatter
CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
# Default target entry
@ -533,6 +532,9 @@ physics: $(PHYSICS)
core/core_basic_window: core/core_basic_window.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
core/core_basic_screen_manager: core/core_basic_screen_manager.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
core/core_input_keys: core/core_input_keys.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
@ -561,7 +563,7 @@ core/core_2d_camera_platformer: core/core_2d_camera_platformer.c
core/core_3d_camera_mode: core/core_3d_camera_mode.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
core/core_3d_camera_free: core/core_3d_camera_free.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
@ -596,15 +598,25 @@ core/core_vr_simulator: core/core_vr_simulator.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file core/resources/distortion100.fs@resources/distortion100.fs
# NOTE: To use multi-threading raylib must be compiled with multi-theading support (-s USE_PTHREADS=1)
core/core_loading_thread: core/core_loading_thread.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s USE_PTHREADS=1
core/core_quat_conversion: core/core_quat_conversion.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
core/core_window_flags: core/core_window_flags.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
core/core_split_screen: core/core_split_screen.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
core/core_smooth_pixelperfect: core/core_smooth_pixelperfect.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
core/core_custom_frame_control: core/core_custom_frame_control.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# Compile SHAPES examples
shapes/shapes_basic_shapes: shapes/shapes_basic_shapes.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
@ -614,7 +626,7 @@ shapes/shapes_bouncing_ball: shapes/shapes_bouncing_ball.c
shapes/shapes_colors_palette: shapes/shapes_colors_palette.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
shapes/shapes_logo_raylib: shapes/shapes_logo_raylib.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
@ -626,28 +638,28 @@ shapes/shapes_rectangle_scaling: shapes/shapes_rectangle_scaling.c
shapes/shapes_lines_bezier: shapes/shapes_lines_bezier.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
shapes/shapes_collision_area: shapes/shapes_collision_area.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
shapes/shapes_following_eyes: shapes/shapes_following_eyes.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
shapes/shapes_easings_ball_anim: shapes/shapes_easings_ball_anim.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
shapes/shapes_easings_box_anim: shapes/shapes_easings_box_anim.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
shapes/shapes_easings_rectangle_array: shapes/shapes_easings_rectangle_array.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
shapes/shapes_draw_ring: shapes/shapes_draw_ring.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
shapes/shapes_draw_circle_sector: shapes/shapes_draw_circle_sector.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
shapes/shapes_draw_rectangle_rounded: shapes/shapes_draw_rectangle_rounded.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
@ -666,7 +678,7 @@ textures/textures_rectangle: textures/textures_rectangle.c
textures/textures_srcrec_dstrec: textures/textures_srcrec_dstrec.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file textures/resources/scarfy.png@resources/scarfy.png
textures/textures_image_loading: textures/textures_image_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file textures/resources/raylib_logo.png@resources/raylib_logo.png
@ -676,14 +688,14 @@ textures/textures_image_drawing: textures/textures_image_drawing.c
--preload-file textures/resources/custom_jupiter_crash.png@resources/custom_jupiter_crash.png \
--preload-file textures/resources/parrots.png@resources/parrots.png \
--preload-file textures/resources/cat.png@resources/cat.png
textures/textures_image_generation: textures/textures_image_generation.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864
textures/textures_image_processing: textures/textures_image_processing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file textures/resources/parrots.png@resources/parrots.png
textures/textures_image_text: textures/textures_image_text.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file textures/resources/parrots.png@resources/parrots.png \
@ -692,11 +704,11 @@ textures/textures_image_text: textures/textures_image_text.c
textures/textures_to_image: textures/textures_to_image.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file textures/resources/raylib_logo.png@resources/raylib_logo.png
textures/textures_raw_data: textures/textures_raw_data.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file textures/resources/fudesumi.raw@resources/fudesumi.raw
textures/textures_particles_blending: textures/textures_particles_blending.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file textures/resources/spark_flame.png@resources/spark_flame.png
@ -704,36 +716,40 @@ textures/textures_particles_blending: textures/textures_particles_blending.c
textures/textures_npatch_drawing: textures/textures_npatch_drawing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file textures/resources/ninepatch_button.png@resources/ninepatch_button.png
textures/textures_background_scrolling: textures/textures_background_scrolling.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file textures/resources/cyberpunk_street_background.png@resources/cyberpunk_street_background.png \
--preload-file textures/resources/cyberpunk_street_midground.png@resources/cyberpunk_street_midground.png \
--preload-file textures/resources/cyberpunk_street_foreground.png@resources/cyberpunk_street_foreground.png
textures/textures_sprite_button: textures/textures_sprite_button.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file textures/resources/button.png@resources/button.png \
--preload-file textures/resources/buttonfx.wav@resources/buttonfx.wav
textures/textures_sprite_explosion: textures/textures_sprite_explosion.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file textures/resources/explosion.png@resources/explosion.png \
--preload-file textures/resources/boom.wav@resources/boom.wav
textures/textures_bunnymark: textures/textures_bunnymark.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file textures/resources/wabbit_alpha.png@resources/wabbit_alpha.png
textures/textures_blend_modes: textures/textures_blend_modes.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s ASYNCIFY \
--preload-file textures/resources/cyberpunk_street_background.png@resources/cyberpunk_street_background.png \
--preload-file textures/resources/cyberpunk_street_foreground.png@resources/cyberpunk_street_foreground.png
textures/textures_draw_tiled: textures/textures_draw_tiled.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s ASYNCIFY \
--preload-file textures/resources/patterns.png@resources/patterns.png
textures/textures_polygon: textures/textures_polygon.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file textures/resources/cat.png@resources/cat.png
# Compile TEXT examples
text/text_raylib_fonts: text/text_raylib_fonts.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
@ -756,7 +772,7 @@ text/text_font_loading: text/text_font_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file text/resources/pixantiqua.fnt@resources/pixantiqua.fnt \
--preload-file text/resources/pixantiqua.png@resources/pixantiqua.png \
--preload-file text/resources/pixantiqua.ttf@resources/pixantiqua.ttf
--preload-file text/resources/pixantiqua.ttf@resources/pixantiqua.ttf
text/text_font_filters: text/text_font_filters.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
@ -766,7 +782,7 @@ text/text_font_sdf: text/text_font_sdf.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file text/resources/anonymous_pro_bold.ttf@resources/anonymous_pro_bold.ttf \
--preload-file text/resources/shaders/glsl100/sdf.fs@resources/shaders/glsl100/sdf.fs
text/text_format_text: text/text_format_text.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
@ -787,21 +803,25 @@ text/text_unicode: text/text_unicode.c
--preload-file text/resources/noto_cjk.png@resources/noto_cjk.png \
--preload-file text/resources/symbola.fnt@resources/symbola.fnt \
--preload-file text/resources/symbola.png@resources/symbola.png
text/text_draw_3d: text/text_draw_3d.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file text/resources/shaders/glsl100/alpha_discard.fs@resources/shaders/glsl100/alpha_discard.fs
# Compile MODELS examples
models/models_animation: models/models_animation.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file models/resources/iqm/guy/guy.iqm@resources/iqm/guy/guy.iqm \
--preload-file models/resources/iqm/guy/guytex.png@resources/iqm/guy/guytex.png \
--preload-file models/resources/iqm/guy/guyanim.iqm@resources/iqm/guy/guyanim.iqm
--preload-file models/resources/models/iqm/guy.iqm@resources/models/iqm/guy.iqm \
--preload-file models/resources/models/iqm/guytex.png@resources/models/iqm/guytex.png \
--preload-file models/resources/models/iqm/guyanim.iqm@resources/models/iqm/guyanim.iqm
models/models_billboard: models/models_billboard.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file models/resources/billboard.png@resources/billboard.png
models/models_box_collisions: models/models_box_collisions.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
models/models_cubicmap: models/models_cubicmap.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file models/resources/cubicmap.png@resources/cubicmap.png \
@ -817,7 +837,7 @@ models/models_geometric_shapes: models/models_geometric_shapes.c
models/models_mesh_generation: models/models_mesh_generation.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
models/models_mesh_picking: models/models_mesh_picking.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file models/resources/models/obj/turret.obj@resources/models/obj/turret.obj \
@ -827,7 +847,7 @@ models/models_loading: models/models_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file models/resources/models/obj/castle.obj@resources/models/obj/castle.obj \
--preload-file models/resources/models/obj/castle_diffuse.png@resources/models/obj/castle_diffuse.png
models/models_loading_vox: models/models_loading_vox.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file models/resources/models/vox/chr_knight.vox@resources/models/vox/chr_knight.vox \
@ -837,7 +857,13 @@ models/models_loading_vox: models/models_loading_vox.c
models/models_loading_gltf: models/models_loading_gltf.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file models/resources/models/gltf/raylib_32x32.glb@resources/models/gltf/raylib_32x32.glb \
--preload-file models/resources/models/gltf/girl.glb@resources/models/gltf/girl.glb
--preload-file models/resources/models/gltf/girl.glb@resources/models/gltf/girl.glb \
--preload-file models/resources/models/gltf/rigged_figure.glb@resources/models/gltf/rigged_figure.glb \
--preload-file models/resources/models/gltf/GearboxAssy.glb@resources/models/gltf/GearboxAssy.glb \
--preload-file models/resources/models/gltf/BoxAnimated.glb@resources/models/gltf/BoxAnimated.glb \
--preload-file models/resources/models/gltf/AnimatedTriangle.gltf@resources/models/gltf/AnimatedTriangle.gltf \
--preload-file models/resources/models/gltf/AnimatedMorphCube.glb@resources/models/gltf/AnimatedMorphCube.glb \
--preload-file models/resources/models/gltf/vertex_colored_object.glb@resources/models/gltf/vertex_colored_object.glb
models/models_orthographic_projection: models/models_orthographic_projection.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
@ -857,7 +883,7 @@ models/models_yaw_pitch_roll: models/models_yaw_pitch_roll.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file models/resources/models/gltf/plane/plane.gltf@resources/models/gltf/plane/plane.gltf \
--preload-file models/resources/models/gltf/plane/plane_diffuse.png@resources/models/gltf/plane/plane_diffuse.png
models/models_heightmap: models/models_heightmap.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file models/resources/heightmap.png@resources/heightmap.png
@ -868,8 +894,8 @@ models/models_waving_cubes: models/models_waving_cubes.c
# Compile SHADER examples
shaders/shaders_model_shader: shaders/shaders_model_shader.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file shaders/resources/models/obj/watermill.obj@resources/models/obj/watermill.obj \
--preload-file shaders/resources/models/obj/watermill_diffuse.png@resources/models/obj/watermill_diffuse.png \
--preload-file shaders/resources/models/watermill.obj@resources/models/watermill.obj \
--preload-file shaders/resources/models/watermill_diffuse.png@resources/models/watermill_diffuse.png \
--preload-file shaders/resources/shaders/glsl100/grayscale.fs@resources/shaders/glsl100/grayscale.fs
shaders/shaders_shapes_textures: shaders/shaders_shapes_textures.c
@ -880,28 +906,28 @@ shaders/shaders_shapes_textures: shaders/shaders_shapes_textures.c
shaders/shaders_custom_uniform: shaders/shaders_custom_uniform.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file shaders/resources/models/obj/barracks.obj@resources/models/obj/barracks.obj \
--preload-file shaders/resources/models/obj/barracks_diffuse.png@resources/models/obj/barracks_diffuse.png \
--preload-file shaders/resources/models/barracks.obj@resources/models/barracks.obj \
--preload-file shaders/resources/models/barracks_diffuse.png@resources/models/barracks_diffuse.png \
--preload-file shaders/resources/shaders/glsl100/swirl.fs@resources/shaders/glsl100/swirl.fs
shaders/shaders_postprocessing: shaders/shaders_postprocessing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 \
--preload-file shaders/resources/models/obj/church.obj@resources/models/obj/church.obj \
--preload-file shaders/resources/models/obj/church_diffuse.png@resources/models/obj/church_diffuse.png \
--preload-file shaders/resources/models/church.obj@resources/models/church.obj \
--preload-file shaders/resources/models/church_diffuse.png@resources/models/church_diffuse.png \
--preload-file shaders/resources/shaders/glsl100@resources/shaders/glsl100
shaders/shaders_palette_switch: shaders/shaders_palette_switch.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/shaders/glsl100/palette_switch.fs@resources/shaders/glsl100/palette_switch.fs
shaders/shaders_raymarching: shaders/shaders_raymarching.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/shaders/glsl100/raymarching.fs@resources/shaders/glsl100/raymarching.fs
shaders/shaders_texture_drawing: shaders/shaders_texture_drawing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/shaders/glsl100/cubes_panning.fs@resources/shaders/glsl100/cubes_panning.fs
shaders/shaders_texture_waves: shaders/shaders_texture_waves.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/space.png@resources/space.png \
@ -932,17 +958,17 @@ shaders/shaders_simple_mask: shaders/shaders_simple_mask.c
--preload-file shaders/resources/plasma.png@resources/plasma.png \
--preload-file shaders/resources/mask.png@resources/mask.png \
--preload-file shaders/resources/shaders/glsl100/mask.fs@resources/shaders/glsl100/mask.fs
shaders/shaders_spotlight: shaders/shaders_spotlight.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/raysan.png@resources/raysan.png \
--preload-file shaders/resources/shaders/glsl100/spotlight.fs@resources/shaders/glsl100/spotlight.fs
shaders/shaders_hot_reloading: shaders/shaders_hot_reloading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s FORCE_FILESYSTEM=1 \
--preload-file shaders/resources/shaders/glsl100/reload.fs@resources/shaders/glsl100/reload.fs
shaders/shaders_rlgl_mesh_instanced: shaders/shaders_rlgl_mesh_instanced.c
shaders/shaders_mesh_instancing: shaders/shaders_mesh_instancing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/shaders/glsl100/lighting.fs@resources/shaders/glsl100/lighting.fs \
--preload-file shaders/resources/shaders/glsl100/base_lighting_instanced.vs@resources/shaders/glsl100/base_lighting_instanced.vs
@ -950,6 +976,11 @@ shaders/shaders_rlgl_mesh_instanced: shaders/shaders_rlgl_mesh_instanced.c
shaders/shaders_multi_sample2d: shaders/shaders_multi_sample2d.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/shaders/glsl100/color_mix.fs@resources/shaders/glsl100/color_mix.fs
shaders/shaders_texture_outline: shaders/shaders_texture_outline.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file shaders/resources/shaders/glsl100/outline.fs@resources/shaders/glsl100/outline.fs \
--preload-file shaders/resources/fudesumi.png@resources/fudesumi.png
# Compile AUDIO examples
audio/audio_module_playing: audio/audio_module_playing.c
@ -974,6 +1005,7 @@ audio/audio_multichannel_sound: audio/audio_multichannel_sound.c
--preload-file audio/resources/target.ogg@resources/target.ogg
# Compile PHYSICS examples
# NOTE: To use multi-threading raylib must be compiled with multi-theading support (-s USE_PTHREADS=1)
physics/physics_demo: physics/physics_demo.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -static -lpthread -D$(PLATFORM) -s USE_PTHREADS=1

View File

@ -9,27 +9,29 @@ varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
uniform vec2 texScale;
// Function for drawing outlines on alpha-blended textures
vec4 DrawOutline(sampler2D tex, vec2 uv, vec2 lineScale, vec3 lineCol)
{
vec2 texelScale = 1.0 / lineScale;
vec4 center = texture2D(tex, uv); // We sample the center texel, (with all color data)
// Next we sample four corner texels, but only for the alpha channel (this is for the outline)
vec4 corners;
corners.x = texture2D(tex, uv+vec2( texelScale.x, texelScale.y)).a;
corners.y = texture2D(tex, uv+vec2( texelScale.x,-texelScale.y)).a;
corners.z = texture2D(tex, uv+vec2(-texelScale.x, texelScale.y)).a;
corners.w = texture2D(tex, uv+vec2(-texelScale.x,-texelScale.y)).a;
float outline = min(dot(corners, vec4(1.0)), 1.0);
vec4 col = mix(vec4(0.0), vec4(lineCol, 1.0), outline);
col = mix(col, center, center.a);
return col;
}
uniform vec2 textureSize;
uniform float outlineSize;
uniform vec4 outlineColor;
// Output fragment color
out vec4 finalColor;
void main()
{
gl_FragColor = DrawOutline(texture0, fragTexCoord, texScale, vec3(0.0));
vec4 texel = texture2D(texture0, fragTexCoord); // Get texel color
vec2 texelScale = vec2(0.0);
texelScale.x = outlineSize/textureSize.x;
texelScale.y = outlineSize/textureSize.y;
// We sample four corner texels, but only for the alpha channel (this is for the outline)
vec4 corners = vec4(0.0);
corners.x = texture2D(texture0, fragTexCoord + vec2(texelScale.x, texelScale.y)).a;
corners.y = texture2D(texture0, fragTexCoord + vec2(texelScale.x, -texelScale.y)).a;
corners.z = texture2D(texture0, fragTexCoord + vec2(-texelScale.x, texelScale.y)).a;
corners.w = texture2D(texture0, fragTexCoord + vec2(-texelScale.x, -texelScale.y)).a;
float outline = min(dot(corners, vec4(1.0)), 1.0);
vec4 color = mix(vec4(0.0), outlineColor, outline);
gl_FragColor = mix(color, texel, texel.a);
}

View File

@ -0,0 +1,20 @@
#version 100
precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
void main()
{
vec4 texelColor = texture2D(texture0, fragTexCoord);
if (texelColor.a == 0.0) discard;
gl_FragColor = texelColor*fragColor*colDiffuse;
}

View File

@ -1,5 +1,7 @@
#version 100
precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;

View File

@ -43,8 +43,8 @@
.PHONY: all clean install uninstall
# Define required raylib variables
RAYLIB_VERSION = 3.8.1
RAYLIB_API_VERSION = 381
RAYLIB_VERSION = 4.0.0
RAYLIB_API_VERSION = 400
# Define raylib source code path
RAYLIB_SRC_PATH ?= ../src