Merge pull request #367 from raysan5/develop

Integrate Develop branch
This commit is contained in:
Ray 2017-10-18 00:12:27 +02:00 committed by GitHub
commit 53280a56e3
140 changed files with 7573 additions and 9361 deletions

27
.gitignore vendored
View File

@ -6,13 +6,6 @@
*.swo *.swo
*~ *~
# Ignore Android generated files and folders
src_android/obj/
templates/android_project/bin/
templates/android_project/obj/
templates/android_project/libs/
local.properties
# Ignore thumbnails created by windows # Ignore thumbnails created by windows
Thumbs.db Thumbs.db
@ -42,7 +35,7 @@ Thumbs.db
*.sbr *.sbr
*.sdf *.sdf
obj/ obj/
[Rr]elease/ [R]elease/
[Rr]elease.win32/ [Rr]elease.win32/
_ReSharper*/ _ReSharper*/
[Tt]est[Rr]esult* [Tt]est[Rr]esult*
@ -89,7 +82,6 @@ xcschememanagement.plist
._.* ._.*
xcuserdata/ xcuserdata/
DerivedData/ DerivedData/
*.dll
# external libraries DLLs # external libraries DLLs
!src/external/glfw3/lib/win32/glfw3.dll !src/external/glfw3/lib/win32/glfw3.dll
@ -119,16 +111,6 @@ docs/examples/web/*/*.html
!docs/examples/web/shaders/loader.html !docs/examples/web/shaders/loader.html
!docs/examples/web/models/loader.html !docs/examples/web/models/loader.html
# raylib release libs
src/libraylib.a
src/libraylib.bc
!release/android/armeabi-v7a/libraylib.a
!release/android/armeabi-v7a/libraylib.so
!release/linux/libraylib.a
!release/linux/libraylib.so
!release/rpi/libraylib.a
!release/win32/mingw32/raylib.dll
# Meson build system # Meson build system
builddir/ builddir/
@ -149,8 +131,5 @@ build
!examples/CMakeLists.txt !examples/CMakeLists.txt
!games/CMakeLists.txt !games/CMakeLists.txt
# binaries made from raylib # Ignore Android generated files and folders
libraylib.a templates/android_project/output
libraylib.so
libraylib.dylib
libraylib.dll

50
.travis.yml Normal file
View File

@ -0,0 +1,50 @@
language: c
sudo: required
dist: trusty
git:
depth: 3
os:
- osx
- linux
env:
global:
- VERBOSE=1
matrix:
- CFLAGS=-m64
- CFLAGS=-m32
before_script:
- export CFLAGS="-std=gnu99 $CFLAGS"
before_install:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
sudo apt-get install -y gcc-multilib
libopenal-dev
libxcursor-dev libxinerama-dev
mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libglew-dev;
wget 'https://github.com/a3f/GLFW-3.2.1-Debian-binary-package/releases/download/v3.2.1/GLFW-3.2.1-Linux.deb' && sudo dpkg -i GLFW-3.2.1-Linux.deb;
fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; brew install glfw; fi
- "$CC --version"
script:
- mkdir build
- cd build
- cmake -DBUILD_EXAMPLES=OFF -DBUILD_GAMES=OFF ..
- make
# - make package
# - sudo make install
#
#deploy:
# provider: releases
# api_key:
# secure: XXX
# file_glob: true
# file: raylib-*.tar.gz
# skip_cleanup: true
# on:
# branch: master
# tags: true

107
CHANGELOG
View File

@ -7,16 +7,16 @@ Current Release: raylib 1.8.0 (Oct 2017)
Release: raylib 1.8.0 (Oct 2017) Release: raylib 1.8.0 (Oct 2017)
----------------------------------------------- -----------------------------------------------
NOTE: NOTE:
In this release, multiple parts of the library have been reviewed again for consistency and simplification. In this release, multiple parts of the library have been reviewed (again) for consistency and simplification.
It exposes more than 20 new functions in comparison with previous version and it improves overall programming experience. It exposes more than 30 new functions in comparison with previous version and it improves overall programming experience.
BIG CHANGES: BIG CHANGES:
- Image generation functions: Gradient, Checked, Noise, Cellular... - New Image generation functions: Gradient, Checked, Noise, Cellular...
- Mesh generation functions: Cube, Sphere, Cylinder, Torus, Knot... - New Mesh generation functions: Cube, Sphere, Cylinder, Torus, Knot...
- New Shaders and Materials systems to support PBR materials - New Shaders and Materials systems to support PBR materials
- Custom Android toolchain for APK building with simple Makefile - Custom Android APK build pipeline with simple Makefile
- Complete review of raymath functionality (Matrix, Quaternion)
- Complete review of rlgl layer functionality - Complete review of rlgl layer functionality
- Complete review of raymath functionality
detailed changes: detailed changes:
[rlgl] RENAMED: rlglLoadTexture() to rlLoadTexture() [rlgl] RENAMED: rlglLoadTexture() to rlLoadTexture()
@ -35,54 +35,63 @@ detailed changes:
[rlgl] RENAMED: LoadDefaultShader() to LoadShaderDefault() [rlgl] RENAMED: LoadDefaultShader() to LoadShaderDefault()
[rlgl] RENAMED: LoadDefaultShaderLocations() to SetShaderDefaultLocations() [rlgl] RENAMED: LoadDefaultShaderLocations() to SetShaderDefaultLocations()
[rlgl] RENAMED: UnloadDefaultShader() to UnLoadShaderDefault() [rlgl] RENAMED: UnloadDefaultShader() to UnLoadShaderDefault()
// Texture maps generation (PBR) [rlgl] ADDED: rlGenMapCubemap(), Generate cubemap texture map from HDR texture
[rlgl] ADDED: rlGenMapCubemap(Texture2D skyHDR, int size); // Generate cubemap texture map from HDR texture [rlgl] ADDED: rlGenMapIrradiance(), Generate irradiance texture map
[rlgl] ADDED: rlGenMapIrradiance(Texture2D cubemap, int size); // Generate irradiance texture map [rlgl] ADDED: rlGenMapPrefilter(), Generate prefilter texture map
[rlgl] ADDED: rlGenMapPrefilter(Texture2D cubemap, int size); // Generate prefilter texture map [rlgl] ADDED: rlGenMapBRDF(), Generate BRDF texture map
[rlgl] ADDED: rlGenMapBRDF(Texture2D cubemap, int size); // Generate BRDF texture map [rlgl] ADDED: GetVrDeviceInfo(), Get VR device information for some standard devices
[core] ADDED: SetWindowTitle() [rlgl] REVIEWED: InitVrSimulator(), to accept device parameters as input
[core] ADDED: GetExtension() [core] ADDED: SetWindowTitle(), Set title for window (only PLATFORM_DESKTOP)
[textures] ADDED: SaveImageAs() [core] ADDED: GetExtension(), Get file extension
? [textures] ADDED: DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw a gradient-filled rectangle with custom vertex colors [shapes] REMOVED: DrawRectangleGradient(), replaced by DrawRectangleGradientV() and DrawRectangleGradientH()
? [textures] ADDED: DrawRectangleT(int posX, int posY, int width, int height, Color color); // Draw rectangle using text character [shapes] ADDED: DrawRectangleGradientV(), Draw a vertical-gradient-filled rectangle
// Image generation functions [shapes] ADDED: DrawRectangleGradientH(), Draw a horizontal-gradient-filled rectangle
[textures] ADDED: GenImageGradientV(int width, int height, Color top, Color bottom); // Generate image: vertical gradient [shapes] ADDED: DrawRectangleGradientEx(), Draw a gradient-filled rectangle with custom vertex colors
[textures] ADDED: GenImageGradientH(int width, int height, Color left, Color right); // Generate image: horizontal gradient [shapes] ADDED: DrawRectangleT(), Draw rectangle using text character
[textures] ADDED: GenImageGradientRadial(int width, int height, float density, Color inner, Color outer); // Generate image: radial gradient [textures] ADDED: SaveImageAs(), Save image as PNG file
[textures] ADDED: GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); // Generate image: checked [textures] ADDED: GenImageGradientV(), Generate image: vertical gradient
[textures] ADDED: GenImageWhiteNoise(int width, int height, float factor); // Generate image: white noise [textures] ADDED: GenImageGradientH(), Generate image: horizontal gradient
[textures] ADDED: GenImagePerlinNoise(int width, int height, float scale); // Generate image: perlin noise [textures] ADDED: GenImageGradientRadial(), Generate image: radial gradient
[textures] ADDED: GenImageCellular(int width, int height, int tileSize); // Generate image: cellular algorithm. Bigger tileSize means bigger cells [textures] ADDED: GenImageChecked(), Generate image: checked
// Texture maps generation (PBR) [textures] ADDED: GenImageWhiteNoise(), Generate image: white noise
[textures] ADDED: GenTextureCubemap(Shader shader, Texture2D skyHDR, int size); // Generate cubemap texture from HDR texture [textures] ADDED: GenImagePerlinNoise(), Generate image: perlin noise
[textures] ADDED: GenTextureIrradiance(Shader shader, Texture2D cubemap, int size); // Generate irradiance texture using cubemap data [textures] ADDED: GenImageCellular(), Generate image: cellular algorithm. Bigger tileSize means bigger cells
[textures] ADDED: GenTexturePrefilter(Shader shader, Texture2D cubemap, int size); // Generate prefilter texture using cubemap data [textures] ADDED: GenTextureCubemap(), Generate cubemap texture from HDR texture
[textures] ADDED: GenTextureBRDF(Shader shader, Texture2D cubemap, int size); // Generate BRDF texture using cubemap data [textures] ADDED: GenTextureIrradiance(), Generate irradiance texture using cubemap data
[models] REMOVED: LoadMeshEx() [textures] ADDED: GenTexturePrefilter(), Generate prefilter texture using cubemap data
[models] REMOVED: UpdateMesh() [textures] ADDED: GenTextureBRDF(), Generate BRDF texture using cubemap data
[models] REMOVED: LoadHeightmap() [models] REMOVED: LoadMeshEx(), Mesh struct variables can be directly accessed
[models] REMOVED: LoadCubicmap() [models] REMOVED: UpdateMesh(), very ineficient
[models] REMOVED: LoadHeightmap(), use GenMeshHeightmap() and LoadModelFromMesh()
[models] REMOVED: LoadCubicmap(), use GenMeshCubicmap() and LoadModelFromMesh()
[models] RENAMED: LoadDefaultMaterial() to LoadMaterialDefault() [models] RENAMED: LoadDefaultMaterial() to LoadMaterialDefault()
// Mesh generation functions [models] ADDED: GenMeshPlane(), Generate plane mesh (with subdivisions)
[models] ADDED: GenMeshPlane() [models] ADDED: GenMeshCube(), Generate cuboid mesh
[models] ADDED: GenMeshCube() [models] ADDED: GenMeshSphere(), Generate sphere mesh (standard sphere)
[models] ADDED: GenMeshSphere() [models] ADDED: GenMeshHemiSphere(), Generate half-sphere mesh (no bottom cap)
[models] ADDED: GenMeshHemiSphere(float radius, int rings, int slices); // Generate half-sphere mesh (no bottom cap) [models] ADDED: GenMeshCylinder(), Generate cylinder mesh
[models] ADDED: GenMeshCylinder(float radius, float height, int slices); // Generate cylinder mesh [models] ADDED: GenMeshTorus(), Generate torus mesh
[models] ADDED: GenMeshTorus(float radius, float size, int radSeg, int sides); // Generate torus mesh [models] ADDED: GenMeshKnot(), Generate trefoil knot mesh
[models] ADDED: GenMeshKnot(float radius, float size, int radSeg, int sides); // Generate trefoil knot mesh [models] ADDED: GenMeshHeightmap(), Generate heightmap mesh from image data
[models] ADDED: GenMeshHeightmap(Image heightmap, Vector3 size); // Generate heightmap mesh from image data [models] ADDED: GenMeshCubicmap(), Generate cubes-based map mesh from image data
[models] ADDED: GenMeshCubicmap(Image cubicmap, Vector3 cubeSize); // Generate cubes-based map mesh from image data [raymath] REVIEWED: full Matrix functionality to align with GLM in usage
[raymath] RENAMED: Vector3 functions for consistency: Vector*() renamed to Vector3*()
[raymath] Reviewed full Matrix functionality
[raymath] Renamed Vector3 functions for consistency
[build] Integrate Android APK building into examples Makefile [build] Integrate Android APK building into examples Makefile
[example] ADDED: [build] Integrate Android APK building into templates Makefiles
[example] ADDED: [build] Improved Visual Studio 2015 project, folders, references...
[example] ADDED: [templates] Reviewed the full pack to support Android building
[examples] Reviewed full collection to adapt to raylib changes
[examples] [textures] ADDED: textures_image_generation
[examples] [models] ADDED: models_mesh_generation
[examples] [models] ADDED: models_material_pbr
[examples] [models] ADDED: models_skybox
[examples] [models] ADDED: models_yaw_pitch_roll
[examples] [others] REVIEWED: rlgl_standalone
[examples] [others] REVIEWED: audio_standalone
[github] Moved raylib webpage to own repo: github.com/raysan5/raylib.com [github] Moved raylib webpage to own repo: github.com/raysan5/raylib.com
[games] Reviewed game: Koala Seasons [games] Reviewed game: Koala Seasons
[*] Updated STB libraries to latest version [*] Updated STB libraries to latest version
[*] Multiple bugs corrected (check github issues)
----------------------------------------------- -----------------------------------------------
Release: raylib 1.7.0 (20 May 2017) Release: raylib 1.7.0 (20 May 2017)

View File

@ -12,7 +12,7 @@ contributing (in some way or another) to make raylib project better. Huge thanks
- Daniel Moreno for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com)) - Daniel Moreno for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
- Daniel Gomez for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com)) - Daniel Gomez for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
- [Sergio Martinez](https://github.com/anidealgift) for helping on raygui development and tools development (raygui_styler). - [Sergio Martinez](https://github.com/anidealgift) for helping on raygui development and tools development (raygui_styler).
- [Victor Fisac](https://github.com/victorfisac) for developing physics raylib module (physac) and implementing materials and lighting systems... among multiple other improvements and multiple tools and games. - [Victor Fisac](https://github.com/victorfisac) for developing physics raylib module (physac) and implementing PBR materials and lighting systems... among multiple other improvements and multiple tools and games.
- Albert Martos for helping on raygui and porting examples and game-templates to Android and HTML5. - Albert Martos for helping on raygui and porting examples and game-templates to Android and HTML5.
- Ian Eito for helping on raygui and porting examples and game-templates to Android and HTML5. - Ian Eito for helping on raygui and porting examples and game-templates to Android and HTML5.
- [procedural](https://github.com/procedural) for testing raylib on Linux, correcting some bugs and adding several mouse functions. - [procedural](https://github.com/procedural) for testing raylib on Linux, correcting some bugs and adding several mouse functions.
@ -28,7 +28,8 @@ contributing (in some way or another) to make raylib project better. Huge thanks
- [Joel Davis](https://github.com/joeld42) for adding raycast picking utilities and a [great example](https://github.com/raysan5/raylib/blob/master/examples/models/models_mesh_picking.c) - [Joel Davis](https://github.com/joeld42) for adding raycast picking utilities and a [great example](https://github.com/raysan5/raylib/blob/master/examples/models/models_mesh_picking.c)
- [Richard Goodwin](https://github.com/AudioMorphology) for adding RPI touchscreen support - [Richard Goodwin](https://github.com/AudioMorphology) for adding RPI touchscreen support
- [Milan Nikolic](https://github.com/gen2brain) for adding Android build support with custom standalone toolchain - [Milan Nikolic](https://github.com/gen2brain) for adding Android build support with custom standalone toolchain
- [Michael Vetter](https://github.com/jubalh) for improvements on build system and adding meson support for Linux
** TODO ** - [Wilhem Barbier](https://github.com/nounoursheureux) for adding Image generation functions and some fixes
- [Benjamin Summerton](https://github.com/define-private-public) for improving OSX building and his amazing work on CMake build sytem
Please, if I forget someone in this list, excuse me and write me an email to remind me to add you! Please, if I forget someone in this list, excuse me and write me an email to remind me to add you!

View File

@ -182,3 +182,23 @@ Some other features: Gamepad support on HTML5, RPI touch screen support, 32bit a
And here it is another version of **raylib, a simple and easy-to-use library to learn videogames programming**. Enjoy it. And here it is another version of **raylib, a simple and easy-to-use library to learn videogames programming**. Enjoy it.
notes on raylib 1.8
-------------------
October 2017, around 5 months after latest raylib version, another release is published: raylib 1.8. Again, several modules of the library have been reviewed and some new functionality added. Main changes of this new release are:
[Procedural image generation](https://github.com/raysan5/raylib/blob/develop/examples/textures/textures_image_generation.c) function, a set of new functions have been added to generate gradients, checked, noise and cellular images from scratch. Image generation could be useful for certain textures or learning pourpouses.
[Parametric mesh generation](https://github.com/raysan5/raylib/blob/develop/examples/models/models_mesh_generation.c) functions, create 3d meshes from scratch just defining a set of parameters, meshes like cube, sphere, cylinder, torus, knot and more can be very useful for prototyping or for lighting and texture testing.
PBR Materials support, a completely redesigned shaders and material system allows advance materials definition and usage, with fully customizable shaders. Some new functions have been added to generate the environment textures required for PBR shading and a a new complete [PBR material example](https://github.com/raysan5/raylib/blob/develop/examples/models/models_material_pbr.c) is also provided for reference.
Custom Android APK build pipeline with [simple Makefile](https://github.com/raysan5/raylib/blob/develop/templates/simple_game/Makefile). Actually, full code building mechanism based on plain Makefile has been completely reviewed and Android building has been added for sources and also for examples and templates building into final APK package. This way, raylib Android building has been greatly simplified and integrated seamlessly into standard build scripts.
[rlgl](https://github.com/raysan5/raylib/blob/develop/src/rlgl.c) module has been completely reviewed and most of the functions renamed for consistency. This way, standalone usage of rlgl is promoted, with a [complete example provided](https://github.com/raysan5/raylib/blob/develop/examples/others/rlgl_standalone.c). rlgl offers a pseudo-OpenGL 1.1 immediate-mode programming-style layer, with backends to multiple OpenGL versions.
[raymath](https://github.com/raysan5/raylib/blob/develop/src/rlgl.c) library has been also reviewed to align with other advance math libraries like [GLM](https://github.com/g-truc/glm). Matrix math has been improved and simplified, some new Quaternion functions have been added and Vector3 functions have been renamed all around the library for consistency with new Vector2 functionality.
Additionally, as always, examples and templates have been reviewed to work with new version (some new examples have been added), all external libraries have been updated to latest stable version and latest Notepad++ and MinGW have been configured to work with new raylib. For a full list of changes, just check [CHANGELOG](CHANGELOG).
New installer provided, web updated, examples re-builded, documentation reviewed... **new raylib 1.8 published**. Enjoy coding games.

View File

@ -10,6 +10,8 @@ NOTE for ADVENTURERS: raylib is a programming library to learn videogames progra
no fancy interface, no visual helpers, no auto-debugging... just coding in the most no fancy interface, no visual helpers, no auto-debugging... just coding in the most
pure spartan-programmers way. Are you ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html) pure spartan-programmers way. Are you ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html)
[![Build Status](https://travis-ci.org/raysan5/raylib.svg?branch=develop)](https://travis-ci.org/raysan5/raylib)
features features
-------- --------

View File

@ -10,11 +10,13 @@ Note that [raylib source code](https://github.com/raysan5/raylib/tree/develop/sr
- [ ] Basic GPU stats sytem (memory, draws, time...) - [ ] Basic GPU stats sytem (memory, draws, time...)
- [ ] Improved custom file-format (.rres) and packaging tool - [ ] Improved custom file-format (.rres) and packaging tool
- [ ] Touch-based camera controls for Android - [ ] Touch-based camera controls for Android
- [ ] Quaternions-based camera system
**raylib 1.8** **raylib 1.8**
- [x] Improved Materials system with PBR support - [x] Improved Materials system with PBR support
- [x] Procedural image generation functions (spot, gradient, noise...) - [x] Procedural image generation functions (spot, gradient, noise...)
- [x] Procedural mesh generation functions (cube, sphere...) - [x] Procedural mesh generation functions (cube, sphere...)
- [x] Custom Android APK build pipeline (default Makefile)
**raylib 1.7** **raylib 1.7**
- [x] Support configuration flags - [x] Support configuration flags

View File

@ -1,8 +1,6 @@
#************************************************************************************************** #**************************************************************************************************
# #
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten) # raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
#
# NOTE: By default examples are compiled using raylib static library and OpenAL Soft shared library
# #
# Copyright (c) 2013-2017 Ramon Santamaria (@raysan5) # Copyright (c) 2013-2017 Ramon Santamaria (@raysan5)
# #
@ -25,19 +23,34 @@
.PHONY: all clean .PHONY: all clean
# define raylib platform to compile for # Define required raylib variables
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
# WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop() # WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
PLATFORM ?= PLATFORM_DESKTOP PLATFORM ?= PLATFORM_DESKTOP
RAYLIB_PATH ?= ..
PROJECT_NAME ?= raylib_example
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_PATH ?= /home/pi/raylib
endif
# Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll)
# NOTE: Libraries should be provided in the selected form
RAYLIB_LIBTYPE ?= STATIC
OPENAL_LIBTYPE ?= STATIC
# On PLATFORM_WEB force OpenAL Soft shared library
ifeq ($(PLATFORM),PLATFORM_WEB)
OPENAL_LIBTYPE = SHARED
endif
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
PLATFORM_OS=WINDOWS PLATFORM_OS=WINDOWS
LIBPATH=win32 LIBPATH=win32
else else
UNAMEOS:=$(shell uname) UNAMEOS=$(shell uname)
ifeq ($(UNAMEOS),Linux) ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX PLATFORM_OS=LINUX
LIBPATH=linux LIBPATH=linux
@ -50,46 +63,72 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
endif endif
endif endif
# define default raylib path for include and library search ifeq ($(PLATFORM),PLATFORM_RPI)
# RPI cross-compiler
RPI_CROSS_COMPILE ?= NO
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables
EMSDK_PATH = C:/emsdk
EMSCRIPTEN_VERSION = 1.37.9
CLANG_VERSION=e1.37.9_64bit
PYTHON_VERSION=2.7.5.3_64bit
NODE_VERSION=4.1.1_64bit
export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
endif
# Define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_PATH ?= C:\raylib\raylib RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/win32/mingw32
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_PATH ?= .. RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/linux
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
RAYLIB_PATH ?= .. RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/osx
endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/rpi
endif
# Define default C compiler: gcc
CC = gcc
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
# OSX default compiler
CC = clang
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
ifeq ($(RPI_CROSS_COMPILE),YES)
# RPI cross-compiler
CC = armv6j-hardfloat-linux-gnueabi-gcc
endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# HTML5 emscripten compiler
CC = emcc
endif
# Define default make program: Mingw32-make
MAKE = mingw32-make
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX)
MAKE = make
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) # Define compiler flags:
RAYLIB_PATH ?= /home/pi/raylib # -O1 defines optimization level
endif
# define NO to use OpenAL Soft as static library (shared by default)
SHARED_OPENAL ?= NO
ifeq ($(PLATFORM),PLATFORM_WEB)
SHARED_OPENAL = NO
endif
# define compiler: gcc for C program, define as g++ for C++
ifeq ($(PLATFORM),PLATFORM_WEB)
# define emscripten compiler
CC = emcc
else
ifeq ($(PLATFORM_OS),OSX)
# define llvm compiler for mac
CC = clang
else
# define default gcc compiler
CC = gcc
endif
endif
# define compiler flags:
# -O2 defines optimization level
# -Og enable debugging # -Og enable debugging
# -s strip unnecessary data from build # -s strip unnecessary data from build
# -Wall turns on most, but not all, compiler warnings # -Wall turns on most, but not all, compiler warnings
@ -98,144 +137,100 @@ endif
# -fgnu89-inline declaring inline functions support (GCC optimized) # -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces
# Additional flags for compiler (if desired)
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
CFLAGS = -O2 -s -Wall -std=c99 # resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window
CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
CFLAGS = -O2 -s -Wall -std=c99 -no-pie -D_DEFAULT_SOURCE CFLAGS += -no-pie -D_DEFAULT_SOURCE
endif
ifeq ($(PLATFORM_OS),OSX)
CFLAGS = -O2 -s -Wall -std=c99
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS += -std=gnu99
endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -s USE_GLFW=3 -s ASSERTIONS=1 --profiling # -O2 # if used, also set --memory-init-file 0
# -O2 # if used, also set --memory-init-file 0 # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s USE_PTHREADS=1 # multithreading support
# --preload-file file.res # embbed file.res resource into .data file CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 --profiling TOTAL_MEMORY=16777216 --preload-file resources
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/win32/mingw32
endif
ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/linux
endif
ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/osx
endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/rpi
endif endif
# define any directories containing required header files # Define include paths for required headers
INCLUDES = -I. -I$(RAYLIB_RELEASE) -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external # NOTE: Several external required libraries (stb and others)
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/release/include -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
# Define additional directories containing required header files
ifeq ($(PLATFORM),PLATFORM_RPI)
# RPI requried libraries
INCLUDE_PATHS += -I/opt/vc/include
INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux
INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads
endif
# Define library paths containing required libs
LDFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES += -I../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads LDFLAGS += -L/opt/vc/lib
endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
# external libraries headers
# GLFW3
INCLUDES += -I$(RAYLIB_PATH)/src/external/glfw3/include
# OpenAL Soft
INCLUDES += -I$(RAYLIB_PATH)/src/external/openal_soft/include
endif
ifeq ($(PLATFORM_OS),LINUX)
# you may optionally create this directory and install raylib
# and related headers there. Edit ../src/Makefile appropriately.
INCLUDES += -I/usr/local/include/raylib
endif
ifeq ($(PLATFORM_OS),OSX)
# additional directories for MacOS
endif
endif endif
# define library paths containing required libs # Define any libraries required on linking
LFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_RPI)
LFLAGS += -L/opt/vc/lib
endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# add standard directories for GNU/Linux
ifeq ($(PLATFORM_OS),WINDOWS)
# external libraries to link with
# GLFW3
LFLAGS += -L$(RAYLIB_PATH)/src/external/glfw3/lib/$(LIBPATH)
# OpenAL Soft
LFLAGS += -L$(RAYLIB_PATH)/src/external/openal_soft/lib/$(LIBPATH)
endif
endif
# define any libraries to link into executable
# if you want to link libraries (libname.so or libname.a), use the -lname # if you want to link libraries (libname.so or libname.a), use the -lname
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),WINDOWS)
# libraries for Debian GNU/Linux desktop compiling # Libraries for Windows desktop compiling
# requires the following packages:
# libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw -lGL -lopenal -lm -lpthread -ldl
# on XWindow requires also below libraries
LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
else
ifeq ($(PLATFORM_OS),OSX)
# libraries for OS X 10.9 desktop compiling
# requires the following packages:
# libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa
else
# libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed # NOTE: GLFW3 and OpenAL Soft libraries should be installed
LIBS = -lraylib -lglfw3 -lopengl32 -lgdi32 LDLIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
# if static OpenAL Soft required, define the corresponding libs
ifeq ($(SHARED_OPENAL),NO) # Define required flags and libs for OpenAL Soft STATIC/SHARED usage
LIBS += -lopenal32 -lwinmm # NOTE: ALLIBS flag only required for raylib Win32 SHARED library building
CFLAGS += -Wl,-allow-multiple-definition ifeq ($(OPENAL_LIBTYPE),STATIC)
LDLIBS += -lopenal32 -lwinmm
CFLAGS += -DAL_LIBTYPE_STATIC -Wl,-allow-multiple-definition
else else
LIBS += -lopenal32dll LDLIBS += -lopenal32dll
endif endif
PHYSAC_LIBS = -static -lpthread PHYSAC_LIBS = -static -lpthread
endif endif
ifeq ($(PLATFORM_OS),LINUX)
# Libraries for Debian GNU/Linux desktop compiling
# NOTE: Required packages: libglfw3-dev libopenal-dev libegl1-mesa-dev
LDLIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl
# On XWindow requires also below libraries
LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
endif
ifeq ($(PLATFORM_OS),OSX)
# Libraries for OSX 10.9 desktop compiling
# NOTE: Required packages: libglfw3-dev libopenal-dev libegl1-mesa-dev
LDLIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# libraries for Raspberry Pi compiling # Libraries for Raspberry Pi compiling
# NOTE: OpenAL Soft library should be installed (libopenal1 package) # NOTE: Required packages: libopenal1
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# NOTE: Set the correct path to libraylib.bc # Libraries for web (HTML5) compiling
LIBS = $(RAYLIB_RELEASE)/libraylib.bc LDLIBS = $(RAYLIB_RELEASE)/libraylib.bc
endif
# define additional parameters and flags for windows
ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window
WINFLAGS = $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif endif
# Define output extension to generate a .html file using provided shell
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html EXT = .html
WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
endif endif
# define all object files required # Define all object files required
EXAMPLES = \ EXAMPLES = \
core/core_basic_window \ core/core_basic_window \
core/core_input_keys \ core/core_input_keys \
@ -268,6 +263,7 @@ EXAMPLES = \
textures/textures_particles_blending \ textures/textures_particles_blending \
textures/textures_image_processing \ textures/textures_image_processing \
textures/textures_image_drawing \ textures/textures_image_drawing \
textures/textures_image_generation \
text/text_sprite_fonts \ text/text_sprite_fonts \
text/text_bmfont_ttf \ text/text_bmfont_ttf \
text/text_raylib_fonts \ text/text_raylib_fonts \
@ -283,6 +279,10 @@ EXAMPLES = \
models/models_heightmap \ models/models_heightmap \
models/models_cubicmap \ models/models_cubicmap \
models/models_mesh_picking \ models/models_mesh_picking \
models/models_mesh_generation \
models/models_yaw_pitch_roll \
models/models_material_pbr \
models/models_skybox \
shaders/shaders_model_shader \ shaders/shaders_model_shader \
shaders/shaders_shapes_textures \ shaders/shaders_shapes_textures \
shaders/shaders_custom_uniform \ shaders/shaders_custom_uniform \
@ -298,49 +298,50 @@ EXAMPLES = \
physac/physics_shatter \ physac/physics_shatter \
fix_dylib \ fix_dylib \
CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
# typing 'make' will invoke the default target entry # Default target entry
all: examples all: examples
# generic compilation pattern # Generic compilation pattern
%: %.c %: %.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile all examples # Compile all examples
examples: $(EXAMPLES) examples: $(EXAMPLES)
# compile [core] example - basic window # compile [core] example - basic window
core/core_basic_window: core/core_basic_window.c core/core_basic_window: core/core_basic_window.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [core] example - keyboard input # compile [core] example - keyboard input
core/core_input_keys: core/core_input_keys.c core/core_input_keys: core/core_input_keys.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [core] example - mouse input # compile [core] example - mouse input
core/core_input_mouse: core/core_input_mouse.c core/core_input_mouse: core/core_input_mouse.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [core] example - mouse wheel # compile [core] example - mouse wheel
core/core_mouse_wheel: core/core_mouse_wheel.c core/core_mouse_wheel: core/core_mouse_wheel.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [core] example - gamepad input # compile [core] example - gamepad input
core/core_input_gamepad: core/core_input_gamepad.c core/core_input_gamepad: core/core_input_gamepad.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [core] example - generate random values # compile [core] example - generate random values
core/core_random_values: core/core_random_values.c core/core_random_values: core/core_random_values.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [core] example - color selection (collision detection) # compile [core] example - color selection (collision detection)
core/core_color_select: core/core_color_select.c core/core_color_select: core/core_color_select.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [core] example - drop files # compile [core] example - drop files
core/core_drop_files: core/core_drop_files.c core/core_drop_files: core/core_drop_files.c
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
else else
@echo core_drop_files: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB or PLATFORM_RPI @echo core_drop_files: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB or PLATFORM_RPI
endif endif
@ -348,218 +349,218 @@ endif
# compile [core] example - storage values # compile [core] example - storage values
core/core_storage_values: core/core_storage_values.c core/core_storage_values: core/core_storage_values.c
ifeq ($(PLATFORM), $(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_RPI)) ifeq ($(PLATFORM), $(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_RPI))
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
else else
@echo core_storage_values: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB @echo core_storage_values: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB
endif endif
# compile [core] example - gestures detection # compile [core] example - gestures detection
core/core_gestures_detection: core/core_gestures_detection.c core/core_gestures_detection: core/core_gestures_detection.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [core] example - 3d mode # compile [core] example - 3d mode
core/core_3d_mode: core/core_3d_mode.c core/core_3d_mode: core/core_3d_mode.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [core] example - 3d picking # compile [core] example - 3d picking
core/core_3d_picking: core/core_3d_picking.c core/core_3d_picking: core/core_3d_picking.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [core] example - 3d camera free # compile [core] example - 3d camera free
core/core_3d_camera_free: core/core_3d_camera_free.c core/core_3d_camera_free: core/core_3d_camera_free.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [core] example - 3d camera first person # compile [core] example - 3d camera first person
core/core_3d_camera_first_person: core/core_3d_camera_first_person.c core/core_3d_camera_first_person: core/core_3d_camera_first_person.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [core] example - 2d camera # compile [core] example - 2d camera
core/core_2d_camera: core/core_2d_camera.c core/core_2d_camera: core/core_2d_camera.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [core] example - world screen # compile [core] example - world screen
core/core_world_screen: core/core_world_screen.c core/core_world_screen: core/core_world_screen.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [core] example - vr simulator # compile [core] example - vr simulator
core/core_vr_simulator: core/core_vr_simulator.c core/core_vr_simulator: core/core_vr_simulator.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [shapes] example - raylib logo (with basic shapes) # compile [shapes] example - raylib logo (with basic shapes)
shapes/shapes_logo_raylib: shapes/shapes_logo_raylib.c shapes/shapes_logo_raylib: shapes/shapes_logo_raylib.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [shapes] example - basic shapes usage (rectangle, circle, ...) # compile [shapes] example - basic shapes usage (rectangle, circle, ...)
shapes/shapes_basic_shapes: shapes/shapes_basic_shapes.c shapes/shapes_basic_shapes: shapes/shapes_basic_shapes.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [shapes] example - raylib color palette # compile [shapes] example - raylib color palette
shapes/shapes_colors_palette: shapes/shapes_colors_palette.c shapes/shapes_colors_palette: shapes/shapes_colors_palette.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [shapes] example - raylib logo animation # compile [shapes] example - raylib logo animation
shapes/shapes_logo_raylib_anim: shapes/shapes_logo_raylib_anim.c shapes/shapes_logo_raylib_anim: shapes/shapes_logo_raylib_anim.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [shapes] example - lines bezier # compile [shapes] example - lines bezier
shapes/shapes_lines_bezier: shapes/shapes_lines_bezier.c shapes/shapes_lines_bezier: shapes/shapes_lines_bezier.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [textures] example - raylib logo texture loading # compile [textures] example - raylib logo texture loading
textures/textures_logo_raylib: textures/textures_logo_raylib.c textures/textures_logo_raylib: textures/textures_logo_raylib.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [textures] example - image loading and conversion to texture # compile [textures] example - image loading and conversion to texture
textures/textures_image_loading: textures/textures_image_loading.c textures/textures_image_loading: textures/textures_image_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [textures] example - texture rectangle drawing # compile [textures] example - texture rectangle drawing
textures/textures_rectangle: textures/textures_rectangle.c textures/textures_rectangle: textures/textures_rectangle.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [textures] example - texture source and destination rectangles # compile [textures] example - texture source and destination rectangles
textures/textures_srcrec_dstrec: textures/textures_srcrec_dstrec.c textures/textures_srcrec_dstrec: textures/textures_srcrec_dstrec.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [textures] example - texture to image # compile [textures] example - texture to image
textures/textures_to_image: textures/textures_to_image.c textures/textures_to_image: textures/textures_to_image.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [textures] example - texture raw data # compile [textures] example - texture raw data
textures/textures_raw_data: textures/textures_raw_data.c textures/textures_raw_data: textures/textures_raw_data.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [textures] example - texture particles blending # compile [textures] example - texture particles blending
textures/textures_particles_blending: textures/textures_particles_blending.c textures/textures_particles_blending: textures/textures_particles_blending.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [textures] example - texture image processing # compile [textures] example - texture image processing
textures/textures_image_processing: textures/textures_image_processing.c textures/textures_image_processing: textures/textures_image_processing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [textures] example - texture image drawing # compile [textures] example - texture image drawing
textures/textures_image_drawing: textures/textures_image_drawing.c textures/textures_image_drawing: textures/textures_image_drawing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [text] example - sprite fonts loading # compile [text] example - sprite fonts loading
text/text_sprite_fonts: text/text_sprite_fonts.c text/text_sprite_fonts: text/text_sprite_fonts.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [text] example - bmfonts and ttf loading # compile [text] example - bmfonts and ttf loading
text/text_bmfont_ttf: text/text_bmfont_ttf.c text/text_bmfont_ttf: text/text_bmfont_ttf.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [text] example - raylib fonts # compile [text] example - raylib fonts
text/text_raylib_fonts: text/text_raylib_fonts.c text/text_raylib_fonts: text/text_raylib_fonts.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [text] example - text formatting # compile [text] example - text formatting
text/text_format_text: text/text_format_text.c text/text_format_text: text/text_format_text.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [text] example - text writing animation # compile [text] example - text writing animation
text/text_writing_anim: text/text_writing_anim.c text/text_writing_anim: text/text_writing_anim.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [text] example - text ttf loading # compile [text] example - text ttf loading
text/text_ttf_loading: text/text_ttf_loading.c text/text_ttf_loading: text/text_ttf_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [text] example - text bmfont unordered # compile [text] example - text bmfont unordered
text/text_bmfont_unordered: text/text_bmfont_unordered.c text/text_bmfont_unordered: text/text_bmfont_unordered.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [text] example - text input box # compile [text] example - text input box
text/text_input_box: text/text_input_box.c text/text_input_box: text/text_input_box.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [models] example - basic geometric 3d shapes # compile [models] example - basic geometric 3d shapes
models/models_geometric_shapes: models/models_geometric_shapes.c models/models_geometric_shapes: models/models_geometric_shapes.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [models] example - box collisions # compile [models] example - box collisions
models/models_box_collisions: models/models_box_collisions.c models/models_box_collisions: models/models_box_collisions.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [models] example - basic window # compile [models] example - basic window
models/models_planes: models/models_planes.c models/models_planes: models/models_planes.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [models] example - billboard usage # compile [models] example - billboard usage
models/models_billboard: models/models_billboard.c models/models_billboard: models/models_billboard.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [models] example - OBJ model loading # compile [models] example - OBJ model loading
models/models_obj_loading: models/models_obj_loading.c models/models_obj_loading: models/models_obj_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [models] example - heightmap loading # compile [models] example - heightmap loading
models/models_heightmap: models/models_heightmap.c models/models_heightmap: models/models_heightmap.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [models] example - cubesmap loading # compile [models] example - cubesmap loading
models/models_cubicmap: models/models_cubicmap.c models/models_cubicmap: models/models_cubicmap.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [models] example - model mesh picking # compile [models] example - model mesh picking
models/models_mesh_picking: models/models_mesh_picking.c models/models_mesh_picking: models/models_mesh_picking.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [shaders] example - model shader # compile [shaders] example - model shader
shaders/shaders_model_shader: shaders/shaders_model_shader.c shaders/shaders_model_shader: shaders/shaders_model_shader.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [shaders] example - shapes texture shader # compile [shaders] example - shapes texture shader
shaders/shaders_shapes_textures: shaders/shaders_shapes_textures.c shaders/shaders_shapes_textures: shaders/shaders_shapes_textures.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [shaders] example - custom uniform in shader # compile [shaders] example - custom uniform in shader
shaders/shaders_custom_uniform: shaders/shaders_custom_uniform.c shaders/shaders_custom_uniform: shaders/shaders_custom_uniform.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [shaders] example - postprocessing shader # compile [shaders] example - postprocessing shader
shaders/shaders_postprocessing: shaders/shaders_postprocessing.c shaders/shaders_postprocessing: shaders/shaders_postprocessing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [audio] example - sound loading and playing (WAV and OGG) # compile [audio] example - sound loading and playing (WAV and OGG)
audio/audio_sound_loading: audio/audio_sound_loading.c audio/audio_sound_loading: audio/audio_sound_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [audio] example - music stream playing (OGG) # compile [audio] example - music stream playing (OGG)
audio/audio_music_stream: audio/audio_music_stream.c audio/audio_music_stream: audio/audio_music_stream.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [audio] example - module playing (XM) # compile [audio] example - module playing (XM)
audio/audio_module_playing: audio/audio_module_playing.c audio/audio_module_playing: audio/audio_module_playing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [audio] example - raw audio streaming # compile [audio] example - raw audio streaming
audio/audio_raw_stream: audio/audio_raw_stream.c audio/audio_raw_stream: audio/audio_raw_stream.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
# compile [physac] example - physics demo # compile [physac] example - physics demo
physac/physics_demo: physac/physics_demo.c physac/physics_demo: physac/physics_demo.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) $(PHYSAC_LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) $(PHYSAC_LIBS) -D$(PLATFORM)
# compile [physac] example - physics friction # compile [physac] example - physics friction
physac/physics_friction: physac/physics_friction.c physac/physics_friction: physac/physics_friction.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) $(PHYSAC_LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) $(PHYSAC_LIBS) -D$(PLATFORM)
# compile [physac] example - physics movement # compile [physac] example - physics movement
physac/physics_movement: physac/physics_movement.c physac/physics_movement: physac/physics_movement.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) $(PHYSAC_LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) $(PHYSAC_LIBS) -D$(PLATFORM)
# compile [physac] example - physics restitution # compile [physac] example - physics restitution
physac/physics_restitution: physac/physics_restitution.c physac/physics_restitution: physac/physics_restitution.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) $(PHYSAC_LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) $(PHYSAC_LIBS) -D$(PLATFORM)
# compile [physac] example - physics shatter # compile [physac] example - physics shatter
physac/physics_shatter: physac/physics_shatter.c physac/physics_shatter: physac/physics_shatter.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) $(PHYSAC_LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) $(PHYSAC_LIBS) -D$(PLATFORM)
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
external/native_app_glue.o : native_app_glue.c native_app_glue.h external/native_app_glue.o : native_app_glue.c native_app_glue.h
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(SHAREDFLAG) $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(SHAREDFLAG)
endif endif
# fix dylib install path name for each executable (MAC) # fix dylib install path name for each executable (MAC)
@ -568,18 +569,18 @@ ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -print0 | xargs -t -0 -R 1 -I file install_name_tool -change libglfw.3.0.dylib ../external/glfw3/lib/osx/libglfw.3.0.dylib file find . -type f -perm +ugo+x -print0 | xargs -t -0 -R 1 -I file install_name_tool -change libglfw.3.0.dylib ../external/glfw3/lib/osx/libglfw.3.0.dylib file
endif endif
# clean everything # Clean everything
clean: clean:
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
del *.o *.exe /s
endif
ifeq ($(PLATFORM_OS),LINUX)
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -f
endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete find . -type f -perm +ugo+x -delete
rm -f *.o rm -f *.o
else
ifeq ($(PLATFORM_OS),LINUX)
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -f
else
del *.o *.exe /s
endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
@ -590,3 +591,4 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
del *.o *.html *.js del *.o *.html *.js
endif endif
@echo Cleaning done @echo Cleaning done

View File

@ -41,10 +41,13 @@ int main()
model.material = LoadMaterialPBR((Color){ 255, 255, 255, 255 }, 1.0f, 1.0f); model.material = LoadMaterialPBR((Color){ 255, 255, 255, 255 }, 1.0f, 1.0f);
// Define lights attributes // Define lights attributes
Light lights[MAX_LIGHTS] = { CreateLight(LIGHT_POINT, (Vector3){ LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 0, 255 }, model.material.shader), // NOTE: Shader is passed to every light on creation to define shader bindings internally
CreateLight(LIGHT_POINT, (Vector3){ 0.0f, LIGHT_HEIGHT, LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 255, 0, 255 }, model.material.shader), Light lights[MAX_LIGHTS] = {
CreateLight(LIGHT_POINT, (Vector3){ -LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 0, 255, 255 }, model.material.shader), CreateLight(LIGHT_POINT, (Vector3){ LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 0, 255 }, model.material.shader),
CreateLight(LIGHT_DIRECTIONAL, (Vector3){ 0.0f, LIGHT_HEIGHT*2.0f, -LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 255, 255 }, model.material.shader) }; CreateLight(LIGHT_POINT, (Vector3){ 0.0f, LIGHT_HEIGHT, LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 255, 0, 255 }, model.material.shader),
CreateLight(LIGHT_POINT, (Vector3){ -LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 0, 255, 255 }, model.material.shader),
CreateLight(LIGHT_DIRECTIONAL, (Vector3){ 0.0f, LIGHT_HEIGHT*2.0f, -LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 255, 255 }, model.material.shader)
};
SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode
@ -156,6 +159,7 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
UnloadTexture(cubemap); UnloadTexture(cubemap);
UnloadTexture(texHDR); UnloadTexture(texHDR);
// Unload already used shaders (to create specific textures)
UnloadShader(shdrCubemap); UnloadShader(shdrCubemap);
UnloadShader(shdrIrradiance); UnloadShader(shdrIrradiance);
UnloadShader(shdrPrefilter); UnloadShader(shdrPrefilter);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 KiB

After

Width:  |  Height:  |  Size: 317 KiB

View File

@ -0,0 +1,113 @@
/*******************************************************************************************
*
* raylib example - procedural mesh generation
*
* This example has been created using raylib 1.8 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2017 Ramon Santamaria (Ray San)
*
********************************************************************************************/
#include "raylib.h"
#define NUM_MODELS 7 // We generate 7 parametric 3d shapes
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - mesh generation");
// We generate a checked image for texturing
Image checked = GenImageChecked(2, 2, 1, 1, RED, GREEN);
Texture2D texture = LoadTextureFromImage(checked);
UnloadImage(checked);
Model models[NUM_MODELS];
models[0] = LoadModelFromMesh(GenMeshPlane(2, 2, 5, 5));
models[1] = LoadModelFromMesh(GenMeshCube(2.0f, 1.0f, 2.0f));
models[2] = LoadModelFromMesh(GenMeshSphere(2, 32, 32));
models[3] = LoadModelFromMesh(GenMeshHemiSphere(2, 16, 16));
models[4] = LoadModelFromMesh(GenMeshCylinder(1, 2, 16));
models[5] = LoadModelFromMesh(GenMeshTorus(0.25f, 4.0f, 16, 32));
models[6] = LoadModelFromMesh(GenMeshKnot(1.0f, 2.0f, 16, 128));
// Set checked texture as default diffuse component for all models material
for (int i = 0; i < NUM_MODELS; i++) models[i].material.maps[MAP_DIFFUSE].texture = texture;
// Define the camera to look into our 3d world
Camera camera = {{ 5.0f, 5.0f, 5.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f };
// Model drawing position
Vector3 position = { 0.0f, 0.0f, 0.0f };
int currentModel = 0;
SetCameraMode(camera, CAMERA_ORBITAL); // Set a orbital camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
UpdateCamera(&camera); // Update internal camera and our camera
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
{
currentModel = (currentModel + 1)%NUM_MODELS; // Cycle between the textures
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
Begin3dMode(camera);
DrawModel(models[currentModel], position, 1.0f, WHITE);
DrawGrid(10, 1.0);
End3dMode();
DrawRectangle(30, 400, 310, 30, Fade(SKYBLUE, 0.5f));
DrawRectangleLines(30, 400, 310, 30, Fade(DARKBLUE, 0.5f));
DrawText("MOUSE LEFT BUTTON to CYCLE PROCEDURAL MODELS", 40, 410, 10, BLUE);
switch(currentModel)
{
case 0: DrawText("PLANE", 680, 10, 20, DARKBLUE); break;
case 1: DrawText("CUBE", 680, 10, 20, DARKBLUE); break;
case 2: DrawText("SPHERE", 680, 10, 20, DARKBLUE); break;
case 3: DrawText("HEMISPHERE", 640, 10, 20, DARKBLUE); break;
case 4: DrawText("CYLINDER", 680, 10, 20, DARKBLUE); break;
case 5: DrawText("TORUS", 680, 10, 20, DARKBLUE); break;
case 6: DrawText("KNOT", 680, 10, 20, DARKBLUE); break;
default: break;
}
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
// Unload models data (GPU VRAM)
for (int i = 0; i < NUM_MODELS; i++) UnloadModel(models[i]);
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -89,7 +89,7 @@ int main()
cursorColor = PURPLE; cursorColor = PURPLE;
hitObjectName = "Triangle"; hitObjectName = "Triangle";
bary = VectorBarycenter(nearestHit.position, ta, tb, tc); bary = Vector3Barycenter(nearestHit.position, ta, tb, tc);
hitTriangle = true; hitTriangle = true;
} }
else hitTriangle = false; else hitTriangle = false;

View File

@ -1,6 +1,6 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib [models] example - Plane rotations (pitch, roll, yaw) * raylib [models] example - Plane rotations (yaw, pitch, roll)
* *
* This example has been created using raylib 1.8 (www.raylib.com) * This example has been created using raylib 1.8 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
@ -28,7 +28,7 @@ int main()
const int screenWidth = 800; const int screenWidth = 800;
const int screenHeight = 450; const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - plane rotations (pitch, roll, yaw)"); InitWindow(screenWidth, screenHeight, "raylib [models] example - plane rotations (yaw, pitch, roll)");
Texture2D texAngleGauge = LoadTexture("resources/angle_gauge.png"); Texture2D texAngleGauge = LoadTexture("resources/angle_gauge.png");
Texture2D texBackground = LoadTexture("resources/background.png"); Texture2D texBackground = LoadTexture("resources/background.png");
@ -71,6 +71,15 @@ int main()
else if (roll < 0.0f) roll += 0.5f; else if (roll < 0.0f) roll += 0.5f;
} }
// Plane yaw (y-axis) controls
if (IsKeyDown(KEY_S)) yaw += 1.0f;
else if (IsKeyDown(KEY_A)) yaw -= 1.0f;
else
{
if (yaw > 0.0f) yaw -= 0.5f;
else if (yaw < 0.0f) yaw += 0.5f;
}
// Plane pitch (z-axis) controls // Plane pitch (z-axis) controls
if (IsKeyDown(KEY_DOWN)) pitch += 0.6f; if (IsKeyDown(KEY_DOWN)) pitch += 0.6f;
else if (IsKeyDown(KEY_UP)) pitch -= 0.6f; else if (IsKeyDown(KEY_UP)) pitch -= 0.6f;
@ -85,15 +94,6 @@ int main()
while (pitchOffset > 180) pitchOffset -= 360; while (pitchOffset > 180) pitchOffset -= 360;
while (pitchOffset < -180) pitchOffset += 360; while (pitchOffset < -180) pitchOffset += 360;
pitchOffset *= 10; pitchOffset *= 10;
// Plane yaw (y-axis) controls
if (IsKeyDown(KEY_S)) yaw += 1.0f;
else if (IsKeyDown(KEY_A)) yaw -= 1.0f;
else
{
if (yaw > 0.0f) yaw -= 0.5f;
else if (yaw < 0.0f) yaw += 0.5f;
}
Matrix transform = MatrixIdentity(); Matrix transform = MatrixIdentity();

View File

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

View File

@ -65,7 +65,7 @@ int main()
DrawText("USING CUSTOM SHADER", 190, 40, 10, RED); DrawText("USING CUSTOM SHADER", 190, 40, 10, RED);
DrawRectangle(250 - 60, 90, 120, 60, RED); DrawRectangle(250 - 60, 90, 120, 60, RED);
DrawRectangleGradient(250 - 90, 170, 180, 130, MAROON, GOLD); DrawRectangleGradientH(250 - 90, 170, 180, 130, MAROON, GOLD);
DrawRectangleLines(250 - 40, 320, 80, 60, ORANGE); DrawRectangleLines(250 - 40, 320, 80, 60, ORANGE);
// Activate our default shader for next drawings // Activate our default shader for next drawings

View File

@ -46,7 +46,7 @@ int main()
DrawCircleLines(screenWidth/4, 340, 80, DARKBLUE); DrawCircleLines(screenWidth/4, 340, 80, DARKBLUE);
DrawRectangle(screenWidth/4*2 - 60, 100, 120, 60, RED); DrawRectangle(screenWidth/4*2 - 60, 100, 120, 60, RED);
DrawRectangleGradient(screenWidth/4*2 - 90, 170, 180, 130, MAROON, GOLD); DrawRectangleGradientH(screenWidth/4*2 - 90, 170, 180, 130, MAROON, GOLD);
DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE); DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE);
DrawTriangle((Vector2){screenWidth/4*3, 80}, DrawTriangle((Vector2){screenWidth/4*3, 80},

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -36,6 +36,14 @@ int main()
ImageCrop(&parrots, (Rectangle){ 0, 50, parrots.width, parrots.height - 100 }); // Crop resulting image ImageCrop(&parrots, (Rectangle){ 0, 50, parrots.width, parrots.height - 100 }); // Crop resulting image
UnloadImage(cat); // Unload image from RAM UnloadImage(cat); // Unload image from RAM
// Load custom font for frawing on image
SpriteFont font = LoadSpriteFont("resources/custom_jupiter_crash.png");
// Draw over image using custom font
ImageDrawTextEx(&parrots, (Vector2){ 300, 230 }, font, "PARROTS & CAT", font.baseSize, -2, WHITE);
UnloadSpriteFont(font); // Unload custom spritefont (already drawn used on image)
Texture2D texture = LoadTextureFromImage(parrots); // Image converted to texture, uploaded to GPU memory (VRAM) Texture2D texture = LoadTextureFromImage(parrots); // Image converted to texture, uploaded to GPU memory (VRAM)
UnloadImage(parrots); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM UnloadImage(parrots); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM

View File

@ -11,7 +11,7 @@
#include "raylib.h" #include "raylib.h"
#define TEXTURES_NUM 7 // for now we have 7 generation algorithms #define NUM_TEXTURES 7 // Currently we have 7 generation algorithms
int main() int main()
{ {
@ -30,7 +30,7 @@ int main()
Image perlinNoise = GenImagePerlinNoise(screenWidth, screenHeight, 8.f); Image perlinNoise = GenImagePerlinNoise(screenWidth, screenHeight, 8.f);
Image cellular = GenImageCellular(screenWidth, screenHeight, 32); Image cellular = GenImageCellular(screenWidth, screenHeight, 32);
Texture2D textures[TEXTURES_NUM]; Texture2D textures[NUM_TEXTURES];
textures[0] = LoadTextureFromImage(verticalGradient); textures[0] = LoadTextureFromImage(verticalGradient);
textures[1] = LoadTextureFromImage(horizontalGradient); textures[1] = LoadTextureFromImage(horizontalGradient);
textures[2] = LoadTextureFromImage(radialGradient); textures[2] = LoadTextureFromImage(radialGradient);
@ -38,6 +38,15 @@ int main()
textures[4] = LoadTextureFromImage(whiteNoise); textures[4] = LoadTextureFromImage(whiteNoise);
textures[5] = LoadTextureFromImage(perlinNoise); textures[5] = LoadTextureFromImage(perlinNoise);
textures[6] = LoadTextureFromImage(cellular); textures[6] = LoadTextureFromImage(cellular);
// Unload image data (CPU RAM)
UnloadImage(verticalGradient);
UnloadImage(horizontalGradient);
UnloadImage(radialGradient);
UnloadImage(checked);
UnloadImage(whiteNoise);
UnloadImage(perlinNoise);
UnloadImage(cellular);
int currentTexture = 0; int currentTexture = 0;
@ -51,7 +60,7 @@ int main()
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
{ {
currentTexture = (currentTexture + 1) % TEXTURES_NUM; // cycle between the 5 textures currentTexture = (currentTexture + 1)%NUM_TEXTURES; // Cycle between the textures
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@ -63,24 +72,31 @@ int main()
DrawTexture(textures[currentTexture], 0, 0, WHITE); DrawTexture(textures[currentTexture], 0, 0, WHITE);
DrawRectangle(30, 400, 325, 30, Fade(SKYBLUE, 0.5f));
DrawRectangleLines(30, 400, 325, 30, Fade(WHITE, 0.5f));
DrawText("MOUSE LEFT BUTTON to CYCLE PROCEDURAL TEXTURES", 40, 410, 10, WHITE);
switch(currentTexture)
{
case 0: DrawText("VERTICAL GRADIENT", 560, 10, 20, RAYWHITE); break;
case 1: DrawText("HORIZONTAL GRADIENT", 540, 10, 20, RAYWHITE); break;
case 2: DrawText("RADIAL GRADIENT", 580, 10, 20, LIGHTGRAY); break;
case 3: DrawText("CHECKED", 680, 10, 20, RAYWHITE); break;
case 4: DrawText("WHITE NOISE", 640, 10, 20, RED); break;
case 5: DrawText("PERLIN NOISE", 630, 10, 20, RAYWHITE); break;
case 6: DrawText("CELLULAR", 670, 10, 20, RAYWHITE); break;
default: break;
}
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Unload image data (CPU RAM)
UnloadImage(verticalGradient);
UnloadImage(horizontalGradient);
UnloadImage(radialGradient);
UnloadImage(checked);
UnloadImage(whiteNoise);
UnloadImage(perlinNoise);
UnloadImage(cellular);
// Unload textures data (GPU VRAM) // Unload textures data (GPU VRAM)
for (int i = 0; i < TEXTURES_NUM; i++) UnloadTexture(textures[i]); for (int i = 0; i < NUM_TEXTURES; i++) UnloadTexture(textures[i]);
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 KiB

After

Width:  |  Height:  |  Size: 220 KiB

View File

@ -36,7 +36,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
endif endif
# define raylib directory for include and library # define raylib directory for include and library
RAYLIB_PATH ?= C:\raylib\raylib RAYLIB_PATH ?= C:\GitHub\raylib
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected # determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)

View File

@ -6,7 +6,7 @@ in vec2 vertexTexCoord;
in vec4 vertexColor; in vec4 vertexColor;
// Input uniform values // Input uniform values
uniform mat4 mvpMatrix; uniform mat4 mvp;
// Output vertex attributes (to fragment shader) // Output vertex attributes (to fragment shader)
out vec2 fragTexCoord; out vec2 fragTexCoord;
@ -21,5 +21,5 @@ void main()
fragColor = vertexColor; fragColor = vertexColor;
// Calculate final vertex position // Calculate final vertex position
gl_Position = mvpMatrix*vec4(vertexPosition, 1.0); gl_Position = mvp*vec4(vertexPosition, 1.0);
} }

View File

@ -855,11 +855,11 @@ void DrawTitleScreen(void)
{ {
BeginShaderMode(colorBlend); BeginShaderMode(colorBlend);
DrawTexturePro(atlas02,gameplay_background, (Rectangle){0, 0, gameplay_background.width*2, gameplay_background.height*2}, (Vector2){0, 0}, 0, color02); DrawTexturePro(atlas02, gameplay_background, (Rectangle){0, 0, gameplay_background.width*2, gameplay_background.height*2}, (Vector2){0, 0}, 0, color02);
// Draw parallax // Draw parallax
DrawParallaxBack(); //DrawParallaxBack();
DrawParallaxMiddle(); //DrawParallaxMiddle();
for (int i = 0; i < MAX_particle; i++) for (int i = 0; i < MAX_particle; i++)
{ {
@ -946,7 +946,6 @@ void DrawTitleScreen(void)
(Rectangle){ rainParticle.particle[i].position.x, rainParticle.particle[i].position.y, particle_waterdrop.width*rainParticle.particle[i].size, particle_waterdrop.height*rainParticle.particle[i].size }, (Rectangle){ rainParticle.particle[i].position.x, rainParticle.particle[i].position.y, particle_waterdrop.width*rainParticle.particle[i].size, particle_waterdrop.height*rainParticle.particle[i].size },
(Vector2){ particle_waterdrop.width*rainParticle.particle[i].size/2, particle_waterdrop.height*rainParticle.particle[i].size/2 }, rainParticle.particle[i].rotation, (Vector2){ particle_waterdrop.width*rainParticle.particle[i].size/2, particle_waterdrop.height*rainParticle.particle[i].size/2 }, rainParticle.particle[i].rotation,
Fade(rainParticle.particle[i].color, rainParticle.particle[i].alpha)); Fade(rainParticle.particle[i].color, rainParticle.particle[i].alpha));
} }
for (int i = 0; i < 1024; i++) for (int i = 0; i < 1024; i++)
@ -959,7 +958,6 @@ void DrawTitleScreen(void)
for (int i = 0; i < 256; i++) for (int i = 0; i < 256; i++)
{ {
if (snowStormParticle.particle[i].active) DrawTexturePro(atlas01, particle_icecrystal, if (snowStormParticle.particle[i].active) DrawTexturePro(atlas01, particle_icecrystal,
(Rectangle){ snowStormParticle.particle[i].position.x, snowStormParticle.particle[i].position.y, particle_icecrystal.width*snowStormParticle.particle[i].size, particle_icecrystal.height*snowStormParticle.particle[i].size }, (Rectangle){ snowStormParticle.particle[i].position.x, snowStormParticle.particle[i].position.y, particle_icecrystal.width*snowStormParticle.particle[i].size, particle_icecrystal.height*snowStormParticle.particle[i].size },
(Vector2){ particle_icecrystal.width*snowStormParticle.particle[i].size/2, particle_icecrystal.height*snowStormParticle.particle[i].size/2 }, snowStormParticle.particle[i].rotation, (Vector2){ particle_icecrystal.width*snowStormParticle.particle[i].size/2, particle_icecrystal.height*snowStormParticle.particle[i].size/2 }, snowStormParticle.particle[i].rotation,
@ -969,8 +967,7 @@ void DrawTitleScreen(void)
for (int i = 0; i < 20; i++) for (int i = 0; i < 20; i++)
{ {
if (rayparticle.particle[i].active) DrawTexturePro(atlas01, gameplay_fx_lightraymid,
if (rayparticle.particle[i].active) DrawTexturePro(atlas01, gameplay_fx_lightraymid,
(Rectangle){ rayparticle.particle[i].position.x, rayparticle.particle[i].position.y, gameplay_fx_lightraymid.width*rayparticle.particle[i].size, gameplay_fx_lightraymid.height*rayparticle.particle[i].size }, (Rectangle){ rayparticle.particle[i].position.x, rayparticle.particle[i].position.y, gameplay_fx_lightraymid.width*rayparticle.particle[i].size, gameplay_fx_lightraymid.height*rayparticle.particle[i].size },
(Vector2){ gameplay_fx_lightraymid.width*rayparticle.particle[i].size/2, gameplay_fx_lightraymid.height*rayparticle.particle[i].size/2 }, rayparticle.particle[i].rotation, (Vector2){ gameplay_fx_lightraymid.width*rayparticle.particle[i].size/2, gameplay_fx_lightraymid.height*rayparticle.particle[i].size/2 }, rayparticle.particle[i].rotation,
Fade(rayparticle.particle[i].color, rayparticle.particle[i].alpha)); Fade(rayparticle.particle[i].color, rayparticle.particle[i].alpha));
@ -987,6 +984,8 @@ void DrawTitleScreen(void)
if (musicActive)DrawTexturePro(atlas01, title_speaker_on, (Rectangle){speakerButton.x, speakerButton.y, title_speaker_on.width, title_speaker_on.height}, (Vector2){0,0}, 0, WHITE); if (musicActive)DrawTexturePro(atlas01, title_speaker_on, (Rectangle){speakerButton.x, speakerButton.y, title_speaker_on.width, title_speaker_on.height}, (Vector2){0,0}, 0, WHITE);
else DrawTexturePro(atlas01, title_speaker_off, (Rectangle){speakerButton.x, speakerButton.y, title_speaker_off.width, title_speaker_off.height}, (Vector2){0,0}, 0, WHITE); else DrawTexturePro(atlas01, title_speaker_off, (Rectangle){speakerButton.x, speakerButton.y, title_speaker_off.width, title_speaker_off.height}, (Vector2){0,0}, 0, WHITE);
*/ */
DrawParallaxFront();
} }
// Title Screen Unload logic // Title Screen Unload logic
@ -1004,7 +1003,10 @@ int FinishTitleScreen(void)
static void DrawParallaxFront(void) static void DrawParallaxFront(void)
{ {
Rectangle ground01 = gameplay_back_ground01; Rectangle ground01 = gameplay_back_ground01;
DrawTexturePro(atlas02, gameplay_back_tree01_layer01, (Rectangle){0, 0, gameplay_back_tree01_layer01.width*2, gameplay_back_tree01_layer01.height*2}, (Vector2){0,0}, 0, WHITE);
/*
//DrawTexturePro(atlas02, gameplay_back_tree01_layer03, (Rectangle){0, 21, gameplay_back_tree01_layer03.width*2, gameplay_back_tree01_layer03.height*2}, (Vector2){0,0}, 0, color02); //DrawTexturePro(atlas02, gameplay_back_tree01_layer03, (Rectangle){0, 21, gameplay_back_tree01_layer03.width*2, gameplay_back_tree01_layer03.height*2}, (Vector2){0,0}, 0, color02);
DrawTexturePro(atlas02, gameplay_back_tree01_layer01, (Rectangle){(int)parallaxFrontOffset, 60, gameplay_back_tree01_layer01.width*2, gameplay_back_tree01_layer01.height*2}, (Vector2){0,0}, 0, color02); DrawTexturePro(atlas02, gameplay_back_tree01_layer01, (Rectangle){(int)parallaxFrontOffset, 60, gameplay_back_tree01_layer01.width*2, gameplay_back_tree01_layer01.height*2}, (Vector2){0,0}, 0, color02);
DrawTexturePro(atlas02, gameplay_back_tree02_layer01, (Rectangle){(int)parallaxFrontOffset + 140, 60, gameplay_back_tree02_layer01.width*2, gameplay_back_tree02_layer01.height*2}, (Vector2){0,0}, 0, color02); DrawTexturePro(atlas02, gameplay_back_tree02_layer01, (Rectangle){(int)parallaxFrontOffset + 140, 60, gameplay_back_tree02_layer01.width*2, gameplay_back_tree02_layer01.height*2}, (Vector2){0,0}, 0, color02);
@ -1016,7 +1018,8 @@ static void DrawParallaxFront(void)
DrawTexturePro(atlas02, gameplay_back_tree08_layer01, (Rectangle){(int)parallaxFrontOffset + 140*7, 60, gameplay_back_tree08_layer01.width*2, gameplay_back_tree08_layer01.height*2}, (Vector2){0,0}, 0, color02); DrawTexturePro(atlas02, gameplay_back_tree08_layer01, (Rectangle){(int)parallaxFrontOffset + 140*7, 60, gameplay_back_tree08_layer01.width*2, gameplay_back_tree08_layer01.height*2}, (Vector2){0,0}, 0, color02);
DrawTexturePro(atlas02, gameplay_back_ground01, (Rectangle){0, 559, ground01.width*2, ground01.height*2}, (Vector2){0,0}, 0, color01); DrawTexturePro(atlas02, gameplay_back_ground01, (Rectangle){0, 559, ground01.width*2, ground01.height*2}, (Vector2){0,0}, 0, color01);
DrawTexturePro(atlas02, (Rectangle){ground01.x, ground01.y + ground01.height, ground01.width, -ground01.height}, (Rectangle){0, -33, ground01.width*2, ground01.height*2}, (Vector2){0,0}, 0, color01); DrawTexturePro(atlas02, (Rectangle){ground01.x, ground01.y + ground01.height, ground01.width, -ground01.height}, (Rectangle){0, -33, ground01.width*2, ground01.height*2}, (Vector2){0,0}, 0, color01);
} */
}
static void DrawParallaxMiddle(void) static void DrawParallaxMiddle(void)
{ {

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

15
release/README.md Normal file
View File

@ -0,0 +1,15 @@
## raylib release
In this folder you can find raylib library pre-compiled and ready-to-use for different platforms.
It also includes additional raylib required libraries for different platforms that sometimes users need to compile by themselfs.Depending on target platform some libraries can be just downloaded from their repos using some package manager software provided by the OS, very tipical in Linux (`apt-get`) and OSX.
**Provided libraries you will find in this folder are:**
Library | Version | Date | Platform | Notes
--- | :---: | :---: | :---: | ---
[raylib]() | 1.8.0 | Oct 2017 | *all* | simple and easy-to-use library for games dev.
[GLFW3](http://www.glfw.org/) | 3.2.1 | Aug 2016 | win32-mingw32,<br> win32-msvc | Window and input management on desktop platforms
[OpenAL Soft](http://kcat.strangesoft.net/openal.html) | 1.18.2 | Sep 2017 | win32-mingw32,<br> win32-msvc,<br> Android | Audio device management
For detailed information on raylib external dependencies, just check [Wiki information on external dependencies](https://github.com/raysan5/raylib/wiki/External-dependencies).

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -448,6 +448,17 @@ AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index);
#endif #endif
#endif #endif
#ifndef AL_SOFT_source_spatialize
#define AL_SOFT_source_spatialize
#define AL_SOURCE_SPATIALIZE_SOFT 0x1214
#define AL_AUTO_SOFT 0x0002
#endif
#ifndef ALC_SOFT_output_limiter
#define ALC_SOFT_output_limiter
#define ALC_OUTPUT_LIMITER_SOFT 0x199A
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -74,14 +74,17 @@
//#define PLATFORM_WEB // HTML5 (emscripten, asm.js) //#define PLATFORM_WEB // HTML5 (emscripten, asm.js)
// Security check in case no PLATFORM_* defined // Security check in case no PLATFORM_* defined
#if !defined(PLATFORM_DESKTOP) && !defined(PLATFORM_ANDROID) && !defined(PLATFORM_RPI) && !defined(PLATFORM_WEB) #if !defined(PLATFORM_DESKTOP) && \
#define PLATFORM_DESKTOP !defined(PLATFORM_ANDROID) && \
!defined(PLATFORM_RPI) && \
!defined(PLATFORM_WEB)
#define PLATFORM_DESKTOP
#endif #endif
#if defined(_WIN32) && defined(BUILDING_DLL) #if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED)
#define RLAPI __declspec(dllexport) // We are building raylib as a Win32 DLL #define RLAPI __declspec(dllexport) // We are building raylib as a Win32 shared library (.dll)
#elif defined(_WIN32) && defined(RAYLIB_DLL) #elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED)
#define RLAPI __declspec(dllimport) // We are using raylib as a Win32 DLL #define RLAPI __declspec(dllimport) // We are using raylib as a Win32 shared library (.dll)
#else #else
#define RLAPI // We are building or using raylib as a static library (or Linux shared library) #define RLAPI // We are building or using raylib as a static library (or Linux shared library)
#endif #endif
@ -856,7 +859,8 @@ RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color);
RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle
RLAPI void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle RLAPI void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle
RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters
RLAPI void DrawRectangleGradient(int posX, int posY, int width, int height, Color color1, Color color2); // Draw a gradient-filled rectangle RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2);// Draw a vertical-gradient-filled rectangle
RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2);// Draw a horizontal-gradient-filled rectangle
RLAPI void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw a gradient-filled rectangle with custom vertex colors RLAPI void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw a gradient-filled rectangle with custom vertex colors
RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version) RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version)
RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

0
release/libs/osx/ADDLIBS Normal file
View File

0
release/libs/rpi/ADDLIBS Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,25 +1,26 @@
/********************************************************************************************** /**********************************************************************************************
* *
* raylib v1.8.0 * raylib v1.8.0
* *
* A simple and easy-to-use library to learn videogames programming (www.raylib.com) * A simple and easy-to-use library to learn videogames programming (www.raylib.com)
* *
* FEATURES: * FEATURES:
* - Library written in plain C code (C99) * - Written in plain C code (C99) in PascalCase/camelCase notation
* - Multiple platforms supported: Windows, Linux, Mac, Android, Raspberry Pi, HTML5. * - Multiple platforms support: Windows, Linux, Mac, Android, Raspberry Pi and HTML5
* - Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES 2.0) * - Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES 2.0)
* - Unique OpenGL abstraction layer (usable as standalone module): [rlgl] * - Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
* - Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF) * - Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF)
* - Multiple textures support, including compressed formats and mipmaps generation * - Outstanding texture formats support, including compressed formats (DXT, ETC, PVRT, ASTC)
* - Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps * - Basic 3d support for Geometrics, Models, Billboards, Heightmaps and Cubicmaps
* - Flexible Materials system, supporting classic maps and PBR maps
* - Shaders support, including Model shaders and Postprocessing shaders
* - Powerful math module for Vector2, Vector3, Matrix and Quaternion operations: [raymath] * - Powerful math module for Vector2, Vector3, Matrix and Quaternion operations: [raymath]
* - Audio loading and playing with streaming support and mixing channels: [audio] * - Audio loading and playing with streaming support and mixing channels: [audio]
* - VR stereo rendering support with configurable HMD device parameters * - VR stereo rendering support with configurable HMD device parameters
* - Minimal external dependencies (GLFW3, OpenGL, OpenAL) * - Minimal external dependencies (GLFW3, OpenGL, OpenAL)
* - Complete bindings for Lua, Go and Pascal * - Complete bindings to LUA (raylib-lua) and Go (raylib-go)
* *
* NOTES: * NOTES:
* 32bit Colors - Any defined Color is always RGBA (4 byte)
* One custom font is loaded by default when InitWindow() [core] * One custom font is loaded by default when InitWindow() [core]
* If using OpenGL 3.3 or ES2, one default shader is loaded automatically (internally defined) [rlgl] * If using OpenGL 3.3 or ES2, one default shader is loaded automatically (internally defined) [rlgl]
* If using OpenGL 3.3 or ES2, several vertex buffers (VAO/VBO) are created to manage lines-triangles-quads * If using OpenGL 3.3 or ES2, several vertex buffers (VAO/VBO) are created to manage lines-triangles-quads
@ -31,12 +32,16 @@
* *
* OPTIONAL DEPENDENCIES: * OPTIONAL DEPENDENCIES:
* stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA) [textures] * stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA) [textures]
* stb_image_resize (Sean Barret) for image resizing algorythms [textures]
* stb_image_write (Sean Barret) for image writting (PNG) [utils] * stb_image_write (Sean Barret) for image writting (PNG) [utils]
* stb_truetype (Sean Barret) for ttf fonts loading [text] * stb_truetype (Sean Barret) for ttf fonts loading [text]
* stb_vorbis (Sean Barret) for ogg audio loading [audio] * stb_vorbis (Sean Barret) for ogg audio loading [audio]
* stb_perlin (Sean Barret) for Perlin noise image generation [textures]
* par_shapes (Philip Rideout) for parametric 3d shapes generation [models]
* jar_xm (Joshua Reisenauer) for XM audio module loading [audio] * jar_xm (Joshua Reisenauer) for XM audio module loading [audio]
* jar_mod (Joshua Reisenauer) for MOD audio module loading [audio] * jar_mod (Joshua Reisenauer) for MOD audio module loading [audio]
* dr_flac (David Reid) for FLAC audio file loading [audio] * dr_flac (David Reid) for FLAC audio file loading [audio]
* rgif (Charlie Tangora, Ramon Santamaria) for GIF recording [core]
* tinfl for data decompression (DEFLATE algorithm) [rres] * tinfl for data decompression (DEFLATE algorithm) [rres]
* *
* *
@ -74,14 +79,17 @@
//#define PLATFORM_WEB // HTML5 (emscripten, asm.js) //#define PLATFORM_WEB // HTML5 (emscripten, asm.js)
// Security check in case no PLATFORM_* defined // Security check in case no PLATFORM_* defined
#if !defined(PLATFORM_DESKTOP) && !defined(PLATFORM_ANDROID) && !defined(PLATFORM_RPI) && !defined(PLATFORM_WEB) #if !defined(PLATFORM_DESKTOP) && \
#define PLATFORM_DESKTOP !defined(PLATFORM_ANDROID) && \
!defined(PLATFORM_RPI) && \
!defined(PLATFORM_WEB)
#define PLATFORM_DESKTOP
#endif #endif
#if defined(_WIN32) && defined(BUILDING_DLL) #if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED)
#define RLAPI __declspec(dllexport) // We are building raylib as a Win32 DLL #define RLAPI __declspec(dllexport) // We are building raylib as a Win32 shared library (.dll)
#elif defined(_WIN32) && defined(RAYLIB_DLL) #elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED)
#define RLAPI __declspec(dllimport) // We are using raylib as a Win32 DLL #define RLAPI __declspec(dllimport) // We are using raylib as a Win32 shared library (.dll)
#else #else
#define RLAPI // We are building or using raylib as a static library (or Linux shared library) #define RLAPI // We are building or using raylib as a static library (or Linux shared library)
#endif #endif
@ -291,12 +299,16 @@
#define MAGENTA CLITERAL{ 255, 0, 255, 255 } // Magenta #define MAGENTA CLITERAL{ 255, 0, 255, 255 } // Magenta
#define RAYWHITE CLITERAL{ 245, 245, 245, 255 } // My own White (raylib logo) #define RAYWHITE CLITERAL{ 245, 245, 245, 255 } // My own White (raylib logo)
// Shader and material limits
#define MAX_SHADER_LOCATIONS 32 // Maximum number of predefined locations stored in shader struct
#define MAX_MATERIAL_MAPS 12 // Maximum number of texture maps stored in shader struct
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Structures Definition // Structures Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#ifndef __cplusplus #ifndef __cplusplus
// Boolean type // Boolean type
#if !defined(_STDBOOL_H) || !defined(__STDBOOL_H) // CLang uses second form #ifndef bool
typedef enum { false, true } bool; typedef enum { false, true } bool;
#endif #endif
#endif #endif
@ -400,63 +412,46 @@ typedef struct Camera2D {
// Bounding box type // Bounding box type
typedef struct BoundingBox { typedef struct BoundingBox {
Vector3 min; // minimum vertex box-corner Vector3 min; // Minimum vertex box-corner
Vector3 max; // maximum vertex box-corner Vector3 max; // Maximum vertex box-corner
} BoundingBox; } BoundingBox;
// Vertex data definning a mesh // Vertex data definning a mesh
// NOTE: Data stored in CPU memory (and GPU)
typedef struct Mesh { typedef struct Mesh {
int vertexCount; // number of vertices stored in arrays int vertexCount; // Number of vertices stored in arrays
int triangleCount; // number of triangles stored (indexed or not) int triangleCount; // Number of triangles stored (indexed or not)
float *vertices; // vertex position (XYZ - 3 components per vertex) (shader-location = 0)
float *texcoords; // vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) float *vertices; // Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
float *texcoords2; // vertex second texture coordinates (useful for lightmaps) (shader-location = 5) float *texcoords; // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
float *normals; // vertex normals (XYZ - 3 components per vertex) (shader-location = 2) float *texcoords2; // Vertex second texture coordinates (useful for lightmaps) (shader-location = 5)
float *tangents; // vertex tangents (XYZ - 3 components per vertex) (shader-location = 4) float *normals; // Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
unsigned char *colors; // vertex colors (RGBA - 4 components per vertex) (shader-location = 3) float *tangents; // Vertex tangents (XYZ - 3 components per vertex) (shader-location = 4)
unsigned short *indices;// vertex indices (in case vertex data comes indexed) unsigned char *colors; // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
unsigned short *indices;// Vertex indices (in case vertex data comes indexed)
unsigned int vaoId; // OpenGL Vertex Array Object id unsigned int vaoId; // OpenGL Vertex Array Object id
unsigned int vboId[7]; // OpenGL Vertex Buffer Objects id (7 types of vertex data) unsigned int vboId[7]; // OpenGL Vertex Buffer Objects id (7 types of vertex data)
} Mesh; } Mesh;
// Shader type (generic shader) // Shader type (generic)
typedef struct Shader { typedef struct Shader {
unsigned int id; // Shader program id unsigned int id; // Shader program id
int locs[MAX_SHADER_LOCATIONS]; // Shader locations array
// Vertex attributes locations (default locations)
int vertexLoc; // Vertex attribute location point (default-location = 0)
int texcoordLoc; // Texcoord attribute location point (default-location = 1)
int texcoord2Loc; // Texcoord2 attribute location point (default-location = 5)
int normalLoc; // Normal attribute location point (default-location = 2)
int tangentLoc; // Tangent attribute location point (default-location = 4)
int colorLoc; // Color attibute location point (default-location = 3)
// Uniform locations
int mvpLoc; // ModelView-Projection matrix uniform location point (vertex shader)
int colDiffuseLoc; // Diffuse color uniform location point (fragment shader)
int colAmbientLoc; // Ambient color uniform location point (fragment shader)
int colSpecularLoc; // Specular color uniform location point (fragment shader)
// Texture map locations (generic for any kind of map)
int mapTexture0Loc; // Map texture uniform location point (default-texture-unit = 0)
int mapTexture1Loc; // Map texture uniform location point (default-texture-unit = 1)
int mapTexture2Loc; // Map texture uniform location point (default-texture-unit = 2)
} Shader; } Shader;
// Material type // Material texture map
typedef struct MaterialMap {
Texture2D texture; // Material map texture
Color color; // Material map color
float value; // Material map value
} MaterialMap;
// Material type (generic)
typedef struct Material { typedef struct Material {
Shader shader; // Standard shader (supports 3 map textures) Shader shader; // Material shader
MaterialMap maps[MAX_MATERIAL_MAPS]; // Material maps
Texture2D texDiffuse; // Diffuse texture (binded to shader mapTexture0Loc) float *params; // Material generic parameters (if required)
Texture2D texNormal; // Normal texture (binded to shader mapTexture1Loc)
Texture2D texSpecular; // Specular texture (binded to shader mapTexture2Loc)
Color colDiffuse; // Diffuse color
Color colAmbient; // Ambient color
Color colSpecular; // Specular color
float glossiness; // Glossiness level (Ranges from 0 to 1000)
} Material; } Material;
// Model type // Model type
@ -528,6 +523,20 @@ typedef struct RRESData {
// RRES type (pointer to RRESData array) // RRES type (pointer to RRESData array)
typedef struct RRESData *RRES; typedef struct RRESData *RRES;
// Head-Mounted-Display device parameters
typedef struct VrDeviceInfo {
int hResolution; // HMD horizontal resolution in pixels
int vResolution; // HMD vertical resolution in pixels
float hScreenSize; // HMD horizontal size in meters
float vScreenSize; // HMD vertical size in meters
float vScreenCenter; // HMD screen center in meters
float eyeToScreenDistance; // HMD distance between eye and display in meters
float lensSeparationDistance; // HMD lens separation distance in meters
float interpupillaryDistance; // HMD IPD (distance between pupils) in meters
float lensDistortionValues[4]; // HMD lens distortion constant parameters
float chromaAbCorrection[4]; // HMD chromatic aberration correction parameters
} VrDeviceInfo;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Enumerators Definition // Enumerators Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@ -540,6 +549,56 @@ typedef enum {
LOG_OTHER LOG_OTHER
} LogType; } LogType;
// Shader location point type
typedef enum {
LOC_VERTEX_POSITION = 0,
LOC_VERTEX_TEXCOORD01,
LOC_VERTEX_TEXCOORD02,
LOC_VERTEX_NORMAL,
LOC_VERTEX_TANGENT,
LOC_VERTEX_COLOR,
LOC_MATRIX_MVP,
LOC_MATRIX_MODEL,
LOC_MATRIX_VIEW,
LOC_MATRIX_PROJECTION,
LOC_VECTOR_VIEW,
LOC_COLOR_DIFFUSE,
LOC_COLOR_SPECULAR,
LOC_COLOR_AMBIENT,
LOC_MAP_ALBEDO, // LOC_MAP_DIFFUSE
LOC_MAP_METALNESS, // LOC_MAP_SPECULAR
LOC_MAP_NORMAL,
LOC_MAP_ROUGHNESS,
LOC_MAP_OCCUSION,
LOC_MAP_EMISSION,
LOC_MAP_HEIGHT,
LOC_MAP_CUBEMAP,
LOC_MAP_IRRADIANCE,
LOC_MAP_PREFILTER,
LOC_MAP_BRDF
} ShaderLocationIndex;
#define LOC_MAP_DIFFUSE LOC_MAP_ALBEDO
#define LOC_MAP_SPECULAR LOC_MAP_METALNESS
// Material map type
typedef enum {
MAP_ALBEDO = 0, // MAP_DIFFUSE
MAP_METALNESS = 1, // MAP_SPECULAR
MAP_NORMAL = 2,
MAP_ROUGHNESS = 3,
MAP_OCCLUSION,
MAP_EMISSION,
MAP_HEIGHT,
MAP_CUBEMAP, // NOTE: Uses GL_TEXTURE_CUBE_MAP
MAP_IRRADIANCE, // NOTE: Uses GL_TEXTURE_CUBE_MAP
MAP_PREFILTER, // NOTE: Uses GL_TEXTURE_CUBE_MAP
MAP_BRDF
} TexmapIndex;
#define MAP_DIFFUSE MAP_ALBEDO
#define MAP_SPECULAR MAP_METALNESS
// Texture formats // Texture formats
// NOTE: Support depends on OpenGL version and platform // NOTE: Support depends on OpenGL version and platform
typedef enum { typedef enum {
@ -620,13 +679,10 @@ typedef enum {
HMD_DEFAULT_DEVICE = 0, HMD_DEFAULT_DEVICE = 0,
HMD_OCULUS_RIFT_DK2, HMD_OCULUS_RIFT_DK2,
HMD_OCULUS_RIFT_CV1, HMD_OCULUS_RIFT_CV1,
HMD_OCULUS_GO,
HMD_VALVE_HTC_VIVE, HMD_VALVE_HTC_VIVE,
HMD_SAMSUNG_GEAR_VR, HMD_SONY_PSVR
HMD_GOOGLE_CARDBOARD, } VrDeviceType;
HMD_SONY_PLAYSTATION_VR,
HMD_RAZER_OSVR,
HMD_FOVE_VR,
} VrDevice;
// RRESData type // RRESData type
typedef enum { typedef enum {
@ -664,6 +720,7 @@ RLAPI bool WindowShouldClose(void); // Check if KE
RLAPI bool IsWindowMinimized(void); // Check if window has been minimized (or lost focus) RLAPI bool IsWindowMinimized(void); // Check if window has been minimized (or lost focus)
RLAPI void ToggleFullscreen(void); // Toggle fullscreen mode (only PLATFORM_DESKTOP) RLAPI void ToggleFullscreen(void); // Toggle fullscreen mode (only PLATFORM_DESKTOP)
RLAPI void SetWindowIcon(Image image); // Set icon for window (only PLATFORM_DESKTOP) RLAPI void SetWindowIcon(Image image); // Set icon for window (only PLATFORM_DESKTOP)
RLAPI void SetWindowTitle(const char *title); // Set title for window (only PLATFORM_DESKTOP)
RLAPI void SetWindowPosition(int x, int y); // Set window position on screen (only PLATFORM_DESKTOP) RLAPI void SetWindowPosition(int x, int y); // Set window position on screen (only PLATFORM_DESKTOP)
RLAPI void SetWindowMonitor(int monitor); // Set monitor for the current window (fullscreen mode) RLAPI void SetWindowMonitor(int monitor); // Set monitor for the current window (fullscreen mode)
RLAPI void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) RLAPI void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
@ -705,8 +762,13 @@ RLAPI int GetHexValue(Color color); // Returns hex
RLAPI Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value RLAPI Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value
RLAPI Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f RLAPI Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
RLAPI float *ColorToFloat(Color color); // Converts Color to float array and normalizes RLAPI float *ColorToFloat(Color color); // Converts Color to float array and normalizes
RLAPI float *VectorToFloat(Vector3 vec); // Converts Vector3 to float array
RLAPI float *MatrixToFloat(Matrix mat); // Converts Matrix to float array // Math useful functions (available from raymath.h)
RLAPI float *VectorToFloat(Vector3 vec); // Returns Vector3 as float array
RLAPI float *MatrixToFloat(Matrix mat); // Returns Matrix as float array
RLAPI Vector3 Vector3Zero(void); // Vector with components value 0.0f
RLAPI Vector3 Vector3One(void); // Vector with components value 1.0f
RLAPI Matrix MatrixIdentity(void); // Returns identity matrix
// Misc. functions // Misc. functions
RLAPI void ShowLogo(void); // Activate raylib logo at startup (can be done with flags) RLAPI void ShowLogo(void); // Activate raylib logo at startup (can be done with flags)
@ -717,6 +779,7 @@ RLAPI int GetRandomValue(int min, int max); // Returns a r
// Files management functions // Files management functions
RLAPI bool IsFileExtension(const char *fileName, const char *ext);// Check file extension RLAPI bool IsFileExtension(const char *fileName, const char *ext);// Check file extension
RLAPI const char *GetExtension(const char *fileName); // Get file extension
RLAPI const char *GetDirectoryPath(const char *fileName); // Get directory for a given fileName (with path) RLAPI const char *GetDirectoryPath(const char *fileName); // Get directory for a given fileName (with path)
RLAPI const char *GetWorkingDirectory(void); // Get current working directory RLAPI const char *GetWorkingDirectory(void); // Get current working directory
RLAPI bool ChangeDirectory(const char *dir); // Change working directory, returns true if success RLAPI bool ChangeDirectory(const char *dir); // Change working directory, returns true if success
@ -812,9 +875,12 @@ RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color);
RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle
RLAPI void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle RLAPI void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle
RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters
RLAPI void DrawRectangleGradient(int posX, int posY, int width, int height, Color color1, Color color2); // Draw a gradient-filled rectangle RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2);// Draw a vertical-gradient-filled rectangle
RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2);// Draw a horizontal-gradient-filled rectangle
RLAPI void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw a gradient-filled rectangle with custom vertex colors
RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version) RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version)
RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
RLAPI void DrawRectangleT(int posX, int posY, int width, int height, Color color); // Draw rectangle using text character
RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle
RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline
RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version) RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version)
@ -876,7 +942,7 @@ RLAPI void ImageColorBrightness(Image *image, int brightness);
// Image generation functions // Image generation functions
RLAPI Image GenImageGradientV(int width, int height, Color top, Color bottom); // Generate image: vertical gradient RLAPI Image GenImageGradientV(int width, int height, Color top, Color bottom); // Generate image: vertical gradient
RLAPI Image GenImageGradientH(int width, int height, Color left, Color right); // Generate image: horizontal gradient RLAPI Image GenImageGradientH(int width, int height, Color left, Color right); // Generate image: horizontal gradient
RLAPI Image GenImageRadialGradient(int width, int height, float density, Color inner, Color outer); // Generate image: radial gradient RLAPI Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer); // Generate image: radial gradient
RLAPI Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); // Generate image: checked RLAPI Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); // Generate image: checked
RLAPI Image GenImageWhiteNoise(int width, int height, float factor); // Generate image: white noise RLAPI Image GenImageWhiteNoise(int width, int height, float factor); // Generate image: white noise
RLAPI Image GenImagePerlinNoise(int width, int height, float scale); // Generate image: perlin noise RLAPI Image GenImagePerlinNoise(int width, int height, float scale); // Generate image: perlin noise
@ -944,18 +1010,28 @@ RLAPI void DrawGizmo(Vector3 position);
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Model loading/unloading functions // Model loading/unloading functions
RLAPI Mesh LoadMesh(const char *fileName); // Load mesh from file RLAPI Model LoadModel(const char *fileName); // Load model from files (mesh and material)
RLAPI Mesh LoadMeshEx(int numVertex, float *vData, float *vtData, float *vnData, Color *cData); // Load mesh from vertex data RLAPI Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh
RLAPI Model LoadModel(const char *fileName); // Load model from file
RLAPI Model LoadModelFromMesh(Mesh data, bool dynamic); // Load model from mesh data
RLAPI Model LoadHeightmap(Image heightmap, Vector3 size); // Load heightmap model from image data
RLAPI Model LoadCubicmap(Image cubicmap); // Load cubes-based map model from image data
RLAPI void UnloadMesh(Mesh *mesh); // Unload mesh from memory (RAM and/or VRAM)
RLAPI void UnloadModel(Model model); // Unload model from memory (RAM and/or VRAM) RLAPI void UnloadModel(Model model); // Unload model from memory (RAM and/or VRAM)
// Mesh loading/unloading functions
RLAPI Mesh LoadMesh(const char *fileName); // Load mesh from file
RLAPI void UnloadMesh(Mesh *mesh); // Unload mesh from memory (RAM and/or VRAM)
// Mesh generation functions
RLAPI Mesh GenMeshPlane(float width, float length, int resX, int resZ); // Generate plane mesh (with subdivisions)
RLAPI Mesh GenMeshCube(float width, float height, float length); // Generate cuboid mesh
RLAPI Mesh GenMeshSphere(float radius, int rings, int slices); // Generate sphere mesh (standard sphere)
RLAPI Mesh GenMeshHemiSphere(float radius, int rings, int slices); // Generate half-sphere mesh (no bottom cap)
RLAPI Mesh GenMeshCylinder(float radius, float height, int slices); // Generate cylinder mesh
RLAPI Mesh GenMeshTorus(float radius, float size, int radSeg, int sides); // Generate torus mesh
RLAPI Mesh GenMeshKnot(float radius, float size, int radSeg, int sides); // Generate trefoil knot mesh
RLAPI Mesh GenMeshHeightmap(Image heightmap, Vector3 size); // Generate heightmap mesh from image data
RLAPI Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize); // Generate cubes-based map mesh from image data
// Material loading/unloading functions // Material loading/unloading functions
RLAPI Material LoadMaterial(const char *fileName); // Load material from file RLAPI Material LoadMaterial(const char *fileName); // Load material from file
RLAPI Material LoadDefaultMaterial(void); // Load default material (uses default models shader) RLAPI Material LoadMaterialDefault(void); // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
RLAPI void UnloadMaterial(Material material); // Unload material from GPU memory (VRAM) RLAPI void UnloadMaterial(Material material); // Unload material from GPU memory (VRAM)
// Model drawing functions // Model drawing functions
@ -993,8 +1069,8 @@ RLAPI char *LoadText(const char *fileName); // Loa
RLAPI Shader LoadShader(char *vsFileName, char *fsFileName); // Load shader from files and bind default locations RLAPI Shader LoadShader(char *vsFileName, char *fsFileName); // Load shader from files and bind default locations
RLAPI void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM) RLAPI void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM)
RLAPI Shader GetDefaultShader(void); // Get default shader RLAPI Shader GetShaderDefault(void); // Get default shader
RLAPI Texture2D GetDefaultTexture(void); // Get default texture RLAPI Texture2D GetTextureDefault(void); // Get default texture
// Shader configuration functions // Shader configuration functions
RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
@ -1004,6 +1080,13 @@ RLAPI void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat);
RLAPI void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix) RLAPI void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix)
RLAPI void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix) RLAPI void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix)
// Texture maps generation (PBR)
// NOTE: Required shaders should be provided
RLAPI Texture2D GenTextureCubemap(Shader shader, Texture2D skyHDR, int size); // Generate cubemap texture from HDR texture
RLAPI Texture2D GenTextureIrradiance(Shader shader, Texture2D cubemap, int size); // Generate irradiance texture using cubemap data
RLAPI Texture2D GenTexturePrefilter(Shader shader, Texture2D cubemap, int size); // Generate prefilter texture using cubemap data
RLAPI Texture2D GenTextureBRDF(Shader shader, Texture2D cubemap, int size); // Generate BRDF texture using cubemap data
// Shading begin/end functions // Shading begin/end functions
RLAPI void BeginShaderMode(Shader shader); // Begin custom shader drawing RLAPI void BeginShaderMode(Shader shader); // Begin custom shader drawing
RLAPI void EndShaderMode(void); // End custom shader drawing (use default shader) RLAPI void EndShaderMode(void); // End custom shader drawing (use default shader)
@ -1011,7 +1094,8 @@ RLAPI void BeginBlendMode(int mode); // Beg
RLAPI void EndBlendMode(void); // End blending mode (reset to default: alpha blending) RLAPI void EndBlendMode(void); // End blending mode (reset to default: alpha blending)
// VR control functions // VR control functions
RLAPI void InitVrSimulator(int vrDevice); // Init VR simulator for selected device VrDeviceInfo GetVrDeviceInfo(int vrDeviceType); // Get VR device information for some standard devices
void InitVrSimulator(VrDeviceInfo info); // Init VR simulator for selected device parameters
RLAPI void CloseVrSimulator(void); // Close VR simulator for current device RLAPI void CloseVrSimulator(void); // Close VR simulator for current device
RLAPI bool IsVrSimulatorReady(void); // Detect if VR simulator is ready RLAPI bool IsVrSimulatorReady(void); // Detect if VR simulator is ready
RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -40,41 +40,33 @@
.PHONY: all clean install uninstall .PHONY: all clean install uninstall
# define raylib platform to compile for # Define required raylib variables
# possible platforms: PLATFORM_DESKTOP PLATFORM_ANDROID PLATFORM_RPI PLATFORM_WEB
PLATFORM ?= PLATFORM_DESKTOP PLATFORM ?= PLATFORM_DESKTOP
RAYLIB_PATH ?= ..
# define raylib default path, required to look for emsdk and android-toolchain # Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_PATH ?= C:/raylib # NOTE: OpenAL Soft library should be provided in the selected form
RAYLIB_LIBTYPE ?= STATIC
OPENAL_LIBTYPE ?= STATIC
# define YES if you want shared/dynamic version of library instead of static (default) # On PLATFORM_WEB force OpenAL Soft shared library
SHARED_RAYLIB ?= NO
# use OpenAL Soft as shared library (.so / .dll)
# NOTE: If defined NO, static OpenAL Soft library should be provided
SHARED_OPENAL ?= NO
# on PLATFORM_WEB force OpenAL Soft shared library
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
SHARED_OPENAL = YES OPENAL_LIBTYPE = SHARED
endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
SHARED_OPENAL = YES
endif endif
# determine if the file has root access (only for installing raylib) # Determine if the file has root access (only for installing raylib)
# "whoami" prints the name of the user that calls him (so, if it is the root # "whoami" prints the name of the user that calls him (so, if it is the root
# user, "whoami" prints "root"). # user, "whoami" prints "root").
ROOT = $(shell whoami) ROOT = $(shell whoami)
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected # Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! # No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows # ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
PLATFORM_OS=WINDOWS PLATFORM_OS=WINDOWS
else else
UNAMEOS:=$(shell uname) UNAMEOS=$(shell uname)
ifeq ($(UNAMEOS),Linux) ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX PLATFORM_OS=LINUX
else else
@ -85,9 +77,14 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI)
# RPI cross-compiler
RPI_CROSS_COMPILE ?= NO
endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables # Emscripten required variables
EMSDK_PATH = $(RAYLIB_PATH)/emsdk EMSDK_PATH = C:/emsdk
EMSCRIPTEN_VERSION = 1.37.9 EMSCRIPTEN_VERSION = 1.37.9
CLANG_VERSION=e1.37.9_64bit CLANG_VERSION=e1.37.9_64bit
PYTHON_VERSION=2.7.5.3_64bit PYTHON_VERSION=2.7.5.3_64bit
@ -96,6 +93,33 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION) EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
endif endif
# Define output directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/win32/mingw32
endif
ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/linux
endif
ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/osx
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/rpi
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/html5
endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(ANDROID_ARCH),ARM)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/android/armeabi-v7a
endif
ifeq ($(ANDROID_ARCH),ARM64)
RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/android/arm64-v8a
endif
endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
# Android required path variables # Android required path variables
ANDROID_NDK = C:/android-ndk ANDROID_NDK = C:/android-ndk
@ -103,86 +127,66 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID)
# Android architecture: ARM or ARM64 # Android architecture: ARM or ARM64
ANDROID_ARCH ?= ARM ANDROID_ARCH ?= ARM
# Android compiler: gcc or clang
# NOTE: Define YES to use clang instead of gcc
ANDROID_LLVM ?= NO
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) # Define raylib graphics api depending on selected platform
# RPI cross-compiler
CROSS_COMPILE ?= NO
endif
# define raylib graphics api depending on selected platform
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# by default use OpenGL 3.3 on desktop platforms # By default use OpenGL 3.3 on desktop platforms
GRAPHICS ?= GRAPHICS_API_OPENGL_33 GRAPHICS ?= GRAPHICS_API_OPENGL_33
#GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1 #GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
#GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1 #GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# on RPI OpenGL ES 2.0 must be used # On RPI OpenGL ES 2.0 must be used
GRAPHICS = GRAPHICS_API_OPENGL_ES2 GRAPHICS = GRAPHICS_API_OPENGL_ES2
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# on HTML5 OpenGL ES 2.0 is used, emscripten translates it to WebGL 1.0 # On HTML5 OpenGL ES 2.0 is used, emscripten translates it to WebGL 1.0
GRAPHICS = GRAPHICS_API_OPENGL_ES2 GRAPHICS = GRAPHICS_API_OPENGL_ES2
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
# by default use OpenGL ES 2.0 on Android # By default use OpenGL ES 2.0 on Android
GRAPHICS = GRAPHICS_API_OPENGL_ES2 GRAPHICS = GRAPHICS_API_OPENGL_ES2
endif endif
# NOTE: makefiles targets require tab indentation # Default C compiler: gcc
# NOTE: define compiler: gcc for C program, define as g++ for C++ # NOTE: define g++ compiler if using C++
# default gcc compiler
CC = gcc CC = gcc
# For OS X
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
CC = clang # OSX default compiler
endif CC = clang
endif
# Android toolchain compiler
ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(ANDROID_ARCH),ARM)
ifeq ($(ANDROID_LLVM),YES)
CC = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-clang
else
CC = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-gcc
endif
endif
ifeq ($(ANDROID_ARCH),ARM64)
ifeq ($(ANDROID_LLVM),YES)
CC = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-clang
else
CC = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-gcc
endif
endif endif
endif endif
# RPI cross-compiler
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
ifeq ($(CROSS_COMPILE),YES) ifeq ($(RPI_CROSS_COMPILE),YES)
# rpi compiler # RPI cross-compiler
CC = armv6j-hardfloat-linux-gnueabi-gcc CC = armv6j-hardfloat-linux-gnueabi-gcc
endif endif
endif endif
# HTML5 emscripten compiler
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# HTML5 emscripten compiler
CC = emcc CC = emcc
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
# Android toolchain (must be provided for desired architecture and compiler)
# NOTE: gcc compiler is being deprecated in Android NDK r16
ifeq ($(ANDROID_ARCH),ARM)
CC = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-gcc
endif
ifeq ($(ANDROID_ARCH),ARM64)
CC = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-gcc
endif
endif
# default archiver program to pack libraries # Default archiver program to pack libraries
AR = ar AR = ar
# Android archiver # Android archiver (also depends on desired architecture)
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(ANDROID_ARCH),ARM) ifeq ($(ANDROID_ARCH),ARM)
AR = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-ar AR = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-ar
@ -192,9 +196,10 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID)
endif endif
endif endif
# define compiler flags: # Define compiler flags:
# -O1 defines optimization level # -O1 defines optimization level
# -Og enable debugging # -Og enable debugging
# -s strip unnecessary data from build
# -Wall turns on most, but not all, compiler warnings # -Wall turns on most, but not all, compiler warnings
# -std=c99 defines C language mode (standard C from 1999 revision) # -std=c99 defines C language mode (standard C from 1999 revision)
# -std=gnu99 defines C language mode (GNU C from 1999 revision) # -std=gnu99 defines C language mode (GNU C from 1999 revision)
@ -203,109 +208,83 @@ endif
# -D_DEFAULT_SOURCE use with -std=c99 # -D_DEFAULT_SOURCE use with -std=c99
CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces
# Additional flags for compiler (if desired)
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 --profiling --preload-file resources
# -O2 # if used, also set --memory-init-file 0 # -O2 # if used, also set --memory-init-file 0
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# -s USE_PTHREADS=1 # multithreading support # -s USE_PTHREADS=1 # multithreading support
CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 --profiling
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
# Compiler flags for arquitecture
CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
# Compilation functions attributes options
CFLAGS += -ffunction-sections -funwind-tables -fstack-protector-strong -fPIC
# Compiler options for the linker
CFLAGS += -Wa,--noexecstack -Wformat -Werror=format-security -no-canonical-prefixes
# Preprocessor macro definitions
CFLAGS += -DANDROID -DPLATFORM_ANDROID -D__ANDROID_API__=16
endif endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes # Define required compilation flags for raylib SHARED lib
ifeq ($(RAYLIB_LIBTYPE),SHARED)
# if shared library required, make sure code is compiled as position independent # make sure code is compiled as position independent
ifeq ($(SHARED_RAYLIB),YES) # BE CAREFUL: It seems that for gcc -fpic si not the same as -fPIC
CFLAGS += -fPIC # MinGW32 just doesn't need -fPIC, it shows warnings
SHAREDFLAG = BUILDING_DLL CFLAGS += -fPIC -DBUILD_LIBTYPE_SHARED
else
SHAREDFLAG = BUILDING_STATIC
endif endif
# if static OpenAL Soft required, define the corresponding flags # Define required compilation flags for OpenAL Soft STATIC lib
ifeq ($(SHARED_OPENAL),NO) ifeq ($(OPENAL_LIBTYPE),STATIC)
SHAREDLIBS += -lopenal32 -lwinmm ALFLAGS = -DAL_LIBTYPE_STATIC -Wl,-allow-multiple-definition
SHAREDOPENALFLAG = AL_LIBTYPE_STATIC
else
SHAREDLIBS += -lopenal32dll
SHAREDOPENALFLAG = SHARED_OPENAL
endif endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes # Define include paths for required headers
# NOTE: Several external required libraries (stb and others)
INCLUDE_PATHS = -I. -Iexternal -Iexternal/include
# external required libraries (stb and others) # Define additional directories containing required header files
INCLUDES = -I. -Iexternal
# OpenAL Soft library
INCLUDES += -Iexternal/openal_soft/include
# define any directories containing required header files
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# GLFW3 library
INCLUDES += -Iexternal/glfw3/include
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
# RPI requried libraries # RPI requried libraries
INCLUDES += -I/opt/vc/include INCLUDE_PATHS += -I/opt/vc/include
INCLUDES += -I/opt/vc/include/interface/vmcs_host/linux INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux
INCLUDES += -I/opt/vc/include/interface/vcos/pthreads INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# GLFW3 library
INCLUDES += -Iexternal/glfw3/include
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
# Android required libraries # Android required libraries
INCLUDES += -I$(ANDROID_TOOLCHAIN)/sysroot/usr/include INCLUDE_PATHS += -I$(ANDROID_TOOLCHAIN)/sysroot/usr/include
# Include android_native_app_glue.h # Include android_native_app_glue.h
INCLUDES += -Iexternal/android/native_app_glue INCLUDE_PATHS += -Iexternal/android/native_app_glue
#INCLUDES += -I$(ANDROID_NDK)/sources/android/native_app_glue #INCLUDE_PATHS += -I$(ANDROID_NDK)/sources/android/native_app_glue
endif endif
# define output directory for compiled library # Define linker options
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
OUTPUT_PATH = ../release/win32/mingw32
endif
ifeq ($(PLATFORM_OS),LINUX)
OUTPUT_PATH = ../release/linux
endif
ifeq ($(PLATFORM_OS),OSX)
OUTPUT_PATH = ../release/osx
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
OUTPUT_PATH = ../release/rpi
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
OUTPUT_PATH = ../release/html5
endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(ANDROID_ARCH),ARM) LDFLAGS = -Wl,-soname,libraylib.so -Wl,--exclude-libs,libatomic.a
OUTPUT_PATH = ../release/android/armeabi-v7a LDFLAGS += -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings
endif # Force linking of library module to define symbol
ifeq ($(ANDROID_ARCH),ARM64) LDFLAGS += -u ANativeActivity_onCreate
OUTPUT_PATH = ../release/android/arm64-v8a # Library paths containing required libs
endif LDFLAGS += -L. -Lsrc -L$(RAYLIB_RELEASE_PATH)
LDLIBS = -lopenal -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm
endif endif
# define all object files required with a wildcard # Define all object files required with a wildcard
# The wildcard takes all files that finish with ".c", then it replaces the # The wildcard takes all files that finish with ".c",
# extentions with ".o", that are the object files. # and replaces extentions with ".o", that are the object files
OBJS = $(patsubst %.c, %.o, $(wildcard *.c)) OBJS = $(patsubst %.c, %.o, $(wildcard *.c))
OBJS += external/stb_vorbis.o OBJS += stb_vorbis.o
# typing 'make' will invoke the default target entry called 'all', # Default target entry
# in this case, the 'default' target entry is raylib
all: raylib all: raylib
# generate standalone Android toolchain # Generate standalone Android toolchain
# NOTE: Android toolchain could already be provided # NOTE: Android toolchain could already be provided
toolchain: generate_android_toolchain:
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
ifeq ($(ANDROID_ARCH),ARM) ifeq ($(ANDROID_ARCH),ARM)
$(ANDROID_NDK)/build/tools/make-standalone-toolchain.sh --platform=android-9 --toolchain=arm-linux-androideabi-4.9 --use-llvm --install-dir=$(ANDROID_TOOLCHAIN) $(ANDROID_NDK)/build/tools/make-standalone-toolchain.sh --platform=android-9 --toolchain=arm-linux-androideabi-4.9 --use-llvm --install-dir=$(ANDROID_TOOLCHAIN)
@ -315,39 +294,39 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID)
endif endif
endif endif
# compile raylib library # Compile raylib library
raylib: $(OBJS) raylib: $(OBJS)
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# compile raylib for web. # Compile raylib for web.
emcc -O1 $(OBJS) -o $(OUTPUT_PATH)/libraylib.bc emcc -O1 $(OBJS) -o $(RAYLIB_RELEASE_PATH)/libraylib.bc
@echo "libraylib.bc generated (web version)!" @echo "raylib library generated (libraylib.bc)!"
else else
ifeq ($(SHARED_RAYLIB),YES) ifeq ($(RAYLIB_LIBTYPE),SHARED)
# NOTE: If using OpenAL Soft as static library, all its dependencies must be also linked in the shared library # NOTE: If using OpenAL Soft as static library, all its dependencies must be also linked in the shared library
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
$(CC) -shared -o $(OUTPUT_PATH)/raylib.dll $(OBJS) $(SHAREDLIBS) -Lexternal/glfw3/lib/win32 -Lexternal/openal_soft/lib/win32 -lglfw3 -lgdi32 -Wl,--out-implib,$(OUTPUT_PATH)/libraylibdll.a $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/raylib.dll $(OBJS) $(ALLIBS) -Lexternal/glfw3/lib/win32 -Lexternal/openal_soft/lib/win32 -lglfw3 -lgdi32 -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/libraylibdll.a
@echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!" @echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!"
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# compile raylib to shared library version for GNU/Linux. # Compile raylib to shared library version for GNU/Linux.
# WARNING: you should type "make clean" before doing this target # WARNING: you should type "make clean" before doing this target
$(CC) -shared -o $(OUTPUT_PATH)/libraylib.so $(OBJS) -lglfw -lGL -lopenal -lm -lpthread -ldl $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lglfw -lGL -lopenal -lm -lpthread -ldl
@echo "raylib shared library generated (libraylib.so)!" @echo "raylib shared library generated (libraylib.so)!"
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
$(CC) -dynamiclib -o $(OUTPUT_PATH)/libraylib.dylib $(OBJS) -L/usr/local/Cellar/glfw/3.2.1/lib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa $(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/libraylib.dylib $(OBJS) -L/usr/local/Cellar/glfw/3.2.1/lib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa
install_name_tool -id "libraylib.dylib" $(OUTPUT_PATH)/libraylib.dylib install_name_tool -id "libraylib.dylib" $(RAYLIB_RELEASE_PATH)/libraylib.dylib
@echo "raylib shared library generated (libraylib.dylib)!" @echo "raylib shared library generated (libraylib.dylib)!"
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
$(CC) -shared -o $(OUTPUT_PATH)/libraylib.so $(OBJS) $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) $(LDFLAGS) $(LDLIBS)
@echo "raylib shared library generated (libraylib.so)!" @echo "raylib shared library generated (libraylib.so)!"
endif endif
else else
# compile raylib static library. # Compile raylib static library.
$(AR) rcs $(OUTPUT_PATH)/libraylib.a $(OBJS) $(AR) rcs $(RAYLIB_RELEASE_PATH)/libraylib.a $(OBJS)
@echo "raylib static library generated (libraylib.a)!" @echo "raylib static library generated (libraylib.a)!"
ifeq ($(SHARED_OPENAL),NO) ifeq ($(OPENAL_LIBTYPE),STATIC)
@echo "expected OpenAL Soft static library linking" @echo "expected OpenAL Soft static library linking"
else else
@echo "expected OpenAL Soft shared library linking" @echo "expected OpenAL Soft shared library linking"
@ -355,46 +334,45 @@ else
endif endif
endif endif
# compile all modules with their prerequisites # Compile all modules with their prerequisites
# compile core module # Compile core module
core.o : core.c raylib.h rlgl.h utils.h raymath.h gestures.h core.o : core.c raylib.h rlgl.h utils.h raymath.h gestures.h
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(SHAREDFLAG) $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
# compile rlgl module # Compile rlgl module
rlgl.o : rlgl.c rlgl.h raymath.h rlgl.o : rlgl.c rlgl.h raymath.h
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(GRAPHICS) $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
# compile shapes module # Compile shapes module
shapes.o : shapes.c raylib.h rlgl.h shapes.o : shapes.c raylib.h rlgl.h
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(SHAREDFLAG) $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
# compile textures module # Compile textures module
textures.o : textures.c rlgl.h utils.h textures.o : textures.c rlgl.h utils.h
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS) -D$(SHAREDFLAG) $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
# compile text module # Compile text module
text.o : text.c raylib.h utils.h text.o : text.c raylib.h utils.h
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(SHAREDFLAG) $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
# compile models module # Compile models module
models.o : models.c raylib.h rlgl.h raymath.h models.o : models.c raylib.h rlgl.h raymath.h
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(SHAREDFLAG) $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
# compile audio module # Compile audio module
audio.o : audio.c raylib.h audio.o : audio.c raylib.h
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(SHAREDFLAG) -D$(SHAREDOPENALFLAG) $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) $(ALFLAGS)
# compile stb_vorbis library # Compile stb_vorbis library
external/stb_vorbis.o: external/stb_vorbis.c external/stb_vorbis.h stb_vorbis.o: external/stb_vorbis.c external/stb_vorbis.h
$(CC) -c -o $@ $< -O1 $(CFLAGS) $(INCLUDES) -D$(PLATFORM) $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM)
# compile utils module # Compile utils module
utils.o : utils.c utils.h utils.o : utils.c utils.h
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(SHAREDFLAG) $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM)
# It installs generated and needed files to compile projects using raylib. # Install generated and needed files to required directories
# The installation works manually.
# TODO: add other platforms. # TODO: add other platforms.
install : install :
ifeq ($(ROOT),root) ifeq ($(ROOT),root)
@ -403,11 +381,11 @@ ifeq ($(ROOT),root)
# libraries and header files. These directory (/usr/local/lib and # libraries and header files. These directory (/usr/local/lib and
# /usr/local/include/) are for libraries that are installed # /usr/local/include/) are for libraries that are installed
# manually (without a package manager). # manually (without a package manager).
ifeq ($(SHARED_RAYLIB),YES) ifeq ($(RAYLIB_LIBTYPE),SHARED)
cp --update $(OUTPUT_PATH)/libraylib.so /usr/local/lib/libraylib.so cp --update $(RAYLIB_RELEASE_PATH)/libraylib.so /usr/local/lib/libraylib.so
else else
cp --update raylib.h /usr/local/include/raylib.h cp --update raylib.h /usr/local/include/raylib.h
cp --update $(OUTPUT_PATH)/libraylib.a /usr/local/lib/libraylib.a cp --update $(RAYLIB_RELEASE_PATH)/libraylib.a /usr/local/lib/libraylib.a
endif endif
@echo "raylib dev files installed/updated!" @echo "raylib dev files installed/updated!"
else else
@ -417,31 +395,31 @@ else
@echo "Error: no root permissions" @echo "Error: no root permissions"
endif endif
# it removes raylib dev files installed on the system. # Remove raylib dev files installed on the system
# TODO: see 'install' target. # TODO: see 'install' target.
uninstall : uninstall :
ifeq ($(ROOT),root) ifeq ($(ROOT),root)
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
rm --force /usr/local/include/raylib.h rm --force /usr/local/include/raylib.h
ifeq ($(SHARED_RAYLIB),YES) ifeq ($(RAYLIB_LIBTYPE),SHARED)
rm --force /usr/local/lib/libraylib.so rm --force /usr/local/lib/libraylib.so
else else
rm --force /usr/local/lib/libraylib.a rm --force /usr/local/lib/libraylib.a
endif endif
@echo "raylib dev files removed!" @echo "raylib development files removed!"
else else
@echo "This function works only on GNU/Linux systems" @echo "This function works only on GNU/Linux systems"
endif endif
else else
@echo "Error: no root permissions" @echo "Error: no root permissions"
endif endif
# clean everything # Clean everything
clean: clean:
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
del *.o $(OUTPUT_PATH)/libraylib.a $(OUTPUT_PATH)/libraylib.bc $(OUTPUT_PATH)/libraylib.so external/stb_vorbis.o del *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so external/stb_vorbis.o
else else
rm -f *.o $(OUTPUT_PATH)/libraylib.a $(OUTPUT_PATH)/libraylib.bc $(OUTPUT_PATH)/libraylib.so external/stb_vorbis.o rm -f *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so external/stb_vorbis.o
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
rm -rf $(ANDROID_TOOLCHAIN) rm -rf $(ANDROID_TOOLCHAIN)

View File

@ -105,8 +105,8 @@
#endif #endif
#if defined(SUPPORT_GIF_RECORDING) #if defined(SUPPORT_GIF_RECORDING)
#define GIF_IMPLEMENTATION #define RGIF_IMPLEMENTATION
#include "external/gif.h" // Support GIF recording #include "external/rgif.h" // Support GIF recording
#endif #endif
#if defined(__linux__) || defined(PLATFORM_WEB) #if defined(__linux__) || defined(PLATFORM_WEB)
@ -314,9 +314,7 @@ static Vector2 mousePosition; // Mouse position on screen
static bool toggleCursorLock = false; // Ask for cursor pointer lock on next click static bool toggleCursorLock = false; // Ask for cursor pointer lock on next click
#endif #endif
#if defined(SUPPORT_GESTURES_SYSTEM)
static Vector2 touchPosition[MAX_TOUCH_POINTS]; // Touch position on screen static Vector2 touchPosition[MAX_TOUCH_POINTS]; // Touch position on screen
#endif
#if defined(PLATFORM_DESKTOP) #if defined(PLATFORM_DESKTOP)
static char **dropFilesPath; // Store dropped files paths as strings static char **dropFilesPath; // Store dropped files paths as strings
@ -477,8 +475,6 @@ void InitWindow(int width, int height, void *state)
{ {
TraceLog(LOG_INFO, "Initializing raylib (v1.8.0)"); TraceLog(LOG_INFO, "Initializing raylib (v1.8.0)");
app_dummy();
screenWidth = width; screenWidth = width;
screenHeight = height; screenHeight = height;
@ -1495,6 +1491,7 @@ bool IsMouseButtonPressed(int button)
{ {
bool pressed = false; bool pressed = false;
// TODO: Review, gestures could be not supported despite being on Android platform!
#if defined(PLATFORM_ANDROID) #if defined(PLATFORM_ANDROID)
if (IsGestureDetected(GESTURE_TAP)) pressed = true; if (IsGestureDetected(GESTURE_TAP)) pressed = true;
#else #else
@ -2748,6 +2745,7 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
int32_t action = AMotionEvent_getAction(event); int32_t action = AMotionEvent_getAction(event);
unsigned int flags = action & AMOTION_EVENT_ACTION_MASK; unsigned int flags = action & AMOTION_EVENT_ACTION_MASK;
#if defined(SUPPORT_GESTURES_SYSTEM)
GestureEvent gestureEvent; GestureEvent gestureEvent;
// Register touch actions // Register touch actions
@ -2776,8 +2774,13 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
// Gesture data is sent to gestures system for processing // Gesture data is sent to gestures system for processing
ProcessGestureEvent(gestureEvent); ProcessGestureEvent(gestureEvent);
#else
// TODO: Support only simple touch position
#endif
return 0; // return 1; return 0;
} }
#endif #endif

View File

@ -1,10 +0,0 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE:= android_native_app_glue
LOCAL_SRC_FILES:= android_native_app_glue.c
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_EXPORT_LDLIBS := -llog
include $(BUILD_STATIC_LIBRARY)

View File

@ -420,8 +420,9 @@ static void onInputQueueDestroyed(ANativeActivity* activity, AInputQueue* queue)
android_app_set_input((struct android_app*)activity->instance, NULL); android_app_set_input((struct android_app*)activity->instance, NULL);
} }
void ANativeActivity_onCreate(ANativeActivity* activity, JNIEXPORT
void* savedState, size_t savedStateSize) { void ANativeActivity_onCreate(ANativeActivity* activity, void* savedState,
size_t savedStateSize) {
LOGV("Creating: %p\n", activity); LOGV("Creating: %p\n", activity);
activity->callbacks->onDestroy = onDestroy; activity->callbacks->onDestroy = onDestroy;
activity->callbacks->onStart = onStart; activity->callbacks->onStart = onStart;

View File

@ -332,9 +332,14 @@ void android_app_pre_exec_cmd(struct android_app* android_app, int8_t cmd);
void android_app_post_exec_cmd(struct android_app* android_app, int8_t cmd); void android_app_post_exec_cmd(struct android_app* android_app, int8_t cmd);
/** /**
* Dummy function you can call to ensure glue code isn't stripped. * Dummy function that used to be used to prevent the linker from stripping app
* glue code. No longer necessary, since __attribute__((visibility("default")))
* does this for us.
*/ */
void app_dummy(); __attribute__((
deprecated("Calls to app_dummy are no longer necessary. See "
"https://github.com/android-ndk/ndk/issues/381."))) void
app_dummy();
/** /**
* This is the function that application code must implement, representing * This is the function that application code must implement, representing

View File

@ -448,6 +448,17 @@ AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index);
#endif #endif
#endif #endif
#ifndef AL_SOFT_source_spatialize
#define AL_SOFT_source_spatialize
#define AL_SOURCE_SPATIALIZE_SOFT 0x1214
#define AL_AUTO_SOFT 0x0002
#endif
#ifndef ALC_SOFT_output_limiter
#define ALC_SOFT_output_limiter
#define ALC_OUTPUT_LIMITER_SOFT 0x199A
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

4235
src/external/include/GLFW/glfw3.h vendored Normal file

File diff suppressed because it is too large Load Diff

456
src/external/include/GLFW/glfw3native.h vendored Normal file
View File

@ -0,0 +1,456 @@
/*************************************************************************
* GLFW 3.2 - www.glfw.org
* A library for OpenGL, window and input
*------------------------------------------------------------------------
* Copyright (c) 2002-2006 Marcus Geelnard
* Copyright (c) 2006-2016 Camilla Berglund <elmindreda@glfw.org>
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
*************************************************************************/
#ifndef _glfw3_native_h_
#define _glfw3_native_h_
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************************
* Doxygen documentation
*************************************************************************/
/*! @file glfw3native.h
* @brief The header of the native access functions.
*
* This is the header file of the native access functions. See @ref native for
* more information.
*/
/*! @defgroup native Native access
*
* **By using the native access functions you assert that you know what you're
* doing and how to fix problems caused by using them. If you don't, you
* shouldn't be using them.**
*
* Before the inclusion of @ref glfw3native.h, you may define exactly one
* window system API macro and zero or more context creation API macros.
*
* The chosen backends must match those the library was compiled for. Failure
* to do this will cause a link-time error.
*
* The available window API macros are:
* * `GLFW_EXPOSE_NATIVE_WIN32`
* * `GLFW_EXPOSE_NATIVE_COCOA`
* * `GLFW_EXPOSE_NATIVE_X11`
* * `GLFW_EXPOSE_NATIVE_WAYLAND`
* * `GLFW_EXPOSE_NATIVE_MIR`
*
* The available context API macros are:
* * `GLFW_EXPOSE_NATIVE_WGL`
* * `GLFW_EXPOSE_NATIVE_NSGL`
* * `GLFW_EXPOSE_NATIVE_GLX`
* * `GLFW_EXPOSE_NATIVE_EGL`
*
* These macros select which of the native access functions that are declared
* and which platform-specific headers to include. It is then up your (by
* definition platform-specific) code to handle which of these should be
* defined.
*/
/*************************************************************************
* System headers and types
*************************************************************************/
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
// example to allow applications to correctly declare a GL_ARB_debug_output
// callback) but windows.h assumes no one will define APIENTRY before it does
#undef APIENTRY
#include <windows.h>
#elif defined(GLFW_EXPOSE_NATIVE_COCOA)
#include <ApplicationServices/ApplicationServices.h>
#if defined(__OBJC__)
#import <Cocoa/Cocoa.h>
#else
typedef void* id;
#endif
#elif defined(GLFW_EXPOSE_NATIVE_X11)
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
#include <wayland-client.h>
#elif defined(GLFW_EXPOSE_NATIVE_MIR)
#include <mir_toolkit/mir_client_library.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_WGL)
/* WGL is declared by windows.h */
#endif
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
/* NSGL is declared by Cocoa.h */
#endif
#if defined(GLFW_EXPOSE_NATIVE_GLX)
#include <GL/glx.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_EGL)
#include <EGL/egl.h>
#endif
/*************************************************************************
* Functions
*************************************************************************/
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
/*! @brief Returns the adapter device name of the specified monitor.
*
* @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`)
* of the specified monitor, or `NULL` if an [error](@ref error_handling)
* occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
/*! @brief Returns the display device name of the specified monitor.
*
* @return The UTF-8 encoded display device name (for example
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
/*! @brief Returns the `HWND` of the specified window.
*
* @return The `HWND` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_WGL)
/*! @brief Returns the `HGLRC` of the specified window.
*
* @return The `HGLRC` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_COCOA)
/*! @brief Returns the `CGDirectDisplayID` of the specified monitor.
*
* @return The `CGDirectDisplayID` of the specified monitor, or
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
/*! @brief Returns the `NSWindow` of the specified window.
*
* @return The `NSWindow` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
/*! @brief Returns the `NSOpenGLContext` of the specified window.
*
* @return The `NSOpenGLContext` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_X11)
/*! @brief Returns the `Display` used by GLFW.
*
* @return The `Display` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI Display* glfwGetX11Display(void);
/*! @brief Returns the `RRCrtc` of the specified monitor.
*
* @return The `RRCrtc` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
/*! @brief Returns the `RROutput` of the specified monitor.
*
* @return The `RROutput` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
/*! @brief Returns the `Window` of the specified window.
*
* @return The `Window` of the specified window, or `None` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_GLX)
/*! @brief Returns the `GLXContext` of the specified window.
*
* @return The `GLXContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
/*! @brief Returns the `GLXWindow` of the specified window.
*
* @return The `GLXWindow` of the specified window, or `None` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
/*! @brief Returns the `struct wl_display*` used by GLFW.
*
* @return The `struct wl_display*` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
/*! @brief Returns the `struct wl_output*` of the specified monitor.
*
* @return The `struct wl_output*` of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
/*! @brief Returns the main `struct wl_surface*` of the specified window.
*
* @return The main `struct wl_surface*` of the specified window, or `NULL` if
* an [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_MIR)
/*! @brief Returns the `MirConnection*` used by GLFW.
*
* @return The `MirConnection*` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI MirConnection* glfwGetMirDisplay(void);
/*! @brief Returns the Mir output ID of the specified monitor.
*
* @return The Mir output ID of the specified monitor, or zero if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI int glfwGetMirMonitor(GLFWmonitor* monitor);
/*! @brief Returns the `MirSurface*` of the specified window.
*
* @return The `MirSurface*` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI MirSurface* glfwGetMirWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_EGL)
/*! @brief Returns the `EGLDisplay` used by GLFW.
*
* @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
/*! @brief Returns the `EGLContext` of the specified window.
*
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
/*! @brief Returns the `EGLSurface` of the specified window.
*
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _glfw3_native_h_ */

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
/********************************************************************************************** /**********************************************************************************************
* *
* gif.h by Charlie Tangora [ctangora -at- gmail -dot- com] * rgif.h original implementation by Charlie Tangora [ctangora -at- gmail -dot- com]
* adapted to C99 and reformatted by Ramon Santamaria (@raysan5) * adapted to C99, reformatted and renamed by Ramon Santamaria (@raysan5)
* *
* This file offers a simple, very limited way to create animated GIFs directly in code. * This file offers a simple, very limited way to create animated GIFs directly in code.
* *
@ -17,7 +17,7 @@
* *
* CONFIGURATION: * CONFIGURATION:
* *
* #define GIF_IMPLEMENTATION * #define RGIF_IMPLEMENTATION
* Generates the implementation of the library into the included file. * Generates the implementation of the library into the included file.
* If not defined, the library is in header only mode and can be included in other headers * If not defined, the library is in header only mode and can be included in other headers
* or source files without problems. But only ONE file should hold the implementation. * or source files without problems. But only ONE file should hold the implementation.
@ -56,14 +56,14 @@
#include <stdio.h> // Required for: FILE #include <stdio.h> // Required for: FILE
//#define GIF_STATIC //#define RGIF_STATIC
#ifdef GIF_STATIC #ifdef RGIF_STATIC
#define GIFDEF static // Functions just visible to module including this file #define RGIFDEF static // Functions just visible to module including this file
#else #else
#ifdef __cplusplus #ifdef __cplusplus
#define GIFDEF extern "C" // Functions visible from other files (no name mangling of functions in C++) #define RGIFDEF extern "C" // Functions visible from other files (no name mangling of functions in C++)
#else #else
#define GIFDEF extern // Functions visible from other files #define RGIFDEF extern // Functions visible from other files
#endif #endif
#endif #endif
@ -72,9 +72,9 @@
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// NOTE: By default use bitDepth = 8, dither = false // NOTE: By default use bitDepth = 8, dither = false
GIFDEF bool GifBegin(const char *filename, unsigned int width, unsigned int height, unsigned int delay, unsigned int bitDepth, bool dither); RGIFDEF bool GifBegin(const char *filename, unsigned int width, unsigned int height, unsigned int delay, unsigned int bitDepth, bool dither);
GIFDEF bool GifWriteFrame(const unsigned char *image, unsigned int width, unsigned int height, unsigned int delay, int bitDepth, bool dither); RGIFDEF bool GifWriteFrame(const unsigned char *image, unsigned int width, unsigned int height, unsigned int delay, int bitDepth, bool dither);
GIFDEF bool GifEnd(); RGIFDEF bool GifEnd();
#endif // GIF_H #endif // GIF_H
@ -85,7 +85,7 @@ GIFDEF bool GifEnd();
* *
************************************************************************************/ ************************************************************************************/
#if defined(GIF_IMPLEMENTATION) #if defined(RGIF_IMPLEMENTATION)
#include <stdio.h> // Required for: FILE, fopen(), fclose() #include <stdio.h> // Required for: FILE, fopen(), fclose()
#include <string.h> // Required for: memcpy() #include <string.h> // Required for: memcpy()
@ -186,7 +186,7 @@ static void GifWriteLzwImage(FILE *f, unsigned char *image, unsigned int left, u
// Creates a gif file // Creates a gif file
// NOTE: Initializes internal file pointer (only one gif recording at a time) // NOTE: Initializes internal file pointer (only one gif recording at a time)
// The delay value is the time between frames in hundredths of a second - note that not all viewers pay much attention to this value. // The delay value is the time between frames in hundredths of a second - note that not all viewers pay much attention to this value.
GIFDEF bool GifBegin(const char *filename, unsigned int width, unsigned int height, unsigned int delay, unsigned int bitDepth, bool dither) RGIFDEF bool GifBegin(const char *filename, unsigned int width, unsigned int height, unsigned int delay, unsigned int bitDepth, bool dither)
{ {
#if _MSC_VER >= 1400 #if _MSC_VER >= 1400
gifFile = 0; gifFile = 0;
@ -248,7 +248,7 @@ GIFDEF bool GifBegin(const char *filename, unsigned int width, unsigned int heig
// NOTE: gifFile should have been initialized with GifBegin() // NOTE: gifFile should have been initialized with GifBegin()
// AFAIK, it is legal to use different bit depths for different frames of an image - // AFAIK, it is legal to use different bit depths for different frames of an image -
// this may be handy to save bits in animations that don't change much. // this may be handy to save bits in animations that don't change much.
GIFDEF bool GifWriteFrame(const unsigned char *image, unsigned int width, unsigned int height, unsigned int delay, int bitDepth, bool dither) RGIFDEF bool GifWriteFrame(const unsigned char *image, unsigned int width, unsigned int height, unsigned int delay, int bitDepth, bool dither)
{ {
if (!gifFile) return false; if (!gifFile) return false;
@ -268,7 +268,7 @@ GIFDEF bool GifWriteFrame(const unsigned char *image, unsigned int width, unsign
// Writes the EOF code, closes the file handle, and frees temp memory used by a GIF. // Writes the EOF code, closes the file handle, and frees temp memory used by a GIF.
// Many if not most viewers will still display a GIF properly if the EOF code is missing, // Many if not most viewers will still display a GIF properly if the EOF code is missing,
// but it's still a good idea to write it out. // but it's still a good idea to write it out.
GIFDEF bool GifEnd() RGIFDEF bool GifEnd()
{ {
if (!gifFile) return false; if (!gifFile) return false;
@ -910,4 +910,4 @@ static void GifWriteLzwImage(FILE *f, unsigned char *image, unsigned int left, u
GIF_TEMP_FREE(codetree); GIF_TEMP_FREE(codetree);
} }
#endif // GIF_IMPLEMENTATION #endif // RGIF_IMPLEMENTATION

View File

@ -5,21 +5,22 @@
* A simple and easy-to-use library to learn videogames programming (www.raylib.com) * A simple and easy-to-use library to learn videogames programming (www.raylib.com)
* *
* FEATURES: * FEATURES:
* - Library written in plain C code (C99) * - Written in plain C code (C99) in PascalCase/camelCase notation
* - Multiple platforms supported: Windows, Linux, Mac, Android, Raspberry Pi, HTML5. * - Multiple platforms support: Windows, Linux, Mac, Android, Raspberry Pi and HTML5
* - Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES 2.0) * - Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES 2.0)
* - Unique OpenGL abstraction layer (usable as standalone module): [rlgl] * - Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
* - Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF) * - Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF)
* - Multiple textures support, including compressed formats and mipmaps generation * - Outstanding texture formats support, including compressed formats (DXT, ETC, PVRT, ASTC)
* - Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps * - Basic 3d support for Geometrics, Models, Billboards, Heightmaps and Cubicmaps
* - Flexible Materials system, supporting classic maps and PBR maps
* - Shaders support, including Model shaders and Postprocessing shaders
* - Powerful math module for Vector2, Vector3, Matrix and Quaternion operations: [raymath] * - Powerful math module for Vector2, Vector3, Matrix and Quaternion operations: [raymath]
* - Audio loading and playing with streaming support and mixing channels: [audio] * - Audio loading and playing with streaming support and mixing channels: [audio]
* - VR stereo rendering support with configurable HMD device parameters * - VR stereo rendering support with configurable HMD device parameters
* - Minimal external dependencies (GLFW3, OpenGL, OpenAL) * - Minimal external dependencies (GLFW3, OpenGL, OpenAL)
* - Complete bindings for Lua, Go and Pascal * - Complete bindings to LUA (raylib-lua) and Go (raylib-go)
* *
* NOTES: * NOTES:
* 32bit Colors - Any defined Color is always RGBA (4 byte)
* One custom font is loaded by default when InitWindow() [core] * One custom font is loaded by default when InitWindow() [core]
* If using OpenGL 3.3 or ES2, one default shader is loaded automatically (internally defined) [rlgl] * If using OpenGL 3.3 or ES2, one default shader is loaded automatically (internally defined) [rlgl]
* If using OpenGL 3.3 or ES2, several vertex buffers (VAO/VBO) are created to manage lines-triangles-quads * If using OpenGL 3.3 or ES2, several vertex buffers (VAO/VBO) are created to manage lines-triangles-quads
@ -31,12 +32,16 @@
* *
* OPTIONAL DEPENDENCIES: * OPTIONAL DEPENDENCIES:
* stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA) [textures] * stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA) [textures]
* stb_image_resize (Sean Barret) for image resizing algorythms [textures]
* stb_image_write (Sean Barret) for image writting (PNG) [utils] * stb_image_write (Sean Barret) for image writting (PNG) [utils]
* stb_truetype (Sean Barret) for ttf fonts loading [text] * stb_truetype (Sean Barret) for ttf fonts loading [text]
* stb_vorbis (Sean Barret) for ogg audio loading [audio] * stb_vorbis (Sean Barret) for ogg audio loading [audio]
* stb_perlin (Sean Barret) for Perlin noise image generation [textures]
* par_shapes (Philip Rideout) for parametric 3d shapes generation [models]
* jar_xm (Joshua Reisenauer) for XM audio module loading [audio] * jar_xm (Joshua Reisenauer) for XM audio module loading [audio]
* jar_mod (Joshua Reisenauer) for MOD audio module loading [audio] * jar_mod (Joshua Reisenauer) for MOD audio module loading [audio]
* dr_flac (David Reid) for FLAC audio file loading [audio] * dr_flac (David Reid) for FLAC audio file loading [audio]
* rgif (Charlie Tangora, Ramon Santamaria) for GIF recording [core]
* tinfl for data decompression (DEFLATE algorithm) [rres] * tinfl for data decompression (DEFLATE algorithm) [rres]
* *
* *
@ -74,14 +79,17 @@
//#define PLATFORM_WEB // HTML5 (emscripten, asm.js) //#define PLATFORM_WEB // HTML5 (emscripten, asm.js)
// Security check in case no PLATFORM_* defined // Security check in case no PLATFORM_* defined
#if !defined(PLATFORM_DESKTOP) && !defined(PLATFORM_ANDROID) && !defined(PLATFORM_RPI) && !defined(PLATFORM_WEB) #if !defined(PLATFORM_DESKTOP) && \
#define PLATFORM_DESKTOP !defined(PLATFORM_ANDROID) && \
!defined(PLATFORM_RPI) && \
!defined(PLATFORM_WEB)
#define PLATFORM_DESKTOP
#endif #endif
#if defined(_WIN32) && defined(BUILDING_DLL) #if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED)
#define RLAPI __declspec(dllexport) // We are building raylib as a Win32 DLL #define RLAPI __declspec(dllexport) // We are building raylib as a Win32 shared library (.dll)
#elif defined(_WIN32) && defined(RAYLIB_DLL) #elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED)
#define RLAPI __declspec(dllimport) // We are using raylib as a Win32 DLL #define RLAPI __declspec(dllimport) // We are using raylib as a Win32 shared library (.dll)
#else #else
#define RLAPI // We are building or using raylib as a static library (or Linux shared library) #define RLAPI // We are building or using raylib as a static library (or Linux shared library)
#endif #endif
@ -300,7 +308,7 @@
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#ifndef __cplusplus #ifndef __cplusplus
// Boolean type // Boolean type
#if !defined(_STDBOOL_H) || !defined(__STDBOOL_H) // CLang uses second form #ifndef bool
typedef enum { false, true } bool; typedef enum { false, true } bool;
#endif #endif
#endif #endif
@ -515,6 +523,20 @@ typedef struct RRESData {
// RRES type (pointer to RRESData array) // RRES type (pointer to RRESData array)
typedef struct RRESData *RRES; typedef struct RRESData *RRES;
// Head-Mounted-Display device parameters
typedef struct VrDeviceInfo {
int hResolution; // HMD horizontal resolution in pixels
int vResolution; // HMD vertical resolution in pixels
float hScreenSize; // HMD horizontal size in meters
float vScreenSize; // HMD vertical size in meters
float vScreenCenter; // HMD screen center in meters
float eyeToScreenDistance; // HMD distance between eye and display in meters
float lensSeparationDistance; // HMD lens separation distance in meters
float interpupillaryDistance; // HMD IPD (distance between pupils) in meters
float lensDistortionValues[4]; // HMD lens distortion constant parameters
float chromaAbCorrection[4]; // HMD chromatic aberration correction parameters
} VrDeviceInfo;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Enumerators Definition // Enumerators Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@ -657,13 +679,10 @@ typedef enum {
HMD_DEFAULT_DEVICE = 0, HMD_DEFAULT_DEVICE = 0,
HMD_OCULUS_RIFT_DK2, HMD_OCULUS_RIFT_DK2,
HMD_OCULUS_RIFT_CV1, HMD_OCULUS_RIFT_CV1,
HMD_OCULUS_GO,
HMD_VALVE_HTC_VIVE, HMD_VALVE_HTC_VIVE,
HMD_SAMSUNG_GEAR_VR, HMD_SONY_PSVR
HMD_GOOGLE_CARDBOARD, } VrDeviceType;
HMD_SONY_PLAYSTATION_VR,
HMD_RAZER_OSVR,
HMD_FOVE_VR,
} VrDevice;
// RRESData type // RRESData type
typedef enum { typedef enum {
@ -856,7 +875,8 @@ RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color);
RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle
RLAPI void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle RLAPI void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle
RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters
RLAPI void DrawRectangleGradient(int posX, int posY, int width, int height, Color color1, Color color2); // Draw a gradient-filled rectangle RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2);// Draw a vertical-gradient-filled rectangle
RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2);// Draw a horizontal-gradient-filled rectangle
RLAPI void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw a gradient-filled rectangle with custom vertex colors RLAPI void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw a gradient-filled rectangle with custom vertex colors
RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version) RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version)
RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
@ -1074,7 +1094,8 @@ RLAPI void BeginBlendMode(int mode); // Beg
RLAPI void EndBlendMode(void); // End blending mode (reset to default: alpha blending) RLAPI void EndBlendMode(void); // End blending mode (reset to default: alpha blending)
// VR control functions // VR control functions
RLAPI void InitVrSimulator(int vrDevice); // Init VR simulator for selected device VrDeviceInfo GetVrDeviceInfo(int vrDeviceType); // Get VR device information for some standard devices
void InitVrSimulator(VrDeviceInfo info); // Init VR simulator for selected device parameters
RLAPI void CloseVrSimulator(void); // Close VR simulator for current device RLAPI void CloseVrSimulator(void); // Close VR simulator for current device
RLAPI bool IsVrSimulatorReady(void); // Detect if VR simulator is ready RLAPI bool IsVrSimulatorReady(void); // Detect if VR simulator is ready
RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera

View File

@ -223,20 +223,6 @@ typedef struct DrawCall {
} DrawCall; } DrawCall;
#if defined(SUPPORT_VR_SIMULATOR) #if defined(SUPPORT_VR_SIMULATOR)
// Head-Mounted-Display device parameters
typedef struct VrDeviceInfo {
int hResolution; // HMD horizontal resolution in pixels
int vResolution; // HMD vertical resolution in pixels
float hScreenSize; // HMD horizontal size in meters
float vScreenSize; // HMD vertical size in meters
float vScreenCenter; // HMD screen center in meters
float eyeToScreenDistance; // HMD distance between eye and display in meters
float lensSeparationDistance; // HMD lens separation distance in meters
float interpupillaryDistance; // HMD IPD (distance between pupils) in meters
float distortionK[4]; // HMD lens distortion constant parameters
float chromaAbCorrection[4]; // HMD chromatic aberration correction parameters
} VrDeviceInfo;
// VR Stereo rendering configuration for simulator // VR Stereo rendering configuration for simulator
typedef struct VrStereoConfig { typedef struct VrStereoConfig {
RenderTexture2D stereoFbo; // VR stereo rendering framebuffer RenderTexture2D stereoFbo; // VR stereo rendering framebuffer
@ -291,7 +277,6 @@ static bool texCompASTCSupported = false; // ASTC texture compression support
#if defined(SUPPORT_VR_SIMULATOR) #if defined(SUPPORT_VR_SIMULATOR)
// VR global variables // VR global variables
static VrDeviceInfo hmd; // Current VR device info
static VrStereoConfig vrConfig; // VR stereo configuration for simulator static VrStereoConfig vrConfig; // VR stereo configuration for simulator
static bool vrSimulatorReady = false; // VR simulator ready flag static bool vrSimulatorReady = false; // VR simulator ready flag
static bool vrStereoRender = false; // VR stereo rendering enabled/disabled flag static bool vrStereoRender = false; // VR stereo rendering enabled/disabled flag
@ -418,6 +403,7 @@ void rlPushMatrix(void)
} }
stack[stackCounter] = *currentMatrix; stack[stackCounter] = *currentMatrix;
rlLoadIdentity();
stackCounter++; stackCounter++;
if (currentMatrixMode == RL_MODELVIEW) useTempBuffer = true; if (currentMatrixMode == RL_MODELVIEW) useTempBuffer = true;
@ -1947,7 +1933,7 @@ void rlDrawMesh(Mesh mesh, Material material, Matrix transform)
// Matrices and other values required by shader // Matrices and other values required by shader
//----------------------------------------------------- //-----------------------------------------------------
// Calculate and send to shader model matrix (used by PBR shader) // Calculate and send to shader model matrix (used by PBR shader)
SetShaderValueMatrix(material.shader, material.shader.locs[LOC_MATRIX_MODEL], transform); if (material.shader.locs[LOC_MATRIX_MODEL] != -1) SetShaderValueMatrix(material.shader, material.shader.locs[LOC_MATRIX_MODEL], transform);
// Upload to shader material.colDiffuse // Upload to shader material.colDiffuse
if (material.shader.locs[LOC_COLOR_DIFFUSE] != -1) if (material.shader.locs[LOC_COLOR_DIFFUSE] != -1)
@ -2829,68 +2815,88 @@ void EndBlendMode(void)
} }
#if defined(SUPPORT_VR_SIMULATOR) #if defined(SUPPORT_VR_SIMULATOR)
// Init VR simulator for selected device // Get VR device information for some standard devices
// NOTE: It modifies the global variable: VrDeviceInfo hmd VrDeviceInfo GetVrDeviceInfo(int vrDeviceType)
void InitVrSimulator(int vrDevice) {
VrDeviceInfo hmd = { 0 }; // Current VR device info
switch (vrDeviceType)
{
case HMD_DEFAULT_DEVICE:
case HMD_OCULUS_RIFT_CV1:
{
// Oculus Rift CV1 parameters
// NOTE: CV1 represents a complete HMD redesign compared to previous versions,
// new Fresnel-hybrid-asymmetric lenses have been added and, consequently,
// previous parameters (DK2) and distortion shader (DK2) doesn't work any more.
// I just defined a set of parameters for simulator that approximate to CV1 stereo rendering
// but result is not the same obtained with Oculus PC SDK.
hmd.hResolution = 2160; // HMD horizontal resolution in pixels
hmd.vResolution = 1200; // HMD vertical resolution in pixels
hmd.hScreenSize = 0.133793f; // HMD horizontal size in meters
hmd.vScreenSize = 0.0669f; // HMD vertical size in meters
hmd.vScreenCenter = 0.04678f; // HMD screen center in meters
hmd.eyeToScreenDistance = 0.041f; // HMD distance between eye and display in meters
hmd.lensSeparationDistance = 0.07f; // HMD lens separation distance in meters
hmd.interpupillaryDistance = 0.07f; // HMD IPD (distance between pupils) in meters
hmd.lensDistortionValues[0] = 1.0f; // HMD lens distortion constant parameter 0
hmd.lensDistortionValues[1] = 0.22f; // HMD lens distortion constant parameter 1
hmd.lensDistortionValues[2] = 0.24f; // HMD lens distortion constant parameter 2
hmd.lensDistortionValues[3] = 0.0f; // HMD lens distortion constant parameter 3
hmd.chromaAbCorrection[0] = 0.996f; // HMD chromatic aberration correction parameter 0
hmd.chromaAbCorrection[1] = -0.004f; // HMD chromatic aberration correction parameter 1
hmd.chromaAbCorrection[2] = 1.014f; // HMD chromatic aberration correction parameter 2
hmd.chromaAbCorrection[3] = 0.0f; // HMD chromatic aberration correction parameter 3
TraceLog(LOG_INFO, "Initializing VR Simulator (Oculus Rift CV1)");
} break;
case HMD_OCULUS_RIFT_DK2:
{
// Oculus Rift DK2 parameters
hmd.hResolution = 1280; // HMD horizontal resolution in pixels
hmd.vResolution = 800; // HMD vertical resolution in pixels
hmd.hScreenSize = 0.14976f; // HMD horizontal size in meters
hmd.vScreenSize = 0.09356f; // HMD vertical size in meters
hmd.vScreenCenter = 0.04678f; // HMD screen center in meters
hmd.eyeToScreenDistance = 0.041f; // HMD distance between eye and display in meters
hmd.lensSeparationDistance = 0.0635f; // HMD lens separation distance in meters
hmd.interpupillaryDistance = 0.064f; // HMD IPD (distance between pupils) in meters
hmd.lensDistortionValues[0] = 1.0f; // HMD lens distortion constant parameter 0
hmd.lensDistortionValues[1] = 0.22f; // HMD lens distortion constant parameter 1
hmd.lensDistortionValues[2] = 0.24f; // HMD lens distortion constant parameter 2
hmd.lensDistortionValues[3] = 0.0f; // HMD lens distortion constant parameter 3
hmd.chromaAbCorrection[0] = 0.996f; // HMD chromatic aberration correction parameter 0
hmd.chromaAbCorrection[1] = -0.004f; // HMD chromatic aberration correction parameter 1
hmd.chromaAbCorrection[2] = 1.014f; // HMD chromatic aberration correction parameter 2
hmd.chromaAbCorrection[3] = 0.0f; // HMD chromatic aberration correction parameter 3
TraceLog(LOG_INFO, "Initializing VR Simulator (Oculus Rift DK2)");
} break;
case HMD_OCULUS_GO:
{
// TODO: Provide device display and lens parameters
}
case HMD_VALVE_HTC_VIVE:
{
// TODO: Provide device display and lens parameters
}
case HMD_SONY_PSVR:
{
// TODO: Provide device display and lens parameters
}
default: break;
}
return hmd;
}
// Init VR simulator for selected device parameters
// NOTE: It modifies the global variable: VrStereoConfig vrConfig
void InitVrSimulator(VrDeviceInfo info)
{ {
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
if (vrDevice == HMD_OCULUS_RIFT_DK2)
{
// Oculus Rift DK2 parameters
hmd.hResolution = 1280; // HMD horizontal resolution in pixels
hmd.vResolution = 800; // HMD vertical resolution in pixels
hmd.hScreenSize = 0.14976f; // HMD horizontal size in meters
hmd.vScreenSize = 0.09356f; // HMD vertical size in meters
hmd.vScreenCenter = 0.04678f; // HMD screen center in meters
hmd.eyeToScreenDistance = 0.041f; // HMD distance between eye and display in meters
hmd.lensSeparationDistance = 0.0635f; // HMD lens separation distance in meters
hmd.interpupillaryDistance = 0.064f; // HMD IPD (distance between pupils) in meters
hmd.distortionK[0] = 1.0f; // HMD lens distortion constant parameter 0
hmd.distortionK[1] = 0.22f; // HMD lens distortion constant parameter 1
hmd.distortionK[2] = 0.24f; // HMD lens distortion constant parameter 2
hmd.distortionK[3] = 0.0f; // HMD lens distortion constant parameter 3
hmd.chromaAbCorrection[0] = 0.996f; // HMD chromatic aberration correction parameter 0
hmd.chromaAbCorrection[1] = -0.004f; // HMD chromatic aberration correction parameter 1
hmd.chromaAbCorrection[2] = 1.014f; // HMD chromatic aberration correction parameter 2
hmd.chromaAbCorrection[3] = 0.0f; // HMD chromatic aberration correction parameter 3
TraceLog(LOG_INFO, "Initializing VR Simulator (Oculus Rift DK2)");
}
else if ((vrDevice == HMD_DEFAULT_DEVICE) || (vrDevice == HMD_OCULUS_RIFT_CV1))
{
// Oculus Rift CV1 parameters
// NOTE: CV1 represents a complete HMD redesign compared to previous versions,
// new Fresnel-hybrid-asymmetric lenses have been added and, consequently,
// previous parameters (DK2) and distortion shader (DK2) doesn't work any more.
// I just defined a set of parameters for simulator that approximate to CV1 stereo rendering
// but result is not the same obtained with Oculus PC SDK.
hmd.hResolution = 2160; // HMD horizontal resolution in pixels
hmd.vResolution = 1200; // HMD vertical resolution in pixels
hmd.hScreenSize = 0.133793f; // HMD horizontal size in meters
hmd.vScreenSize = 0.0669f; // HMD vertical size in meters
hmd.vScreenCenter = 0.04678f; // HMD screen center in meters
hmd.eyeToScreenDistance = 0.041f; // HMD distance between eye and display in meters
hmd.lensSeparationDistance = 0.07f; // HMD lens separation distance in meters
hmd.interpupillaryDistance = 0.07f; // HMD IPD (distance between pupils) in meters
hmd.distortionK[0] = 1.0f; // HMD lens distortion constant parameter 0
hmd.distortionK[1] = 0.22f; // HMD lens distortion constant parameter 1
hmd.distortionK[2] = 0.24f; // HMD lens distortion constant parameter 2
hmd.distortionK[3] = 0.0f; // HMD lens distortion constant parameter 3
hmd.chromaAbCorrection[0] = 0.996f; // HMD chromatic aberration correction parameter 0
hmd.chromaAbCorrection[1] = -0.004f; // HMD chromatic aberration correction parameter 1
hmd.chromaAbCorrection[2] = 1.014f; // HMD chromatic aberration correction parameter 2
hmd.chromaAbCorrection[3] = 0.0f; // HMD chromatic aberration correction parameter 3
TraceLog(LOG_INFO, "Initializing VR Simulator (Oculus Rift CV1)");
}
else
{
TraceLog(LOG_WARNING, "VR Simulator doesn't support selected device parameters,");
TraceLog(LOG_WARNING, "using default VR Simulator parameters");
}
// Initialize framebuffer and textures for stereo rendering // Initialize framebuffer and textures for stereo rendering
// NOTE: screen size should match HMD aspect ratio // NOTE: Screen size should match HMD aspect ratio
vrConfig.stereoFbo = rlLoadRenderTexture(screenWidth, screenHeight); vrConfig.stereoFbo = rlLoadRenderTexture(screenWidth, screenHeight);
#if defined(SUPPORT_DISTORTION_SHADER) #if defined(SUPPORT_DISTORTION_SHADER)
@ -2899,7 +2905,7 @@ void InitVrSimulator(int vrDevice)
if (vrConfig.distortionShader.id > 0) SetShaderDefaultLocations(&vrConfig.distortionShader); if (vrConfig.distortionShader.id > 0) SetShaderDefaultLocations(&vrConfig.distortionShader);
#endif #endif
SetStereoConfig(hmd); SetStereoConfig(info);
vrSimulatorReady = true; vrSimulatorReady = true;
#endif #endif
@ -2923,6 +2929,18 @@ void CloseVrSimulator(void)
#endif #endif
} }
// TODO: Review VR system to be more flexible,
// move distortion shader to user side,
// SetStereoConfig() must be reviewed...
/*
// Set VR view distortion shader
void SetVrDistortionShader(Shader shader)
{
vrConfig.distortionShader = shader;
SetStereoConfig(info);
}
*/
// Detect if VR simulator is running // Detect if VR simulator is running
bool IsVrSimulatorReady(void) bool IsVrSimulatorReady(void)
{ {
@ -3345,8 +3363,6 @@ static void SetShaderDefaultLocations(Shader *shader)
shader->locs[LOC_MAP_DIFFUSE] = glGetUniformLocation(shader->id, "texture0"); shader->locs[LOC_MAP_DIFFUSE] = glGetUniformLocation(shader->id, "texture0");
shader->locs[LOC_MAP_NORMAL] = glGetUniformLocation(shader->id, "texture1"); shader->locs[LOC_MAP_NORMAL] = glGetUniformLocation(shader->id, "texture1");
shader->locs[LOC_MAP_SPECULAR] = glGetUniformLocation(shader->id, "texture2"); shader->locs[LOC_MAP_SPECULAR] = glGetUniformLocation(shader->id, "texture2");
// TODO: Try to find all expected/recognized shader locations (predefined names, must be documented)
} }
// Unload default shader // Unload default shader
@ -3941,6 +3957,7 @@ static void GenDrawCube(void)
#if defined(SUPPORT_VR_SIMULATOR) #if defined(SUPPORT_VR_SIMULATOR)
// Configure stereo rendering (including distortion shader) with HMD device parameters // Configure stereo rendering (including distortion shader) with HMD device parameters
// NOTE: It modifies the global variable: VrStereoConfig vrConfig
static void SetStereoConfig(VrDeviceInfo hmd) static void SetStereoConfig(VrDeviceInfo hmd)
{ {
// Compute aspect ratio // Compute aspect ratio
@ -3957,10 +3974,10 @@ static void SetStereoConfig(VrDeviceInfo hmd)
// NOTE: To get lens max radius, lensShift must be normalized to [-1..1] // NOTE: To get lens max radius, lensShift must be normalized to [-1..1]
float lensRadius = fabsf(-1.0f - 4.0f*lensShift); float lensRadius = fabsf(-1.0f - 4.0f*lensShift);
float lensRadiusSq = lensRadius*lensRadius; float lensRadiusSq = lensRadius*lensRadius;
float distortionScale = hmd.distortionK[0] + float distortionScale = hmd.lensDistortionValues[0] +
hmd.distortionK[1]*lensRadiusSq + hmd.lensDistortionValues[1]*lensRadiusSq +
hmd.distortionK[2]*lensRadiusSq*lensRadiusSq + hmd.lensDistortionValues[2]*lensRadiusSq*lensRadiusSq +
hmd.distortionK[3]*lensRadiusSq*lensRadiusSq*lensRadiusSq; hmd.lensDistortionValues[3]*lensRadiusSq*lensRadiusSq*lensRadiusSq;
TraceLog(LOG_DEBUG, "VR: Distortion Scale: %f", distortionScale); TraceLog(LOG_DEBUG, "VR: Distortion Scale: %f", distortionScale);
@ -3983,7 +4000,7 @@ static void SetStereoConfig(VrDeviceInfo hmd)
SetShaderValue(vrConfig.distortionShader, GetShaderLocation(vrConfig.distortionShader, "scale"), scale, 2); SetShaderValue(vrConfig.distortionShader, GetShaderLocation(vrConfig.distortionShader, "scale"), scale, 2);
SetShaderValue(vrConfig.distortionShader, GetShaderLocation(vrConfig.distortionShader, "scaleIn"), scaleIn, 2); SetShaderValue(vrConfig.distortionShader, GetShaderLocation(vrConfig.distortionShader, "scaleIn"), scaleIn, 2);
SetShaderValue(vrConfig.distortionShader, GetShaderLocation(vrConfig.distortionShader, "hmdWarpParam"), hmd.distortionK, 4); SetShaderValue(vrConfig.distortionShader, GetShaderLocation(vrConfig.distortionShader, "hmdWarpParam"), hmd.lensDistortionValues, 4);
SetShaderValue(vrConfig.distortionShader, GetShaderLocation(vrConfig.distortionShader, "chromaAbParam"), hmd.chromaAbCorrection, 4); SetShaderValue(vrConfig.distortionShader, GetShaderLocation(vrConfig.distortionShader, "chromaAbParam"), hmd.chromaAbCorrection, 4);
#endif #endif
@ -4022,6 +4039,7 @@ static void SetStereoView(int eye, Matrix matProjection, Matrix matModelView)
// Apply view offset to modelview matrix // Apply view offset to modelview matrix
eyeModelView = MatrixMultiply(matModelView, vrConfig.eyesViewOffset[eye]); eyeModelView = MatrixMultiply(matModelView, vrConfig.eyesViewOffset[eye]);
// Set current eye projection matrix
eyeProjection = vrConfig.eyesProjection[eye]; eyeProjection = vrConfig.eyesProjection[eye];
SetMatrixModelview(eyeModelView); SetMatrixModelview(eyeModelView);

Some files were not shown because too many files have changed in this diff Show More