Merge branch 'raysan5:master' into master
This commit is contained in:
commit
2771f4653a
|
|
@ -100,9 +100,10 @@ elseif ("${PLATFORM}" MATCHES "SDL")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (NOT ${OPENGL_VERSION} MATCHES "OFF")
|
if (NOT ${OPENGL_VERSION} MATCHES "OFF")
|
||||||
set(${SUGGESTED_GRAPHICS} "${GRAPHICS}")
|
set(SUGGESTED_GRAPHICS "${GRAPHICS}")
|
||||||
|
|
||||||
if (${OPENGL_VERSION} MATCHES "4.3")
|
if (${OPENGL_VERSION} MATCHES "4.3")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_43")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_43")
|
||||||
elseif (${OPENGL_VERSION} MATCHES "3.3")
|
elseif (${OPENGL_VERSION} MATCHES "3.3")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_33")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_33")
|
||||||
elseif (${OPENGL_VERSION} MATCHES "2.1")
|
elseif (${OPENGL_VERSION} MATCHES "2.1")
|
||||||
|
|
@ -114,8 +115,8 @@ if (NOT ${OPENGL_VERSION} MATCHES "OFF")
|
||||||
elseif (${OPENGL_VERSION} MATCHES "ES 3.0")
|
elseif (${OPENGL_VERSION} MATCHES "ES 3.0")
|
||||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES3")
|
set(GRAPHICS "GRAPHICS_API_OPENGL_ES3")
|
||||||
endif ()
|
endif ()
|
||||||
if ("${SUGGESTED_GRAPHICS}" AND NOT "${SUGGESTED_GRAPHICS}" STREQUAL "${GRAPHICS}")
|
if (NOT "${SUGGESTED_GRAPHICS}" STREQUAL "" AND NOT "${SUGGESTED_GRAPHICS}" STREQUAL "${GRAPHICS}")
|
||||||
message(WARNING "You are overriding the suggested GRAPHICS=${SUGGESTED_GRAPHICS} with ${GRAPHICS}! This may fail")
|
message(WARNING "You are overriding the suggested GRAPHICS=${SUGGESTED_GRAPHICS} with ${GRAPHICS}! This may fail.")
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ int main(void)
|
||||||
|
|
||||||
UnloadImage(cat); // Unload image from RAM
|
UnloadImage(cat); // Unload image from RAM
|
||||||
|
|
||||||
// Load custom font for frawing on image
|
// Load custom font for drawing on image
|
||||||
Font font = LoadFont("resources/custom_jupiter_crash.png");
|
Font font = LoadFont("resources/custom_jupiter_crash.png");
|
||||||
|
|
||||||
// Draw over image using custom font
|
// Draw over image using custom font
|
||||||
|
|
@ -93,4 +93,4 @@ int main(void)
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,17 @@ pub fn addRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
||||||
return raylib;
|
return raylib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn setDesktopPlatform(raylib: *std.Build.Step.Compile, platform: PlatformBackend) void {
|
||||||
|
raylib.defineCMacro("PLATFORM_DESKTOP", null);
|
||||||
|
|
||||||
|
switch (platform) {
|
||||||
|
.glfw => raylib.defineCMacro("PLATFORM_DESKTOP_GLFW", null),
|
||||||
|
.rgfw => raylib.defineCMacro("PLATFORM_DESKTOP_RGFW", null),
|
||||||
|
.sdl => raylib.defineCMacro("PLATFORM_DESKTOP_SDL", null),
|
||||||
|
else => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, options: Options) !*std.Build.Step.Compile {
|
fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, options: Options) !*std.Build.Step.Compile {
|
||||||
raylib_flags_arr.clearRetainingCapacity();
|
raylib_flags_arr.clearRetainingCapacity();
|
||||||
|
|
||||||
|
|
@ -102,7 +113,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
||||||
raylib.linkLibC();
|
raylib.linkLibC();
|
||||||
|
|
||||||
// No GLFW required on PLATFORM_DRM
|
// No GLFW required on PLATFORM_DRM
|
||||||
if (!options.platform_drm) {
|
if (options.platform != .drm) {
|
||||||
raylib.addIncludePath(b.path("src/external/glfw/include"));
|
raylib.addIncludePath(b.path("src/external/glfw/include"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,10 +147,10 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
||||||
raylib.linkSystemLibrary("gdi32");
|
raylib.linkSystemLibrary("gdi32");
|
||||||
raylib.linkSystemLibrary("opengl32");
|
raylib.linkSystemLibrary("opengl32");
|
||||||
|
|
||||||
raylib.defineCMacro("PLATFORM_DESKTOP", null);
|
setDesktopPlatform(raylib, options.platform);
|
||||||
},
|
},
|
||||||
.linux => {
|
.linux => {
|
||||||
if (!options.platform_drm) {
|
if (options.platform != .drm) {
|
||||||
try c_source_files.append("rglfw.c");
|
try c_source_files.append("rglfw.c");
|
||||||
raylib.linkSystemLibrary("GL");
|
raylib.linkSystemLibrary("GL");
|
||||||
raylib.linkSystemLibrary("rt");
|
raylib.linkSystemLibrary("rt");
|
||||||
|
|
@ -177,7 +188,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
||||||
waylandGenerate(b, raylib, "xdg-activation-v1.xml", "xdg-activation-v1-client-protocol");
|
waylandGenerate(b, raylib, "xdg-activation-v1.xml", "xdg-activation-v1-client-protocol");
|
||||||
waylandGenerate(b, raylib, "idle-inhibit-unstable-v1.xml", "idle-inhibit-unstable-v1-client-protocol");
|
waylandGenerate(b, raylib, "idle-inhibit-unstable-v1.xml", "idle-inhibit-unstable-v1-client-protocol");
|
||||||
}
|
}
|
||||||
raylib.defineCMacro("PLATFORM_DESKTOP", null);
|
setDesktopPlatform(raylib, options.platform);
|
||||||
} else {
|
} else {
|
||||||
if (options.opengl_version == .auto) {
|
if (options.opengl_version == .auto) {
|
||||||
raylib.linkSystemLibrary("GLESv2");
|
raylib.linkSystemLibrary("GLESv2");
|
||||||
|
|
@ -211,7 +222,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
||||||
raylib.linkSystemLibrary("Xxf86vm");
|
raylib.linkSystemLibrary("Xxf86vm");
|
||||||
raylib.linkSystemLibrary("Xcursor");
|
raylib.linkSystemLibrary("Xcursor");
|
||||||
|
|
||||||
raylib.defineCMacro("PLATFORM_DESKTOP", null);
|
setDesktopPlatform(raylib, options.platform);
|
||||||
},
|
},
|
||||||
.macos => {
|
.macos => {
|
||||||
// On macos rglfw.c include Objective-C files.
|
// On macos rglfw.c include Objective-C files.
|
||||||
|
|
@ -227,7 +238,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
||||||
raylib.linkFramework("AppKit");
|
raylib.linkFramework("AppKit");
|
||||||
raylib.linkFramework("IOKit");
|
raylib.linkFramework("IOKit");
|
||||||
|
|
||||||
raylib.defineCMacro("PLATFORM_DESKTOP", null);
|
setDesktopPlatform(raylib, options.platform);
|
||||||
},
|
},
|
||||||
.emscripten => {
|
.emscripten => {
|
||||||
raylib.defineCMacro("PLATFORM_WEB", null);
|
raylib.defineCMacro("PLATFORM_WEB", null);
|
||||||
|
|
@ -286,7 +297,7 @@ pub const Options = struct {
|
||||||
rtext: bool = true,
|
rtext: bool = true,
|
||||||
rtextures: bool = true,
|
rtextures: bool = true,
|
||||||
raygui: bool = false,
|
raygui: bool = false,
|
||||||
platform_drm: bool = false,
|
platform: PlatformBackend = .glfw,
|
||||||
shared: bool = false,
|
shared: bool = false,
|
||||||
linux_display_backend: LinuxDisplayBackend = .Both,
|
linux_display_backend: LinuxDisplayBackend = .Both,
|
||||||
opengl_version: OpenglVersion = .auto,
|
opengl_version: OpenglVersion = .auto,
|
||||||
|
|
@ -323,6 +334,13 @@ pub const LinuxDisplayBackend = enum {
|
||||||
Both,
|
Both,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub const PlatformBackend = enum {
|
||||||
|
glfw,
|
||||||
|
rgfw,
|
||||||
|
sdl,
|
||||||
|
drm
|
||||||
|
};
|
||||||
|
|
||||||
pub fn build(b: *std.Build) !void {
|
pub fn build(b: *std.Build) !void {
|
||||||
// Standard target options allows the person running `zig build` to choose
|
// Standard target options allows the person running `zig build` to choose
|
||||||
// what target to build for. Here we do not override the defaults, which
|
// what target to build for. Here we do not override the defaults, which
|
||||||
|
|
@ -336,7 +354,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
|
|
||||||
const defaults = Options{};
|
const defaults = Options{};
|
||||||
const options = Options{
|
const options = Options{
|
||||||
.platform_drm = b.option(bool, "platform_drm", "Compile raylib in native mode (no X11)") orelse defaults.platform_drm,
|
.platform = b.option(PlatformBackend, "platform", "Choose the platform backedn for desktop target") orelse defaults.platform,
|
||||||
.raudio = b.option(bool, "raudio", "Compile with audio support") orelse defaults.raudio,
|
.raudio = b.option(bool, "raudio", "Compile with audio support") orelse defaults.raudio,
|
||||||
.rmodels = b.option(bool, "rmodels", "Compile with models support") orelse defaults.rmodels,
|
.rmodels = b.option(bool, "rmodels", "Compile with models support") orelse defaults.rmodels,
|
||||||
.rtext = b.option(bool, "rtext", "Compile with text support") orelse defaults.rtext,
|
.rtext = b.option(bool, "rtext", "Compile with text support") orelse defaults.rtext,
|
||||||
|
|
|
||||||
13
src/config.h
13
src/config.h
|
|
@ -121,12 +121,10 @@
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES 6
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES 6
|
||||||
|
|
||||||
// The mac OpenGL drivers do not support more than 8 VBOs, so we can't support GPU animations
|
|
||||||
#ifndef __APPLE__
|
|
||||||
#define RL_SUPPORT_MESH_ANIMATION_VBO
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RL_SUPPORT_MESH_ANIMATION_VBO
|
#define RL_SUPPORT_MESH_GPU_SKINNING // Remove this if your GPU does not support more than 8 VBOs
|
||||||
|
|
||||||
|
#ifdef RL_SUPPORT_MESH_GPU_SKINNING
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS 7
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS 7
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 8
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 8
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -237,7 +235,12 @@
|
||||||
// rmodels: Configuration values
|
// rmodels: Configuration values
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
#define MAX_MATERIAL_MAPS 12 // Maximum number of shader maps supported
|
#define MAX_MATERIAL_MAPS 12 // Maximum number of shader maps supported
|
||||||
|
|
||||||
|
#ifdef RL_SUPPORT_MESH_GPU_SKINNING
|
||||||
#define MAX_MESH_VERTEX_BUFFERS 9 // Maximum vertex buffers (VBO) per mesh
|
#define MAX_MESH_VERTEX_BUFFERS 9 // Maximum vertex buffers (VBO) per mesh
|
||||||
|
#else
|
||||||
|
#define MAX_MESH_VERTEX_BUFFERS 7 // Maximum vertex buffers (VBO) per mesh
|
||||||
|
#endif
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Module: raudio - Configuration Flags
|
// Module: raudio - Configuration Flags
|
||||||
|
|
|
||||||
|
|
@ -1447,7 +1447,7 @@ int InitPlatform(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACELOG(LOG_WARNING, "SYSTEM: Closest fullscreen videomode: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
TRACELOG(LOG_INFO, "SYSTEM: Closest fullscreen videomode: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||||
|
|
||||||
// NOTE: ISSUE: Closest videomode could not match monitor aspect-ratio, for example,
|
// NOTE: ISSUE: Closest videomode could not match monitor aspect-ratio, for example,
|
||||||
// for a desired screen size of 800x450 (16:9), closest supported videomode is 800x600 (4:3),
|
// for a desired screen size of 800x450 (16:9), closest supported videomode is 800x600 (4:3),
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,13 @@
|
||||||
#include "SDL_opengl.h" // SDL OpenGL functionality (if required, instead of internal renderer)
|
#include "SDL_opengl.h" // SDL OpenGL functionality (if required, instead of internal renderer)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Defines and Macros
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
#ifndef MAX_CLIPBOARD_BUFFER_LENGTH
|
||||||
|
#define MAX_CLIPBOARD_BUFFER_LENGTH 1024 // Size of the clipboard buffer used on GetClipboardText()
|
||||||
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Types and Structures Definition
|
// Types and Structures Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
@ -852,10 +859,22 @@ void SetClipboardText(const char *text)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get clipboard text content
|
// Get clipboard text content
|
||||||
// NOTE: returned string must be freed with SDL_free()
|
|
||||||
const char *GetClipboardText(void)
|
const char *GetClipboardText(void)
|
||||||
{
|
{
|
||||||
return SDL_GetClipboardText();
|
static char buffer[MAX_CLIPBOARD_BUFFER_LENGTH] = { 0 };
|
||||||
|
|
||||||
|
char *clipboard = SDL_GetClipboardText();
|
||||||
|
|
||||||
|
int clipboardSize = snprintf(buffer, sizeof(buffer), "%s", clipboard);
|
||||||
|
if (clipboardSize >= MAX_CLIPBOARD_BUFFER_LENGTH)
|
||||||
|
{
|
||||||
|
char *truncate = buffer + MAX_CLIPBOARD_BUFFER_LENGTH - 4;
|
||||||
|
sprintf(truncate, "...");
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_free(clipboard);
|
||||||
|
|
||||||
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show mouse cursor
|
// Show mouse cursor
|
||||||
|
|
@ -1589,8 +1608,8 @@ int InitPlatform(void)
|
||||||
// Initialize storage system
|
// Initialize storage system
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Define base path for storage
|
// Define base path for storage
|
||||||
CORE.Storage.basePath = SDL_GetBasePath(); // Alternative: GetWorkingDirectory();
|
CORE.Storage.basePath = SDL_GetBasePath(); // Alternative: GetWorkingDirectory();
|
||||||
CHDIR(CORE.Storage.basePath);
|
CHDIR(CORE.Storage.basePath);
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (SDL): Initialized successfully");
|
TRACELOG(LOG_INFO, "PLATFORM: DESKTOP (SDL): Initialized successfully");
|
||||||
|
|
|
||||||
|
|
@ -444,11 +444,17 @@ void UpdateCamera(Camera *camera, int mode)
|
||||||
bool lockView = ((mode == CAMERA_FREE) || (mode == CAMERA_FIRST_PERSON) || (mode == CAMERA_THIRD_PERSON) || (mode == CAMERA_ORBITAL));
|
bool lockView = ((mode == CAMERA_FREE) || (mode == CAMERA_FIRST_PERSON) || (mode == CAMERA_THIRD_PERSON) || (mode == CAMERA_ORBITAL));
|
||||||
bool rotateUp = false;
|
bool rotateUp = false;
|
||||||
|
|
||||||
|
// Camera speeds based on frame time
|
||||||
|
float cameraMoveSpeed = CAMERA_MOVE_SPEED*GetFrameTime();
|
||||||
|
float cameraRotationSpeed = CAMERA_ROTATION_SPEED*GetFrameTime();
|
||||||
|
float cameraPanSpeed = CAMERA_PAN_SPEED*GetFrameTime();
|
||||||
|
float cameraOrbitalSpeed = CAMERA_ORBITAL_SPEED*GetFrameTime();
|
||||||
|
|
||||||
if (mode == CAMERA_CUSTOM) {}
|
if (mode == CAMERA_CUSTOM) {}
|
||||||
else if (mode == CAMERA_ORBITAL)
|
else if (mode == CAMERA_ORBITAL)
|
||||||
{
|
{
|
||||||
// Orbital can just orbit
|
// Orbital can just orbit
|
||||||
Matrix rotation = MatrixRotate(GetCameraUp(camera), CAMERA_ORBITAL_SPEED*GetFrameTime());
|
Matrix rotation = MatrixRotate(GetCameraUp(camera), cameraOrbitalSpeed);
|
||||||
Vector3 view = Vector3Subtract(camera->position, camera->target);
|
Vector3 view = Vector3Subtract(camera->position, camera->target);
|
||||||
view = Vector3Transform(view, rotation);
|
view = Vector3Transform(view, rotation);
|
||||||
camera->position = Vector3Add(camera->target, view);
|
camera->position = Vector3Add(camera->target, view);
|
||||||
|
|
@ -456,22 +462,22 @@ void UpdateCamera(Camera *camera, int mode)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Camera rotation
|
// Camera rotation
|
||||||
if (IsKeyDown(KEY_DOWN)) CameraPitch(camera, -CAMERA_ROTATION_SPEED, lockView, rotateAroundTarget, rotateUp);
|
if (IsKeyDown(KEY_DOWN)) CameraPitch(camera, -cameraRotationSpeed, lockView, rotateAroundTarget, rotateUp);
|
||||||
if (IsKeyDown(KEY_UP)) CameraPitch(camera, CAMERA_ROTATION_SPEED, lockView, rotateAroundTarget, rotateUp);
|
if (IsKeyDown(KEY_UP)) CameraPitch(camera, cameraRotationSpeed, lockView, rotateAroundTarget, rotateUp);
|
||||||
if (IsKeyDown(KEY_RIGHT)) CameraYaw(camera, -CAMERA_ROTATION_SPEED, rotateAroundTarget);
|
if (IsKeyDown(KEY_RIGHT)) CameraYaw(camera, -cameraRotationSpeed, rotateAroundTarget);
|
||||||
if (IsKeyDown(KEY_LEFT)) CameraYaw(camera, CAMERA_ROTATION_SPEED, rotateAroundTarget);
|
if (IsKeyDown(KEY_LEFT)) CameraYaw(camera, cameraRotationSpeed, rotateAroundTarget);
|
||||||
if (IsKeyDown(KEY_Q)) CameraRoll(camera, -CAMERA_ROTATION_SPEED);
|
if (IsKeyDown(KEY_Q)) CameraRoll(camera, -cameraRotationSpeed);
|
||||||
if (IsKeyDown(KEY_E)) CameraRoll(camera, CAMERA_ROTATION_SPEED);
|
if (IsKeyDown(KEY_E)) CameraRoll(camera, cameraRotationSpeed);
|
||||||
|
|
||||||
// Camera movement
|
// Camera movement
|
||||||
// Camera pan (for CAMERA_FREE)
|
// Camera pan (for CAMERA_FREE)
|
||||||
if ((mode == CAMERA_FREE) && (IsMouseButtonDown(MOUSE_BUTTON_MIDDLE)))
|
if ((mode == CAMERA_FREE) && (IsMouseButtonDown(MOUSE_BUTTON_MIDDLE)))
|
||||||
{
|
{
|
||||||
const Vector2 mouseDelta = GetMouseDelta();
|
const Vector2 mouseDelta = GetMouseDelta();
|
||||||
if (mouseDelta.x > 0.0f) CameraMoveRight(camera, CAMERA_PAN_SPEED, moveInWorldPlane);
|
if (mouseDelta.x > 0.0f) CameraMoveRight(camera, cameraPanSpeed, moveInWorldPlane);
|
||||||
if (mouseDelta.x < 0.0f) CameraMoveRight(camera, -CAMERA_PAN_SPEED, moveInWorldPlane);
|
if (mouseDelta.x < 0.0f) CameraMoveRight(camera, -cameraPanSpeed, moveInWorldPlane);
|
||||||
if (mouseDelta.y > 0.0f) CameraMoveUp(camera, -CAMERA_PAN_SPEED);
|
if (mouseDelta.y > 0.0f) CameraMoveUp(camera, -cameraPanSpeed);
|
||||||
if (mouseDelta.y < 0.0f) CameraMoveUp(camera, CAMERA_PAN_SPEED);
|
if (mouseDelta.y < 0.0f) CameraMoveUp(camera, cameraPanSpeed);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -481,7 +487,6 @@ void UpdateCamera(Camera *camera, int mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keyboard support
|
// Keyboard support
|
||||||
float cameraMoveSpeed = CAMERA_MOVE_SPEED*GetFrameTime();
|
|
||||||
if (IsKeyDown(KEY_W)) CameraMoveForward(camera, cameraMoveSpeed, moveInWorldPlane);
|
if (IsKeyDown(KEY_W)) CameraMoveForward(camera, cameraMoveSpeed, moveInWorldPlane);
|
||||||
if (IsKeyDown(KEY_A)) CameraMoveRight(camera, -cameraMoveSpeed, moveInWorldPlane);
|
if (IsKeyDown(KEY_A)) CameraMoveRight(camera, -cameraMoveSpeed, moveInWorldPlane);
|
||||||
if (IsKeyDown(KEY_S)) CameraMoveForward(camera, -cameraMoveSpeed, moveInWorldPlane);
|
if (IsKeyDown(KEY_S)) CameraMoveForward(camera, -cameraMoveSpeed, moveInWorldPlane);
|
||||||
|
|
|
||||||
|
|
@ -348,7 +348,7 @@
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES 6
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES 6
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RL_SUPPORT_MESH_ANIMATION_VBO
|
#ifdef RL_SUPPORT_MESH_GPU_SKINNING
|
||||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS
|
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS
|
||||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS 7
|
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS 7
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -4175,7 +4175,7 @@ unsigned int rlLoadShaderProgram(unsigned int vShaderId, unsigned int fShaderId)
|
||||||
glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT, RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT);
|
glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT, RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT);
|
||||||
glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2, RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2);
|
glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2, RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2);
|
||||||
|
|
||||||
#ifdef RL_SUPPORT_MESH_ANIMATION_VBO
|
#ifdef RL_SUPPORT_MESH_GPU_SKINNING
|
||||||
glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS, RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS);
|
glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS, RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS);
|
||||||
glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS, RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS);
|
glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS, RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1254,7 +1254,7 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
||||||
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2] = 0; // Vertex buffer: texcoords2
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2] = 0; // Vertex buffer: texcoords2
|
||||||
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES] = 0; // Vertex buffer: indices
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES] = 0; // Vertex buffer: indices
|
||||||
|
|
||||||
#ifdef RL_SUPPORT_MESH_ANIMATION_VBO
|
#ifdef RL_SUPPORT_MESH_GPU_SKINNING
|
||||||
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS] = 0; // Vertex buffer: boneIds
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS] = 0; // Vertex buffer: boneIds
|
||||||
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS] = 0; // Vertex buffer: boneWeights
|
mesh->vboId[RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS] = 0; // Vertex buffer: boneWeights
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1345,7 +1345,7 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
||||||
rlDisableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2);
|
rlDisableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RL_SUPPORT_MESH_ANIMATION_VBO
|
#ifdef RL_SUPPORT_MESH_GPU_SKINNING
|
||||||
if (mesh->boneIds != NULL)
|
if (mesh->boneIds != NULL)
|
||||||
{
|
{
|
||||||
// Enable vertex attribute: boneIds (shader-location = 6)
|
// Enable vertex attribute: boneIds (shader-location = 6)
|
||||||
|
|
@ -1492,7 +1492,7 @@ void DrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||||
// Upload model normal matrix (if locations available)
|
// Upload model normal matrix (if locations available)
|
||||||
if (material.shader.locs[SHADER_LOC_MATRIX_NORMAL] != -1) rlSetUniformMatrix(material.shader.locs[SHADER_LOC_MATRIX_NORMAL], MatrixTranspose(MatrixInvert(matModel)));
|
if (material.shader.locs[SHADER_LOC_MATRIX_NORMAL] != -1) rlSetUniformMatrix(material.shader.locs[SHADER_LOC_MATRIX_NORMAL], MatrixTranspose(MatrixInvert(matModel)));
|
||||||
|
|
||||||
#ifdef RL_SUPPORT_MESH_ANIMATION_VBO
|
#ifdef RL_SUPPORT_MESH_GPU_SKINNING
|
||||||
// Upload Bone Transforms
|
// Upload Bone Transforms
|
||||||
if (material.shader.locs[SHADER_LOC_BONE_MATRICES] != -1 && mesh.boneMatrices)
|
if (material.shader.locs[SHADER_LOC_BONE_MATRICES] != -1 && mesh.boneMatrices)
|
||||||
{
|
{
|
||||||
|
|
@ -1578,7 +1578,7 @@ void DrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RL_SUPPORT_MESH_ANIMATION_VBO
|
#ifdef RL_SUPPORT_MESH_GPU_SKINNING
|
||||||
// Bind mesh VBO data: vertex bone ids (shader-location = 6, if available)
|
// Bind mesh VBO data: vertex bone ids (shader-location = 6, if available)
|
||||||
if (material.shader.locs[SHADER_LOC_VERTEX_BONEIDS] != -1)
|
if (material.shader.locs[SHADER_LOC_VERTEX_BONEIDS] != -1)
|
||||||
{
|
{
|
||||||
|
|
@ -1738,7 +1738,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, i
|
||||||
// Upload model normal matrix (if locations available)
|
// Upload model normal matrix (if locations available)
|
||||||
if (material.shader.locs[SHADER_LOC_MATRIX_NORMAL] != -1) rlSetUniformMatrix(material.shader.locs[SHADER_LOC_MATRIX_NORMAL], MatrixTranspose(MatrixInvert(matModel)));
|
if (material.shader.locs[SHADER_LOC_MATRIX_NORMAL] != -1) rlSetUniformMatrix(material.shader.locs[SHADER_LOC_MATRIX_NORMAL], MatrixTranspose(MatrixInvert(matModel)));
|
||||||
|
|
||||||
#ifdef RL_SUPPORT_MESH_ANIMATION_VBO
|
#ifdef RL_SUPPORT_MESH_GPU_SKINNING
|
||||||
// Upload Bone Transforms
|
// Upload Bone Transforms
|
||||||
if (material.shader.locs[SHADER_LOC_BONE_MATRICES] != -1 && mesh.boneMatrices)
|
if (material.shader.locs[SHADER_LOC_BONE_MATRICES] != -1 && mesh.boneMatrices)
|
||||||
{
|
{
|
||||||
|
|
@ -1823,7 +1823,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, i
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_TEXCOORD02]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RL_SUPPORT_MESH_ANIMATION_VBO
|
#ifdef RL_SUPPORT_MESH_GPU_SKINNING
|
||||||
// Bind mesh VBO data: vertex bone ids (shader-location = 6, if available)
|
// Bind mesh VBO data: vertex bone ids (shader-location = 6, if available)
|
||||||
if (material.shader.locs[SHADER_LOC_VERTEX_BONEIDS] != -1)
|
if (material.shader.locs[SHADER_LOC_VERTEX_BONEIDS] != -1)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user