REVIEWED: DrawMesh()
#2511
Disable color vertex attribute if not provided by mesh
This commit is contained in:
parent
850321cf2b
commit
c6c71fe73c
4 changed files with 75 additions and 53 deletions
|
@ -3,7 +3,7 @@
|
|||
// Input vertex attributes (from vertex shader)
|
||||
in vec3 fragPosition;
|
||||
in vec2 fragTexCoord;
|
||||
in vec4 fragColor;
|
||||
//in vec4 fragColor;
|
||||
in vec3 fragNormal;
|
||||
|
||||
// Input uniform values
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
in vec3 vertexPosition;
|
||||
in vec2 vertexTexCoord;
|
||||
in vec3 vertexNormal;
|
||||
in vec4 vertexColor;
|
||||
//in vec4 vertexColor; // Not required
|
||||
|
||||
in mat4 instanceTransform;
|
||||
|
||||
|
@ -28,7 +28,7 @@ void main()
|
|||
// Send vertex attributes to fragment shader
|
||||
fragPosition = vec3(mvpi*vec4(vertexPosition, 1.0));
|
||||
fragTexCoord = vertexTexCoord;
|
||||
fragColor = vertexColor;
|
||||
//fragColor = vertexColor;
|
||||
fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
|
||||
|
||||
// Calculate final vertex position
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "rlights.h"
|
||||
|
||||
#include <stdlib.h> // Required for: calloc(), free()
|
||||
#include <math.h> // Required for:
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
|
@ -27,7 +26,7 @@
|
|||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
#define MAX_INSTANCES 8000
|
||||
#define MAX_INSTANCES 10000
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
|
@ -87,7 +86,9 @@ int main(void)
|
|||
matInstances.shader = shader;
|
||||
matInstances.maps[MATERIAL_MAP_DIFFUSE].color = RED;
|
||||
|
||||
// Create a defult material with default internal shader for non-instanced mesh drawing
|
||||
// Load default material (using raylib intenral default shader) for non-instanced mesh drawing
|
||||
// WARNING: Default shader enables vertex color attribute BUT GenMeshCube() does not generate vertex colors, so,
|
||||
// when drawing the color attribute is disabled and a default color value is provided as input for thevertex attribute
|
||||
Material matDefault = LoadMaterialDefault();
|
||||
matDefault.maps[MATERIAL_MAP_DIFFUSE].color = BLUE;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue