mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
Merge remote-tracking branch 'upstream/development' into torquescript-generateCompiler
This commit is contained in:
commit
4f3a1f395c
18 changed files with 87 additions and 110 deletions
|
|
@ -460,6 +460,8 @@ void Prefab::_onFileChanged( const Torque::Path &path )
|
||||||
|
|
||||||
Prefab* Prefab::getPrefabByChild( SimObject *child )
|
Prefab* Prefab::getPrefabByChild( SimObject *child )
|
||||||
{
|
{
|
||||||
|
if (child == NULL) return NULL;
|
||||||
|
|
||||||
ChildToPrefabMap::Iterator itr = smChildToPrefabMap.find( child->getId() );
|
ChildToPrefabMap::Iterator itr = smChildToPrefabMap.find( child->getId() );
|
||||||
if ( itr == smChildToPrefabMap.end() )
|
if ( itr == smChildToPrefabMap.end() )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -3073,6 +3073,13 @@ DefineEngineMethod( SimObject, setFieldValue, bool, ( const char* fieldName, con
|
||||||
char fieldNameBuffer[ 1024 ];
|
char fieldNameBuffer[ 1024 ];
|
||||||
char arrayIndexBuffer[ 64 ];
|
char arrayIndexBuffer[ 64 ];
|
||||||
|
|
||||||
|
if( !fieldName || !fieldName[0] )
|
||||||
|
{
|
||||||
|
AssertFatal(false, "SimObject::setFieldValue - Invalid field name.");
|
||||||
|
Con::errorf( "SimObject::setFieldValue - Invalid field name." );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Parse out index if the field is given in the form of 'name[index]'.
|
// Parse out index if the field is given in the form of 'name[index]'.
|
||||||
|
|
||||||
const char* arrayIndex = NULL;
|
const char* arrayIndex = NULL;
|
||||||
|
|
|
||||||
|
|
@ -961,11 +961,11 @@ void Gizmo::on3DMouseDragged( const Gui3DMouseEvent & event )
|
||||||
mDeltaTotalPos = projPnt - mMouseDownProjPnt;
|
mDeltaTotalPos = projPnt - mMouseDownProjPnt;
|
||||||
newPosition = mSavedTransform.getPosition() + mDeltaTotalPos;
|
newPosition = mSavedTransform.getPosition() + mDeltaTotalPos;
|
||||||
|
|
||||||
mDeltaPos = newPosition - mTransform.getPosition();
|
|
||||||
|
|
||||||
if (mProfile->snapToGrid)
|
if (mProfile->snapToGrid)
|
||||||
newPosition = _snapPoint(newPosition);
|
newPosition = _snapPoint(newPosition);
|
||||||
|
|
||||||
|
mDeltaPos = newPosition - mTransform.getPosition();
|
||||||
|
|
||||||
mTransform.setPosition( newPosition );
|
mTransform.setPosition( newPosition );
|
||||||
|
|
||||||
mCurrentTransform.setPosition( newPosition );
|
mCurrentTransform.setPosition( newPosition );
|
||||||
|
|
|
||||||
|
|
@ -328,6 +328,7 @@ bool ProcessedCustomMaterial::setupPass( SceneRenderState *state, const SceneDat
|
||||||
|
|
||||||
shaderConsts->setSafe(rpd->shaderHandles.mAccumTimeSC, MATMGR->getTotalTime());
|
shaderConsts->setSafe(rpd->shaderHandles.mAccumTimeSC, MATMGR->getTotalTime());
|
||||||
shaderConsts->setSafe(rpd->shaderHandles.mDampnessSC, MATMGR->getDampnessClamped());
|
shaderConsts->setSafe(rpd->shaderHandles.mDampnessSC, MATMGR->getDampnessClamped());
|
||||||
|
shaderConsts->setSafe(rpd->shaderHandles.mIsCapturingSC, state ? (S32)state->isCapturing() : 0);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,8 @@ void ShaderConstHandles::init( GFXShader *shader, CustomMaterial* mat /*=NULL*/)
|
||||||
// MFT_HardwareSkinning
|
// MFT_HardwareSkinning
|
||||||
mNodeTransforms = shader->getShaderConstHandle( "$nodeTransforms" );
|
mNodeTransforms = shader->getShaderConstHandle( "$nodeTransforms" );
|
||||||
|
|
||||||
|
mIsCapturingSC = shader->getShaderConstHandle(ShaderGenVars::isCapturing);
|
||||||
|
|
||||||
// Clear any existing texture handles.
|
// Clear any existing texture handles.
|
||||||
dMemset( mTexHandlesSC, 0, sizeof( mTexHandlesSC ) );
|
dMemset( mTexHandlesSC, 0, sizeof( mTexHandlesSC ) );
|
||||||
if(mat)
|
if(mat)
|
||||||
|
|
@ -1093,6 +1095,8 @@ void ProcessedShaderMaterial::_setShaderConstants(SceneRenderState * state, cons
|
||||||
shaderConsts->setSafe( handles->mAccumTimeSC, MATMGR->getTotalTime() );
|
shaderConsts->setSafe( handles->mAccumTimeSC, MATMGR->getTotalTime() );
|
||||||
|
|
||||||
shaderConsts->setSafe(handles->mDampnessSC, MATMGR->getDampnessClamped());
|
shaderConsts->setSafe(handles->mDampnessSC, MATMGR->getDampnessClamped());
|
||||||
|
shaderConsts->setSafe(handles->mIsCapturingSC, (S32)state->isCapturing());
|
||||||
|
|
||||||
// If the shader constants have not been lost then
|
// If the shader constants have not been lost then
|
||||||
// they contain the content from a previous render pass.
|
// they contain the content from a previous render pass.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ public:
|
||||||
|
|
||||||
GFXShaderConstHandle* mNodeTransforms;
|
GFXShaderConstHandle* mNodeTransforms;
|
||||||
|
|
||||||
|
GFXShaderConstHandle* mIsCapturingSC;
|
||||||
struct customHandleData
|
struct customHandleData
|
||||||
{
|
{
|
||||||
StringTableEntry handleName;
|
StringTableEntry handleName;
|
||||||
|
|
|
||||||
|
|
@ -498,7 +498,8 @@ PostEffect::PostEffect()
|
||||||
mMatCameraToWorldSC( NULL),
|
mMatCameraToWorldSC( NULL),
|
||||||
mInvCameraTransSC(NULL),
|
mInvCameraTransSC(NULL),
|
||||||
mMatCameraToScreenSC(NULL),
|
mMatCameraToScreenSC(NULL),
|
||||||
mMatScreenToCameraSC(NULL)
|
mMatScreenToCameraSC(NULL),
|
||||||
|
mIsCapturingSC(NULL)
|
||||||
{
|
{
|
||||||
dMemset( mTexSRGB, 0, sizeof(bool) * NumTextures);
|
dMemset( mTexSRGB, 0, sizeof(bool) * NumTextures);
|
||||||
dMemset( mActiveTextures, 0, sizeof( GFXTextureObject* ) * NumTextures );
|
dMemset( mActiveTextures, 0, sizeof( GFXTextureObject* ) * NumTextures );
|
||||||
|
|
@ -798,8 +799,12 @@ void PostEffect::_setupConstants( const SceneRenderState *state )
|
||||||
mInvCameraTransSC = mShader->getShaderConstHandle("$invCameraTrans");
|
mInvCameraTransSC = mShader->getShaderConstHandle("$invCameraTrans");
|
||||||
mMatCameraToScreenSC = mShader->getShaderConstHandle("$cameraToScreen");
|
mMatCameraToScreenSC = mShader->getShaderConstHandle("$cameraToScreen");
|
||||||
mMatScreenToCameraSC = mShader->getShaderConstHandle("$screenToCamera");
|
mMatScreenToCameraSC = mShader->getShaderConstHandle("$screenToCamera");
|
||||||
|
mIsCapturingSC = mShader->getShaderConstHandle("$isCapturing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mIsCapturingSC->isValid())
|
||||||
|
mShaderConsts->set(mIsCapturingSC, (S32)state->isCapturing());
|
||||||
|
|
||||||
// Set up shader constants for source image size
|
// Set up shader constants for source image size
|
||||||
if ( mRTSizeSC->isValid() )
|
if ( mRTSizeSC->isValid() )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,8 @@ protected:
|
||||||
GFXShaderConstHandle *mMatCameraToScreenSC;
|
GFXShaderConstHandle *mMatCameraToScreenSC;
|
||||||
GFXShaderConstHandle *mMatScreenToCameraSC;
|
GFXShaderConstHandle *mMatScreenToCameraSC;
|
||||||
|
|
||||||
|
GFXShaderConstHandle* mIsCapturingSC;
|
||||||
|
|
||||||
bool mAllowReflectPass;
|
bool mAllowReflectPass;
|
||||||
|
|
||||||
/// If true update the shader.
|
/// If true update the shader.
|
||||||
|
|
|
||||||
|
|
@ -503,47 +503,13 @@ void RenderProbeMgr::reloadTextures()
|
||||||
void RenderProbeMgr::preBake()
|
void RenderProbeMgr::preBake()
|
||||||
{
|
{
|
||||||
RenderProbeMgr::smBakeReflectionProbes = true;
|
RenderProbeMgr::smBakeReflectionProbes = true;
|
||||||
GFXShader::addGlobalMacro("CAPTURING", String("1"));
|
Con::setBoolVariable("$ReflectionProbes::Capturing", RenderProbeMgr::smBakeReflectionProbes);
|
||||||
|
|
||||||
//Con::setVariable("$Probes::Capturing", "1");
|
|
||||||
mRenderMaximumNumOfLights = AdvancedLightBinManager::smMaximumNumOfLights;
|
|
||||||
mRenderUseLightFade = AdvancedLightBinManager::smUseLightFade;
|
|
||||||
|
|
||||||
AdvancedLightBinManager::smMaximumNumOfLights = -1;
|
|
||||||
AdvancedLightBinManager::smUseLightFade = false;
|
|
||||||
|
|
||||||
//kickstart rendering
|
|
||||||
LightManager* lm = LIGHTMGR;
|
|
||||||
if (lm)
|
|
||||||
{
|
|
||||||
SceneManager* sm = lm->getSceneManager();
|
|
||||||
if (sm && sm->getContainer() == &gClientContainer)
|
|
||||||
{
|
|
||||||
lm->deactivate();
|
|
||||||
lm->activate(sm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderProbeMgr::postBake()
|
void RenderProbeMgr::postBake()
|
||||||
{
|
{
|
||||||
RenderProbeMgr::smBakeReflectionProbes = false;
|
RenderProbeMgr::smBakeReflectionProbes = false;
|
||||||
GFXShader::addGlobalMacro("CAPTURING", String("0"));
|
Con::setBoolVariable("$ReflectionProbes::Capturing", RenderProbeMgr::smBakeReflectionProbes);
|
||||||
//Con::setVariable("$Probes::Capturing", "0");
|
|
||||||
AdvancedLightBinManager::smMaximumNumOfLights = mRenderMaximumNumOfLights;
|
|
||||||
AdvancedLightBinManager::smUseLightFade = mRenderUseLightFade;
|
|
||||||
|
|
||||||
//kickstart rendering
|
|
||||||
LightManager* lm = LIGHTMGR;
|
|
||||||
if (lm)
|
|
||||||
{
|
|
||||||
SceneManager* sm = lm->getSceneManager();
|
|
||||||
if (sm && sm->getContainer() == &gClientContainer)
|
|
||||||
{
|
|
||||||
lm->deactivate();
|
|
||||||
lm->activate(sm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderProbeMgr::bakeProbe(ReflectionProbe* probe)
|
void RenderProbeMgr::bakeProbe(ReflectionProbe* probe)
|
||||||
|
|
|
||||||
|
|
@ -223,6 +223,7 @@ class SceneRenderState
|
||||||
/// Returns true if this is not one of the other rendering passes.
|
/// Returns true if this is not one of the other rendering passes.
|
||||||
bool isOtherPass() const { return mScenePassType >= SPT_Other; }
|
bool isOtherPass() const { return mScenePassType >= SPT_Other; }
|
||||||
|
|
||||||
|
bool isCapturing() const { return Con::getBoolVariable("$ReflectionProbes::Capturing", false); };
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// @name Render Style
|
/// @name Render Style
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,8 @@ const String ShaderGenVars::vectorLightDirection("$vectorLightDirection");
|
||||||
const String ShaderGenVars::vectorLightColor("$vectorLightColor");
|
const String ShaderGenVars::vectorLightColor("$vectorLightColor");
|
||||||
const String ShaderGenVars::vectorLightBrightness("$vectorLightBrightness");
|
const String ShaderGenVars::vectorLightBrightness("$vectorLightBrightness");
|
||||||
|
|
||||||
|
const String ShaderGenVars::isCapturing("$isCapturing");
|
||||||
|
|
||||||
const String ShaderGenVars::ormConfig("$ORMConfig");
|
const String ShaderGenVars::ormConfig("$ORMConfig");
|
||||||
const String ShaderGenVars::roughness("$roughness");
|
const String ShaderGenVars::roughness("$roughness");
|
||||||
const String ShaderGenVars::metalness("$metalness");
|
const String ShaderGenVars::metalness("$metalness");
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,8 @@ struct ShaderGenVars
|
||||||
const static String vectorLightColor;
|
const static String vectorLightColor;
|
||||||
const static String vectorLightBrightness;
|
const static String vectorLightBrightness;
|
||||||
|
|
||||||
|
const static String isCapturing;
|
||||||
|
|
||||||
const static String ormConfig;
|
const static String ormConfig;
|
||||||
const static String roughness;
|
const static String roughness;
|
||||||
const static String metalness;
|
const static String metalness;
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#include "./brdf.glsl"
|
#include "./brdf.glsl"
|
||||||
|
|
||||||
uniform float maxProbeDrawDistance;
|
uniform float maxProbeDrawDistance;
|
||||||
|
uniform int isCapturing;
|
||||||
|
|
||||||
#ifndef TORQUE_SHADERGEN
|
#ifndef TORQUE_SHADERGEN
|
||||||
#line 27
|
#line 27
|
||||||
|
|
@ -54,10 +55,6 @@ uniform vec4 albedo;
|
||||||
|
|
||||||
#define MAX_FORWARD_LIGHT 4
|
#define MAX_FORWARD_LIGHT 4
|
||||||
|
|
||||||
#ifndef CAPTURING
|
|
||||||
#define CAPTURING 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DEBUGVIZ_ATTENUATION
|
#ifndef DEBUGVIZ_ATTENUATION
|
||||||
#define DEBUGVIZ_ATTENUATION 0
|
#define DEBUGVIZ_ATTENUATION 0
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -237,32 +234,28 @@ vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
|
||||||
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq);
|
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq);
|
||||||
vec3 Fr = D * F * Vis;
|
vec3 Fr = D * F * Vis;
|
||||||
|
|
||||||
#if CAPTURING == 1
|
if(isCapturing == 1)
|
||||||
return mix(Fd + Fr, surface.baseColor.rgb, surface.metalness);
|
return mix(Fd + Fr, surface.baseColor.rgb, surface.metalness);
|
||||||
#else
|
else
|
||||||
return Fd + Fr;
|
return Fd + Fr;
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float shadow)
|
vec3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float shadow)
|
||||||
{
|
{
|
||||||
#if CAPTURING == 1
|
|
||||||
float lightfloor = CAPTURE_LIGHT_FLOOR;
|
float lightfloor = CAPTURE_LIGHT_FLOOR;
|
||||||
#else
|
if(isCapturing != 1)
|
||||||
float lightfloor = 0.0;
|
lightfloor = 0.0;
|
||||||
#endif
|
|
||||||
vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity, lightfloor);
|
vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity, lightfloor);
|
||||||
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
|
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float radius, float shadow)
|
vec3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float radius, float shadow)
|
||||||
{
|
{
|
||||||
#if CAPTURING == 1
|
|
||||||
float lightfloor = CAPTURE_LIGHT_FLOOR;
|
float lightfloor = CAPTURE_LIGHT_FLOOR;
|
||||||
#else
|
if(isCapturing != 1)
|
||||||
float lightfloor = 0.0;
|
lightfloor = 0.0;
|
||||||
#endif
|
|
||||||
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
|
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
|
||||||
vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity * attenuation, lightfloor);
|
vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity * attenuation, lightfloor);
|
||||||
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
|
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
|
||||||
|
|
@ -270,11 +263,10 @@ vec3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, vec3 light
|
||||||
|
|
||||||
vec3 getSpotlight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float radius, vec3 lightDir, vec2 lightSpotParams, float shadow)
|
vec3 getSpotlight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float radius, vec3 lightDir, vec2 lightSpotParams, float shadow)
|
||||||
{
|
{
|
||||||
#if CAPTURING == 1
|
|
||||||
float lightfloor = CAPTURE_LIGHT_FLOOR;
|
float lightfloor = CAPTURE_LIGHT_FLOOR;
|
||||||
#else
|
if(isCapturing != 1)
|
||||||
float lightfloor = 0.0;
|
lightfloor = 0.0;
|
||||||
#endif
|
|
||||||
float attenuation = 1.0f;
|
float attenuation = 1.0f;
|
||||||
attenuation *= getDistanceAtt(surfaceToLight.Lu, radius);
|
attenuation *= getDistanceAtt(surfaceToLight.Lu, radius);
|
||||||
attenuation *= getSpotAngleAtt(-surfaceToLight.L, lightDir, lightSpotParams.xy);
|
attenuation *= getSpotAngleAtt(-surfaceToLight.L, lightDir, lightSpotParams.xy);
|
||||||
|
|
@ -567,11 +559,11 @@ vec4 computeForwardProbes(Surface surface,
|
||||||
float horizonOcclusion = 1.3;
|
float horizonOcclusion = 1.3;
|
||||||
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
||||||
horizon *= horizon;
|
horizon *= horizon;
|
||||||
#if CAPTURING == 1
|
|
||||||
return vec4(mix((irradiance + specular* horizon),surface.baseColor.rgb,surface.metalness),0);
|
if(isCapturing == 1)
|
||||||
#else
|
return vec4(mix((irradiance + specular* horizon),surface.baseColor.rgb,surface.metalness),0);
|
||||||
return vec4((irradiance + specular* horizon) , 0);//alpha writes disabled
|
else
|
||||||
#endif
|
return vec4((irradiance + specular* horizon) , 0);//alpha writes disabled
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 debugVizForwardProbes(Surface surface,
|
vec4 debugVizForwardProbes(Surface surface,
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
//globals
|
//globals
|
||||||
uniform float3 eyePosWorld;
|
uniform float3 eyePosWorld;
|
||||||
uniform float maxProbeDrawDistance;
|
uniform float maxProbeDrawDistance;
|
||||||
|
uniform int isCapturing;
|
||||||
#ifndef TORQUE_SHADERGEN
|
#ifndef TORQUE_SHADERGEN
|
||||||
|
|
||||||
// These are the uniforms used by most lighting shaders.
|
// These are the uniforms used by most lighting shaders.
|
||||||
|
|
@ -56,10 +57,6 @@ uniform float4 albedo;
|
||||||
|
|
||||||
#define MAX_FORWARD_LIGHT 4
|
#define MAX_FORWARD_LIGHT 4
|
||||||
|
|
||||||
#ifndef CAPTURING
|
|
||||||
#define CAPTURING 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DEBUGVIZ_ATTENUATION
|
#ifndef DEBUGVIZ_ATTENUATION
|
||||||
#define DEBUGVIZ_ATTENUATION 0
|
#define DEBUGVIZ_ATTENUATION 0
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -238,32 +235,28 @@ float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
|
||||||
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq);
|
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq);
|
||||||
float3 Fr = D * F * Vis;
|
float3 Fr = D * F * Vis;
|
||||||
|
|
||||||
#if CAPTURING == 1
|
if(isCapturing == 1)
|
||||||
return lerp(Fd + Fr,surface.baseColor.rgb,surface.metalness);
|
return lerp(Fd + Fr,surface.baseColor.rgb,surface.metalness);
|
||||||
#else
|
else
|
||||||
return Fd + Fr;
|
return Fd + Fr;
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float shadow)
|
float3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float shadow)
|
||||||
{
|
{
|
||||||
#if CAPTURING == 1
|
|
||||||
float lightfloor = CAPTURE_LIGHT_FLOOR;
|
float lightfloor = CAPTURE_LIGHT_FLOOR;
|
||||||
#else
|
if(isCapturing != 1)
|
||||||
float lightfloor = 0.0;
|
lightfloor = 0.0;
|
||||||
#endif
|
|
||||||
float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity, lightfloor) ;
|
float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity, lightfloor) ;
|
||||||
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
|
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
float3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float radius, float shadow)
|
float3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float radius, float shadow)
|
||||||
{
|
{
|
||||||
#if CAPTURING == 1
|
|
||||||
float lightfloor = CAPTURE_LIGHT_FLOOR;
|
float lightfloor = CAPTURE_LIGHT_FLOOR;
|
||||||
#else
|
if(isCapturing != 1)
|
||||||
float lightfloor = 0.0;
|
lightfloor = 0.0;
|
||||||
#endif
|
|
||||||
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
|
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
|
||||||
float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation, lightfloor) ;
|
float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation, lightfloor) ;
|
||||||
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
|
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
|
||||||
|
|
@ -271,11 +264,10 @@ float3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, float3 l
|
||||||
|
|
||||||
float3 getSpotlight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float radius, float3 lightDir, float2 lightSpotParams, float shadow)
|
float3 getSpotlight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float radius, float3 lightDir, float2 lightSpotParams, float shadow)
|
||||||
{
|
{
|
||||||
#if CAPTURING == 1
|
|
||||||
float lightfloor = CAPTURE_LIGHT_FLOOR;
|
float lightfloor = CAPTURE_LIGHT_FLOOR;
|
||||||
#else
|
if(isCapturing != 1)
|
||||||
float lightfloor = 0.0;
|
lightfloor = 0.0;
|
||||||
#endif
|
|
||||||
float attenuation = 1.0f;
|
float attenuation = 1.0f;
|
||||||
attenuation *= getDistanceAtt(surfaceToLight.Lu, radius);
|
attenuation *= getDistanceAtt(surfaceToLight.Lu, radius);
|
||||||
attenuation *= getSpotAngleAtt(-surfaceToLight.L, lightDir, lightSpotParams.xy);
|
attenuation *= getSpotAngleAtt(-surfaceToLight.L, lightDir, lightSpotParams.xy);
|
||||||
|
|
@ -573,11 +565,11 @@ float4 computeForwardProbes(Surface surface,
|
||||||
float horizonOcclusion = 1.3;
|
float horizonOcclusion = 1.3;
|
||||||
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
||||||
horizon *= horizon;
|
horizon *= horizon;
|
||||||
#if CAPTURING == 1
|
|
||||||
return float4(lerp((irradiance + specular* horizon),surface.baseColor.rgb,surface.metalness),0);
|
if(isCapturing == 1)
|
||||||
#else
|
return float4(lerp((irradiance + specular* horizon),surface.baseColor.rgb,surface.metalness),0);
|
||||||
return float4((irradiance + specular* horizon) , 0);//alpha writes disabled
|
else
|
||||||
#endif
|
return float4((irradiance + specular* horizon) , 0);//alpha writes disabled
|
||||||
}
|
}
|
||||||
|
|
||||||
float4 debugVizForwardProbes(Surface surface,
|
float4 debugVizForwardProbes(Surface surface,
|
||||||
|
|
|
||||||
|
|
@ -222,9 +222,9 @@ void main()
|
||||||
float horizonOcclusion = 1.3;
|
float horizonOcclusion = 1.3;
|
||||||
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
||||||
horizon *= horizon;
|
horizon *= horizon;
|
||||||
#if CAPTURING == 1
|
|
||||||
OUT_col = vec4(mix((irradiance + specular* horizon),surface.baseColor.rgb, surface.metalness),0);
|
if(isCapturing == 1)
|
||||||
#else
|
OUT_col = vec4(mix((irradiance + specular* horizon),surface.baseColor.rgb, surface.metalness),0);
|
||||||
OUT_col = vec4((irradiance + specular* horizon)*ambientColor, 0);//alpha writes disabled
|
else
|
||||||
#endif
|
OUT_col = vec4((irradiance + specular* horizon)*ambientColor, 0);//alpha writes disabled
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -208,9 +208,9 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
||||||
float horizonOcclusion = 1.3;
|
float horizonOcclusion = 1.3;
|
||||||
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
||||||
horizon *= horizon;
|
horizon *= horizon;
|
||||||
#if CAPTURING == 1
|
|
||||||
return float4(lerp((irradiance + specular* horizon), surface.baseColor.rgb,surface.metalness),0);
|
if(isCapturing == 1)
|
||||||
#else
|
return float4(lerp((irradiance + specular* horizon), surface.baseColor.rgb,surface.metalness),0);
|
||||||
return float4((irradiance + specular* horizon)*ambientColor, 0);//alpha writes disabled
|
else
|
||||||
#endif
|
return float4((irradiance + specular* horizon)*ambientColor, 0);//alpha writes disabled
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<ShapeAsset
|
<ShapeAsset
|
||||||
AssetName="Primitive"
|
AssetName="ArrowPrimitive"
|
||||||
fileName="@assetFile=Primitive.fbx"
|
fileName="@assetFile=ArrowPrimitive.fbx"
|
||||||
constuctorFileName="@assetFile=Primitive.tscript"
|
constuctorFileName="@assetFile=ArrowPrimitive.tscript"
|
||||||
materialSlot0="@asset=Prototyping:InteractiveRed"/>
|
materialSlot0="@asset=Prototyping:InteractiveRed"/>
|
||||||
|
|
|
||||||
|
|
@ -2535,20 +2535,20 @@ function EWorldEditor::onControlDropped( %this, %payload, %position )
|
||||||
{
|
{
|
||||||
if(%assetType $= "Datablock")
|
if(%assetType $= "Datablock")
|
||||||
{
|
{
|
||||||
%buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %asset @ ",\"" @ %position @ "\");";
|
%buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %asset @ ",\"" @ %pos @ "\");";
|
||||||
}
|
}
|
||||||
else if(%assetType $= "Prefab")
|
else if(%assetType $= "Prefab")
|
||||||
{
|
{
|
||||||
%buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(\"" @ %module @ "/" @ %asset @ "\",\"" @ %position @ "\");";
|
%buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(\"" @ %module @ "/" @ %asset @ "\",\"" @ %pos @ "\");";
|
||||||
}
|
}
|
||||||
else if(%assetType $= "Creator")
|
else if(%assetType $= "Creator")
|
||||||
{
|
{
|
||||||
%buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %module @ ",\"" @ %position @ "\");";
|
%buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %module @ ",\"" @ %pos @ "\");";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
%assetDef = AssetDatabase.acquireAsset(%module @ ":" @ %asset);
|
%assetDef = AssetDatabase.acquireAsset(%module @ ":" @ %asset);
|
||||||
%buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %assetDef @ ",\"" @ %position @ "\");";
|
%buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %assetDef @ ",\"" @ %pos @ "\");";
|
||||||
}
|
}
|
||||||
eval(%buildCommand);
|
eval(%buildCommand);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue