Last active
August 21, 2016 15:08
-
-
Save DCubix/ea78b15892f511a9e72806ed2db01214 to your computer and use it in GitHub Desktop.
Custom material shader concept for BGE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generated code. Not visible. | |
uniform struct TextureSlot { | |
vec2 offset; | |
vec2 scale; | |
float intensity; | |
float lodBias; | |
bool isNormalMap; | |
int blendMode; // Mix, Add, Subtract, Overlay, ... | |
int type; // Reflection, Refraction, Normal, UV, Generated.... This will determine which UV mapping algorithm to use. | |
/// and much more... | |
} vTextureSlots[8]; // Properties for each texture | |
uniform sampler2D vTextures[8]; // 8 is the max textures on my hardware. | |
// End of generated code | |
in vec3 vPosition; | |
in vec3 vNormal; | |
in vec2 vTexCoords[8]; | |
in vec4 vColor; | |
void main() { | |
vec4 col = texture2D(vTextures[0], vTexCoords[0]); | |
gl_FragColor = col * vColor; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment