瀏覽代碼

Review some comments

Ray 8 年之前
父節點
當前提交
59652c75b4
共有 16 個文件被更改,包括 83 次插入80 次删除
  1. 8 10
      src/audio.c
  2. 1 1
      src/audio.h
  3. 2 2
      src/camera.h
  4. 9 9
      src/core.c
  5. 2 2
      src/gestures.h
  6. 1 1
      src/models.c
  7. 1 1
      src/raylib.h
  8. 1 1
      src/raymath.h
  9. 18 29
      src/rlgl.c
  10. 31 14
      src/rlgl.h
  11. 1 3
      src/rres.h
  12. 1 1
      src/shapes.c
  13. 1 1
      src/text.c
  14. 1 1
      src/textures.c
  15. 1 1
      src/utils.c
  16. 4 3
      src/utils.h

+ 8 - 10
src/audio.c

@@ -2,15 +2,13 @@
 *
 *   raylib.audio - Basic funtionality to work with audio
 *
-*   DESCRIPTION:
-*
-*   This module provides basic functionality to:
-*     - Manage audio device (init/close)
-*     - Load and unload audio files
-*     - Format wave data (sample rate, size, channels)
-*     - Play/Stop/Pause/Resume loaded audio
-*     - Manage mixing channels
-*     - Manage raw audio context
+*   FEATURES:
+*       - Manage audio device (init/close)
+*       - Load and unload audio files
+*       - Format wave data (sample rate, size, channels)
+*       - Play/Stop/Pause/Resume loaded audio
+*       - Manage mixing channels
+*       - Manage raw audio context
 *
 *   CONFIGURATION:
 *   
@@ -51,7 +49,7 @@
 *
 *   LICENSE: zlib/libpng
 *
-*   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2014-2017 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.

+ 1 - 1
src/audio.h

@@ -29,7 +29,7 @@
 *
 *   LICENSE: zlib/libpng
 *
-*   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2014-2017 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.

+ 2 - 2
src/camera.h

@@ -1,6 +1,6 @@
 /*******************************************************************************************
 *
-*   raylib Camera System - Camera Modes Setup and Control Functions
+*   raylib.camera - Camera system with multiple modes support
 *
 *   NOTE: Memory footprint of this library is aproximately 52 bytes (global variables)
 *
@@ -22,7 +22,7 @@
 *
 *   LICENSE: zlib/libpng
 *
-*   Copyright (c) 2015-2016 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2015-2017 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.

+ 9 - 9
src/core.c

@@ -2,14 +2,14 @@
 *
 *   raylib.core - Basic functions to manage windows, OpenGL context and input on multiple platforms
 *
-*   The following platforms are supported: 
-*       Windows (win32/Win64)
-*       Linux (tested on Ubuntu)
-*       Mac (OSX)
-*       Android (API Level 9 or greater) 
-*       Raspberry Pi (Raspbian)
-*       HTML5 (Chrome, Firefox)
-*       Oculus Rift CV1
+*   PLATFORMS SUPPORTED: 
+*       - Windows (win32/Win64)
+*       - Linux (tested on Ubuntu)
+*       - Mac (OSX)
+*       - Android (API Level 9 or greater) 
+*       - Raspberry Pi (Raspbian)
+*       - HTML5 (Chrome, Firefox)
+*       - Oculus Rift CV1
 *
 *   CONFIGURATION:
 *
@@ -49,7 +49,7 @@
 *
 *   LICENSE: zlib/libpng
 *
-*   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2014-2017 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.

+ 2 - 2
src/gestures.h

@@ -1,6 +1,6 @@
 /**********************************************************************************************
 *
-*   raylib Gestures System - Gestures Processing based on input gesture events (touch/mouse)
+*   raylib.gestures - Gestures system, gestures processing based on input events (touch/mouse)
 *
 *   NOTE: Memory footprint of this library is aproximately 128 bytes (global variables)
 *
@@ -24,7 +24,7 @@
 *
 *   LICENSE: zlib/libpng
 *
-*   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2014-2017 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.

+ 1 - 1
src/models.c

@@ -13,7 +13,7 @@
 *
 *   LICENSE: zlib/libpng
 *
-*   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2014-2017 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.

+ 1 - 1
src/raylib.h

@@ -47,7 +47,7 @@
 *   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-2016 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2013-2017 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.

+ 1 - 1
src/raymath.h

@@ -1,6 +1,6 @@
 /**********************************************************************************************
 *
-*   raymath v1.0 - Some useful functions to work with Vector3, Matrix and Quaternions
+*   raymath v1.0 - Math functions to work with Vector3, Matrix and Quaternions
 *
 *   CONFIGURATION:
 *

+ 18 - 29
src/rlgl.c

@@ -2,10 +2,8 @@
 *
 *   rlgl - raylib OpenGL abstraction layer
 *
-*   DESCRIPTION:
-*
-*   rlgl allows usage of OpenGL 1.1 style functions (rlVertex) that are internally mapped to
-*   selected OpenGL version (1.1, 2.1, 3.3 Core, ES 2.0).
+*   rlgl is a wrapper for multiple OpenGL versions (1.1, 2.1, 3.3 Core, ES 2.0) to 
+*   pseudo-OpenGL 1.1 style functions (rlVertex, rlTranslate, rlRotate...). 
 *
 *   When chosing an OpenGL version greater than OpenGL 1.1, rlgl stores vertex data on internal
 *   VBO buffers (and VAOs if available). It requires calling 3 functions:
@@ -16,32 +14,19 @@
 *   CONFIGURATION:
 *
 *   #define GRAPHICS_API_OPENGL_11
-*       Use OpenGL 1.1 backend
-*
 *   #define GRAPHICS_API_OPENGL_21
-*       Use OpenGL 2.1 backend
-*
 *   #define GRAPHICS_API_OPENGL_33
-*       Use OpenGL 3.3 Core profile backend
-*
 *   #define GRAPHICS_API_OPENGL_ES2
-*       Use OpenGL ES 2.0 backend
+*       Use selected OpenGL backend
 *
 *   #define RLGL_STANDALONE
 *       Use rlgl as standalone library (no raylib dependency)
 *
-*   #define RLGL_NO_DISTORTION_SHADER
-*       Avoid stereo rendering distortion sahder (shader_distortion.h) inclusion
-*
-*   #define SUPPORT_SHADER_DEFAULT / ENABLE_SHADER_DEFAULT
+*   #define SUPPORT_VR_SIMULATION / SUPPORT_STEREO_RENDERING
+*       Support VR simulation functionality (stereo rendering)
 *
 *   #define SUPPORT_SHADER_DISTORTION
-*
-*   #define SUPPORT_VR_SIMULATION
-*
-*   #define SUPPORT_STEREO_RENDERING
-*
-*   #define RLGL_NO_DEFAULT_SHADER
+*       Include stereo rendering distortion shader (shader_distortion.h)
 *
 *   DEPENDENCIES:
 *       raymath     - 3D math functionality (Vector3, Matrix, Quaternion)
@@ -50,7 +35,7 @@
 *
 *   LICENSE: zlib/libpng
 *
-*   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2014-2017 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.
@@ -295,6 +280,13 @@ 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
+
+// VR global variables
+static VrDeviceInfo hmd;                // Current VR device info
+static VrStereoConfig vrConfig;         // VR stereo configuration for simulator
+static bool vrSimulatorReady = false;   // VR simulator ready flag
+static bool vrStereoRender = false;     // VR stereo rendering enabled/disabled flag
+                                        // NOTE: This flag is useful to render data over stereo image (i.e. FPS)
 #endif
 
 // Extension supported flag: Anisotropic filtering
@@ -304,13 +296,6 @@ static float maxAnisotropicLevel = 0.0f;        // Maximum anisotropy level supp
 // Extension supported flag: Clamp mirror wrap mode
 static bool texClampMirrorSupported = false;    // Clamp mirror wrap mode supported
 
-// VR global variables
-static VrDeviceInfo hmd;                // Current VR device info
-static VrStereoConfig vrConfig;         // VR stereo configuration for simulator
-static bool vrSimulatorReady = false;   // VR simulator ready flag
-static bool vrStereoRender = false;     // VR stereo rendering enabled/disabled flag
-                                        // NOTE: This flag is useful to render data over stereo image (i.e. FPS)
-
 #if defined(GRAPHICS_API_OPENGL_ES2)
 // NOTE: VAO functionality is exposed through extensions (OES)
 static PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays;
@@ -2636,7 +2621,11 @@ void CloseVrSimulator(void)
 // Detect if VR simulator is running
 bool IsVrSimulatorReady(void)
 {
+#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
     return vrSimulatorReady;
+#else
+    return false;
+#endif
 }
 
 // Enable/Disable VR experience (device or simulator)

+ 31 - 14
src/rlgl.h

@@ -2,8 +2,8 @@
 *
 *   rlgl - raylib OpenGL abstraction layer
 *
-*   rlgl allows usage of OpenGL 1.1 style functions (rlVertex) that are internally mapped to 
-*   selected OpenGL version (1.1, 2.1, 3.3 Core, ES 2.0). 
+*   rlgl is a wrapper for multiple OpenGL versions (1.1, 2.1, 3.3 Core, ES 2.0) to 
+*   pseudo-OpenGL 1.1 style functions (rlVertex, rlTranslate, rlRotate...). 
 *
 *   When chosing an OpenGL version greater than OpenGL 1.1, rlgl stores vertex data on internal 
 *   VBO buffers (and VAOs if available). It requires calling 3 functions:
@@ -11,18 +11,29 @@
 *       rlglDraw()  - Process internal buffers and send required draw calls
 *       rlglClose() - De-initialize internal buffers data and other auxiliar resources
 *
-*   External libs:
+*   CONFIGURATION:
+*
+*   #define GRAPHICS_API_OPENGL_11
+*   #define GRAPHICS_API_OPENGL_21
+*   #define GRAPHICS_API_OPENGL_33
+*   #define GRAPHICS_API_OPENGL_ES2
+*       Use selected OpenGL backend
+*
+*   #define RLGL_STANDALONE
+*       Use rlgl as standalone library (no raylib dependency)
+*
+*   #define SUPPORT_VR_SIMULATION / SUPPORT_STEREO_RENDERING
+*       Support VR simulation functionality (stereo rendering)
+*
+*   #define SUPPORT_SHADER_DISTORTION
+*       Include stereo rendering distortion shader (shader_distortion.h)
+*
+*   DEPENDENCIES:
 *       raymath     - 3D math functionality (Vector3, Matrix, Quaternion)
 *       GLAD        - OpenGL extensions loading (OpenGL 3.3 Core only)
 *
-*   Module Configuration Flags:
-*       GRAPHICS_API_OPENGL_11  - Use OpenGL 1.1 backend
-*       GRAPHICS_API_OPENGL_21  - Use OpenGL 2.1 backend
-*       GRAPHICS_API_OPENGL_33  - Use OpenGL 3.3 Core profile backend
-*       GRAPHICS_API_OPENGL_ES2 - Use OpenGL ES 2.0 backend
-*
-*       RLGL_STANDALONE             - Use rlgl as standalone library (no raylib dependency)
 *
+*   LICENSE: zlib/libpng
 *
 *   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
 *
@@ -124,15 +135,21 @@
 #define RL_WRAP_CLAMP                   0x812F      // GL_CLAMP_TO_EDGE
 #define RL_WRAP_CLAMP_MIRROR            0x8742      // GL_MIRROR_CLAMP_EXT
 
+// Matrix modes (equivalent to OpenGL)
+#define RL_MODELVIEW                    0x1700      // GL_MODELVIEW 
+#define RL_PROJECTION                   0x1701      // GL_PROJECTION
+#define RL_TEXTURE                      0x1702      // GL_TEXTURE
+
+// Primitive assembly draw modes
+#define RL_LINES                        0x0001      // GL_LINES
+#define RL_TRIANGLES                    0x0004      // GL_TRIANGLES
+#define RL_QUADS                        0x0007      // GL_QUADS
+
 //----------------------------------------------------------------------------------
 // Types and Structures Definition
 //----------------------------------------------------------------------------------
 typedef enum { OPENGL_11 = 1, OPENGL_21, OPENGL_33, OPENGL_ES_20 } GlVersion;
 
-typedef enum { RL_PROJECTION, RL_MODELVIEW, RL_TEXTURE } MatrixMode;
-
-typedef enum { RL_LINES, RL_TRIANGLES, RL_QUADS } DrawMode;
-
 typedef unsigned char byte;
 
 #if defined(RLGL_STANDALONE)

+ 1 - 3
src/rres.h

@@ -1,8 +1,6 @@
 /**********************************************************************************************
 *
-*   rres - raylib Resource custom format management functions
-*
-*   Basic functions to load/save rRES resource files
+*   rres v1.0 - raylib resource (rRES) custom fileformat management functions
 *
 *   CONFIGURATION:
 *

+ 1 - 1
src/shapes.c

@@ -13,7 +13,7 @@
 *
 *   LICENSE: zlib/libpng
 *
-*   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2014-2017 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.

+ 1 - 1
src/text.c

@@ -18,7 +18,7 @@
 *
 *   LICENSE: zlib/libpng
 *
-*   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2014-2017 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.

+ 1 - 1
src/textures.c

@@ -31,7 +31,7 @@
 *
 *   LICENSE: zlib/libpng
 *
-*   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2014-2017 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.

+ 1 - 1
src/utils.c

@@ -25,7 +25,7 @@
 *
 *   LICENSE: zlib/libpng
 *
-*   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+*   Copyright (c) 2014-2017 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.

+ 4 - 3
src/utils.h

@@ -1,10 +1,11 @@
 /**********************************************************************************************
 *
-*   raylib.utils
+*   raylib.utils - Some common utility functions
 *
-*   Some utility functions
 *
-*   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+*   LICENSE: zlib/libpng
+*
+*   Copyright (c) 2014-2017 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.