mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-02 20:29:18 -05:00
Compare commits
2 Commits
ca33d495b3
...
2554dcba9b
| Author | SHA1 | Date | |
|---|---|---|---|
| 2554dcba9b | |||
| 4f9b933b34 |
@ -604,6 +604,7 @@ TEXT = \
|
||||
text/text_writing_anim
|
||||
|
||||
MODELS = \
|
||||
models/models_animation_gpu_skinning \
|
||||
models/models_animation_playing \
|
||||
models/models_billboard_rendering \
|
||||
models/models_bone_socket \
|
||||
@ -611,7 +612,6 @@ MODELS = \
|
||||
models/models_cubicmap_rendering \
|
||||
models/models_first_person_maze \
|
||||
models/models_geometric_shapes \
|
||||
models/models_animation_gpu_skinning \
|
||||
models/models_heightmap_rendering \
|
||||
models/models_loading \
|
||||
models/models_loading_gltf \
|
||||
|
||||
@ -604,6 +604,7 @@ TEXT = \
|
||||
text/text_writing_anim
|
||||
|
||||
MODELS = \
|
||||
models/models_animation_gpu_skinning \
|
||||
models/models_animation_playing \
|
||||
models/models_billboard_rendering \
|
||||
models/models_bone_socket \
|
||||
@ -611,7 +612,6 @@ MODELS = \
|
||||
models/models_cubicmap_rendering \
|
||||
models/models_first_person_maze \
|
||||
models/models_geometric_shapes \
|
||||
models/models_animation_gpu_skinning \
|
||||
models/models_heightmap_rendering \
|
||||
models/models_loading \
|
||||
models/models_loading_gltf \
|
||||
@ -1019,8 +1019,11 @@ text/text_sprite_fonts: text/text_sprite_fonts.c
|
||||
text/text_unicode_emojis: text/text_unicode_emojis.c
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||
--preload-file text/resources/dejavu.fnt@resources/dejavu.fnt \
|
||||
--preload-file text/resources/dejavu.png@resources/dejavu.png \
|
||||
--preload-file text/resources/noto_cjk.fnt@resources/noto_cjk.fnt \
|
||||
--preload-file text/resources/symbola.fnt@resources/symbola.fnt
|
||||
--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_unicode_ranges: text/text_unicode_ranges.c
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||
@ -1030,6 +1033,12 @@ text/text_writing_anim: text/text_writing_anim.c
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||
|
||||
# Compile MODELS examples
|
||||
models/models_animation_gpu_skinning: models/models_animation_gpu_skinning.c
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||
--preload-file models/resources/models/gltf/greenman.glb@resources/models/gltf/greenman.glb \
|
||||
--preload-file models/resources/shaders/glsl100/skinning.vs@resources/shaders/glsl100/skinning.vs \
|
||||
--preload-file models/resources/shaders/glsl100/skinning.fs@resources/shaders/glsl100/skinning.fs
|
||||
|
||||
models/models_animation_playing: models/models_animation_playing.c
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||
--preload-file models/resources/models/iqm/guy.iqm@resources/models/iqm/guy.iqm \
|
||||
@ -1063,12 +1072,6 @@ models/models_first_person_maze: models/models_first_person_maze.c
|
||||
models/models_geometric_shapes: models/models_geometric_shapes.c
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
|
||||
|
||||
models/models_animation_gpu_skinning: models/models_animation_gpu_skinning.c
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||
--preload-file models/resources/models/gltf/greenman.glb@resources/models/gltf/greenman.glb \
|
||||
--preload-file models/resources/shaders/glsl100/skinning.vs@resources/shaders/glsl100/skinning.vs \
|
||||
--preload-file models/resources/shaders/glsl100/skinning.fs@resources/shaders/glsl100/skinning.fs
|
||||
|
||||
models/models_heightmap_rendering: models/models_heightmap_rendering.c
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
|
||||
--preload-file models/resources/heightmap.png@resources/heightmap.png
|
||||
|
||||
@ -169,9 +169,9 @@ int main(void)
|
||||
// Load the font resources
|
||||
// NOTE: fontAsian is for asian languages,
|
||||
// fontEmoji is the emojis and fontDefault is used for everything else
|
||||
Font fontDefault = LoadFont("resources/dejavu.fnt");
|
||||
Font fontAsian = LoadFont("resources/noto_cjk.fnt");
|
||||
Font fontEmoji = LoadFont("resources/symbola.fnt");
|
||||
Font fontDefault = LoadFont("resources/dejavu.fnt"); // Requires "resources/dejavu.png"
|
||||
Font fontAsian = LoadFont("resources/noto_cjk.fnt"); // Requires "resources/noto_cjk.png"
|
||||
Font fontEmoji = LoadFont("resources/symbola.fnt"); // Requires "resources/symbola.png"
|
||||
|
||||
Vector2 hoveredPos = { 0.0f, 0.0f };
|
||||
Vector2 selectedPos = { 0.0f, 0.0f };
|
||||
|
||||
11
src/rlgl.h
11
src/rlgl.h
@ -1067,6 +1067,7 @@ typedef struct rlglData {
|
||||
Matrix stack[RL_MAX_MATRIX_STACK_SIZE];// Matrix stack for push/pop
|
||||
int stackCounter; // Matrix stack counter
|
||||
|
||||
unsigned int currentTextureId; // Current texture id to be used on glBegin
|
||||
unsigned int defaultTextureId; // Default texture used on shapes/poly drawing (required by shader)
|
||||
unsigned int activeTextureId[RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS]; // Active texture ids to be enabled on batch drawing (0 active by default)
|
||||
unsigned int defaultVShaderId; // Default vertex shader id (used by default shader program)
|
||||
@ -1485,8 +1486,8 @@ void rlBegin(int mode)
|
||||
if (RLGL.currentBatch->drawCounter >= RL_DEFAULT_BATCH_DRAWCALLS) rlDrawRenderBatch(RLGL.currentBatch);
|
||||
|
||||
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode = mode;
|
||||
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount = 0;
|
||||
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId = RLGL.State.defaultTextureId;
|
||||
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId = RLGL.State.currentTextureId;
|
||||
RLGL.State.currentTextureId = RLGL.State.defaultTextureId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1651,6 +1652,7 @@ void rlSetTexture(unsigned int id)
|
||||
{
|
||||
rlDrawRenderBatch(RLGL.currentBatch);
|
||||
}
|
||||
RLGL.State.currentTextureId = RLGL.State.defaultTextureId;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@ -1658,6 +1660,7 @@ void rlSetTexture(unsigned int id)
|
||||
#if defined(GRAPHICS_API_OPENGL_11)
|
||||
rlEnableTexture(id);
|
||||
#else
|
||||
RLGL.State.currentTextureId = id;
|
||||
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId != id)
|
||||
{
|
||||
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount > 0)
|
||||
@ -1676,6 +1679,9 @@ void rlSetTexture(unsigned int id)
|
||||
RLGL.State.vertexCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment;
|
||||
|
||||
RLGL.currentBatch->drawCounter++;
|
||||
|
||||
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode = RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 2].mode;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -2257,6 +2263,7 @@ void rlglInit(int width, int height)
|
||||
// Init default white texture
|
||||
unsigned char pixels[4] = { 255, 255, 255, 255 }; // 1 pixel RGBA (4 bytes)
|
||||
RLGL.State.defaultTextureId = rlLoadTexture(pixels, 1, 1, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, 1);
|
||||
RLGL.State.currentTextureId = RLGL.State.defaultTextureId;
|
||||
|
||||
if (RLGL.State.defaultTextureId != 0) TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Default texture loaded successfully", RLGL.State.defaultTextureId);
|
||||
else TRACELOG(RL_LOG_WARNING, "TEXTURE: Failed to load default texture");
|
||||
|
||||
@ -137,7 +137,7 @@ Example elements validated:
|
||||
| models_heightmap_rendering | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||
| models_skybox_rendering | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||
| models_textured_cube | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||
| models_gpu_skinning | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||
| models_animation_gpu_skinning | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||
| models_bone_socket | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||
| models_tesseract_view | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||
| shaders_basic_lighting | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||
|
||||
Reference in New Issue
Block a user