51
README.md
|
@ -18,18 +18,18 @@ features
|
|||
* Uses PascalCase/camelCase notation
|
||||
* Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES2)
|
||||
* Unique OpenGL abstraction layer (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c)
|
||||
* Powerful fonts module with multiple SpriteFonts formats support (XNA bitmap fonts, AngelCode fonts, TTF)
|
||||
* Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF)
|
||||
* Outstanding texture formats support, including compressed formats (DXT, ETC, PVRT, ASTC)
|
||||
* Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps
|
||||
* Materials (diffuse, normal, specular) and Lighting (point, directional, spot) support
|
||||
* Basic 3d support for Geometrics, Models, Billboards, Heightmaps and Cubicmaps
|
||||
* Flexible Materials system, supporting by default diffuse, normal and specular maps
|
||||
* Shaders support, including Model shaders and Postprocessing shaders
|
||||
* Powerful math module for Vector and Matrix operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.c)
|
||||
* Audio loading and playing with streaming support and mixing channels (WAV, OGG, FLAC, XM, MOD)
|
||||
* Powerful math module for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.c)
|
||||
* Audio loading and playing with streaming support (WAV, OGG, FLAC, XM, MOD)
|
||||
* Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi** and **HTML5**
|
||||
* VR stereo rendering support with configurable HMD device parameters
|
||||
* Custom color palette for fancy visuals on raywhite background
|
||||
* Minimal external dependencies (GLFW3, OpenGL, OpenAL)
|
||||
* Complete binding to LUA: [raylib-lua](https://github.com/raysan5/raylib-lua)
|
||||
* Complete bindings to LUA ([raylib-lua](https://github.com/raysan5/raylib-lua)) and Go ([raylib-go](https://github.com/gen2brain/raylib-go))
|
||||
|
||||
raylib uses on its core module the outstanding [GLFW3](http://www.glfw.org/) library. The best option I found for
|
||||
multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, maintained, ...).
|
||||
|
@ -43,31 +43,17 @@ On Raspberry Pi, raylib uses Videocore API and EGL for window/context management
|
|||
|
||||
raylib is licensed under a zlib/libpng license. View [LICENSE](https://github.com/raysan5/raylib/blob/master/LICENSE.md).
|
||||
|
||||
tools requirements
|
||||
------------------
|
||||
building
|
||||
--------
|
||||
|
||||
For detailed building instructions, check [raylib Wiki](https://github.com/raysan5/raylib/wiki).
|
||||
|
||||
raylib has been developed using exclusively two tools:
|
||||
|
||||
* Notepad++ (text editor) - [http://notepad-plus-plus.org/](http://notepad-plus-plus.org/)
|
||||
* MinGW (GCC compiler) - [http://www.mingw.org/](http://www.mingw.org/)
|
||||
|
||||
Those are the tools I recommend to develop with raylib, in fact, those are the tools my students use.
|
||||
I believe those are the best tools to train spartan-programmers.
|
||||
|
||||
Someone could argue about debugging. raylib is a library intended for learning and I think C it's a clear enough language
|
||||
to allow writing small-mid size programs with a printf-based debugging. All raylib examples have also been written this way.
|
||||
|
||||
Since raylib v1.1, you can download a Windows Installer package for easy installation and configuration. Check [raylib Webpage](http://www.raylib.com/)
|
||||
|
||||
building source (generate libraylib.a)
|
||||
--------------------------------------
|
||||
|
||||
Check raylib wiki page: [Compile for...](https://github.com/raysan5/raylib/wiki)
|
||||
|
||||
building examples
|
||||
-----------------
|
||||
|
||||
Check raylib wiki page: [Compile for...](https://github.com/raysan5/raylib/wiki)
|
||||
Those are the tools recommended to develop with raylib, in fact, those are the tools my students use.
|
||||
|
||||
contact
|
||||
-------
|
||||
|
@ -98,7 +84,7 @@ contributing (in some way or another) to make raylib project better. Huge thanks
|
|||
- Marc Agüera 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))
|
||||
- Sergio Martinez 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.
|
||||
- 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.
|
||||
|
@ -106,15 +92,22 @@ contributing (in some way or another) to make raylib project better. Huge thanks
|
|||
- [Chris Hemingway](https://github.com/cHemingway) for improving raylib on OSX build system.
|
||||
- [Emanuele Petriglia](https://github.com/LelixSuper) for working on multiple GNU/Linux improvements and developing [TicTacToe](https://github.com/LelixSuper/TicTacToe) raylib game.
|
||||
- [Joshua Reisenauer](https://github.com/kd7tck) for adding audio modules support (XM, MOD) and reviewing audio system.
|
||||
- Marcelo Paez (paezao) for his help on OSX to solve High DPI display issue. Thanks Marcelo!
|
||||
- [Marcelo Paez](https://github.com/paezao) for his help on OSX to solve High DPI display issue. Thanks Marcelo!
|
||||
- [Ghassan Al-Mashareqa](https://github.com/ghassanpl) for his amazing contribution with raylib Lua module, I just work over his code to implement [rlua](https://github.com/raysan5/raylib/blob/master/src/rlua.h)
|
||||
- [Teodor Stoenescu](https://github.com/teodor-stoenescu) for his improvements on OBJ object loading.
|
||||
- [RDR8](https://github.com/RDR8) for helping with Linux build improvements
|
||||
- [Saggi Mizrahi](https://github.com/ficoos) for multiple fixes on Linux and audio system
|
||||
- [Daniel Lemos](https://github.com/xspager) for fixing issues on Linux games building
|
||||
- [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
|
||||
- [Milan Nikolic](https://github.com/gen2brain) for adding Android build support with custom standalone toolchain
|
||||
|
||||
Please, if I forget someone in this list, excuse me and write me an email to remind me to add you!
|
||||
|
||||
[raysan5]: mailto:ray@raylib.com "Ramon Santamaria - Ray San"
|
||||
|
||||
license
|
||||
-------
|
||||
|
||||
raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE.md) for further details.
|
||||
|
||||
[raysan5]: mailto:ray@raylib.com "Ramon Santamaria - Ray San"
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
<a id="logo" href="http://www.raylib.com/index.html"></a>
|
||||
<p id="title">[simple and easy-to-use library to learn videogames programming]</p>
|
||||
<p id="plinks">[<a href="http://www.facebook.com/raylibgames" target="_blank">www.facebook.com/raylibgames</a>][<a href="https://github.com/raysan5/raylib">github.com/raysan5/raylib</a>]</p>
|
||||
<p id="version">v1.6.0 quick reference card</p>
|
||||
<p id="version">v1.7.0 quick reference card</p>
|
||||
</div>
|
||||
<br>
|
||||
<div id="fulldata">
|
||||
|
@ -154,7 +154,7 @@
|
|||
<p id="pcolors">colors</p>
|
||||
<div id="colors"><pre><code class="cpp"></code></pre></div>
|
||||
</div>
|
||||
<p id="copyright">raylib quick reference card - Copyright (c) 2013-2016 Ramon Santamaria (<a href="http://www.twitter.com/raysan5">@raysan5</a>)</p>
|
||||
<p id="copyright">raylib quick reference card - Copyright (c) 2013-2017 Ramon Santamaria (<a href="http://www.twitter.com/raysan5">@raysan5</a>)</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
void InitAudioDevice(void); // Initialize audio device and context
|
||||
void CloseAudioDevice(void); // Close the audio device and context (and music stream)
|
||||
bool IsAudioDeviceReady(void); // Check if audio device is ready
|
||||
void SetMasterVolume(float volume); // Set master volume (listener)
|
||||
|
||||
// Wave/Sound loading/unloading functions
|
||||
Wave LoadWave(const char *fileName); // Load wave data from file into RAM
|
||||
|
@ -10,7 +11,6 @@
|
|||
int sampleSize, int channels); // Load wave data from float array data (32bit)
|
||||
Sound LoadSound(const char *fileName); // Load sound to memory
|
||||
Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data
|
||||
Sound LoadSoundFromRES(const char *rresName, int resId); // Load sound to memory from rRES file (raylib Resource)
|
||||
void UpdateSound(Sound sound, void *data, int numSamples); // Update sound buffer with new data
|
||||
void UnloadWave(Wave wave); // Unload wave data
|
||||
void UnloadSound(Sound sound); // Unload sound
|
||||
|
@ -39,6 +39,7 @@
|
|||
bool IsMusicPlaying(Music music); // Check if music is playing
|
||||
void SetMusicVolume(Music music, float volume); // Set volume for music (1.0 is max level)
|
||||
void SetMusicPitch(Music music, float pitch); // Set pitch for a music (1.0 is base level)
|
||||
void SetMusicLoopCount(Music music, float count); // Set music loop count (loop repeats)
|
||||
float GetMusicTimeLength(Music music); // Get music time length (in seconds)
|
||||
float GetMusicTimePlayed(Music music); // Get current music time played (in seconds)
|
||||
|
||||
|
|
|
@ -1,62 +1,72 @@
|
|||
|
||||
// Window-related functions
|
||||
void InitWindow(int width, int height, char* title); // Initialize Window and Graphics Context (OpenGL)
|
||||
void CloseWindow(void); // Close Window and Terminate Context
|
||||
bool WindowShouldClose(void); // Detect if KEY_ESCAPE pressed or Close icon pressed
|
||||
bool IsWindowMinimized(void); // Detect if window has been minimized (or lost focus)
|
||||
void ToggleFullscreen(void); // Fullscreen toggle (by default F11)
|
||||
void CloseWindow(void); // Close window and unload OpenGL context
|
||||
bool WindowShouldClose(void); // Check if KEY_ESCAPE pressed or Close icon pressed
|
||||
bool IsWindowMinimized(void); // Check if window has been minimized (or lost focus)
|
||||
void ToggleFullscreen(void); // Toggle fullscreen mode (only PLATFORM_DESKTOP)
|
||||
void SetWindowIcon(Image image); // Set icon for window (only PLATFORM_DESKTOP)
|
||||
void SetWindowPosition(int x, int y); // Set window position on screen (only PLATFORM_DESKTOP)
|
||||
void SetWindowMonitor(int monitor); // Set monitor for the current window (fullscreen mode)
|
||||
void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
|
||||
int GetScreenWidth(void); // Get current screen width
|
||||
int GetScreenHeight(void); // Get current screen height
|
||||
|
||||
// Cursor-related functions
|
||||
void ShowCursor(void); // Shows cursor
|
||||
void HideCursor(void); // Hides cursor
|
||||
bool IsCursorHidden(void); // Returns true if cursor is not visible
|
||||
void EnableCursor(void); // Enables cursor
|
||||
void DisableCursor(void); // Disables cursor
|
||||
bool IsCursorHidden(void); // Check if cursor is not visible
|
||||
void EnableCursor(void); // Enables cursor (unlock cursor)
|
||||
void DisableCursor(void); // Disables cursor (lock cursor)
|
||||
|
||||
// Drawing-related functions
|
||||
void ClearBackground(Color color); // Sets Background Color
|
||||
void BeginDrawing(void); // Setup drawing canvas to start drawing
|
||||
void EndDrawing(void); // End canvas drawing and Swap Buffers (Double Buffering)
|
||||
|
||||
void Begin2dMode(Camera2D camera); // Initialize 2D mode with custom camera
|
||||
void End2dMode(void); // Ends 2D mode custom camera usage
|
||||
void Begin3dMode(Camera camera); // Initializes 3D mode for drawing (Camera setup)
|
||||
void ClearBackground(Color color); // Set background color (framebuffer clear color)
|
||||
void BeginDrawing(void); // Setup canvas (framebuffer) to start drawing
|
||||
void EndDrawing(void); // End canvas drawing and swap buffers (double buffering)
|
||||
void Begin2dMode(Camera2D camera); // Initialize 2D mode with custom camera (2D)
|
||||
void End2dMode(void); // Ends 2D mode with custom camera
|
||||
void Begin3dMode(Camera camera); // Initializes 3D mode with custom camera (3D)
|
||||
void End3dMode(void); // Ends 3D mode and returns to default 2D orthographic mode
|
||||
void BeginTextureMode(RenderTexture2D target); // Initializes render texture for drawing
|
||||
void EndTextureMode(void); // Ends drawing to render texture
|
||||
|
||||
// Screen-space-related functions
|
||||
Ray GetMouseRay(Vector2 mousePosition, Camera camera); // Returns a ray trace from mouse position
|
||||
Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Returns the screen space position from a 3d world space position
|
||||
Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Returns the screen space position for a 3d world space position
|
||||
Matrix GetCameraMatrix(Camera camera); // Returns camera transform matrix (view matrix)
|
||||
|
||||
// Timming-related functions
|
||||
void SetTargetFPS(int fps); // Set target FPS (maximum)
|
||||
float GetFPS(void); // Returns current FPS
|
||||
float GetFrameTime(void); // Returns time in seconds for one frame
|
||||
int GetFPS(void); // Returns current FPS
|
||||
float GetFrameTime(void); // Returns time in seconds for last frame drawn
|
||||
|
||||
// Color-related functions
|
||||
Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value
|
||||
int GetHexValue(Color color); // Returns hexadecimal value for a Color
|
||||
Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value
|
||||
Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
|
||||
float *ColorToFloat(Color color); // Converts Color to float array and normalizes
|
||||
float *VectorToFloat(Vector3 vec); // Converts Vector3 to float array
|
||||
float *MatrixToFloat(Matrix mat); // Converts Matrix to float array
|
||||
|
||||
// Misc. functions
|
||||
void ShowLogo(void); // Activate raylib logo at startup (can be done with flags)
|
||||
void SetConfigFlags(char flags); // Setup window configuration flags (view FLAGS)
|
||||
void TraceLog(int logType, const char *text, ...); // Show trace log messages (INFO, WARNING, ERROR, DEBUG)
|
||||
void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (saved a .png)
|
||||
int GetRandomValue(int min, int max); // Returns a random value between min and max (both included)
|
||||
Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0 to 1.0
|
||||
void SetConfigFlags(char flags); // Setup some window configuration flags
|
||||
void ShowLogo(void); // Activates raylib logo at startup (can be done with flags)
|
||||
|
||||
// Drag-and-drop files functions
|
||||
bool IsFileDropped(void); // Check if a file have been dropped into window
|
||||
char **GetDroppedFiles(int *count); // Retrieve dropped files into window
|
||||
// Files management functions
|
||||
bool IsFileExtension(const char *fileName, const char *ext); // Check file extension
|
||||
const char *GetDirectoryPath(const char *fileName); // Get directory for a given fileName (with path)
|
||||
const char *GetWorkingDirectory(void); // Get current working directory
|
||||
bool ChangeDirectory(const char *dir); // Change working directory, returns true if success
|
||||
bool IsFileDropped(void); // Check if a file has been dropped into window
|
||||
char **GetDroppedFiles(int *count); // Get dropped files names
|
||||
void ClearDroppedFiles(void); // Clear dropped files paths buffer
|
||||
|
||||
// Persistent storage management
|
||||
void StorageSaveValue(int position, int value); // Storage save integer value (to defined position)
|
||||
int StorageLoadValue(int position); // Storage load integer value (from defined position)
|
||||
void StorageSaveValue(int position, int value); // Save integer value to storage file (to defined position)
|
||||
int StorageLoadValue(int position); // Load integer value from storage file (from defined position)
|
||||
|
||||
// Input-related functions: keyboard
|
||||
bool IsKeyPressed(int key); // Detect if a key has been pressed once
|
||||
|
|
|
@ -19,20 +19,20 @@
|
|||
void DrawRay(Ray ray, Color color); // Draw a ray line
|
||||
void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
|
||||
void DrawGizmo(Vector3 position); // Draw simple gizmo
|
||||
void DrawLight(Light light); // Draw light in 3D world
|
||||
|
||||
// Model loading/unloading functions
|
||||
Model LoadModel(const char *fileName); // Load a 3d model (.OBJ)
|
||||
Model LoadModelEx(Mesh data, bool dynamic); // Load a 3d model (from mesh data)
|
||||
Model LoadModelFromRES(const char *rresName, int resId); // Load a 3d model from rRES file (raylib Resource)
|
||||
Model LoadHeightmap(Image heightmap, Vector3 size); // Load a heightmap image as a 3d model
|
||||
Model LoadCubicmap(Image cubicmap); // Load a map image as a 3d model (cubes based)
|
||||
void UnloadModel(Model model); // Unload 3d model from memory
|
||||
Mesh LoadMesh(const char *fileName); // Load mesh from file
|
||||
Mesh LoadMeshEx(int numVertex, float *vData, float *vtData, float *vnData, Color *cData); // Load mesh from vertex data
|
||||
Model LoadModel(const char *fileName); // Load model from file
|
||||
Model LoadModelFromMesh(Mesh data, bool dynamic); // Load model from mesh data
|
||||
Model LoadHeightmap(Image heightmap, Vector3 size); // Load heightmap model from image data
|
||||
Model LoadCubicmap(Image cubicmap); // Load cubes-based map model from image data
|
||||
void UnloadMesh(Mesh *mesh); // Unload mesh from memory (RAM and/or VRAM)
|
||||
void UnloadModel(Model model); // Unload model from memory (RAM and/or VRAM)
|
||||
|
||||
// Material loading/unloading functions
|
||||
Material LoadMaterial(const char *fileName); // Load material data (from file)
|
||||
Material LoadDefaultMaterial(void); // Load default material (uses default models shader)
|
||||
Material LoadStandardMaterial(void); // Load standard material (uses material attributes and lighting shader)
|
||||
void UnloadMaterial(Material material); // Unload material textures from VRAM
|
||||
|
||||
// Model drawing functions
|
||||
|
@ -55,4 +55,7 @@
|
|||
bool CheckCollisionRaySphereEx(Ray ray, Vector3 spherePosition, float sphereRadius, Vector3 *collisionPoint); // Detect collision between ray and sphere ex.
|
||||
bool CheckCollisionRayBox(Ray ray, Vector3 minBBox, Vector3 maxBBox); // Detect collision between ray and box
|
||||
BoundingBox CalculateBoundingBox(Mesh mesh); // Calculate mesh bounding box limits
|
||||
RayHitInfo GetCollisionRayMesh(Ray ray, Mesh *mesh); // Get collision info between ray and mesh
|
||||
RayHitInfo GetCollisionRayTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); // Get collision info between ray and triangle
|
||||
RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight); // Get collision info between ray and ground plane (Y-normal plane)
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
|
||||
// Shader loading/unloading functions
|
||||
char *LoadText(const char *fileName); // Load chars array from text file
|
||||
Shader LoadShader(char *vsFileName, char *fsFileName); // Load a custom shader and bind default locations
|
||||
void UnloadShader(Shader shader); // Unload a custom shader from memory
|
||||
|
||||
Shader GetDefaultShader(void); // Get default shader
|
||||
Shader GetStandardShader(void); // Get standard shader
|
||||
Texture2D GetDefaultTexture(void); // Get default texture
|
||||
|
||||
// Shader access functions
|
||||
|
@ -20,15 +21,12 @@
|
|||
void BeginBlendMode(int mode); // Begin blending mode (alpha, additive, multiplied)
|
||||
void EndBlendMode(void); // End blending mode (reset to default: alpha blending)
|
||||
|
||||
// Light creation/destruction functions
|
||||
Light CreateLight(int type, Vector3 position, Color diffuse); // Create a new light, initialize it and add to pool
|
||||
void DestroyLight(Light light); // Destroy a light and take it out of the list
|
||||
|
||||
// VR control functions
|
||||
void InitVrDevice(int vrDevice); // Init VR device
|
||||
void CloseVrDevice(void); // Close VR device
|
||||
bool IsVrDeviceReady(void); // Detect if VR device is ready
|
||||
bool IsVrSimulator(void); // Detect if VR simulator is running
|
||||
void InitVrSimulator(int vrDevice); // Init VR simulator for selected device
|
||||
void CloseVrSimulator(void); // Close VR simulator for current device
|
||||
bool IsVrSimulatorReady(void); // Detect if VR simulator is ready
|
||||
void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
|
||||
void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
|
||||
void ToggleVrMode(void); // Enable/Disable VR experience
|
||||
void BeginVrDrawing(void); // Begin VR simulator stereo rendering
|
||||
void EndVrDrawing(void); // End VR simulator stereo rendering
|
||||
|
||||
|
|
|
@ -4,12 +4,15 @@
|
|||
void DrawPixelV(Vector2 position, Color color); // Draw a pixel (Vector version)
|
||||
void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line
|
||||
void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (Vector version)
|
||||
void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line defining thickness
|
||||
void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line using cubic-bezier curves in-out
|
||||
void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
|
||||
void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); // Draw a gradient-filled circle
|
||||
void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
|
||||
void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
|
||||
void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle
|
||||
void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle
|
||||
void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters
|
||||
void DrawRectangleGradient(int posX, int posY, int width, int height, Color color1, Color color2); // Draw a gradient-filled rectangle
|
||||
void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version)
|
||||
void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
struct Light; // Light type, defines light properties
|
||||
struct Model; // Basic 3d Model type
|
||||
struct Ray; // Ray type (useful for raycast)
|
||||
struct RayHitInfo; // Raycast hit information
|
||||
|
||||
struct Wave; // Wave type, defines audio wave data
|
||||
struct Sound; // Basic Sound source and buffer
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
// SpriteFont loading/unloading functions
|
||||
SpriteFont GetDefaultFont(void); // Get the default SpriteFont
|
||||
SpriteFont LoadSpriteFont(const char *fileName); // Load a SpriteFont image into GPU memory
|
||||
SpriteFont LoadSpriteFontTTF(const char *fileName, int fontSize, int numChars, int *fontChars); // Load a SpriteFont from TTF font with parameters
|
||||
SpriteFont LoadSpriteFontEx(const char *fileName, int fontSize, int numChars, int *fontChars); // Load a SpriteFont from TTF font with parameters
|
||||
void UnloadSpriteFont(SpriteFont spriteFont); // Unload SpriteFont from GPU memory
|
||||
|
||||
// Text drawing functions
|
||||
void DrawFPS(int posX, int posY); // Shows current FPS on top-left corner
|
||||
void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
|
||||
void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, // Draw text using SpriteFont and additional parameters
|
||||
int fontSize, int spacing, Color tint);
|
||||
void DrawFPS(int posX, int posY); // Shows current FPS on top-left corner
|
||||
|
||||
// Text misc. functions
|
||||
int MeasureText(const char *text, int fontSize); // Measure string width for default font
|
||||
|
|
|
@ -2,11 +2,9 @@
|
|||
// Image/Texture2D data loading/unloading functions
|
||||
Image LoadImage(const char *fileName); // Load an image into CPU memory (RAM)
|
||||
Image LoadImageEx(Color *pixels, int width, int height); // Load image data from Color array data (RGBA - 32bit)
|
||||
Image LoadImagePro(void *data, int width, int height, int format); // Load image from raw data with parameters
|
||||
Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image data from RAW file
|
||||
Image LoadImageFromRES(const char *rresName, int resId); // Load an image from rRES file (raylib Resource)
|
||||
Texture2D LoadTexture(const char *fileName); // Load an image as texture into GPU memory
|
||||
Texture2D LoadTextureEx(void *data, int width, int height, int textureFormat, int mipmapCount); // Load a texture from raw data into GPU memory
|
||||
Texture2D LoadTextureFromRES(const char *rresName, int resId); // Load an image as texture from rRES file (raylib Resource)
|
||||
Texture2D LoadTextureFromImage(Image image); // Load a texture from image data
|
||||
RenderTexture2D LoadRenderTexture(int width, int height); // Load a texture to be used for rendering
|
||||
void UnloadImage(Image image); // Unload image from CPU memory (RAM)
|
||||
|
@ -19,6 +17,7 @@
|
|||
// Image manipulation functions
|
||||
void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two)
|
||||
void ImageFormat(Image *image, int newFormat); // Convert image data to desired format
|
||||
void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image
|
||||
void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
|
||||
Image ImageCopy(Image image); // Create an image duplicate (useful for transformations)
|
||||
void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle
|
||||
|
|
|
@ -18,6 +18,48 @@
|
|||
|
||||
#include "raylib.h"
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#define DEFAULT_VERTEX_SHADER "resources/shaders/glsl330/base.vs"
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#define DEFAULT_VERTEX_SHADER "resources/shaders/glsl100/base.vs"
|
||||
#endif
|
||||
|
||||
#define MAX_POSTPRO_SHADERS 12
|
||||
|
||||
typedef enum {
|
||||
FX_GRAYSCALE = 0,
|
||||
FX_POSTERIZATION,
|
||||
FX_DREAM_VISION,
|
||||
FX_PIXELIZER,
|
||||
FX_CROSS_HATCHING,
|
||||
FX_CROSS_STITCHING,
|
||||
FX_PREDATOR_VIEW,
|
||||
FX_SCANLINES,
|
||||
FX_FISHEYE,
|
||||
FX_SOBEL,
|
||||
FX_BLOOM,
|
||||
FX_BLUR,
|
||||
//FX_FXAA
|
||||
} PostproShader;
|
||||
|
||||
static const char *postproShaderText[] = {
|
||||
"GRAYSCALE",
|
||||
"POSTERIZATION",
|
||||
"DREAM_VISION",
|
||||
"PIXELIZER",
|
||||
"CROSS_HATCHING",
|
||||
"CROSS_STITCHING",
|
||||
"PREDATOR_VIEW",
|
||||
"SCANLINES",
|
||||
"FISHEYE",
|
||||
"SOBEL",
|
||||
"BLOOM",
|
||||
"BLUR",
|
||||
//"FXAA"
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
// Initialization
|
||||
|
@ -38,8 +80,25 @@ int main()
|
|||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
||||
Shader shader = LoadShader("resources/shaders/glsl330/base.vs",
|
||||
"resources/shaders/glsl330/bloom.fs"); // Load postpro shader
|
||||
// Load all postpro shaders
|
||||
// NOTE 1: All postpro shader use the base vertex shader (DEFAULT_VERTEX_SHADER)
|
||||
// NOTE 2: We load the correct shader depending on GLSL version
|
||||
Shader shaders[MAX_POSTPRO_SHADERS];
|
||||
|
||||
shaders[FX_GRAYSCALE] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION));
|
||||
shaders[FX_POSTERIZATION] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/posterization.fs", GLSL_VERSION));
|
||||
shaders[FX_DREAM_VISION] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/dream_vision.fs", GLSL_VERSION));
|
||||
shaders[FX_PIXELIZER] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/pixelizer.fs", GLSL_VERSION));
|
||||
shaders[FX_CROSS_HATCHING] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/cross_hatching.fs", GLSL_VERSION));
|
||||
shaders[FX_CROSS_STITCHING] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/cross_stitching.fs", GLSL_VERSION));
|
||||
shaders[FX_PREDATOR_VIEW] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/predator.fs", GLSL_VERSION));
|
||||
shaders[FX_SCANLINES] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/scanlines.fs", GLSL_VERSION));
|
||||
shaders[FX_FISHEYE] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/fisheye.fs", GLSL_VERSION));
|
||||
shaders[FX_SOBEL] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/sobel.fs", GLSL_VERSION));
|
||||
shaders[FX_BLOOM] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/bloom.fs", GLSL_VERSION));
|
||||
shaders[FX_BLUR] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/blur.fs", GLSL_VERSION));
|
||||
|
||||
int currentShader = FX_GRAYSCALE;
|
||||
|
||||
// Create a RenderTexture2D to be used for render to texture
|
||||
RenderTexture2D target = LoadRenderTexture(screenWidth, screenHeight);
|
||||
|
@ -56,6 +115,12 @@ int main()
|
|||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera); // Update camera
|
||||
|
||||
if (IsKeyPressed(KEY_RIGHT)) currentShader++;
|
||||
else if (IsKeyPressed(KEY_LEFT)) currentShader--;
|
||||
|
||||
if (currentShader >= MAX_POSTPRO_SHADERS) currentShader = 0;
|
||||
else if (currentShader < 0) currentShader = MAX_POSTPRO_SHADERS - 1;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
|
@ -74,20 +139,25 @@ int main()
|
|||
|
||||
End3dMode();
|
||||
|
||||
DrawText("HELLO POSTPROCESSING!", 70, 190, 50, RED);
|
||||
|
||||
EndTextureMode(); // End drawing to texture (now we have a texture available for next passes)
|
||||
|
||||
BeginShaderMode(shader);
|
||||
// Render previously generated texture using selected postpro shader
|
||||
BeginShaderMode(shaders[currentShader]);
|
||||
|
||||
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
||||
DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE);
|
||||
|
||||
EndShaderMode();
|
||||
|
||||
DrawRectangle(0, 9, 580, 30, Fade(LIGHTGRAY, 0.7f));
|
||||
|
||||
DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, DARKGRAY);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
DrawText("CURRENT POSTPRO SHADER:", 10, 15, 20, BLACK);
|
||||
DrawText(postproShaderText[currentShader], 330, 15, 20, RED);
|
||||
DrawText("< >", 540, 10, 30, DARKBLUE);
|
||||
|
||||
DrawFPS(700, 15);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -95,7 +165,10 @@ int main()
|
|||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadShader(shader); // Unload shader
|
||||
|
||||
// Unload all postpro shaders
|
||||
for (int i = 0; i < MAX_POSTPRO_SHADERS; i++) UnloadShader(shaders[i]);
|
||||
|
||||
UnloadTexture(texture); // Unload texture
|
||||
UnloadModel(dwarf); // Unload model
|
||||
UnloadRenderTexture(target); // Unload render texture
|
||||
|
|
Before Width: | Height: | Size: 232 KiB After Width: | Height: | Size: 189 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 68 KiB |
BIN
docs/images/raylib_architecture_v1.6.png
Normal file
After Width: | Height: | Size: 69 KiB |
|
@ -86,7 +86,7 @@
|
|||
<!--<a href="https://github.com/raysan5/raylib/releases/download/1.5.0/raylib_installer_v1.5.exe"><div class="downloadButtonInstaller" id="btnlib">Download raylib Windows Installer (v1.5.0)</div></a>-->
|
||||
<div id="itchioframe"><iframe frameborder="0" src="https://itch.io/embed/85331?bg_color=f5f5f5" width="640" height="170"></iframe></div>
|
||||
<br>
|
||||
<p>raylib is highly inspired by Borland BGI graphics lib and by XNA framework. Allegro and SDL have also been analyzed for reference.</p>
|
||||
<p>raylib is highly inspired by Borland BGI graphics lib and by XNA framework. Allegro and SDL have also been used as reference.</p>
|
||||
<br>
|
||||
<p><strong>NOTE for ADVENTURERS:</strong> raylib is a programming library to learn videogames programming; no fancy interface, no visual helpers, no auto-debugging... just coding in the most pure spartan-programmers way. Are you ready to learn? <a class="simplelink" href="examples.html" target="_self">Jump to code examples!</a>.</p>
|
||||
<br>
|
||||
|
@ -99,16 +99,16 @@
|
|||
- Unique OpenGL abstraction layer (usable as standalone module): [<a class="simplelink" href="https://github.com/raysan5/raylib/blob/master/src/rlgl.h" target="_blank">rlgl</a>]<br>
|
||||
- Powerful fonts module with SpriteFonts support (XNA fonts, AngelCode fonts, TTF)<br>
|
||||
- Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC)<br>
|
||||
- Basic 3d support for Geometrics, Models, Heightmaps and Billboards<br>
|
||||
- Materials (diffuse, normal, specular) and Lighting (point, directional, spot)<br>
|
||||
- Basic 3d support for Geometrics, Models, Billboards, Heightmaps ann Cubicmaps <br>
|
||||
- Flexible Materials system, supporting by default diffuse, normal and specular maps<br>
|
||||
- Shaders support, including Model shaders and Postprocessing shaders<br>
|
||||
- Powerful math module for Vector and Matrix operations: [<a class="simplelink" href="https://github.com/raysan5/raylib/blob/master/src/raymath.h" target="_blank">raymath</a>]<br>
|
||||
- Powerful math module for Vector, Matrix and Quaternion operations: [<a class="simplelink" href="https://github.com/raysan5/raylib/blob/master/src/raymath.h" target="_blank">raymath</a>]<br>
|
||||
- Audio loading and playing with streaming support (WAV, OGG, FLAC, XM, MOD)<br>
|
||||
- Multiple platforms support: Windows, Linux, Mac, Android, Raspberry Pi and HTML5<br>
|
||||
- VR stereo rendering support with configurable HMD device parameters<br>
|
||||
- Multiplatform support: Android, Raspberry Pi, HTML5, Oculus Rift CV1<br>
|
||||
- Custom color palette for fancy visuals on raywhite background<br>
|
||||
- Minimal external dependencies (GLFW3, OpenGL, OpenAL)<br>
|
||||
- Complete binding to <a class="simplelink" href="https://github.com/raysan5/raylib-lua" target="_blank">Lua</a>, <a class="simplelink" href="https://github.com/gen2brain/raylib-go" target="_blank">Go</a> and Pascal.<br>
|
||||
- Complete bindings to Lua (<a class="simplelink" href="https://github.com/raysan5/raylib-lua" target="_blank">raylib-lua</a>) and Go (<a class="simplelink" href="https://github.com/gen2brain/raylib-go" target="_blank">raylib-go</a>).<br>
|
||||
</div>
|
||||
<br>
|
||||
<a href="images/raylib_architecture.png"><img src="images/raylib_architecture.png" alt="raylib architechture" width="800" height="450"/></a>
|
||||
|
@ -118,7 +118,7 @@
|
|||
<p>raylib is open-source and free to use. <a class="simplelink" href="license.html" target="_self">View license</a>.</p>
|
||||
<br>
|
||||
<strong>raylib supporters on patreon</strong>
|
||||
<p>The following people is supporting raylib project on <a class="simplelink" href="https://www.patreon.com/raysan5" target="_blank">patreon</a>. Many thanks to all of them for believing in the project and contributing to it.</p>
|
||||
<p>The following people have supported raylib project on <a class="simplelink" href="https://www.patreon.com/raysan5" target="_blank">patreon</a>. Many thanks to all of them for believing in the project and contributing to it.</p>
|
||||
<br>
|
||||
<p> - Jarrod - 2drealms (<a class="simplelink" href="https://twitter.com/2drealms" target="_blank">@2drealms</a>)</p>
|
||||
<p> - Kovay Hatfield</p>
|
||||
|
@ -133,8 +133,11 @@
|
|||
<p> - Antonio Radovcic</p>
|
||||
<p> - James W. Bohnke</p>
|
||||
<p> - Evan Sirchuk</p>
|
||||
<p> - Justin Loudermilk</p>
|
||||
<p> - Tazd'ij (<a class="simplelink" href="https://twitter.com/2drealms" target="_blank">@tazdij</a>)</p>
|
||||
<p> - James W.Bohnke</p>
|
||||
<br>
|
||||
<p>And a very special thanks to <strong>Ilya Zarembsky</strong> (<a class="simplelink" href="https://twitter.com/wly_cdgr" target="_blank">@wly_cdgr</a>) for his generous contribution. Many thanks Ilya! Hope your students are enjoying raylib! :D</p>
|
||||
<p>And a very special thanks to <strong>Ilya Zarembsky</strong> (<a class="simplelink" href="https://twitter.com/wly_cdgr" target="_blank">@wly_cdgr</a>) for his generous contribution. Many thanks Ilya!</p>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
|
|
|
@ -162,9 +162,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||
# external libraries to link with
|
||||
# GLFW3
|
||||
LFLAGS += -L$(RAYLIB_PATH)/src/external/glfw3/lib/$(LIBPATH)
|
||||
LFLAGS += -L$(RAYLIB_PATH)/src/external/glfw3/lib/$(LIBPATH)
|
||||
# OpenAL Soft
|
||||
LFLAGS += -L$(RAYLIB_PATH)/src/external/openal_soft/lib/$(LIBPATH)
|
||||
LFLAGS += -L$(RAYLIB_PATH)/src/external/openal_soft/lib/$(LIBPATH)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -195,6 +195,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||
else
|
||||
LIBS += -lopenal32dll
|
||||
endif
|
||||
PHYSAC_LIBS = -static -lpthread
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
@ -524,23 +525,23 @@ audio/audio_raw_stream: audio/audio_raw_stream.c
|
|||
|
||||
# compile [physac] example - physics demo
|
||||
physac/physics_demo: physac/physics_demo.c
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -static -lpthread -D$(PLATFORM) $(WINFLAGS)
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) $(PHYSAC_LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||
|
||||
# compile [physac] example - physics friction
|
||||
physac/physics_friction: physac/physics_friction.c
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -static -lpthread -D$(PLATFORM) $(WINFLAGS)
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) $(PHYSAC_LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||
|
||||
# compile [physac] example - physics movement
|
||||
physac/physics_movement: physac/physics_movement.c
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -static -lpthread -D$(PLATFORM) $(WINFLAGS)
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) $(PHYSAC_LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||
|
||||
# compile [physac] example - physics restitution
|
||||
physac/physics_restitution: physac/physics_restitution.c
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -static -lpthread -D$(PLATFORM) $(WINFLAGS)
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) $(PHYSAC_LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||
|
||||
# compile [physac] example - physics shatter
|
||||
physac/physics_shatter: physac/physics_shatter.c
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -static -lpthread -D$(PLATFORM) $(WINFLAGS)
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) $(PHYSAC_LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||
|
||||
ifeq ($(PLATFORM),PLATFORM_ANDROID)
|
||||
external/native_app_glue.o : native_app_glue.c native_app_glue.h
|
||||
|
|
|
@ -89,7 +89,7 @@ int main()
|
|||
cursorColor = PURPLE;
|
||||
hitObjectName = "Triangle";
|
||||
|
||||
bary = VectorBarycenter(nearestHit.hitPosition, ta, tb, tc);
|
||||
bary = VectorBarycenter(nearestHit.position, ta, tb, tc);
|
||||
hitTriangle = true;
|
||||
}
|
||||
else hitTriangle = false;
|
||||
|
@ -136,15 +136,15 @@ int main()
|
|||
// If we hit something, draw the cursor at the hit point
|
||||
if (nearestHit.hit)
|
||||
{
|
||||
DrawCube(nearestHit.hitPosition, 0.3, 0.3, 0.3, cursorColor);
|
||||
DrawCubeWires(nearestHit.hitPosition, 0.3, 0.3, 0.3, RED);
|
||||
DrawCube(nearestHit.position, 0.3, 0.3, 0.3, cursorColor);
|
||||
DrawCubeWires(nearestHit.position, 0.3, 0.3, 0.3, RED);
|
||||
|
||||
Vector3 normalEnd;
|
||||
normalEnd.x = nearestHit.hitPosition.x + nearestHit.hitNormal.x;
|
||||
normalEnd.y = nearestHit.hitPosition.y + nearestHit.hitNormal.y;
|
||||
normalEnd.z = nearestHit.hitPosition.z + nearestHit.hitNormal.z;
|
||||
normalEnd.x = nearestHit.position.x + nearestHit.normal.x;
|
||||
normalEnd.y = nearestHit.position.y + nearestHit.normal.y;
|
||||
normalEnd.z = nearestHit.position.z + nearestHit.normal.z;
|
||||
|
||||
DrawLine3D(nearestHit.hitPosition, normalEnd, RED);
|
||||
DrawLine3D(nearestHit.position, normalEnd, RED);
|
||||
}
|
||||
|
||||
DrawRay(ray, MAROON);
|
||||
|
@ -163,14 +163,14 @@ int main()
|
|||
DrawText(FormatText("Distance: %3.2f", nearestHit.distance), 10, ypos, 10, BLACK);
|
||||
|
||||
DrawText(FormatText("Hit Pos: %3.2f %3.2f %3.2f",
|
||||
nearestHit.hitPosition.x,
|
||||
nearestHit.hitPosition.y,
|
||||
nearestHit.hitPosition.z), 10, ypos + 15, 10, BLACK);
|
||||
nearestHit.position.x,
|
||||
nearestHit.position.y,
|
||||
nearestHit.position.z), 10, ypos + 15, 10, BLACK);
|
||||
|
||||
DrawText(FormatText("Hit Norm: %3.2f %3.2f %3.2f",
|
||||
nearestHit.hitNormal.x,
|
||||
nearestHit.hitNormal.y,
|
||||
nearestHit.hitNormal.z), 10, ypos + 30, 10, BLACK);
|
||||
nearestHit.normal.x,
|
||||
nearestHit.normal.y,
|
||||
nearestHit.normal.z), 10, ypos + 30, 10, BLACK);
|
||||
|
||||
if (hitTriangle) DrawText(FormatText("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK);
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 232 KiB After Width: | Height: | Size: 189 KiB |
|
@ -38,8 +38,11 @@ int main()
|
|||
SetTextureFilter(font.texture, FILTER_POINT);
|
||||
int currentFontFilter = 0; // FILTER_POINT
|
||||
|
||||
// NOTE: Drag and drop support only available for desktop platforms: Windows, Linux, OSX
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
int count = 0;
|
||||
char **droppedFiles;
|
||||
#endif
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
@ -74,6 +77,7 @@ int main()
|
|||
if (IsKeyDown(KEY_LEFT)) fontPosition.x -= 10;
|
||||
else if (IsKeyDown(KEY_RIGHT)) fontPosition.x += 10;
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
// Load a dropped TTF file dynamically (at current fontSize)
|
||||
if (IsFileDropped())
|
||||
{
|
||||
|
@ -86,6 +90,7 @@ int main()
|
|||
ClearDroppedFiles();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
|
@ -119,9 +124,10 @@ int main()
|
|||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadSpriteFont(font); // SpriteFont unloading
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
ClearDroppedFiles(); // Clear internal buffers
|
||||
#endif
|
||||
UnloadSpriteFont(font); // SpriteFont unloading
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
|
@ -246,12 +246,14 @@ PHYSACDEF void ClosePhysics(void);
|
|||
#include <stdlib.h> // Required for: malloc(), free(), srand(), rand()
|
||||
#include <math.h> // Required for: cosf(), sinf(), fabs(), sqrtf()
|
||||
|
||||
#include "raymath.h" // Required for: Vector2Add(), Vector2Subtract()
|
||||
|
||||
#if defined(_WIN32)
|
||||
// Functions required to query time on Windows
|
||||
int __stdcall QueryPerformanceCounter(unsigned long long int *lpPerformanceCount);
|
||||
int __stdcall QueryPerformanceFrequency(unsigned long long int *lpFrequency);
|
||||
#elif defined(__linux__) || defined(PLATFORM_WEB)
|
||||
#define _DEFAULT_SOURCE // Enables BSD function definitions and C99 POSIX compliance
|
||||
//#define _DEFAULT_SOURCE // Enables BSD function definitions and C99 POSIX compliance
|
||||
#include <sys/time.h> // Required for: timespec
|
||||
#include <time.h> // Required for: clock_gettime()
|
||||
#include <stdint.h>
|
||||
|
|
|
@ -473,7 +473,7 @@ typedef struct Ray {
|
|||
Vector3 direction; // Ray direction
|
||||
} Ray;
|
||||
|
||||
// Information returned from a raycast
|
||||
// Raycast hit information
|
||||
typedef struct RayHitInfo {
|
||||
bool hit; // Did the ray hit something?
|
||||
float distance; // Distance to nearest hit
|
||||
|
@ -958,7 +958,6 @@ RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint
|
|||
RLAPI void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis,
|
||||
float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters
|
||||
RLAPI void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires)
|
||||
|
||||
RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint); // Draw a billboard texture
|
||||
RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec,
|
||||
Vector3 center, float size, Color tint); // Draw a billboard texture defined by sourceRec
|
||||
|
@ -1006,9 +1005,9 @@ RLAPI void EndBlendMode(void); // End
|
|||
// VR control functions
|
||||
RLAPI void InitVrSimulator(int vrDevice); // Init VR simulator for selected device
|
||||
RLAPI void CloseVrSimulator(void); // Close VR simulator for current device
|
||||
RLAPI bool IsVrSimulatorReady(void); // Detect if VR device 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 ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
|
||||
RLAPI void ToggleVrMode(void); // Enable/Disable VR experience
|
||||
RLAPI void BeginVrDrawing(void); // Begin VR simulator stereo rendering
|
||||
RLAPI void EndVrDrawing(void); // End VR simulator stereo rendering
|
||||
|
||||
|
|