Browse Source

Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop

pull/127/head
victorfisac 8 years ago
parent
commit
3524fc414b
12 changed files with 204 additions and 75 deletions
  1. +87
    -2
      CHANGELOG
  2. +1
    -1
      LICENSE.md
  3. +50
    -16
      README.md
  4. +10
    -4
      ROADMAP.md
  5. +1
    -1
      examples/Makefile
  6. +8
    -13
      examples/oculus_glfw_sample/distortion.fs
  7. +0
    -0
      examples/oculus_glfw_sample/rlgl_standalone.c
  8. +2
    -2
      examples/shaders_standard_lighting.c
  9. +15
    -14
      src/audio.c
  10. +25
    -17
      src/external/jar_mod.h
  11. +2
    -2
      src/rlgl.c
  12. +3
    -3
      src/standard_shader.h

+ 87
- 2
CHANGELOG View File

@ -1,16 +1,101 @@
changelog
---------
Current Release: raylib 1.4.0 (22 February 2016)
Current Release: raylib 1.5.0 (23 June 2016)
NOTE: Only versions marked as 'Release' are available in installer, updates are only available as source.
NOTE: Current Release includes all previous updates.
-----------------------------------------------
Release: raylib 1.5.0 (23 June 2016)
-----------------------------------------------
NOTE:
Probably this new version is the biggest boost of the library ever, lots of parts of the library have been redesigned,
lots of bugs have been solved and some **AMAZING** new features have been added.
HUGE changes:
[core] OCULUS RIFT CV1: Added support for VR witha bunch of Oculus-specific functions to init/close device and Oculus rendering.
[rlgl] MATERIALS SYSTEM: Added support for Materials (.mtl) and multiple material properties: diffuse, specular, normal.
[rlgl] LIGHTING SYSTEM: Added support for up to 8 lights of 3 different types: Omni, Directional and Spot
[physac] REDESIGNED: Improved performance and simplified usage, physic objects are managed internally
[audio] CHIPTUNES: Added support for module audio music (.xm, .mod) loading and playing
other changes:
[core] Review Android button inputs
[core] Support Android internal data storage
[core] Renamed WorldToScreen() to GetWorldToScreen()
[core] Removed function SetCustomCursor()
[core] Removed functions BeginDrawingEx(), BeginDrawingPro()
[core] Added support for field-of-view Y (fovy) on 3d Camera
[core] Added 2D camera mode functions: Begin2dMode() - End2dMode()
[core] Translate mouse inputs to Android touch/gestures internally
[core] Translate mouse inputs as touch inputs in HTML5
[core] Improved function GetKeyPressed() to support multiple keys (including function keys)
[core] Improved gamepad support, specially for RaspberryPi (including multiple gamepads support)
[rlgl] Improved 2D vs 3D drawing system (lines, triangles, quads)
[rlgl] Improved DXT-ETC1 support on HTML5
[rlgl] Review function: rlglUnproject()
[rlgl] Updated Mesh and Shader structs
[rlgl] Simplified internal (default) dynamic buffers
[rlgl] Added support for indexed and dynamic mesh data
[rlgl] Set fixed vertex attribs location points
[rlgl] Improved mesh data loading support
[rlgl] Added standard shader (embeded) to support materials and lighting: standard_shader.h
[rlgl] Added light functions: CreateLight(), DestroyLight()
[rlgl] Added wire mode functions: rlDisableWireMode(), rlEnableWireMode()
[rlgl] Review function consistency, added: rlglLoadMesh(), rlglUpdateMesh(), rlglDrawMesh(), rlglUnloadMesh()
[rlgl] Replaced SetCustomShader() by: BeginShaderMode() - EndShaderMode()
[rlgl] Replaced SetBlendMode() by: BeginBlendMode() - EndBlendMode()
[rlgl] Added functions to customize internal matrices: SetMatrixProjection(), SetMatrixModelview()
[rlgl] Unified internal shaders to only one default shader
[rlgl] Added support for render to texture (RenderTexture2D):
LoadRenderTexture() - UnloadRenderTexture()
BeginTextureMode() - EndTextureMode()
[rlgl] Removed SetShaderMap*() functions
[rlgl] Redesigned default buffers usage functions:
LoadDefaultBuffers() - UnloadDefaultBuffers()
UpdateDefaultBuffers() - DrawDefaultBuffers()
[shapes] Corrected bug on GetCollisionRec()
[textures] Added support for Nearest-Neighbor image scaling
[textures] Added functions to draw text on image: ImageDrawText(), ImageDrawTextEx()
[text] Reorganized internal functions: Added LoadImageFont()
[text] Security check for unsupported BMFonts
[models] Split mesh creation from model loading on heightmap and cubicmap
[models] Updated BoundingBox collision detections
[models] Added color parameter to DrawBoundigBox()
[models] Removed function: DrawQuad()
[models] Redesigned DrawPlane() to use RL_TRIANGLES
[models] Redesigned DrawRectangleV() to use RL_TRIANGLES
[models] Redesign to accomodate new materials system: LoadMaterial()
[models] Added material functions: LoadDefaultMaterial(), LoadStandardMaterial()
[models] Added MTL material loading support: LoadMTL()
[models] Added function: DrawLight()
[audio] Renamed SoundIsPlaying() to IsSoundPlaying()
[audio] Renamed MusicIsPlaying() to IsMusicPlaying()
[audio] Support multiple Music streams (indexed)
[gestures] Improved and reviewed gestures system
[raymath] Added QuaternionInvert()
[raymath] Removed function: PrintMatrix()
[raygui] Ported to header-only library
[shaders] Added depth drawing shader (requires a depth texture)
[shaders] Reviewed included shaders and added comments
[OpenAL Soft] Updated to latest version (1.17.2)
[GLFW3] Updated to latest version (3.2)
[GLAD] Converted to header only library
[stb] Updated to latest headers versions
[*] Reorganize library folders: external libs moved to src/external folder
[*] Reorganize src folder for Android library
[*] Review external dependencies usage
[*] Improved Linux and OSX build systems
[*] Lots of tweaks and bugs corrected all around
-----------------------------------------------
Release: raylib 1.4.0 (22 February 2016)
-----------------------------------------------
NOTE:
This version supposed another big improvement for raylib, inlcuding new modules and new features.
This version supposed another big improvement for raylib, including new modules and new features.
More than 30 new functions have been added to previous raylib version.
Around 8 new examples and +10 new game samples have been added.

+ 1
- 1
LICENSE.md View File

@ -7,7 +7,7 @@ source code
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:
Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
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.

+ 50
- 16
README.md View File

@ -101,40 +101,69 @@ Lots of code changes and lot of testing have concluded in this amazing new rayli
notes on raylib 1.4
-------------------
On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For this new version, lots of parts of the library have been reviewed, lots of bugs have been solved and some interesting features have been added.
On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For this new version,
lots of parts of the library have been reviewed, lots of bugs have been solved and some interesting features have been added.
First big addition is a set of [Image manipulation functions](https://github.com/raysan5/raylib/blob/develop/src/raylib.h#L673) have been added to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image. Now a basic image processing can be done before converting the image to texture for usage.
First big addition is a set of [Image manipulation functions](https://github.com/raysan5/raylib/blob/develop/src/raylib.h#L673) have been added to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image.
Now a basic image processing can be done before converting the image to texture for usage.
SpriteFonts system has been improved, adding support for AngelCode fonts (.fnt) and TrueType Fonts (using [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) helper library). Now raylib can read standard .fnt font data and also generate at loading a SpriteFont from a TTF file.
SpriteFonts system has been improved, adding support for AngelCode fonts (.fnt) and TrueType Fonts (using [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) helper library).
Now raylib can read standard .fnt font data and also generate at loading a SpriteFont from a TTF file.
New [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) physics module for basic 2D physics support. Still in development but already functional. Module comes with some usage examples for basic jump and level interaction and also force-based physic movements.
New [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) physics module for basic 2D physics support. Still in development but already functional.
Module comes with some usage examples for basic jump and level interaction and also force-based physic movements.
[raymath](https://github.com/raysan5/raylib/blob/develop/src/raymath.h) module has been reviewed; some bugs have been solved and the module has been converted to a header-only file for easier portability, optionally, functions can also be used as inline.
[gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse. This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code.
[gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse.
This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code.
Raspberry Pi input system has been redesigned to better read raw inputs using generic Linux event handlers (keyboard:`stdin`, mouse:`/dev/input/mouse0`, gamepad:`/dev/input/js0`). Gamepad support has also been added (experimental).
Raspberry Pi input system has been redesigned to better read raw inputs using generic Linux event handlers (keyboard:`stdin`, mouse:`/dev/input/mouse0`, gamepad:`/dev/input/js0`).
Gamepad support has also been added (experimental).
Other important improvements are the functional raycast system for 3D picking, including some ray collision-detection functions, and the addition of two simple functions for persistent data storage. Now raylib user can save and load game data in a file (only some platforms supported). A simple [easings](https://github.com/raysan5/raylib/blob/develop/src/easings.h) module has also been added for values animation.
Other important improvements are the functional raycast system for 3D picking, including some ray collision-detection functions,
and the addition of two simple functions for persistent data storage. Now raylib user can save and load game data in a file (only some platforms supported).
A simple [easings](https://github.com/raysan5/raylib/blob/develop/src/easings.h) module has also been added for values animation.
Up to 8 new code examples have been added to show the new raylib features and +10 complete game samples have been provided to learn how to create some classic games like Arkanoid, Asteroids, Missile Commander, Snake or Tetris.
Up to 8 new code examples have been added to show the new raylib features and +10 complete game samples have been provided to learn
how to create some classic games like Arkanoid, Asteroids, Missile Commander, Snake or Tetris.
Lots of code changes and lots of hours of hard work have concluded in this amazing new raylib 1.4.
notes on raylib 1.5
-------------------
On June 2016, after 4 months of raylib 1.4 release, arrives raylib 1.5. Probably this new version is the biggest boost of the library ever, lots of parts of the library have been redesigned, lots of bugs have been solved and some **AMAZING** new features have been added.
New platform support: **Oculus Rift CV1**. raylib introduces VR support for one of the most anticipated VR devices in the market.
Supporting Oculus Rift CV1 makes raylib the only (or one of the few) C libraries in the market to support VR out-of-the-box. Additionally, stereo mode rendering has been added to raylib independently of the VR device.
New materials system:
New lighting system:
Complete gamepad support on Raspberry Pi
Redesigned physics module: physac
Up to 8 new code examples have been added to show the new raylib features and the usage of multiple raylib modules as standalone libraries (rlgl, audio).
Lots of code changes (more than 250 commits) and lots of hours of hard work have concluded in this amazing new raylib 1.5.
features
--------
* Written in plain C code (C99)
* Uses C# PascalCase/camelCase notation
* Hardware accelerated with OpenGL (1.1, 3.3 or ES2)
* 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)
* Outstanding texture formats support, including compressed formats (DXT, ETC, PVRT, ASTC)
* Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps
* 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 (WAV and OGG)
* Audio loading and playing with streaming support (WAV, OGG, XM, MOD)
* Custom color palette for fancy visuals on raywhite background
* Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi** and **HTML5**
* Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi**, an class="gs">**HTML5** and **Oculus Rift CV1**
raylib uses on its core module the outstanding [GLFW3](http://www.glfw.org/) library. The best option by far I found for
multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, ...).
@ -191,21 +220,26 @@ If you feel you can help, then, [helpme!](http://www.raylib.com/helpme.htm)
acknowledgements
---------------
The following people have contributed in some way to make raylib project a reality. Big thanks to them!
I believe that time is the most valuable resource and the following people have invested part of their time
contributing (in some way or another) to make raylib project better. Huge thanks!
- [Zopokx](https://github.com/Zopokx) for testing the web.
- [Elendow](http://www.elendow.com) for testing and helping on web development.
- Victor Dual for implementating and testing of 3D shapes functions.
- Marc Palau for implementating and testing of 3D shapes functions and helping on development of camera and getures modules.
- Victor Dual for implementing and testing 3D shapes functions.
- Marc Palau for implementing and testing 3D shapes functions and contribute on camera and gestures modules.
- Kevin Gato for improving texture internal formats support and helping on raygui development.
- Daniel Nicolas for improving texture internal formats support and helping on raygui development.
- 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.
- Victor Fisac for developing physics raylib module (physac) and implementing light shaders and raycast system... and multiple tools and games.
- Sergio Martinez 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.
- [procedural](https://github.com/procedural) for testing raylib on Linux, correcting some bugs and adding several mouse functions.
- [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.
[raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"

+ 10
- 4
ROADMAP.md View File

@ -6,16 +6,22 @@ Here it is a wish list of features I would like to add and functions to improve.
Note that around the raylib source code there are multiple TODO points with pending revisions/bugs. Check [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details!
raylib 1.5
raylib 1.x
Redesign Shaders/Textures system, use Materials
Redesign physics module (physac)
[IN PROGRESS] LUA scripting support (wrapper to lua lib)
Basic GPU stats sytem (memory, draws, time...)
Procedural image generation functions (spot, gradient, noise...)
Procedural mesh generation functions (cube, cone, sphere...)
Touch-based camera controls for Android
Skybox and Fog support
[IN PROGRESS] LUA scripting support (wrapper to lua lib)
raylib 1.5
[DONE] Support Oculus Rift CV1
[DONE] Redesign Shaders/Textures system -> New Materials system
[DONE] Support lighting: Omni, Directional and Spot lights
[DONE] Redesign physics module (physac)
[DONE] Chiptunes audio modules support
raylib 1.4

+ 1
- 1
examples/Makefile View File

@ -2,7 +2,7 @@
#
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
#
# Copyright (c) 2015 Ramon Santamaria (@raysan5)
# Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
#
# 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.

+ 8
- 13
examples/oculus_glfw_sample/distortion.fs View File

@ -33,11 +33,11 @@ Right Lens Center = {0.712005913, 0.5, 0, 0}
// Scales input texture coordinates for distortion.
vec2 HmdWarp(vec2 in01, vec2 LensCenter)
{
vec2 theta = (in01 - LensCenter) * ScaleIn; // Scales to [-1, 1]
float rSq = theta.x * theta.x + theta.y * theta.y;
vec2 rvector = theta * (HmdWarpParam.x + HmdWarpParam.y * rSq + HmdWarpParam.z * rSq * rSq + HmdWarpParam.w * rSq * rSq * rSq);
vec2 theta = (in01 - LensCenter)*ScaleIn; // Scales to [-1, 1]
float rSq = theta.x*theta.x + theta.y*theta.y;
vec2 rvector = theta*(HmdWarpParam.x + HmdWarpParam.y*rSq + HmdWarpParam.z*rSq*rSq + HmdWarpParam.w*rSq*rSq*rSq);
return LensCenter + nf">Scale * rvector;
return LensCenter + err">Scale*rvector;
}
void main()
@ -48,17 +48,12 @@ void main()
vec2 LensCenter = gl_FragCoord.x < 540 ? LeftLensCenter : RightLensCenter;
vec2 ScreenCenter = gl_FragCoord.x < 540 ? LeftScreenCenter : RightScreenCenter;
//vec2 oTexCoord = (gl_FragCoord.xy + vec2(0.5, 0.5)) / vec2(1280, 800); //Uncomment if using BGE's built-in stereo rendering
vec2 tc = HmdWarp(fragTexCoord, LensCenter);
if (any(bvec2(clamp(tc,ScreenCenter-vec2(0.25,0.5), ScreenCenter+vec2(0.25,0.5)) - tc)))
{
gl_FragColor = vec4(vec3(0.0), 1.0);
}
if (any(bvec2(clamp(tc,ScreenCenter-vec2(0.25,0.5), ScreenCenter+vec2(0.25,0.5)) - tc))) finalColor = vec4(0.0, 0.0, 0.0, 1.0);
else
{
//tc.x = gl_FragCoord.x < 640 ? (2.0 * tc.x) : (2.0 * (tc.x - 0.5nf">)); //Uncomment if using BGE's built-in stereo rendering
gl_FragColor = texture2D(texture0, tc);
//tc.x = gl_FragCoord.x < 640 ? (2.0 * tc.x) : (2.0 * (tc.x - 0.5));
finalColor = texture2D(texture0, tc);
}
}
}

examples/oculus_glfw_sample/raylib_rlgl_standalone.c → examples/oculus_glfw_sample/rlgl_standalone.c View File


+ 2
- 2
examples/shaders_standard_lighting.c View File

@ -22,8 +22,8 @@ int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 1280;
int screenHeight = 720;
int screenWidth = 800;
int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT); // Enable Multi Sampling Anti Aliasing 4x (if available)

+ 15
- 14
src/audio.c View File

@ -107,6 +107,7 @@ typedef struct Music {
float totalLengthSeconds;
bool loop;
bool chipTune; // chiptune is loaded?
bool enabled;
} Music;
// Audio errors registered
@ -831,7 +832,7 @@ int PlayMusicStream(int index, char *fileName)
TraceLog(DEBUG, "[%s] Temp memory required: %i", fileName, info.temp_memory_required);
musicChannels_g[index].loop = true; // We loop by default
musicEnabled_g = true;
musicChannels_g[index].enabled = true;
musicChannels_g[index].totalSamplesLeft = (unsigned int)stb_vorbis_stream_length_in_samples(musicChannels_g[index].stream) * info.channels;
@ -861,7 +862,7 @@ int PlayMusicStream(int index, char *fileName)
jar_xm_set_max_loop_count(musicChannels_g[index].xmctx, 0); // infinite number of loops
musicChannels_g[index].totalSamplesLeft = (unsigned int)jar_xm_get_remaining_samples(musicChannels_g[index].xmctx);
musicChannels_g[index].totalLengthSeconds = ((float)musicChannels_g[index].totalSamplesLeft) / 48000.f;
musicEnabled_g = true;
musicChannels_g[index].enabled = true;
TraceLog(INFO, "[%s] XM number of samples: %i", fileName, musicChannels_g[index].totalSamplesLeft);
TraceLog(INFO, "[%s] XM track length: %11.6f sec", fileName, musicChannels_g[index].totalLengthSeconds);
@ -888,7 +889,7 @@ int PlayMusicStream(int index, char *fileName)
musicChannels_g[index].loop = true;
musicChannels_g[index].totalSamplesLeft = (unsigned int)jar_mod_max_samples(&musicChannels_g[index].modctx);
musicChannels_g[index].totalLengthSeconds = ((float)musicChannels_g[index].totalSamplesLeft) / 48000.f;
musicEnabled_g = true;
musicChannels_g[index].enabled = true;
TraceLog(INFO, "[%s] MOD number of samples: %i", fileName, musicChannels_g[index].totalSamplesLeft);
TraceLog(INFO, "[%s] MOD track length: %11.6f sec", fileName, musicChannels_g[index].totalLengthSeconds);
@ -921,15 +922,14 @@ void StopMusicStream(int index)
{
CloseMixChannel(musicChannels_g[index].mixc);
if (musicChannels_g[index].chipTune && musicChannels_g[index].xmctx)
{
if (musicChannels_g[index].xmctx)
jar_xm_free_context(musicChannels_g[index].xmctx);
musicChannels_g[index].xmctx = 0;
}
else if (musicChannels_g[index].chipTune && musicChannels_g[index].modctx.mod_loaded) jar_mod_unload(&musicChannels_g[index].modctx);
else stb_vorbis_close(musicChannels_g[index].stream);
class="k">else class="k">if p">(musicChannels_g[index].modctx.mod_loaded)
jar_mod_unload(&musicChannels_g[index].modctx);
else
stb_vorbis_close(musicChannels_g[index].stream);
k">if (!GetMusicStreamCount()) musicEnabled_g = false;
n">musicChannels_g[index].enabled = false;
if (musicChannels_g[index].stream || musicChannels_g[index].xmctx)
{
@ -957,7 +957,7 @@ int GetMusicStreamCount(void)
void PauseMusicStream(int index)
{
// Pause music stream if music available!
if (index < MAX_MUSIC_STREAMS && musicChannels_g[index].mixc && musicEnabled_g)
if (index < MAX_MUSIC_STREAMS && musicChannels_g[index].mixc && musicChannels_g[index].enabled)
{
TraceLog(INFO, "Pausing music stream");
alSourcePause(musicChannels_g[index].mixc->alSource);
@ -1154,7 +1154,7 @@ void UpdateMusicStream(int index)
bool active = true;
int numBuffers = IsMusicStreamReadyForBuffering(index);
if (musicChannels_g[index].mixc->playing && (index < MAX_MUSIC_STREAMS) && musicEnabled_g && musicChannels_g[index].mixc && numBuffers)
if (musicChannels_g[index].mixc->playing && (index < MAX_MUSIC_STREAMS) && musicChannels_g[index].enabled && musicChannels_g[index].mixc && numBuffers)
{
active = BufferMusicStream(index, numBuffers);
@ -1163,7 +1163,8 @@ void UpdateMusicStream(int index)
if (musicChannels_g[index].chipTune)
{
if(musicChannels_g[index].modctx.mod_loaded) jar_mod_seek_start(&musicChannels_g[index].modctx);
musicChannels_g[index].totalSamplesLeft = musicChannels_g[index].totalLengthSeconds * 48000;
musicChannels_g[index].totalSamplesLeft = musicChannels_g[index].totalLengthSeconds * 48000.f;
}
else
{
@ -1171,7 +1172,7 @@ void UpdateMusicStream(int index)
musicChannels_g[index].totalSamplesLeft = stb_vorbis_stream_length_in_samples(musicChannels_g[index].stream) * musicChannels_g[index].mixc->channels;
}
active = b">true;
active = BufferMusicStream(index, IsMusicStreamReadyForBuffering(index));
}
if (alGetError() != AL_NO_ERROR) TraceLog(WARNING, "Error buffering data...");

+ 25
- 17
src/external/jar_mod.h View File

@ -1063,7 +1063,6 @@ bool jar_mod_init(jar_mod_context_t * modctx)
modctx->stereo_separation = 1;
modctx->bits = 16;
modctx->filter = 1;
modctx->loopcount = 0;
for(i=0; i < PERIOD_TABLE_LENGTH - 1; i++)
{
@ -1472,7 +1471,7 @@ void jar_mod_fillbuffer( jar_mod_context_t * modctx, short * outbuffer, unsigned
}
//resets internals for mod context
static void jar_mod_reset( jar_mod_context_t * modctx)
static bool jar_mod_reset( jar_mod_context_t * modctx)
{
if(modctx)
{
@ -1488,7 +1487,6 @@ static void jar_mod_reset( jar_mod_context_t * modctx)
modctx->patterntickse = 0;
modctx->patternticksaim = 0;
modctx->sampleticksconst = 0;
modctx->loopcount = 0;
modctx->samplenb = 0;
memclear(modctx->channels, 0, sizeof(modctx->channels));
modctx->number_of_channels = 0;
@ -1496,8 +1494,9 @@ static void jar_mod_reset( jar_mod_context_t * modctx)
modctx->last_r_sample = 0;
modctx->last_l_sample = 0;
jar_mod_init(modctx);
k">return jar_mod_init(modctx);
}
return 0;
}
void jar_mod_unload( jar_mod_context_t * modctx)
@ -1508,6 +1507,8 @@ void jar_mod_unload( jar_mod_context_t * modctx)
{
free(modctx->modfile);
modctx->modfile = 0;
modctx->modfilesize = 0;
modctx->loopcount = 0;
}
jar_mod_reset(modctx);
}
@ -1556,27 +1557,34 @@ mulong jar_mod_current_samples(jar_mod_context_t * modctx)
// Works, however it is very slow, this data should be cached to ensure it is run only once per file
mulong jar_mod_max_samples(jar_mod_context_t * ctx)
{
jar_mod_context_t tmpctx;
jar_mod_init(&tmpctx);
if(!jar_mod_load(&tmpctx, (void*)ctx->modfile, ctx->modfilesize)) return 0;
muint buff[2];
mulong lastcount = tmpctx.loopcount;
mulong len;
mulong lastcount = ctx->loopcount;
while(1){
jar_mod_fillbuffer( &tmpctx, buff, 1, 0 );
if(tmpctx.loopcount > lastcount) break;
}
return tmpctx.samplenb;
while(ctx->loopcount <= lastcount)
jar_mod_fillbuffer(ctx, buff, 1, 0);
len = ctx->samplenb;
jar_mod_seek_start(ctx);
return len;
}
// move seek_val to sample index, 0 -> jar_mod_max_samples is the range
void jar_mod_seek_start(jar_mod_context_t * ctx)
{
if(ctx)
if(ctx && ctx->modfile)
{
jar_mod_reset(ctx);
jar_mod_load(ctx, ctx->modfile, ctx->modfilesize);
muchar* ftmp = ctx->modfile;
mulong stmp = ctx->modfilesize;
muint lcnt = ctx->loopcount;
if(jar_mod_reset(ctx)){
jar_mod_load(ctx, ftmp, stmp);
ctx->modfile = ftmp;
ctx->modfilesize = stmp;
ctx->loopcount = lcnt;
}
}
}

+ 2
- 2
src/rlgl.c View File

@ -236,7 +236,7 @@ unsigned int whiteTexture;
//----------------------------------------------------------------------------------
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
static void LoadCompressedTexture(unsigned char *data, int width, int height, int mipmapCount, int compressedFormat);
static unsigned int LoadShaderProgram(char *vShaderStr, char *fShaderStr); // Load custom shader strings and return program id
static unsigned int LoadShaderProgram(">const char *vShaderStr, const char *fShaderStr); // Load custom shader strings and return program id
static Shader LoadDefaultShader(void); // Load default shader (just vertex positioning and texture coloring)
static Shader LoadStandardShader(void); // Load standard shader (support materials and lighting)
@ -2403,7 +2403,7 @@ static void LoadCompressedTexture(unsigned char *data, int width, int height, in
}
// Load custom shader strings and return program id
static unsigned int LoadShaderProgram(char *vShaderStr, char *fShaderStr)
static unsigned int LoadShaderProgram(">const char *vShaderStr, const char *fShaderStr)
{
unsigned int program = 0;

+ 3
- 3
src/standard_shader.h View File

@ -1,6 +1,6 @@
// Vertex shader definition to embed, no external file required
const static unsigned char vStandardShaderStr[] =
static const char vStandardShaderStr[] =
#if defined(GRAPHICS_API_OPENGL_21)
"#version 120 \n"
#elif defined(GRAPHICS_API_OPENGL_ES2)
@ -37,7 +37,7 @@ const static unsigned char vStandardShaderStr[] =
"} \n";
// Fragment shader definition to embed, no external file required
const static unsigned char fStandardShaderStr[] =
static const char fStandardShaderStr[] =
#if defined(GRAPHICS_API_OPENGL_21)
"#version 120 \n"
#elif defined(GRAPHICS_API_OPENGL_ES2)
@ -163,4 +163,4 @@ const static unsigned char fStandardShaderStr[] =
#elif defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_21)
" gl_FragColor = vec4(texelColor.rgb*lighting*colDiffuse.rgb, texelColor.a*colDiffuse.a); \n"
#endif
"} \n";
"}\n";

Loading…
Cancel
Save