Reviewed some comments
This commit is contained in:
parent
6d56c99a37
commit
4211056354
4 changed files with 53 additions and 69 deletions
20
src/raudio.c
20
src/raudio.c
|
@ -221,20 +221,20 @@ struct rAudioBuffer {
|
||||||
#define AudioBuffer rAudioBuffer // HACK: To avoid CoreAudio (macOS) symbol collision
|
#define AudioBuffer rAudioBuffer // HACK: To avoid CoreAudio (macOS) symbol collision
|
||||||
|
|
||||||
// Audio buffers are tracked in a linked list
|
// Audio buffers are tracked in a linked list
|
||||||
static AudioBuffer *firstAudioBuffer = NULL;
|
static AudioBuffer *firstAudioBuffer = NULL; // Pointer to first AudioBuffer in the list
|
||||||
static AudioBuffer *lastAudioBuffer = NULL;
|
static AudioBuffer *lastAudioBuffer = NULL; // Pointer to last AudioBuffer in the list
|
||||||
|
|
||||||
// miniaudio global variables
|
// miniaudio global variables
|
||||||
static ma_context context;
|
static ma_context context; // miniaudio context data
|
||||||
static ma_device device;
|
static ma_device device; // miniaudio device
|
||||||
static ma_mutex audioLock;
|
static ma_mutex audioLock; // miniaudio mutex lock
|
||||||
static bool isAudioInitialized = false;
|
static bool isAudioInitialized = false; // Check if audio device is initialized
|
||||||
static float masterVolume = 1.0f;
|
static float masterVolume = 1.0f; // Master volume (multiplied on output mixing)
|
||||||
|
|
||||||
// Multi channel playback global variables
|
// Multi channel playback global variables
|
||||||
AudioBuffer *audioBufferPool[MAX_AUDIO_BUFFER_POOL_CHANNELS] = { 0 };
|
static AudioBuffer *audioBufferPool[MAX_AUDIO_BUFFER_POOL_CHANNELS] = { 0 }; // Multichannel AudioBuffer pointers pool
|
||||||
unsigned int audioBufferPoolCounter = 0;
|
static unsigned int audioBufferPoolCounter = 0; // AudioBuffer pointers pool counter
|
||||||
unsigned int audioBufferPoolChannels[MAX_AUDIO_BUFFER_POOL_CHANNELS] = { 0 };
|
static unsigned int audioBufferPoolChannels[MAX_AUDIO_BUFFER_POOL_CHANNELS] = { 0 }; // AudioBuffer pool channels
|
||||||
|
|
||||||
// miniaudio functions declaration
|
// miniaudio functions declaration
|
||||||
static void OnLog(ma_context *pContext, ma_device *pDevice, ma_uint32 logLevel, const char *message);
|
static void OnLog(ma_context *pContext, ma_device *pDevice, ma_uint32 logLevel, const char *message);
|
||||||
|
|
64
src/rlgl.h
64
src/rlgl.h
|
@ -767,69 +767,53 @@ typedef struct VrStereoConfig {
|
||||||
// Global Variables Definition
|
// Global Variables Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
static Matrix stack[MAX_MATRIX_STACK_SIZE] = { 0 };
|
static Matrix stack[MAX_MATRIX_STACK_SIZE] = { 0 }; // Matrix stack for push/pop
|
||||||
static int stackCounter = 0;
|
static int stackCounter = 0; // Matrix stack counter
|
||||||
|
static Matrix modelview = { 0 }; // Default modelview matrix
|
||||||
static Matrix modelview = { 0 };
|
static Matrix projection = { 0 }; // Default projection matrix
|
||||||
static Matrix projection = { 0 };
|
static Matrix *currentMatrix = NULL; // Current matrix pointer
|
||||||
static Matrix *currentMatrix = NULL;
|
static int currentMatrixMode = -1; // Current matrix mode
|
||||||
static int currentMatrixMode = -1;
|
static float currentDepth = -1.0f; // Current depth value
|
||||||
static float currentDepth = -1.0f;
|
|
||||||
|
|
||||||
// Default dynamic buffer for elements data
|
// Default dynamic buffer for elements data
|
||||||
// NOTE: A multi-buffering system is supported
|
// NOTE: A multi-buffering system is supported
|
||||||
static DynamicBuffer vertexData[MAX_BATCH_BUFFERING] = { 0 };
|
static DynamicBuffer vertexData[MAX_BATCH_BUFFERING] = { 0 };
|
||||||
static int currentBuffer = 0;
|
static int currentBuffer = 0; // Current buffer tracking
|
||||||
|
|
||||||
// Transform matrix to be used with rlTranslate, rlRotate, rlScale
|
static Matrix transformMatrix = { 0 }; // Transform matrix to be used with rlTranslate, rlRotate, rlScale
|
||||||
static Matrix transformMatrix = { 0 };
|
static bool useTransformMatrix = false; // Use transform matrix against vertex (if required)
|
||||||
static bool useTransformMatrix = false;
|
|
||||||
|
|
||||||
// Default buffers draw calls
|
static DrawCall *draws = NULL; // Draw calls array
|
||||||
static DrawCall *draws = NULL;
|
static int drawsCounter = 0; // Draw calls counter
|
||||||
static int drawsCounter = 0;
|
|
||||||
|
|
||||||
// Default texture (1px white) useful for plain color polys (required by shader)
|
static unsigned int defaultTextureId = 0; // Default texture used on shapes/poly drawing (required by shader)
|
||||||
static unsigned int defaultTextureId = 0;
|
|
||||||
|
|
||||||
// Default shaders
|
|
||||||
static unsigned int defaultVShaderId = 0; // Default vertex shader id (used by default shader program)
|
static unsigned int defaultVShaderId = 0; // Default vertex shader id (used by default shader program)
|
||||||
static unsigned int defaultFShaderId = 0; // Default fragment shader Id (used by default shader program)
|
static unsigned int defaultFShaderId = 0; // Default fragment shader Id (used by default shader program)
|
||||||
|
|
||||||
static Shader defaultShader = { 0 }; // Basic shader, support vertex color and diffuse texture
|
static Shader defaultShader = { 0 }; // Basic shader, support vertex color and diffuse texture
|
||||||
static Shader currentShader = { 0 }; // Shader to be used on rendering (by default, defaultShader)
|
static Shader currentShader = { 0 }; // Shader to be used on rendering (by default, defaultShader)
|
||||||
|
|
||||||
// Extension supported flag: VAO
|
// Extensions supported flags
|
||||||
static bool vaoSupported = false; // VAO support (OpenGL ES2 could not support VAO extension)
|
static bool vaoSupported = false; // VAO support (OpenGL ES2 could not support VAO extension)
|
||||||
|
|
||||||
// Extension supported flag: Compressed textures
|
|
||||||
static bool texCompDXTSupported = false; // DDS texture compression support
|
static bool texCompDXTSupported = false; // DDS texture compression support
|
||||||
static bool texCompETC1Supported = false; // ETC1 texture compression support
|
static bool texCompETC1Supported = false; // ETC1 texture compression support
|
||||||
static bool texCompETC2Supported = false; // ETC2/EAC texture compression support
|
static bool texCompETC2Supported = false; // ETC2/EAC texture compression support
|
||||||
static bool texCompPVRTSupported = false; // PVR texture compression support
|
static bool texCompPVRTSupported = false; // PVR texture compression support
|
||||||
static bool texCompASTCSupported = false; // ASTC texture compression support
|
static bool texCompASTCSupported = false; // ASTC texture compression support
|
||||||
|
|
||||||
// Extension supported flag: Textures format
|
|
||||||
static bool texNPOTSupported = false; // NPOT textures full support
|
static bool texNPOTSupported = false; // NPOT textures full support
|
||||||
static bool texFloatSupported = false; // float textures support (32 bit per channel)
|
static bool texFloatSupported = false; // float textures support (32 bit per channel)
|
||||||
static bool texDepthSupported = false; // Depth textures supported
|
static bool texDepthSupported = false; // Depth textures supported
|
||||||
static int maxDepthBits = 16; // Maximum bits for depth component
|
static bool texMirrorClampSupported = false;// Clamp mirror wrap mode supported
|
||||||
|
static bool texAnisoFilterSupported = false;// Anisotropic texture filtering support
|
||||||
// Extension supported flag: Clamp mirror wrap mode
|
|
||||||
static bool texMirrorClampSupported = false; // Clamp mirror wrap mode supported
|
|
||||||
|
|
||||||
// Extension supported flag: Anisotropic filtering
|
|
||||||
static bool texAnisotropicFilterSupported = false; // Anisotropic texture filtering support
|
|
||||||
static float maxAnisotropicLevel = 0.0f; // Maximum anisotropy level supported (minimum is 2.0f)
|
|
||||||
|
|
||||||
static bool debugMarkerSupported = false; // Debug marker support
|
static bool debugMarkerSupported = false; // Debug marker support
|
||||||
|
static int maxDepthBits = 16; // Maximum bits for depth component
|
||||||
|
static float maxAnisotropicLevel = 0.0f; // Maximum anisotropy level supported (minimum is 2.0f)
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
// NOTE: VAO functionality is exposed through extensions (OES)
|
// NOTE: VAO functionality is exposed through extensions (OES)
|
||||||
static PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays;
|
static PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays; // Entry point pointer to function glGenVertexArrays()
|
||||||
static PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray;
|
static PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray; // Entry point pointer to function glBindVertexArray()
|
||||||
static PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays;
|
static PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays; // Entry point pointer to function glDeleteVertexArrays()
|
||||||
//static PFNGLISVERTEXARRAYOESPROC glIsVertexArray; // NOTE: Fails in WebGL, omitted
|
//static PFNGLISVERTEXARRAYOESPROC glIsVertexArray; // NOTE: Fails in WebGL, omitted
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SUPPORT_VR_SIMULATOR)
|
#if defined(SUPPORT_VR_SIMULATOR)
|
||||||
|
@ -1619,7 +1603,7 @@ void rlglInit(int width, int height)
|
||||||
// Anisotropic texture filter support
|
// Anisotropic texture filter support
|
||||||
if (strcmp(extList[i], (const char *)"GL_EXT_texture_filter_anisotropic") == 0)
|
if (strcmp(extList[i], (const char *)"GL_EXT_texture_filter_anisotropic") == 0)
|
||||||
{
|
{
|
||||||
texAnisotropicFilterSupported = true;
|
texAnisoFilterSupported = true;
|
||||||
glGetFloatv(0x84FF, &maxAnisotropicLevel); // GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
|
glGetFloatv(0x84FF, &maxAnisotropicLevel); // GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1649,7 +1633,7 @@ void rlglInit(int width, int height)
|
||||||
if (texCompPVRTSupported) TraceLog(LOG_INFO, "[EXTENSION] PVRT compressed textures supported");
|
if (texCompPVRTSupported) TraceLog(LOG_INFO, "[EXTENSION] PVRT compressed textures supported");
|
||||||
if (texCompASTCSupported) TraceLog(LOG_INFO, "[EXTENSION] ASTC compressed textures supported");
|
if (texCompASTCSupported) TraceLog(LOG_INFO, "[EXTENSION] ASTC compressed textures supported");
|
||||||
|
|
||||||
if (texAnisotropicFilterSupported) TraceLog(LOG_INFO, "[EXTENSION] Anisotropic textures filtering supported (max: %.0fX)", maxAnisotropicLevel);
|
if (texAnisoFilterSupported) TraceLog(LOG_INFO, "[EXTENSION] Anisotropic textures filtering supported (max: %.0fX)", maxAnisotropicLevel);
|
||||||
if (texMirrorClampSupported) TraceLog(LOG_INFO, "[EXTENSION] Mirror clamp wrap texture mode supported");
|
if (texMirrorClampSupported) TraceLog(LOG_INFO, "[EXTENSION] Mirror clamp wrap texture mode supported");
|
||||||
|
|
||||||
if (debugMarkerSupported) TraceLog(LOG_INFO, "[EXTENSION] Debug Marker supported");
|
if (debugMarkerSupported) TraceLog(LOG_INFO, "[EXTENSION] Debug Marker supported");
|
||||||
|
|
|
@ -58,8 +58,8 @@
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Global Variables Definition
|
// Global Variables Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
static Texture2D texShapes = { 0 };
|
static Texture2D texShapes = { 0 }; // Texture used on shapes drawing (usually a white)
|
||||||
static Rectangle recTexShapes = { 0 };
|
static Rectangle recTexShapes = { 0 }; // Texture source rectangle used on shapes drawing
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module specific Functions Declaration
|
// Module specific Functions Declaration
|
||||||
|
|
34
src/utils.c
34
src/utils.c
|
@ -52,17 +52,26 @@
|
||||||
|
|
||||||
#define MAX_TRACELOG_BUFFER_SIZE 128 // Max length of one trace-log message
|
#define MAX_TRACELOG_BUFFER_SIZE 128 // Max length of one trace-log message
|
||||||
|
|
||||||
|
#define MAX_UWP_MESSAGES 512 // Max UWP messages to process
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Global Variables Definition
|
// Global Variables Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Log types messages
|
// Log types messages
|
||||||
static int logTypeLevel = LOG_INFO;
|
static int logTypeLevel = LOG_INFO; // Minimum log type level
|
||||||
static int logTypeExit = LOG_ERROR;
|
static int logTypeExit = LOG_ERROR; // Log type that exits
|
||||||
static TraceLogCallback logCallback = NULL;
|
static TraceLogCallback logCallback = NULL; // Log callback function pointer
|
||||||
|
|
||||||
#if defined(PLATFORM_ANDROID)
|
#if defined(PLATFORM_ANDROID)
|
||||||
AAssetManager *assetManager = NULL;
|
static AAssetManager *assetManager = NULL; // Android assets manager pointer
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PLATFORM_UWP)
|
||||||
|
static int UWPOutMessageId = -1; // Last index of output message
|
||||||
|
static UWPMessage *UWPOutMessages[MAX_UWP_MESSAGES]; // Messages out to UWP
|
||||||
|
static int UWPInMessageId = -1; // Last index of input message
|
||||||
|
static UWPMessage *UWPInMessages[MAX_UWP_MESSAGES]; // Messages in from UWP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@ -204,16 +213,7 @@ static int android_close(void *cookie)
|
||||||
#endif // PLATFORM_ANDROID
|
#endif // PLATFORM_ANDROID
|
||||||
|
|
||||||
#if defined(PLATFORM_UWP)
|
#if defined(PLATFORM_UWP)
|
||||||
|
UWPMessage *CreateUWPMessage(void)
|
||||||
#define MAX_MESSAGES 512 // If there are over 128 messages, I will cry... either way, this may be too much EDIT: Welp, 512
|
|
||||||
|
|
||||||
static int UWPOutMessageId = -1; // Stores the last index for the message
|
|
||||||
static UWPMessage* UWPOutMessages[MAX_MESSAGES]; // Messages out to UWP
|
|
||||||
|
|
||||||
static int UWPInMessageId = -1; // Stores the last index for the message
|
|
||||||
static UWPMessage* UWPInMessages[MAX_MESSAGES]; // Messages in from UWP
|
|
||||||
|
|
||||||
UWPMessage* CreateUWPMessage(void)
|
|
||||||
{
|
{
|
||||||
UWPMessage *msg = (UWPMessage *)RL_MALLOC(sizeof(UWPMessage));
|
UWPMessage *msg = (UWPMessage *)RL_MALLOC(sizeof(UWPMessage));
|
||||||
msg->type = UWP_MSG_NONE;
|
msg->type = UWP_MSG_NONE;
|
||||||
|
@ -247,7 +247,7 @@ UWPMessage *UWPGetMessage(void)
|
||||||
|
|
||||||
void UWPSendMessage(UWPMessage *msg)
|
void UWPSendMessage(UWPMessage *msg)
|
||||||
{
|
{
|
||||||
if (UWPInMessageId + 1 < MAX_MESSAGES)
|
if ((UWPInMessageId + 1) < MAX_UWP_MESSAGES)
|
||||||
{
|
{
|
||||||
UWPInMessageId++;
|
UWPInMessageId++;
|
||||||
UWPInMessages[UWPInMessageId] = msg;
|
UWPInMessages[UWPInMessageId] = msg;
|
||||||
|
@ -257,7 +257,7 @@ void UWPSendMessage(UWPMessage *msg)
|
||||||
|
|
||||||
void SendMessageToUWP(UWPMessage *msg)
|
void SendMessageToUWP(UWPMessage *msg)
|
||||||
{
|
{
|
||||||
if (UWPOutMessageId + 1 < MAX_MESSAGES)
|
if ((UWPOutMessageId + 1) < MAX_UWP_MESSAGES)
|
||||||
{
|
{
|
||||||
UWPOutMessageId++;
|
UWPOutMessageId++;
|
||||||
UWPOutMessages[UWPOutMessageId] = msg;
|
UWPOutMessages[UWPOutMessageId] = msg;
|
||||||
|
@ -270,7 +270,7 @@ bool HasMessageFromUWP(void)
|
||||||
return UWPInMessageId > -1;
|
return UWPInMessageId > -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UWPMessage* GetMessageFromUWP(void)
|
UWPMessage *GetMessageFromUWP(void)
|
||||||
{
|
{
|
||||||
if (HasMessageFromUWP()) return UWPInMessages[UWPInMessageId--];
|
if (HasMessageFromUWP()) return UWPInMessages[UWPInMessageId--];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue