Reviewed some comments

This commit is contained in:
Ray 2020-01-08 18:21:08 +01:00
parent 6d56c99a37
commit 4211056354
4 changed files with 53 additions and 69 deletions

View File

@ -221,20 +221,20 @@ struct rAudioBuffer {
#define AudioBuffer rAudioBuffer // HACK: To avoid CoreAudio (macOS) symbol collision
// Audio buffers are tracked in a linked list
static AudioBuffer *firstAudioBuffer = NULL;
static AudioBuffer *lastAudioBuffer = NULL;
static AudioBuffer *firstAudioBuffer = NULL; // Pointer to first AudioBuffer in the list
static AudioBuffer *lastAudioBuffer = NULL; // Pointer to last AudioBuffer in the list
// miniaudio global variables
static ma_context context;
static ma_device device;
static ma_mutex audioLock;
static bool isAudioInitialized = false;
static float masterVolume = 1.0f;
static ma_context context; // miniaudio context data
static ma_device device; // miniaudio device
static ma_mutex audioLock; // miniaudio mutex lock
static bool isAudioInitialized = false; // Check if audio device is initialized
static float masterVolume = 1.0f; // Master volume (multiplied on output mixing)
// Multi channel playback global variables
AudioBuffer *audioBufferPool[MAX_AUDIO_BUFFER_POOL_CHANNELS] = { 0 };
unsigned int audioBufferPoolCounter = 0;
unsigned int audioBufferPoolChannels[MAX_AUDIO_BUFFER_POOL_CHANNELS] = { 0 };
static AudioBuffer *audioBufferPool[MAX_AUDIO_BUFFER_POOL_CHANNELS] = { 0 }; // Multichannel AudioBuffer pointers pool
static unsigned int audioBufferPoolCounter = 0; // AudioBuffer pointers pool counter
static unsigned int audioBufferPoolChannels[MAX_AUDIO_BUFFER_POOL_CHANNELS] = { 0 }; // AudioBuffer pool channels
// miniaudio functions declaration
static void OnLog(ma_context *pContext, ma_device *pDevice, ma_uint32 logLevel, const char *message);

View File

@ -767,69 +767,53 @@ typedef struct VrStereoConfig {
// Global Variables Definition
//----------------------------------------------------------------------------------
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
static Matrix stack[MAX_MATRIX_STACK_SIZE] = { 0 };
static int stackCounter = 0;
static Matrix modelview = { 0 };
static Matrix projection = { 0 };
static Matrix *currentMatrix = NULL;
static int currentMatrixMode = -1;
static float currentDepth = -1.0f;
static Matrix stack[MAX_MATRIX_STACK_SIZE] = { 0 }; // Matrix stack for push/pop
static int stackCounter = 0; // Matrix stack counter
static Matrix modelview = { 0 }; // Default modelview matrix
static Matrix projection = { 0 }; // Default projection matrix
static Matrix *currentMatrix = NULL; // Current matrix pointer
static int currentMatrixMode = -1; // Current matrix mode
static float currentDepth = -1.0f; // Current depth value
// Default dynamic buffer for elements data
// NOTE: A multi-buffering system is supported
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 };
static bool useTransformMatrix = false;
static Matrix transformMatrix = { 0 }; // Transform matrix to be used with rlTranslate, rlRotate, rlScale
static bool useTransformMatrix = false; // Use transform matrix against vertex (if required)
// Default buffers draw calls
static DrawCall *draws = NULL;
static int drawsCounter = 0;
static DrawCall *draws = NULL; // Draw calls array
static int drawsCounter = 0; // Draw calls counter
// Default texture (1px white) useful for plain color polys (required by shader)
static unsigned int defaultTextureId = 0;
// Default shaders
static unsigned int defaultTextureId = 0; // Default texture used on shapes/poly drawing (required by shader)
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 Shader defaultShader = { 0 }; // Basic shader, support vertex color and diffuse texture
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)
// Extension supported flag: Compressed textures
static bool texCompDXTSupported = false; // DDS texture compression support
static bool texCompETC1Supported = false; // ETC1 texture compression support
static bool texCompETC2Supported = false; // ETC2/EAC texture compression support
static bool texCompPVRTSupported = false; // PVR 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 texFloatSupported = false; // float textures support (32 bit per channel)
static bool texDepthSupported = false; // Depth textures supported
static int maxDepthBits = 16; // Maximum bits for depth component
// 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 texMirrorClampSupported = false;// Clamp mirror wrap mode supported
static bool texAnisoFilterSupported = false;// Anisotropic texture filtering 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)
// NOTE: VAO functionality is exposed through extensions (OES)
static PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays;
static PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray;
static PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays;
//static PFNGLISVERTEXARRAYOESPROC glIsVertexArray; // NOTE: Fails in WebGL, omitted
static PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays; // Entry point pointer to function glGenVertexArrays()
static PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray; // Entry point pointer to function glBindVertexArray()
static PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays; // Entry point pointer to function glDeleteVertexArrays()
//static PFNGLISVERTEXARRAYOESPROC glIsVertexArray; // NOTE: Fails in WebGL, omitted
#endif
#if defined(SUPPORT_VR_SIMULATOR)
@ -1619,7 +1603,7 @@ void rlglInit(int width, int height)
// Anisotropic texture filter support
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
}
@ -1649,7 +1633,7 @@ void rlglInit(int width, int height)
if (texCompPVRTSupported) TraceLog(LOG_INFO, "[EXTENSION] PVRT 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 (debugMarkerSupported) TraceLog(LOG_INFO, "[EXTENSION] Debug Marker supported");

View File

@ -58,8 +58,8 @@
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
static Texture2D texShapes = { 0 };
static Rectangle recTexShapes = { 0 };
static Texture2D texShapes = { 0 }; // Texture used on shapes drawing (usually a white)
static Rectangle recTexShapes = { 0 }; // Texture source rectangle used on shapes drawing
//----------------------------------------------------------------------------------
// Module specific Functions Declaration

View File

@ -52,17 +52,26 @@
#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
//----------------------------------------------------------------------------------
// Log types messages
static int logTypeLevel = LOG_INFO;
static int logTypeExit = LOG_ERROR;
static TraceLogCallback logCallback = NULL;
static int logTypeLevel = LOG_INFO; // Minimum log type level
static int logTypeExit = LOG_ERROR; // Log type that exits
static TraceLogCallback logCallback = NULL; // Log callback function pointer
#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
//----------------------------------------------------------------------------------
@ -204,16 +213,7 @@ static int android_close(void *cookie)
#endif // PLATFORM_ANDROID
#if defined(PLATFORM_UWP)
#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 *CreateUWPMessage(void)
{
UWPMessage *msg = (UWPMessage *)RL_MALLOC(sizeof(UWPMessage));
msg->type = UWP_MSG_NONE;
@ -247,7 +247,7 @@ UWPMessage *UWPGetMessage(void)
void UWPSendMessage(UWPMessage *msg)
{
if (UWPInMessageId + 1 < MAX_MESSAGES)
if ((UWPInMessageId + 1) < MAX_UWP_MESSAGES)
{
UWPInMessageId++;
UWPInMessages[UWPInMessageId] = msg;
@ -257,7 +257,7 @@ void UWPSendMessage(UWPMessage *msg)
void SendMessageToUWP(UWPMessage *msg)
{
if (UWPOutMessageId + 1 < MAX_MESSAGES)
if ((UWPOutMessageId + 1) < MAX_UWP_MESSAGES)
{
UWPOutMessageId++;
UWPOutMessages[UWPOutMessageId] = msg;
@ -270,7 +270,7 @@ bool HasMessageFromUWP(void)
return UWPInMessageId > -1;
}
UWPMessage* GetMessageFromUWP(void)
UWPMessage *GetMessageFromUWP(void)
{
if (HasMessageFromUWP()) return UWPInMessages[UWPInMessageId--];