mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 15:14:35 +00:00
Merge pull request #961 from Azaezel/alpha41/ignorelighting
add an ignoreLighting entry to materials
This commit is contained in:
commit
aa16c4e23a
15 changed files with 78 additions and 9 deletions
|
|
@ -162,6 +162,7 @@ Material::Material()
|
||||||
|
|
||||||
mGlow[i] = false;
|
mGlow[i] = false;
|
||||||
mReceiveShadows[i] = true;
|
mReceiveShadows[i] = true;
|
||||||
|
mIgnoreLighting[i] = false;
|
||||||
|
|
||||||
mDetailScale[i].set(2.0f, 2.0f);
|
mDetailScale[i].set(2.0f, 2.0f);
|
||||||
|
|
||||||
|
|
@ -347,6 +348,9 @@ void Material::initPersistFields()
|
||||||
"The 0 to 1 rolloff factor used in the subsurface scattering approximation.");
|
"The 0 to 1 rolloff factor used in the subsurface scattering approximation.");
|
||||||
|
|
||||||
addField("receiveShadows", TypeBool, Offset(mReceiveShadows, Material), MAX_STAGES,
|
addField("receiveShadows", TypeBool, Offset(mReceiveShadows, Material), MAX_STAGES,
|
||||||
|
"Shadows being cast onto the material.");
|
||||||
|
|
||||||
|
addField("ignoreLighting", TypeBool, Offset(mIgnoreLighting, Material), MAX_STAGES,
|
||||||
"Enables emissive lighting for the material.");
|
"Enables emissive lighting for the material.");
|
||||||
|
|
||||||
addField("doubleSided", TypeBool, Offset(mDoubleSided, Material),
|
addField("doubleSided", TypeBool, Offset(mDoubleSided, Material),
|
||||||
|
|
|
||||||
|
|
@ -306,6 +306,7 @@ public:
|
||||||
|
|
||||||
bool mGlow[MAX_STAGES]; // entire stage glows
|
bool mGlow[MAX_STAGES]; // entire stage glows
|
||||||
bool mReceiveShadows[MAX_STAGES];
|
bool mReceiveShadows[MAX_STAGES];
|
||||||
|
bool mIgnoreLighting[MAX_STAGES];
|
||||||
|
|
||||||
Point2I mCellIndex[MAX_STAGES];
|
Point2I mCellIndex[MAX_STAGES];
|
||||||
Point2I mCellLayout[MAX_STAGES];
|
Point2I mCellLayout[MAX_STAGES];
|
||||||
|
|
|
||||||
|
|
@ -1200,7 +1200,9 @@ void ProcessedShaderMaterial::_setShaderConstants(SceneRenderState * state, cons
|
||||||
// Deferred Shading: Determine Material Info Flags
|
// Deferred Shading: Determine Material Info Flags
|
||||||
S32 matInfoFlags =
|
S32 matInfoFlags =
|
||||||
(mMaterial->mReceiveShadows[stageNum] ? 1 : 0) | //ReceiveShadows
|
(mMaterial->mReceiveShadows[stageNum] ? 1 : 0) | //ReceiveShadows
|
||||||
(mMaterial->mSubSurface[stageNum] ? 1 << 2 : 0); //subsurface
|
(mMaterial->mSubSurface[stageNum] ? 1 << 2 : 0)| //subsurface
|
||||||
|
(mMaterial->mIgnoreLighting[stageNum] ? 1 << 3 : 0); //IgnoreLighting
|
||||||
|
|
||||||
mMaterial->mMatInfoFlags[stageNum] = matInfoFlags / 255.0f;
|
mMaterial->mMatInfoFlags[stageNum] = matInfoFlags / 255.0f;
|
||||||
shaderConsts->setSafe(handles->mMatInfoFlagsSC, mMaterial->mMatInfoFlags[stageNum]);
|
shaderConsts->setSafe(handles->mMatInfoFlagsSC, mMaterial->mMatInfoFlags[stageNum]);
|
||||||
if( handles->mAccuScaleSC->isValid() )
|
if( handles->mAccuScaleSC->isValid() )
|
||||||
|
|
|
||||||
|
|
@ -276,6 +276,10 @@ vec4 compute4Lights( Surface surface,
|
||||||
vec4 vectorLightingColor,
|
vec4 vectorLightingColor,
|
||||||
float vectorLightBrightness )
|
float vectorLightBrightness )
|
||||||
{
|
{
|
||||||
|
if (getFlag(surface.matFlag, 2))
|
||||||
|
{
|
||||||
|
return surface.baseColor;
|
||||||
|
}
|
||||||
vec3 finalLighting = vec3(0.0f);
|
vec3 finalLighting = vec3(0.0f);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
|
||||||
|
|
@ -277,8 +277,11 @@ float4 compute4Lights( Surface surface,
|
||||||
float4 vectorLightingColor,
|
float4 vectorLightingColor,
|
||||||
float vectorLightBrightness )
|
float vectorLightBrightness )
|
||||||
{
|
{
|
||||||
|
if (getFlag(surface.matFlag, 2))
|
||||||
|
{
|
||||||
|
return surface.baseColor;
|
||||||
|
}
|
||||||
float3 finalLighting = 0.0.xxx;
|
float3 finalLighting = 0.0.xxx;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < MAX_FORWARD_LIGHT; i++)
|
for(i = 0; i < MAX_FORWARD_LIGHT; i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,11 @@ void main()
|
||||||
Surface surface = createSurface( normDepth, colorBuffer, matInfoBuffer,
|
Surface surface = createSurface( normDepth, colorBuffer, matInfoBuffer,
|
||||||
uvScene, eyePosWorld, wsEyeRay, cameraToWorld);
|
uvScene, eyePosWorld, wsEyeRay, cameraToWorld);
|
||||||
|
|
||||||
|
if (getFlag(surface.matFlag, 2))
|
||||||
|
{
|
||||||
|
OUT_col = surface.baseColor;
|
||||||
|
return;
|
||||||
|
}
|
||||||
vec3 L = lightPosition - surface.P;
|
vec3 L = lightPosition - surface.P;
|
||||||
float dist = length(L);
|
float dist = length(L);
|
||||||
vec3 lighting = vec3(0.0);
|
vec3 lighting = vec3(0.0);
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,11 @@ void main()
|
||||||
|
|
||||||
//create surface
|
//create surface
|
||||||
Surface surface = createSurface(normDepth, colorBuffer, matInfoBuffer, IN_uv0.xy, eyePosWorld, IN_wsEyeRay, cameraToWorld);
|
Surface surface = createSurface(normDepth, colorBuffer, matInfoBuffer, IN_uv0.xy, eyePosWorld, IN_wsEyeRay, cameraToWorld);
|
||||||
|
if (getFlag(surface.matFlag, 2))
|
||||||
|
{
|
||||||
|
OUT_col = surface.baseColor;
|
||||||
|
return;
|
||||||
|
}
|
||||||
#ifdef USE_SSAO_MASK
|
#ifdef USE_SSAO_MASK
|
||||||
float ssao = 1.0 - texture( ssaoMask, viewportCoordToRenderTarget( IN_uv0.xy, rtParams7 ) ).r;
|
float ssao = 1.0 - texture( ssaoMask, viewportCoordToRenderTarget( IN_uv0.xy, rtParams7 ) ).r;
|
||||||
surface.ao = min(surface.ao, ssao);
|
surface.ao = min(surface.ao, ssao);
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,11 @@ void main()
|
||||||
//create surface
|
//create surface
|
||||||
Surface surface = createSurface( normDepth, colorBuffer,matInfoBuffer,
|
Surface surface = createSurface( normDepth, colorBuffer,matInfoBuffer,
|
||||||
uvScene, eyePosWorld, wsEyeRay, cameraToWorld);
|
uvScene, eyePosWorld, wsEyeRay, cameraToWorld);
|
||||||
|
if (getFlag(surface.matFlag, 2))
|
||||||
|
{
|
||||||
|
OUT_col = surface.baseColor;
|
||||||
|
return;
|
||||||
|
}
|
||||||
vec3 L = lightPosition - surface.P;
|
vec3 L = lightPosition - surface.P;
|
||||||
float dist = length(L);
|
float dist = length(L);
|
||||||
vec3 lighting = vec3(0.0);
|
vec3 lighting = vec3(0.0);
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,11 @@ void main()
|
||||||
//create surface
|
//create surface
|
||||||
Surface surface = createSurface( normDepth, colorBuffer, matInfoBuffer,
|
Surface surface = createSurface( normDepth, colorBuffer, matInfoBuffer,
|
||||||
uv0, eyePosWorld, wsEyeRay, cameraToWorld);
|
uv0, eyePosWorld, wsEyeRay, cameraToWorld);
|
||||||
|
if (getFlag(surface.matFlag, 2))
|
||||||
|
{
|
||||||
|
OUT_col = surface.baseColor;
|
||||||
|
return;
|
||||||
|
}
|
||||||
//create surface to light
|
//create surface to light
|
||||||
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, -lightDirection);
|
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, -lightDirection);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,10 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
||||||
//create surface
|
//create surface
|
||||||
Surface surface = createSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
Surface surface = createSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
||||||
uvScene, eyePosWorld, wsEyeRay, cameraToWorld);
|
uvScene, eyePosWorld, wsEyeRay, cameraToWorld);
|
||||||
|
if (getFlag(surface.matFlag, 2))
|
||||||
|
{
|
||||||
|
return surface.baseColor;
|
||||||
|
}
|
||||||
float3 L = lightPosition - surface.P;
|
float3 L = lightPosition - surface.P;
|
||||||
float dist = length(L);
|
float dist = length(L);
|
||||||
float3 lighting = 0.0.xxx;
|
float3 lighting = 0.0.xxx;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,12 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
||||||
//create surface
|
//create surface
|
||||||
Surface surface = createSurface(normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
Surface surface = createSurface(normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
||||||
IN.uv0.xy, eyePosWorld, IN.wsEyeRay, cameraToWorld);
|
IN.uv0.xy, eyePosWorld, IN.wsEyeRay, cameraToWorld);
|
||||||
|
|
||||||
|
if (getFlag(surface.matFlag, 2))
|
||||||
|
{
|
||||||
|
return surface.baseColor;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef USE_SSAO_MASK
|
#ifdef USE_SSAO_MASK
|
||||||
float ssao = 1.0 - TORQUE_TEX2D( ssaoMask, viewportCoordToRenderTarget( IN.uv0.xy, rtParams7 ) ).r;
|
float ssao = 1.0 - TORQUE_TEX2D( ssaoMask, viewportCoordToRenderTarget( IN.uv0.xy, rtParams7 ) ).r;
|
||||||
surface.ao = min(surface.ao, ssao);
|
surface.ao = min(surface.ao, ssao);
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,10 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
||||||
//create surface
|
//create surface
|
||||||
Surface surface = createSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
Surface surface = createSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
||||||
uvScene, eyePosWorld, wsEyeRay, cameraToWorld);
|
uvScene, eyePosWorld, wsEyeRay, cameraToWorld);
|
||||||
|
if (getFlag(surface.matFlag, 2))
|
||||||
|
{
|
||||||
|
return surface.baseColor;
|
||||||
|
}
|
||||||
float3 L = lightPosition - surface.P;
|
float3 L = lightPosition - surface.P;
|
||||||
float dist = length(L);
|
float dist = length(L);
|
||||||
float3 lighting = 0.0.xxx;
|
float3 lighting = 0.0.xxx;
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,10 @@ float4 main(FarFrustumQuadConnectP IN) : SV_TARGET
|
||||||
//create surface
|
//create surface
|
||||||
Surface surface = createSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
Surface surface = createSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
||||||
IN.uv0, eyePosWorld, IN.wsEyeRay, cameraToWorld);
|
IN.uv0, eyePosWorld, IN.wsEyeRay, cameraToWorld);
|
||||||
|
if (getFlag(surface.matFlag, 2))
|
||||||
|
{
|
||||||
|
return surface.baseColor;
|
||||||
|
}
|
||||||
//create surface to light
|
//create surface to light
|
||||||
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, -lightDirection);
|
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, -lightDirection);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3177,6 +3177,29 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
||||||
useMouseEvents = "0";
|
useMouseEvents = "0";
|
||||||
useInactiveState = "0";
|
useInactiveState = "0";
|
||||||
};
|
};
|
||||||
|
new GuiCheckBoxCtrl() {
|
||||||
|
canSaveDynamicFields = "0";
|
||||||
|
internalName = "ignoreLightingCheckbox";
|
||||||
|
Enabled = "1";
|
||||||
|
isContainer = "0";
|
||||||
|
Profile = "ToolsGuiCheckBoxProfile";
|
||||||
|
HorizSizing = "right";
|
||||||
|
VertSizing = "bottom";
|
||||||
|
position = "116 4";
|
||||||
|
Extent = "60 16";
|
||||||
|
MinExtent = "8 2";
|
||||||
|
canSave = "1";
|
||||||
|
Visible = "1";
|
||||||
|
Command = "MaterialEditorGui.updateActiveMaterial(\"ignoreLighting[\" @ MaterialEditorGui.currentLayer @ \"]\",$ThisControl.getValue());";
|
||||||
|
tooltipprofile = "ToolsGuiDefaultProfile";
|
||||||
|
ToolTip = "Are we at all influenced by light?";
|
||||||
|
hovertime = "1000";
|
||||||
|
text = "ignoreLight";
|
||||||
|
groupNum = "-1";
|
||||||
|
buttonType = "ToggleButton";
|
||||||
|
useMouseEvents = "0";
|
||||||
|
useInactiveState = "0";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
new GuiContainer(){ // parallax
|
new GuiContainer(){ // parallax
|
||||||
profile = "ToolsGuiTransparentProfile";
|
profile = "ToolsGuiTransparentProfile";
|
||||||
|
|
|
||||||
|
|
@ -936,6 +936,7 @@ function MaterialEditorGui::guiSync( %this, %material )
|
||||||
MaterialEditorPropertiesWindow-->glowMulSlider.setValue((%material).glowMul[%layer]);
|
MaterialEditorPropertiesWindow-->glowMulSlider.setValue((%material).glowMul[%layer]);
|
||||||
MaterialEditorPropertiesWindow-->glowCheckbox.setValue((%material).glow[%layer]);
|
MaterialEditorPropertiesWindow-->glowCheckbox.setValue((%material).glow[%layer]);
|
||||||
MaterialEditorPropertiesWindow-->receiveShadowsCheckbox.setValue((%material).receiveShadows[%layer]);
|
MaterialEditorPropertiesWindow-->receiveShadowsCheckbox.setValue((%material).receiveShadows[%layer]);
|
||||||
|
MaterialEditorPropertiesWindow-->ignoreLightingCheckbox.setValue((%material).ignoreLighting[%layer]);
|
||||||
MaterialEditorPropertiesWindow-->parallaxTextEdit.setText((%material).parallaxScale[%layer]);
|
MaterialEditorPropertiesWindow-->parallaxTextEdit.setText((%material).parallaxScale[%layer]);
|
||||||
MaterialEditorPropertiesWindow-->parallaxSlider.setValue((%material).parallaxScale[%layer]);
|
MaterialEditorPropertiesWindow-->parallaxSlider.setValue((%material).parallaxScale[%layer]);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue