Merge branch 'master' of https://github.com/raysan5/raylib into dr/mini_al
1
.gitignore
vendored
|
|
@ -48,6 +48,7 @@ ipch/
|
||||||
# Ignore compiled binaries
|
# Ignore compiled binaries
|
||||||
*.o
|
*.o
|
||||||
*.exe
|
*.exe
|
||||||
|
!src/raylib.rc.o
|
||||||
|
|
||||||
# Ignore all examples files
|
# Ignore all examples files
|
||||||
examples/*
|
examples/*
|
||||||
|
|
|
||||||
|
|
@ -46,4 +46,4 @@ The following fonts [provided with raylib](https://github.com/raysan5/raylib/tre
|
||||||
3d models
|
3d models
|
||||||
---------
|
---------
|
||||||
|
|
||||||
[dwarf 3d model and textures](https://github.com/raysan5/raylib/tree/master/examples/models/resources/model) have been created by David Moreno and licensed as [Creative Commons Attribution-NonCommercial 3.0](https://creativecommons.org/licenses/by-nc/3.0/legalcode)
|
[medieval city 3d models and textures](https://github.com/raysan5/raylib/tree/master/examples/models/resources/medieval) have been created by Alberto Cano and licensed as [Creative Commons Attribution-NonCommercial 4.0](https://creativecommons.org/licenses/by-nc/4.0/legalcode)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ features
|
||||||
* Shaders support, including Model shaders and Postprocessing shaders
|
* Shaders support, including Model shaders and Postprocessing shaders
|
||||||
* Powerful math module for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h)
|
* Powerful math module for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h)
|
||||||
* Audio loading and playing with streaming support (WAV, OGG, FLAC, XM, MOD)
|
* Audio loading and playing with streaming support (WAV, OGG, FLAC, XM, MOD)
|
||||||
* Multiple platforms support: Windows, Linux, FreeBSD, MacOS, UWP, Android, Raspberry Pi, HTML5.
|
* Multiple platforms support: Windows, Linux, FreeBSD, OpenBSD, NetBSD, DragonFly, MacOS, UWP, Android, Raspberry Pi, HTML5.
|
||||||
* VR stereo rendering with configurable HMD device parameters
|
* VR stereo rendering with configurable HMD device parameters
|
||||||
* NO external dependencies, all required libraries included with raylib
|
* NO external dependencies, all required libraries included with raylib
|
||||||
* Complete bindings to LUA ([raylib-lua](https://github.com/raysan5/raylib-lua)) and Go ([raylib-go](https://github.com/gen2brain/raylib-go))
|
* Complete bindings to LUA ([raylib-lua](https://github.com/raysan5/raylib-lua)) and Go ([raylib-go](https://github.com/gen2brain/raylib-go))
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,11 @@ if(${PLATFORM} MATCHES "Desktop")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Ugly crutch. Temporary workaround for #551
|
||||||
|
if("${CMAKE_SYSTEM_NAME}" MATCHES "(Free|Net|Open)BSD|DragonFly")
|
||||||
|
link_directories("${CMAKE_INSTALL_PREFIX}/lib")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
|
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
|
||||||
set(LINUX TRUE)
|
set(LINUX TRUE)
|
||||||
set(LIBS_PRIVATE dl ${LIBS_PRIVATE})
|
set(LIBS_PRIVATE dl ${LIBS_PRIVATE})
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,16 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
PLATFORM_OS=LINUX
|
PLATFORM_OS=LINUX
|
||||||
endif
|
endif
|
||||||
ifeq ($(UNAMEOS),FreeBSD)
|
ifeq ($(UNAMEOS),FreeBSD)
|
||||||
PLATFORM_OS=FREEBSD
|
PLATFORM_OS=BSD
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAMEOS),OpenBSD)
|
||||||
|
PLATFORM_OS=BSD
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAMEOS),NetBSD)
|
||||||
|
PLATFORM_OS=BSD
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAMEOS),DragonFly)
|
||||||
|
PLATFORM_OS=BSD
|
||||||
endif
|
endif
|
||||||
ifeq ($(UNAMEOS),Darwin)
|
ifeq ($(UNAMEOS),Darwin)
|
||||||
PLATFORM_OS=OSX
|
PLATFORM_OS=OSX
|
||||||
|
|
@ -129,8 +138,8 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/osx
|
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/osx
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),FREEBSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/freebsd
|
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/bsd
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
|
@ -163,8 +172,8 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
# OSX default compiler
|
# OSX default compiler
|
||||||
CC = clang
|
CC = clang
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),FREEBSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# FreeBSD default compiler
|
# FreeBSD, OpenBSD, NetBSD, DragonFly default compiler
|
||||||
CC = clang
|
CC = clang
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
@ -205,9 +214,9 @@ CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
|
||||||
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
# resources file contains windows exe icon
|
# resource file contains windows executable icon and properties
|
||||||
# -Wl,--subsystem,windows hides the console window
|
# -Wl,--subsystem,windows hides the console window
|
||||||
CFLAGS += $(RAYLIB_PATH)/src/raylib_icon -Wl,--subsystem,windows
|
CFLAGS += $(RAYLIB_PATH)/src/raylib.rc.o -Wl,--subsystem,windows
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
|
ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
|
||||||
|
|
@ -254,7 +263,7 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads
|
INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(PLATFORM_OS),FREEBSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Consider -L$(RAYLIB_H_INSTALL_PATH)
|
# Consider -L$(RAYLIB_H_INSTALL_PATH)
|
||||||
INCLUDE_PATHS += -I/usr/local/include
|
INCLUDE_PATHS += -I/usr/local/include
|
||||||
endif
|
endif
|
||||||
|
|
@ -270,7 +279,7 @@ endif
|
||||||
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(PLATFORM_OS),FREEBSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Consider -L$(RAYLIB_INSTALL_PATH)
|
# Consider -L$(RAYLIB_INSTALL_PATH)
|
||||||
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
LDFLAGS += -L. -Lsrc -L/usr/local/lib
|
||||||
endif
|
endif
|
||||||
|
|
@ -316,8 +325,8 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
|
||||||
LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
|
LDLIBS = -lraylib -framework OpenGL -framework OpenAL -framework Cocoa
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),FREEBSD)
|
ifeq ($(PLATFORM_OS),BSD)
|
||||||
# Libraries for FreeBSD desktop compiling
|
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
|
||||||
# NOTE: Required packages: mesa-libs
|
# NOTE: Required packages: mesa-libs
|
||||||
LDLIBS = -lraylib -lGL -lpthread -lm
|
LDLIBS = -lraylib -lGL -lpthread -lm
|
||||||
# On XWindow requires also below libraries
|
# On XWindow requires also below libraries
|
||||||
|
|
|
||||||
|
|
@ -26,17 +26,17 @@ int main()
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
// Define the camera to look into our 3d world
|
||||||
Camera camera;
|
Camera camera;
|
||||||
camera.position = (Vector3){ 10.0f, 8.0f, 10.0f }; // Camera position
|
camera.position = (Vector3){ 20.0f, 20.0f, 20.0f }; // Camera position
|
||||||
camera.target = (Vector3){ 0.0f, 2.3f, 0.0f }; // Camera looking at point
|
camera.target = (Vector3){ 0.0f, 8.0f, 0.0f }; // Camera looking at point
|
||||||
camera.up = (Vector3){ 0.0f, 1.6f, 0.0f }; // Camera up vector (rotation towards target)
|
camera.up = (Vector3){ 0.0f, 1.6f, 0.0f }; // Camera up vector (rotation towards target)
|
||||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||||
camera.type = CAMERA_PERSPECTIVE; // Camera mode type
|
camera.type = CAMERA_PERSPECTIVE; // Camera mode type
|
||||||
|
|
||||||
Ray ray; // Picking ray
|
Ray ray; // Picking ray
|
||||||
|
|
||||||
Model tower = LoadModel("resources/tower.obj"); // Load OBJ model
|
Model tower = LoadModel("resources/models/turret.obj"); // Load OBJ model
|
||||||
Texture2D texture = LoadTexture("resources/tower.png"); // Load model texture
|
Texture2D texture = LoadTexture("resources/models/turret_diffuse.png"); // Load model texture
|
||||||
tower.material.maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture
|
tower.material.maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture
|
||||||
|
|
||||||
Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position
|
Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||||
BoundingBox towerBBox = MeshBoundingBox(tower.mesh); // Get mesh bounding box
|
BoundingBox towerBBox = MeshBoundingBox(tower.mesh); // Get mesh bounding box
|
||||||
|
|
@ -103,6 +103,7 @@ int main()
|
||||||
hitMeshBBox = true;
|
hitMeshBBox = true;
|
||||||
|
|
||||||
// Check ray collision against model
|
// Check ray collision against model
|
||||||
|
// NOTE: It considers model.transform matrix!
|
||||||
meshHitInfo = GetCollisionRayModel(ray, &tower);
|
meshHitInfo = GetCollisionRayModel(ray, &tower);
|
||||||
|
|
||||||
if ((meshHitInfo.hit) && (meshHitInfo.distance < nearestHit.distance))
|
if ((meshHitInfo.hit) && (meshHitInfo.distance < nearestHit.distance))
|
||||||
|
|
@ -124,7 +125,9 @@ int main()
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
// Draw the tower
|
// Draw the tower
|
||||||
DrawModel(tower, towerPos, 1.0, WHITE);
|
// WARNING: If scale is different than 1.0f,
|
||||||
|
// not considered by GetCollisionRayModel()
|
||||||
|
DrawModel(tower, towerPos, 1.0f, WHITE);
|
||||||
|
|
||||||
// Draw the test triangle
|
// Draw the test triangle
|
||||||
DrawLine3D(ta, tb, PURPLE);
|
DrawLine3D(ta, tb, PURPLE);
|
||||||
|
|
@ -150,7 +153,7 @@ int main()
|
||||||
|
|
||||||
DrawRay(ray, MAROON);
|
DrawRay(ray, MAROON);
|
||||||
|
|
||||||
DrawGrid(100, 1.0f);
|
DrawGrid(10, 10.0f);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
|
|
@ -177,6 +180,8 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText("Use Mouse to Move Camera", 10, 430, 10, GRAY);
|
DrawText("Use Mouse to Move Camera", 10, 430, 10, GRAY);
|
||||||
|
|
||||||
|
DrawText("(c) Turret 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 136 KiB |
|
|
@ -22,15 +22,15 @@ int main()
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
// Define the camera to look into our 3d world
|
||||||
Camera camera = { 0 };
|
Camera camera = { 0 };
|
||||||
camera.position = (Vector3){ 3.0f, 3.0f, 3.0f }; // Camera position
|
camera.position = (Vector3){ 8.0f, 8.0f, 8.0f }; // Camera position
|
||||||
camera.target = (Vector3){ 0.0f, 1.5f, 0.0f }; // Camera looking at point
|
camera.target = (Vector3){ 0.0f, 2.5f, 0.0f }; // Camera looking at point
|
||||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||||
camera.type = CAMERA_PERSPECTIVE; // Camera mode type
|
camera.type = CAMERA_PERSPECTIVE; // Camera mode type
|
||||||
|
|
||||||
Model dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model
|
Model model = LoadModel("resources/models/castle.obj"); // Load OBJ model
|
||||||
Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture
|
Texture2D texture = LoadTexture("resources/models/castle_diffuse.png"); // Load model texture
|
||||||
dwarf.material.maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
model.material.maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
|
@ -52,7 +52,7 @@ int main()
|
||||||
|
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawModel(dwarf, position, 2.0f, WHITE); // Draw 3d model with texture
|
DrawModel(model, position, 0.2f, WHITE); // Draw 3d model with texture
|
||||||
|
|
||||||
DrawGrid(10, 1.0f); // Draw a grid
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ int main()
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
DrawText("(c) Castle 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ int main()
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadTexture(texture); // Unload texture
|
UnloadTexture(texture); // Unload texture
|
||||||
UnloadModel(dwarf); // Unload model
|
UnloadModel(model); // Unload model
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 260 KiB |
BIN
examples/models/models_orthographic_projection.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
|
|
@ -36,12 +36,17 @@ int main()
|
||||||
Shader shdrCubemap = LoadShader("resources/shaders/cubemap.vs", "resources/shaders/cubemap.fs");
|
Shader shdrCubemap = LoadShader("resources/shaders/cubemap.vs", "resources/shaders/cubemap.fs");
|
||||||
SetShaderValuei(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, 1);
|
SetShaderValuei(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, 1);
|
||||||
|
|
||||||
Texture2D texHDR = LoadTexture("resources/pinetree.hdr");
|
// Load HDR panorama (sphere) texture
|
||||||
|
Texture2D texHDR = LoadTexture("resources/dresden_square.hdr");
|
||||||
|
|
||||||
|
// Generate cubemap (texture with 6 quads-cube-mapping) from panorama HDR texture
|
||||||
|
// NOTE: New texture is generated rendering to texture, shader computes the sphre->cube coordinates mapping
|
||||||
skybox.material.maps[MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, texHDR, 512);
|
skybox.material.maps[MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, texHDR, 512);
|
||||||
|
|
||||||
UnloadShader(shdrCubemap); // Cubemap generation shader not required any more
|
UnloadTexture(texHDR); // Texture not required anymore, cubemap already generated
|
||||||
|
UnloadShader(shdrCubemap); // Unload cubemap generation shader, not required anymore
|
||||||
|
|
||||||
SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode
|
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set a first person camera mode
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
@ -76,7 +81,7 @@ int main()
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadModel(skybox); // Unload skybox model
|
UnloadModel(skybox); // Unload skybox model (and textures)
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 707 KiB After Width: | Height: | Size: 417 KiB |
BIN
examples/models/resources/dresden_square.hdr
Normal file
|
Before Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 3.9 MiB |
|
Before Width: | Height: | Size: 2.8 MiB |
1725
examples/models/resources/models/bridge.obj
Normal file
BIN
examples/models/resources/models/bridge_diffuse.png
Normal file
|
After Width: | Height: | Size: 311 KiB |