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/*
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ script:
|
||||||
- if [[ "$ARCH" != *-android && "$ARCH" != html5 ]]; then
|
- if [[ "$ARCH" != *-android && "$ARCH" != html5 ]]; then
|
||||||
pkg-config --static --libs raylib;
|
pkg-config --static --libs raylib;
|
||||||
nm -g release/libraylib.a | grep glfwGetProcAddress || (echo "libraylib.a doesn't contain GLFW symbols! Aborting..." && false);
|
nm -g release/libraylib.a | grep glfwGetProcAddress || (echo "libraylib.a doesn't contain GLFW symbols! Aborting..." && false);
|
||||||
|
ctest --output-on-failure;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
|
|
|
||||||
35
CHANGELOG
|
|
@ -9,26 +9,30 @@ Release: raylib 2.0 (June 2017 ?)
|
||||||
KEY CHANGES:
|
KEY CHANGES:
|
||||||
- Removed external dependencies (GLFW3 and OpenAL)
|
- Removed external dependencies (GLFW3 and OpenAL)
|
||||||
- Complete redesign of audio module to use mini_al audio library
|
- Complete redesign of audio module to use mini_al audio library
|
||||||
- Support AppVeyor and Travis CI (continuous integration) build
|
- Support AppVeyor and Travis CI (continuous integration) building
|
||||||
- Reviewed raymath.h for better consistency and performance (inlining)
|
- Reviewed raymath.h for better consistency and performance (inlining)
|
||||||
- Refactor all #define SUPPORT_* into a single config.h
|
- Refactor all #define SUPPORT_* into a single config.h
|
||||||
- Support TCC compiler
|
- Support TCC compiler (32bit and 64bit)
|
||||||
|
|
||||||
Detailed changes:
|
Detailed changes:
|
||||||
[build] REMOVED: GitHub develop branch
|
[build] REMOVED: GitHub develop branch
|
||||||
[build] ADDED: FreeBSD OS support
|
[build] REMOVED: External dependencies GLFW and OpenAL
|
||||||
|
[build] REMOVED: Android 32bit ARM support (only 64bit building supported)
|
||||||
|
[build] ADDED: FreeBSD, OpenBSD, NetBSD, Dragon Fly OS support
|
||||||
[build] ADDED: Universal Windows Platform (UWP) support
|
[build] ADDED: Universal Windows Platform (UWP) support
|
||||||
[build] ADDED: Wayland Linux desktop support
|
[build] ADDED: Wayland Linux desktop support
|
||||||
[build] REMOVED: External dependencies GLFW and OpenAL
|
|
||||||
[build] ADDED: AppVeyor CI for automatic Windows builds
|
[build] ADDED: AppVeyor CI for automatic Windows builds
|
||||||
[build] ADDED: Travis CI for automatic Linux/macOS builds
|
[build] ADDED: Travis CI for automatic Linux/macOS builds
|
||||||
[build] ADDED: rglfw (GLFW3 module) to avoid external dependency
|
[build] ADDED: rglfw (GLFW3 module) to avoid external dependency
|
||||||
[build] ADDED: VS2017 UWP project
|
[build] ADDED: VS2017 UWP project
|
||||||
[build] ADDED: Builder project template
|
[build] ADDED: Builder project template
|
||||||
[build] REVIEWED: VS2015 and VS2017 projects
|
|
||||||
[build] ADDED: Compiler memory sanitizer for better debug
|
[build] ADDED: Compiler memory sanitizer for better debug
|
||||||
[build] Setup CMake package target and CI auto-deploy tags
|
[build] ADDED: CMake package target and CI auto-deploy tags
|
||||||
[build] Support DEBUG library building
|
[build] ADDED: DEBUG library building support
|
||||||
|
[build] ADDED: Notepad++ NppExec scripts
|
||||||
|
[build] REVIEWED: VS2015 and VS2017 projects
|
||||||
|
[build] REVIEWED: Android APK build pipeline
|
||||||
|
[core] REVIEWED: Window creation hints to support transparent windows
|
||||||
[core] Unified InitWindow() between platforms
|
[core] Unified InitWindow() between platforms
|
||||||
[core] Export Android main entry point
|
[core] Export Android main entry point
|
||||||
[core] RENAMED: Begin3dMode() to BeginMode3D()
|
[core] RENAMED: Begin3dMode() to BeginMode3D()
|
||||||
|
|
@ -67,12 +71,24 @@ Detailed changes:
|
||||||
[textures] ADDED: ImageMipmaps()
|
[textures] ADDED: ImageMipmaps()
|
||||||
[textures] ADDED: GenImageColor()
|
[textures] ADDED: GenImageColor()
|
||||||
[textures] ADDED: GetPixelDataSize()
|
[textures] ADDED: GetPixelDataSize()
|
||||||
|
[textures] ADDED: ImageRotateCW()
|
||||||
|
[textures] ADDED: ImageRotateCCW()
|
||||||
|
[textures] ADDED: ImageResizeCanvas()
|
||||||
|
[textures] ADDED: GetImageDataNormalized()
|
||||||
|
[textures] REVIEWED: ImageFormat() to use normalized data
|
||||||
|
[textures] REVIEWED: Manual mipmap generation
|
||||||
|
[textures] REVIEWED: LoadASTC()
|
||||||
[textures] REVIEWED: GenImagePerlinNoise()
|
[textures] REVIEWED: GenImagePerlinNoise()
|
||||||
[textures] REVIEWED: ImageTextEx() to support UTF8 basic characters
|
[textures] REVIEWED: ImageTextEx() to support UTF8 basic characters
|
||||||
[textures] REVIEWED: GetTextureData() for RPI - requires some work
|
[textures] REVIEWED: GetTextureData() for RPI - requires some work
|
||||||
[textures] Added new example: text drawing on image
|
[textures] Added new example: text drawing on image
|
||||||
[text] Corrected issue with ttf font y-offset
|
[text] Corrected issue with ttf font y-offset
|
||||||
|
[text] Support SDF font data generation
|
||||||
|
[text] ADDED: GenImageFontAtlas()
|
||||||
|
[text] ADDED: LoadFontData() to load data from TTF file
|
||||||
|
[text] REMOVED: LoadTTF() internal function
|
||||||
[text] REVIEWED: DrawTextEx() - avoid rendering SPACE character!
|
[text] REVIEWED: DrawTextEx() - avoid rendering SPACE character!
|
||||||
|
[rlgl] ADDED: rlCheckBufferLimit()
|
||||||
[rlgl] ADDED: LoadShaderCode()
|
[rlgl] ADDED: LoadShaderCode()
|
||||||
[rlgl] ADDED: GetMatrixModelview()
|
[rlgl] ADDED: GetMatrixModelview()
|
||||||
[rlgl] ADDED: SetVrDistortionShader(Shader shader)
|
[rlgl] ADDED: SetVrDistortionShader(Shader shader)
|
||||||
|
|
@ -87,6 +103,7 @@ Detailed changes:
|
||||||
[models] RENAMED: CalculateBoundingBox() to MeshBoundingBox()
|
[models] RENAMED: CalculateBoundingBox() to MeshBoundingBox()
|
||||||
[models] REMOVED: GetCollisionRayMesh() - does not consider model transform
|
[models] REMOVED: GetCollisionRayMesh() - does not consider model transform
|
||||||
[models] REVIEWED: LoadMesh() - fallback to default cube mesh if loading fails
|
[models] REVIEWED: LoadMesh() - fallback to default cube mesh if loading fails
|
||||||
|
[audio] ADDED: Support for MP3 fileformat
|
||||||
[audio] ADDED: IsAudioStreamPlaying()
|
[audio] ADDED: IsAudioStreamPlaying()
|
||||||
[audio] ADDED: SetAudioStreamVolume()
|
[audio] ADDED: SetAudioStreamVolume()
|
||||||
[audio] ADDED: SetAudioStreamPitch()
|
[audio] ADDED: SetAudioStreamPitch()
|
||||||
|
|
@ -94,10 +111,14 @@ Detailed changes:
|
||||||
[utils] RENAMED: SaveImageAs() to ExportImage()
|
[utils] RENAMED: SaveImageAs() to ExportImage()
|
||||||
[utils] REMOVED: rres support - moved to external library (rres.h)
|
[utils] REMOVED: rres support - moved to external library (rres.h)
|
||||||
[shaders] REVIEWED: GLSL 120 shaders
|
[shaders] REVIEWED: GLSL 120 shaders
|
||||||
|
[raymath] ADDED: Vector3RotateByQuaternion()
|
||||||
[raymath] REVIEWED: math usage to reduce temp variables
|
[raymath] REVIEWED: math usage to reduce temp variables
|
||||||
[raymath] REVIEWED: Avoid pointer-based parameters for API consistency
|
[raymath] REVIEWED: Avoid pointer-based parameters for API consistency
|
||||||
[physac] REVIEWED: physac.h timming system
|
[physac] REVIEWED: physac.h timming system
|
||||||
|
[examples] Replaced dwarf model by brand new 3d assets: 3d medieval buildings
|
||||||
|
[examples] Assets cleaning and some replacements
|
||||||
[games] ADDED: GGJ18 game - transmission mission
|
[games] ADDED: GGJ18 game - transmission mission
|
||||||
|
[games] REVIEWED: Light my Ritual game - improved gameplay drawing
|
||||||
[*] Updated external libraries to latest version
|
[*] Updated external libraries to latest version
|
||||||
[*] Multiple bugs corrected (check github issues)
|
[*] Multiple bugs corrected (check github issues)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,3 +50,5 @@ endif()
|
||||||
if (${BUILD_GAMES})
|
if (${BUILD_GAMES})
|
||||||
add_subdirectory(games)
|
add_subdirectory(games)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
|
|
||||||
|
|
@ -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))
|
||||||
|
|
|
||||||
21
cmake/test-pkgconfig.sh
Executable file
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Test if including/linking/running an installed raylib works
|
||||||
|
|
||||||
|
set -x
|
||||||
|
export LD_RUN_PATH=/usr/local/lib
|
||||||
|
|
||||||
|
CFLAGS="-Wall -Wextra -Werror $CFLAGS"
|
||||||
|
if [ "$ARCH" = "i386" ]; then
|
||||||
|
CFLAGS="-m32 $CLFAGS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat << EOF | ${CC:-cc} -otest -xc - $(pkg-config --libs --cflags $@ raylib.pc) $CFLAGS && exec ./test
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <raylib.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int num = GetRandomValue(42, 1337);
|
||||||
|
return 42 <= num && num <= 1337 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
14
cmake/utils.cmake
Executable file → Normal file
|
|
@ -11,13 +11,8 @@ if(${PLATFORM} MATCHES "Android")
|
||||||
elseif(${PLATFORM} MATCHES "Web")
|
elseif(${PLATFORM} MATCHES "Web")
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
find_library(OPENGL_LIBRARY OpenGL)
|
find_library(OPENGL_LIBRARY OpenGL)
|
||||||
find_library(COCOA_LIBRARY Cocoa)
|
|
||||||
find_library(IOKIT_LIBRARY IOKit)
|
|
||||||
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
|
|
||||||
find_library(COREVIDEO_LIBRARY CoreVideo)
|
|
||||||
|
|
||||||
set(LIBS_PRIVATE ${OPENGL_LIBRARY} ${COCOA_LIBRARY}
|
set(LIBS_PRIVATE ${OPENGL_LIBRARY})
|
||||||
${IOKIT_LIBRARY} ${COREFOUNDATION_LIBRARY} ${COREVIDEO_LIBRARY})
|
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
# no pkg-config --static on Windows yet...
|
# no pkg-config --static on Windows yet...
|
||||||
else()
|
else()
|
||||||
|
|
@ -34,12 +29,6 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
||||||
# TODO: maybe read those out of glfw's cmake config?
|
|
||||||
if(USE_WAYLAND)
|
|
||||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} wayland-client wayland-cursor wayland-egl)
|
|
||||||
else()
|
|
||||||
set(LIBS_PRIVATE ${LIBS_PRIVATE} X11 Xrandr Xinerama Xi Xxf86vm Xcursor)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${PLATFORM} MATCHES "Desktop")
|
if(${PLATFORM} MATCHES "Desktop")
|
||||||
|
|
@ -55,7 +44,6 @@ 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})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(L ${LIBS_PRIVATE})
|
foreach(L ${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
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
|
||||||
SetShaderValuei(shdrIrradiance, GetShaderLocation(shdrIrradiance, "environmentMap"), (int[1]){ 0 }, 1);
|
SetShaderValuei(shdrIrradiance, GetShaderLocation(shdrIrradiance, "environmentMap"), (int[1]){ 0 }, 1);
|
||||||
SetShaderValuei(shdrPrefilter, GetShaderLocation(shdrPrefilter, "environmentMap"), (int[1]){ 0 }, 1);
|
SetShaderValuei(shdrPrefilter, GetShaderLocation(shdrPrefilter, "environmentMap"), (int[1]){ 0 }, 1);
|
||||||
|
|
||||||
Texture2D texHDR = LoadTexture("resources/pinetree.hdr");
|
Texture2D texHDR = LoadTexture("resources/dresden_square.hdr");
|
||||||
Texture2D cubemap = GenTextureCubemap(shdrCubemap, texHDR, CUBEMAP_SIZE);
|
Texture2D cubemap = GenTextureCubemap(shdrCubemap, texHDR, CUBEMAP_SIZE);
|
||||||
mat.maps[MAP_IRRADIANCE].texture = GenTextureIrradiance(shdrIrradiance, cubemap, IRRADIANCE_SIZE);
|
mat.maps[MAP_IRRADIANCE].texture = GenTextureIrradiance(shdrIrradiance, cubemap, IRRADIANCE_SIZE);
|
||||||
mat.maps[MAP_PREFILTER].texture = GenTexturePrefilter(shdrPrefilter, cubemap, PREFILTERED_SIZE);
|
mat.maps[MAP_PREFILTER].texture = GenTexturePrefilter(shdrPrefilter, cubemap, PREFILTERED_SIZE);
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
||||||
|
|
@ -178,6 +181,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);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
|
||||||
|
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 |