mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 06:34:36 +00:00
Merge branch 'development' of https://github.com/TorqueGameEngines/Torque3D into classPrototypingPresenter
This commit is contained in:
commit
045c15fd26
36 changed files with 313 additions and 91 deletions
|
|
@ -436,7 +436,7 @@ SimObject *spawnObject(String spawnClass, String spawnDataBlock, String spawnNam
|
|||
|
||||
// If we have a spawn script go ahead and execute it last
|
||||
if (spawnScript.isNotEmpty())
|
||||
Con::evaluate(spawnScript.c_str(), true);
|
||||
Con::evaluate(spawnScript.c_str());
|
||||
|
||||
return spawnObject;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ Sun::Sun()
|
|||
mTypeMask = EnvironmentObjectType | LightObjectType | StaticObjectType;
|
||||
|
||||
mLightColor.set(0.7f, 0.7f, 0.7f);
|
||||
mLightAmbient.set(0.3f, 0.3f, 0.3f);
|
||||
mLightAmbient.set(1.0f, 1.0f, 1.0f);
|
||||
mBrightness = 1.0f;
|
||||
mSunAzimuth = 0.0f;
|
||||
mSunElevation = 35.0f;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ void GuiInspectorDynamicField::setData( const char* data, bool callbacks )
|
|||
{
|
||||
target->inspectPreApply();
|
||||
|
||||
if( callbacks )
|
||||
if( callbacks && !mField->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors))
|
||||
{
|
||||
if( isRemoval )
|
||||
Con::executef( mInspector, "onFieldRemoved", target->getIdString(), mDynField->slotName );
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ void GuiInspectorField::setData( const char* data, bool callbacks )
|
|||
|
||||
// Fire callback single-object undo.
|
||||
|
||||
if( callbacks )
|
||||
if( callbacks && !mField->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors) )
|
||||
Con::executef( mInspector, "onInspectorFieldModified",
|
||||
target->getIdString(),
|
||||
mField->pFieldname,
|
||||
|
|
|
|||
|
|
@ -790,7 +790,7 @@ void AdvancedLightBinManager::LightMaterialInfo::setLightParameters( const Light
|
|||
MaterialParameters *matParams = matInstance->getMaterialParameters();
|
||||
|
||||
matParams->setSafe( lightColor, lightInfo->getColor() );
|
||||
matParams->setSafe(lightBrightness, lightInfo->getBrightness() * lightInfo->getFadeAmount());
|
||||
F32 luxTargMultiplier = 1;
|
||||
|
||||
switch( lightInfo->getType() )
|
||||
{
|
||||
|
|
@ -804,10 +804,10 @@ void AdvancedLightBinManager::LightMaterialInfo::setLightParameters( const Light
|
|||
case LightInfo::Spot:
|
||||
{
|
||||
const F32 outerCone = lightInfo->getOuterConeAngle();
|
||||
const F32 innerCone = getMin(lightInfo->getInnerConeAngle(), outerCone);
|
||||
const F32 innerCone = getMin(lightInfo->getInnerConeAngle(), outerCone-0.0001f);
|
||||
const F32 outerCos = mCos(mDegToRad(outerCone / 2.0f));
|
||||
const F32 innerCos = mCos(mDegToRad(innerCone / 2.0f));
|
||||
Point2F spotParams(outerCos,innerCos - outerCos);
|
||||
Point2F spotParams(outerCos,mMax(innerCos - outerCos,0.001f));
|
||||
|
||||
matParams->setSafe( lightSpotParams, spotParams );
|
||||
matParams->setSafe( lightDirection, lightInfo->getDirection());
|
||||
|
|
@ -817,6 +817,9 @@ void AdvancedLightBinManager::LightMaterialInfo::setLightParameters( const Light
|
|||
const F32 invSqrRadius = 1.0f / mSquared(radius);
|
||||
matParams->setSafe(lightRange, radius);
|
||||
matParams->setSafe(lightInvSqrRange, invSqrRadius);
|
||||
|
||||
F32 concentration = 360.0f/ outerCone;
|
||||
luxTargMultiplier = radius * concentration;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -828,6 +831,7 @@ void AdvancedLightBinManager::LightMaterialInfo::setLightParameters( const Light
|
|||
const F32 invSqrRadius = 1.0f / (radius * radius);
|
||||
matParams->setSafe( lightRange, radius);
|
||||
matParams->setSafe( lightInvSqrRange, invSqrRadius);
|
||||
luxTargMultiplier =radius;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -835,6 +839,7 @@ void AdvancedLightBinManager::LightMaterialInfo::setLightParameters( const Light
|
|||
AssertFatal( false, "Bad light type!" );
|
||||
break;
|
||||
}
|
||||
matParams->setSafe(lightBrightness, lightInfo->getBrightness()* lightInfo->getFadeAmount() * luxTargMultiplier);
|
||||
}
|
||||
|
||||
bool LightMatInstance::setupPass( SceneRenderState *state, const SceneData &sgData )
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
|||
static AlignedArray<Point4F> lightSpotDirs(MAX_FORWARD_LIGHTS, sizeof(Point4F));
|
||||
static AlignedArray<Point4F> lightColors(MAX_FORWARD_LIGHTS, sizeof(Point4F));
|
||||
static AlignedArray<Point4F> lightConfigData(MAX_FORWARD_LIGHTS, sizeof(Point4F)); //type, brightness, range, invSqrRange : rgba
|
||||
static AlignedArray<Point2F> lightSpotParams(MAX_FORWARD_LIGHTS, sizeof(Point2F));
|
||||
static AlignedArray<Point2F> lightSpotParams(MAX_FORWARD_LIGHTS, sizeof(Point4F));
|
||||
|
||||
dMemset(lightPositions.getBuffer(), 0, lightPositions.getBufferSize());
|
||||
dMemset(lightSpotDirs.getBuffer(), 0, lightSpotDirs.getBufferSize());
|
||||
|
|
@ -352,11 +352,12 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
|||
vectorLightDirection = Point4F::Zero;
|
||||
vectorLightColor = Point4F::Zero;
|
||||
vectorLightAmbientColor = Point4F::Zero;
|
||||
|
||||
F32 luxTargMultiplier[MAX_FORWARD_LIGHTS];
|
||||
// Gather the data for the first 4 lights.
|
||||
const LightInfo* light;
|
||||
for (U32 i = 0; i < MAX_FORWARD_LIGHTS; i++)
|
||||
{
|
||||
luxTargMultiplier[i] = 1.0;
|
||||
light = sgData.lights[i];
|
||||
if (!light)
|
||||
break;
|
||||
|
|
@ -371,48 +372,52 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
|||
vectorLightColor = Point4F(light->getColor());
|
||||
vectorLightAmbientColor = Point4F(light->getAmbient());
|
||||
hasVectorLight = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// The light positions and spot directions are
|
||||
// in SoA order to make optimal use of the GPU.
|
||||
const Point3F& lightPos = light->getPosition();
|
||||
lightPositions[i].x = lightPos.x;
|
||||
lightPositions[i].y = lightPos.y;
|
||||
lightPositions[i].z = lightPos.z;
|
||||
lightPositions[i].w = 0;
|
||||
|
||||
const VectorF& lightDir = light->getDirection();
|
||||
lightSpotDirs[i].x = lightDir.x;
|
||||
lightSpotDirs[i].y = lightDir.y;
|
||||
lightSpotDirs[i].z = lightDir.z;
|
||||
lightSpotDirs[i].w = 0;
|
||||
|
||||
lightColors[i] = Point4F(light->getColor());
|
||||
|
||||
if (light->getType() == LightInfo::Point)
|
||||
else
|
||||
{
|
||||
lightConfigData[i].x = 0;
|
||||
// The light positions and spot directions are
|
||||
// in SoA order to make optimal use of the GPU.
|
||||
const Point3F& lightPos = light->getPosition();
|
||||
lightPositions[i].x = lightPos.x;
|
||||
lightPositions[i].y = lightPos.y;
|
||||
lightPositions[i].z = lightPos.z;
|
||||
lightPositions[i].w = 0;
|
||||
|
||||
lightColors[i] = Point4F(light->getColor());
|
||||
|
||||
F32 range = light->getRange().x;
|
||||
lightConfigData[i].z = range;
|
||||
|
||||
if (light->getType() == LightInfo::Point)
|
||||
{
|
||||
lightConfigData[i].x = 0;
|
||||
luxTargMultiplier[i] = range;
|
||||
}
|
||||
else if (light->getType() == LightInfo::Spot)
|
||||
{
|
||||
const VectorF& lightDir = light->getDirection();
|
||||
lightSpotDirs[i].x = lightDir.x;
|
||||
lightSpotDirs[i].y = lightDir.y;
|
||||
lightSpotDirs[i].z = lightDir.z;
|
||||
lightSpotDirs[i].w = 0;
|
||||
|
||||
lightConfigData[i].x = 1;
|
||||
|
||||
const F32 outerCone = light->getOuterConeAngle();
|
||||
const F32 innerCone = getMin(light->getInnerConeAngle(), outerCone - 0.0001f);
|
||||
const F32 outerCos = mCos(mDegToRad(outerCone / 2.0f));
|
||||
const F32 innerCos = mCos(mDegToRad(innerCone / 2.0f));
|
||||
Point2F spotParams(outerCos, mMax(innerCos - outerCos, 0.001f));
|
||||
|
||||
lightSpotParams[i].x = spotParams.x;
|
||||
lightSpotParams[i].y = spotParams.y;
|
||||
F32 concentration = 360.0f / outerCone;
|
||||
luxTargMultiplier[i] = range * concentration;
|
||||
}
|
||||
|
||||
lightConfigData[i].y = light->getBrightness() * luxTargMultiplier[i];
|
||||
lightConfigData[i].w = 1.0f / (range * range);
|
||||
}
|
||||
else if (light->getType() == LightInfo::Spot)
|
||||
{
|
||||
lightConfigData[i].x = 1;
|
||||
|
||||
const F32 outerCone = light->getOuterConeAngle();
|
||||
const F32 innerCone = getMin(light->getInnerConeAngle(), outerCone);
|
||||
const F32 outerCos = mCos(mDegToRad(outerCone / 2.0f));
|
||||
const F32 innerCos = mCos(mDegToRad(innerCone / 2.0f));
|
||||
Point2F spotParams(outerCos, innerCos - outerCos);
|
||||
|
||||
lightSpotParams[i].x = spotParams.x;
|
||||
lightSpotParams[i].y = spotParams.y;
|
||||
}
|
||||
|
||||
lightConfigData[i].y = light->getBrightness();
|
||||
|
||||
F32 range = light->getRange().x;
|
||||
lightConfigData[i].z = range;
|
||||
lightConfigData[i].w = 1.0f / (range * range);
|
||||
}
|
||||
|
||||
shaderConsts->setSafe(lightPositionSC, lightPositions);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ void SingleLightShadowMap::_render( RenderPassManager* renderPass,
|
|||
lightMatrix.inverse();
|
||||
GFX->setWorldMatrix(lightMatrix);
|
||||
|
||||
const MatrixF& lightProj = GFX->getProjectionMatrix();
|
||||
MatrixF lightProj = GFX->getProjectionMatrix();
|
||||
lightProj.reverseProjection();
|
||||
mWorldToLightProj = lightProj * lightMatrix;
|
||||
|
||||
// Render the shadowmap!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue