瀏覽代碼

Merge branch 'raysan5:master' into master

RANDRIA Luca 1 月之前
父節點
當前提交
e662ac80d5
共有 5 個文件被更改,包括 10 次插入18 次删除
  1. 8 6
      examples/shaders/shaders_multi_sample2d.c
  2. 0 6
      src/config.h
  3. 0 1
      src/external/rl_gputex.h
  4. 0 3
      src/raudio.c
  5. 2 2
      src/rcore.c

+ 8 - 6
examples/shaders/shaders_multi_sample2d.c

@@ -82,16 +82,18 @@ int main(void)
 
             BeginShaderMode(shader);
 
-                // WARNING: Additional samplers are enabled for all draw calls in the batch,
-                // EndShaderMode() forces batch drawing and consequently resets active textures
-                // to let other sampler2D to be activated on consequent drawings (if required)
+                // WARNING: Additional textures (sampler2D) are enabled for ALL draw calls in the batch,
+                // but EndShaderMode() forces batch drawing and resets active textures, this way
+                // other textures (sampler2D) can be activated on consequent drawings (if required)
+                // The downside of this approach is that SetShaderValue() must be called inside the loop,
+                // to be set again after every EndShaderMode() reset
                 SetShaderValueTexture(shader, texBlueLoc, texBlue);
 
-                // We are drawing texRed using default sampler2D texture0 but
-                // an additional texture units is enabled for texBlue (sampler2D texture1)
+                // We are drawing texRed using default [sampler2D texture0] but
+                // an additional texture units is enabled for texBlue [sampler2D texture1]
                 DrawTexture(texRed, 0, 0, WHITE);
 
-            EndShaderMode();
+            EndShaderMode(); // Texture sampler2D is reseted, needs to be set again for next frame 
 
             DrawText("Use KEY_LEFT/KEY_RIGHT to move texture mixing in shader!", 80, GetScreenHeight() - 40, 20, RAYWHITE);
 

+ 0 - 6
src/config.h

@@ -95,7 +95,6 @@
     #endif
 #endif
 
-
 // rcore: Configuration values
 //------------------------------------------------------------------------------------
 #define MAX_FILEPATH_CAPACITY        8192       // Maximum file paths capacity
@@ -153,7 +152,6 @@
 #endif
 #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCE_TX 9
 
-
 // Default shader vertex attribute names to set location points
 // NOTE: When a new shader is loaded, the following locations are tried to be set for convenience
 #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION     "vertexPosition"    // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION
@@ -173,7 +171,6 @@
 #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1  "texture1"          // texture1 (texture slot active 1)
 #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2  "texture2"          // texture2 (texture slot active 2)
 
-
 //------------------------------------------------------------------------------------
 // Module: rshapes - Configuration Flags
 //------------------------------------------------------------------------------------
@@ -185,7 +182,6 @@
 //------------------------------------------------------------------------------------
 #define SPLINE_SEGMENT_DIVISIONS       24       // Spline segments subdivisions
 
-
 //------------------------------------------------------------------------------------
 // Module: rtextures - Configuration Flags
 //------------------------------------------------------------------------------------
@@ -213,7 +209,6 @@
 // If not defined, still some functions are supported: ImageFormat(), ImageCrop(), ImageToPOT()
 #define SUPPORT_IMAGE_MANIPULATION      1
 
-
 //------------------------------------------------------------------------------------
 // Module: rtext - Configuration Flags
 //------------------------------------------------------------------------------------
@@ -240,7 +235,6 @@
                                                 // TextFormat(), TextSubtext(), TextToUpper(), TextToLower(), TextToPascal(), TextSplit()
 #define MAX_TEXTSPLIT_COUNT           128       // Maximum number of substrings to split: TextSplit()
 
-
 //------------------------------------------------------------------------------------
 // Module: rmodels - Configuration Flags
 //------------------------------------------------------------------------------------

+ 0 - 1
src/external/rl_gputex.h

@@ -141,7 +141,6 @@ RLGPUTEXAPI int rl_save_ktx_to_memory(const char *fileName, void *data, int widt
 
 #endif // RL_GPUTEX_H
 
-
 /***********************************************************************************
 *
 *   RL_GPUTEX IMPLEMENTATION

+ 0 - 3
src/raudio.c

@@ -451,7 +451,6 @@ void SetAudioBufferPan(AudioBuffer *buffer, float pan);
 void TrackAudioBuffer(AudioBuffer *buffer);
 void UntrackAudioBuffer(AudioBuffer *buffer);
 
-
 //----------------------------------------------------------------------------------
 // Module Functions Definition - Audio Device initialization and Closing
 //----------------------------------------------------------------------------------
@@ -996,7 +995,6 @@ Sound LoadSoundAlias(Sound source)
     return sound;
 }
 
-
 // Checks if a sound is valid (data loaded and buffers initialized)
 bool IsSoundValid(Sound sound)
 {
@@ -2349,7 +2347,6 @@ void DetachAudioMixedProcessor(AudioCallback process)
     ma_mutex_unlock(&AUDIO.System.lock);
 }
 
-
 //----------------------------------------------------------------------------------
 // Module specific Functions Definition
 //----------------------------------------------------------------------------------

+ 2 - 2
src/rcore.c

@@ -1889,7 +1889,7 @@ void TakeScreenshot(const char *fileName)
     char path[512] = { 0 };
     strcpy(path, TextFormat("%s/%s", CORE.Storage.basePath, fileName));
 
-    ExportImage(image, path);           // WARNING: Module required: rtextures
+    ExportImage(image, path); // WARNING: Module required: rtextures
     RL_FREE(imgData);
 
     if (FileExists(path)) TRACELOG(LOG_INFO, "SYSTEM: [%s] Screenshot taken successfully", path);
@@ -1936,7 +1936,7 @@ bool FileExists(const char *fileName)
 }
 
 // Check file extension
-// NOTE: Extensions checking is not case-sensitive
+// TODO: Avoid [rtext] module dependency
 bool IsFileExtension(const char *fileName, const char *ext)
 {
     #define MAX_FILE_EXTENSION_LENGTH  16