mirror of
https://github.com/aap/librw.git
synced 2024-11-25 05:05:42 +00:00
extra surf prop for opengl
This commit is contained in:
parent
f68bdb3649
commit
f04ddf031d
@ -111,6 +111,7 @@ struct GLShaderState
|
|||||||
{
|
{
|
||||||
RGBA matColor;
|
RGBA matColor;
|
||||||
SurfaceProperties surfProps;
|
SurfaceProperties surfProps;
|
||||||
|
float extraSurfProp;
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *shaderDecl120 =
|
const char *shaderDecl120 =
|
||||||
@ -1103,7 +1104,7 @@ Shader *lastShaderUploaded;
|
|||||||
#define U(i) currentShader->uniformLocations[i]
|
#define U(i) currentShader->uniformLocations[i]
|
||||||
|
|
||||||
void
|
void
|
||||||
setMaterial(const RGBA &color, const SurfaceProperties &surfaceprops)
|
setMaterial(const RGBA &color, const SurfaceProperties &surfaceprops, float extraSurfProp)
|
||||||
{
|
{
|
||||||
bool force = lastShaderUploaded != currentShader;
|
bool force = lastShaderUploaded != currentShader;
|
||||||
if(force || !equal(shaderState.matColor, color)){
|
if(force || !equal(shaderState.matColor, color)){
|
||||||
@ -1116,12 +1117,13 @@ setMaterial(const RGBA &color, const SurfaceProperties &surfaceprops)
|
|||||||
if(force ||
|
if(force ||
|
||||||
shaderState.surfProps.ambient != surfaceprops.ambient ||
|
shaderState.surfProps.ambient != surfaceprops.ambient ||
|
||||||
shaderState.surfProps.specular != surfaceprops.specular ||
|
shaderState.surfProps.specular != surfaceprops.specular ||
|
||||||
shaderState.surfProps.diffuse != surfaceprops.diffuse){
|
shaderState.surfProps.diffuse != surfaceprops.diffuse ||
|
||||||
|
shaderState.extraSurfProp != extraSurfProp){
|
||||||
float surfProps[4];
|
float surfProps[4];
|
||||||
surfProps[0] = surfaceprops.ambient;
|
surfProps[0] = surfaceprops.ambient;
|
||||||
surfProps[1] = surfaceprops.specular;
|
surfProps[1] = surfaceprops.specular;
|
||||||
surfProps[2] = surfaceprops.diffuse;
|
surfProps[2] = surfaceprops.diffuse;
|
||||||
surfProps[3] = 0.0f;
|
surfProps[3] = extraSurfProp;
|
||||||
glUniform4fv(U(u_surfProps), 1, surfProps);
|
glUniform4fv(U(u_surfProps), 1, surfProps);
|
||||||
shaderState.surfProps = surfaceprops;
|
shaderState.surfProps = surfaceprops;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ int32 setLights(WorldLights *lightData);
|
|||||||
|
|
||||||
// per Mesh
|
// per Mesh
|
||||||
void setTexture(int32 n, Texture *tex);
|
void setTexture(int32 n, Texture *tex);
|
||||||
void setMaterial(const RGBA &color, const SurfaceProperties &surfaceprops);
|
void setMaterial(const RGBA &color, const SurfaceProperties &surfaceprops, float extraSurfProp = 0.0f);
|
||||||
|
|
||||||
void setAlphaBlend(bool32 enable);
|
void setAlphaBlend(bool32 enable);
|
||||||
bool32 getAlphaBlend(void);
|
bool32 getAlphaBlend(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user