Merge branch 'development' of https://github.com/TorqueGameEngines/Torque3D into development

This commit is contained in:
marauder2k7 2023-01-10 02:48:44 +00:00
commit 1fc7b99bd6
39 changed files with 189 additions and 561 deletions

View file

@ -159,7 +159,7 @@ DefineConsoleType(TypeSoundAssetId, String)
AssetPtr<SoundAsset> m##name##Asset = NULL;\ AssetPtr<SoundAsset> m##name##Asset = NULL;\
SFXProfile* m##name##Profile = NULL;\ SFXProfile* m##name##Profile = NULL;\
SFXDescription* m##name##Desc = NULL;\ SFXDescription* m##name##Desc = NULL;\
SimObjectId m##name##SFXId = NULL;\ SimObjectId m##name##SFXId = 0;\
public: \ public: \
const StringTableEntry get##name##File() const { return m##name##Name; }\ const StringTableEntry get##name##File() const { return m##name##Name; }\
void set##name##File(const FileName &_in) { m##name##Name = StringTable->insert(_in.c_str());}\ void set##name##File(const FileName &_in) { m##name##Name = StringTable->insert(_in.c_str());}\
@ -492,9 +492,9 @@ if (m##name##AssetId[index] != StringTable->EmptyString())\
} }
#define PACKDATA_SOUNDASSET_ARRAY(name, index)\ #define PACKDATA_SOUNDASSET_ARRAY(name, index)\
if (stream->writeFlag(m##name##Asset[index].notNull()))\ if (stream->writeFlag(AssetDatabase.isDeclaredAsset(m##name##AssetId[index])))\
{\ {\
stream->writeString(m##name##Asset[index].getAssetId());\ stream->writeString(m##name##AssetId[index]);\
}\ }\
else\ else\
{\ {\

View file

@ -242,7 +242,7 @@ LightningData::LightningData()
for (S32 i = 0; i < MaxThunders; i++) for (S32 i = 0; i < MaxThunders; i++)
{ {
INIT_ASSET_ARRAY(ThunderSound, i); INIT_SOUNDASSET_ARRAY(ThunderSound, i);
} }
for (S32 i = 0; i < MaxTextures; i++) for (S32 i = 0; i < MaxTextures; i++)
@ -335,7 +335,7 @@ void LightningData::packData(BitStream* stream)
U32 i; U32 i;
for (i = 0; i < MaxThunders; i++) for (i = 0; i < MaxThunders; i++)
{ {
PACKDATA_ASSET_ARRAY(ThunderSound, i); PACKDATA_SOUNDASSET_ARRAY(ThunderSound, i);
} }
stream->writeInt(mNumStrikeTextures, 4); stream->writeInt(mNumStrikeTextures, 4);
@ -353,7 +353,7 @@ void LightningData::unpackData(BitStream* stream)
U32 i; U32 i;
for (i = 0; i < MaxThunders; i++) for (i = 0; i < MaxThunders; i++)
{ {
UNPACKDATA_ASSET_ARRAY(ThunderSound, i); UNPACKDATA_SOUNDASSET_ARRAY(ThunderSound, i);
} }
mNumStrikeTextures = stream->readInt(4); mNumStrikeTextures = stream->readInt(4);

View file

@ -228,8 +228,8 @@ enum SceneObjectTypeMasks : U32
OUTDOOR_OBJECT_TYPEMASK = ( TerrainObjectType | OUTDOOR_OBJECT_TYPEMASK = ( TerrainObjectType |
EnvironmentObjectType ), EnvironmentObjectType ),
SKYLIGHT_CAPTURE_TYPEMASK = (EnvironmentObjectType), SKYLIGHT_CAPTURE_TYPEMASK = (OUTDOOR_OBJECT_TYPEMASK) & ~(PhysicalZoneObjectType | MarkerObjectType | TriggerObjectType),
REFLECTION_PROBE_CAPTURE_TYPEMASK = (StaticObjectType | StaticShapeObjectType | LightObjectType) REFLECTION_PROBE_CAPTURE_TYPEMASK = (SKYLIGHT_CAPTURE_TYPEMASK | StaticObjectType | StaticShapeObjectType | LightObjectType)
}; };
#endif #endif

View file

@ -423,7 +423,7 @@ PlayerData::PlayerData()
boxHeadFrontPercentage = 1; boxHeadFrontPercentage = 1;
for (S32 i = 0; i < MaxSounds; i++) for (S32 i = 0; i < MaxSounds; i++)
INIT_ASSET_ARRAY(PlayerSound, i); INIT_SOUNDASSET_ARRAY(PlayerSound, i);
footPuffEmitter = NULL; footPuffEmitter = NULL;
footPuffID = 0; footPuffID = 0;
@ -469,17 +469,17 @@ bool PlayerData::preload(bool server, String &errorStr)
{ {
if(!Parent::preload(server, errorStr)) if(!Parent::preload(server, errorStr))
return false; return false;
if (!server) {
for (U32 i = 0; i < MaxSounds; ++i) for (U32 i = 0; i < MaxSounds; ++i)
{
_setPlayerSound(getPlayerSound(i), i);
if (getPlayerSound(i) != StringTable->EmptyString())
{ {
if (!getPlayerSoundProfile(i)) _setPlayerSound(getPlayerSound(i), i);
Con::errorf("PlayerData::Preload() - unable to find sfxProfile for asset %d %s", i, mPlayerSoundAssetId[i]); if (getPlayerSound(i) != StringTable->EmptyString())
{
if (!getPlayerSoundProfile(i))
Con::errorf("PlayerData::Preload() - unable to find sfxProfile for asset %d %s", i, mPlayerSoundAssetId[i]);
}
} }
} }
// //
runSurfaceCos = mCos(mDegToRad(runSurfaceAngle)); runSurfaceCos = mCos(mDegToRad(runSurfaceAngle));
jumpSurfaceCos = mCos(mDegToRad(jumpSurfaceAngle)); jumpSurfaceCos = mCos(mDegToRad(jumpSurfaceAngle));
@ -1271,7 +1271,7 @@ void PlayerData::packData(BitStream* stream)
stream->write(minLateralImpactSpeed); stream->write(minLateralImpactSpeed);
for (U32 i = 0; i < MaxSounds; i++) for (U32 i = 0; i < MaxSounds; i++)
PACKDATA_ASSET_ARRAY(PlayerSound, i); PACKDATA_SOUNDASSET_ARRAY(PlayerSound, i);
mathWrite(*stream, boxSize); mathWrite(*stream, boxSize);
mathWrite(*stream, crouchBoxSize); mathWrite(*stream, crouchBoxSize);
@ -1452,7 +1452,7 @@ void PlayerData::unpackData(BitStream* stream)
stream->read(&minLateralImpactSpeed); stream->read(&minLateralImpactSpeed);
for (U32 i = 0; i < MaxSounds; i++) for (U32 i = 0; i < MaxSounds; i++)
UNPACKDATA_ASSET_ARRAY(PlayerSound, i); UNPACKDATA_SOUNDASSET_ARRAY(PlayerSound, i);
mathRead(*stream, &boxSize); mathRead(*stream, &boxSize);
mathRead(*stream, &crouchBoxSize); mathRead(*stream, &crouchBoxSize);

View file

@ -207,6 +207,27 @@ TriggerObjectType |
CorpseObjectType; CorpseObjectType;
typedef RigidShapeData::Body::Sounds bodySounds;
DefineEnumType(bodySounds);
ImplementEnumType(bodySounds, "enum types.\n"
"@ingroup VehicleData\n\n")
{ bodySounds::SoftImpactSound, "SoftImpactSound", "..." },
{ bodySounds::HardImpactSound, "HardImpactSound", "..." },
EndImplementEnumType;
typedef RigidShapeData::Sounds waterSounds;
DefineEnumType(waterSounds);
ImplementEnumType(waterSounds, "enum types.\n"
"@ingroup RigidShapeData\n\n")
{ waterSounds::ExitWater, "ExitWater", "..." },
{ waterSounds::ImpactSoft, "ImpactSoft", "..." },
{ waterSounds::ImpactMedium, "ImpactMedium", "..." },
{ waterSounds::ImpactHard, "ImpactHard", "..." },
{ waterSounds::Wake, "Wake", "..." },
EndImplementEnumType;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
RigidShapeData::RigidShapeData() RigidShapeData::RigidShapeData()
@ -238,7 +259,7 @@ RigidShapeData::RigidShapeData()
density = 4; density = 4;
for (S32 i = 0; i < Body::MaxSounds; i++) for (S32 i = 0; i < Body::MaxSounds; i++)
INIT_ASSET_ARRAY(BodySounds, i); INIT_SOUNDASSET_ARRAY(BodySounds, i);
dustEmitter = NULL; dustEmitter = NULL;
dustID = 0; dustID = 0;
@ -257,7 +278,7 @@ RigidShapeData::RigidShapeData()
enablePhysicsRep = true; enablePhysicsRep = true;
for (S32 i = 0; i < Sounds::MaxSounds; i++) for (S32 i = 0; i < Sounds::MaxSounds; i++)
INIT_ASSET_ARRAY(WaterSounds, i); INIT_SOUNDASSET_ARRAY(WaterSounds, i);
dragForce = 0; dragForce = 0;
vertFactor = 0.25; vertFactor = 0.25;
@ -301,7 +322,7 @@ bool RigidShapeData::preload(bool server, String &errorStr)
if (!server) { if (!server) {
for (S32 i = 0; i < Body::MaxSounds; i++) for (S32 i = 0; i < Body::MaxSounds; i++)
{ {
if (mBodySounds[i]) if (getBodySounds(i) != StringTable->EmptyString())
{ {
_setBodySounds(getBodySounds(i), i); _setBodySounds(getBodySounds(i), i);
} }
@ -309,7 +330,7 @@ bool RigidShapeData::preload(bool server, String &errorStr)
for (S32 j = 0; j < Sounds::MaxSounds; j++) for (S32 j = 0; j < Sounds::MaxSounds; j++)
{ {
if (mWaterSounds[j]) if (getWaterSounds(j) != StringTable->EmptyString())
{ {
_setWaterSounds(getWaterSounds(j), j); _setWaterSounds(getWaterSounds(j), j);
} }
@ -371,7 +392,7 @@ void RigidShapeData::packData(BitStream* stream)
stream->write(body.friction); stream->write(body.friction);
for (U32 i = 0; i < Body::MaxSounds; ++i) for (U32 i = 0; i < Body::MaxSounds; ++i)
{ {
PACKDATA_ASSET_ARRAY(BodySounds, i); PACKDATA_SOUNDASSET_ARRAY(BodySounds, i);
} }
stream->write(minImpactSpeed); stream->write(minImpactSpeed);
@ -391,8 +412,9 @@ void RigidShapeData::packData(BitStream* stream)
stream->write(cameraLag); stream->write(cameraLag);
stream->write(cameraDecay); stream->write(cameraDecay);
stream->write(cameraOffset); stream->write(cameraOffset);
stream->write( dustHeight ); stream->write(triggerDustHeight);
stream->write(dustHeight);
stream->write(exitSplashSoundVel); stream->write(exitSplashSoundVel);
stream->write(softSplashSoundVel); stream->write(softSplashSoundVel);
@ -403,7 +425,7 @@ void RigidShapeData::packData(BitStream* stream)
// write the water sound profiles // write the water sound profiles
for (U32 i = 0; i < Sounds::MaxSounds; ++i) for (U32 i = 0; i < Sounds::MaxSounds; ++i)
{ {
PACKDATA_ASSET_ARRAY(WaterSounds, i); PACKDATA_SOUNDASSET_ARRAY(WaterSounds, i);
} }
if (stream->writeFlag( dustEmitter )) if (stream->writeFlag( dustEmitter ))
@ -434,7 +456,7 @@ void RigidShapeData::unpackData(BitStream* stream)
for (U32 i = 0; i < Body::Sounds::MaxSounds; i++) for (U32 i = 0; i < Body::Sounds::MaxSounds; i++)
{ {
UNPACKDATA_ASSET_ARRAY(BodySounds, i); UNPACKDATA_SOUNDASSET_ARRAY(BodySounds, i);
} }
stream->read(&minImpactSpeed); stream->read(&minImpactSpeed);
@ -455,6 +477,7 @@ void RigidShapeData::unpackData(BitStream* stream)
stream->read(&cameraDecay); stream->read(&cameraDecay);
stream->read(&cameraOffset); stream->read(&cameraOffset);
stream->read(&triggerDustHeight);
stream->read( &dustHeight ); stream->read( &dustHeight );
stream->read(&exitSplashSoundVel); stream->read(&exitSplashSoundVel);
@ -466,7 +489,7 @@ void RigidShapeData::unpackData(BitStream* stream)
// write the water sound profiles // write the water sound profiles
for (U32 i = 0; i < Sounds::MaxSounds; ++i) for (U32 i = 0; i < Sounds::MaxSounds; ++i)
{ {
UNPACKDATA_ASSET_ARRAY(WaterSounds, i); UNPACKDATA_SOUNDASSET_ARRAY(WaterSounds, i);
} }
if( stream->readFlag() ) if( stream->readFlag() )
@ -539,14 +562,14 @@ void RigidShapeData::initPersistFields()
addGroup( "Sounds" ); addGroup( "Sounds" );
INITPERSISTFIELD_SOUNDASSET_ARRAY(BodySounds, Body::Sounds::MaxSounds, RigidShapeData, "Sounds for body."); INITPERSISTFIELD_SOUNDASSET_ENUMED(BodySounds, bodySounds, Body::Sounds::MaxSounds, RigidShapeData, "Sounds for body.");
addField("exitSplashSoundVelocity", TypeF32, Offset(exitSplashSoundVel, RigidShapeData), "The minimum velocity at which the exit splash sound will be played when emerging from water.\n"); addField("exitSplashSoundVelocity", TypeF32, Offset(exitSplashSoundVel, RigidShapeData), "The minimum velocity at which the exit splash sound will be played when emerging from water.\n");
addField("softSplashSoundVelocity", TypeF32, Offset(softSplashSoundVel, RigidShapeData),"The minimum velocity at which the soft splash sound will be played when impacting water.\n"); addField("softSplashSoundVelocity", TypeF32, Offset(softSplashSoundVel, RigidShapeData),"The minimum velocity at which the soft splash sound will be played when impacting water.\n");
addField("mediumSplashSoundVelocity", TypeF32, Offset(medSplashSoundVel, RigidShapeData), "The minimum velocity at which the medium splash sound will be played when impacting water.\n"); addField("mediumSplashSoundVelocity", TypeF32, Offset(medSplashSoundVel, RigidShapeData), "The minimum velocity at which the medium splash sound will be played when impacting water.\n");
addField("hardSplashSoundVelocity", TypeF32, Offset(hardSplashSoundVel, RigidShapeData), "The minimum velocity at which the hard splash sound will be played when impacting water.\n"); addField("hardSplashSoundVelocity", TypeF32, Offset(hardSplashSoundVel, RigidShapeData), "The minimum velocity at which the hard splash sound will be played when impacting water.\n");
INITPERSISTFIELD_SOUNDASSET_ARRAY(WaterSounds, Sounds::MaxSounds, RigidShapeData, "Sounds for interacting with water."); INITPERSISTFIELD_SOUNDASSET_ENUMED(WaterSounds, waterSounds, Sounds::MaxSounds, RigidShapeData, "Sounds for interacting with water.");
endGroup( "Sounds" ); endGroup( "Sounds" );

View file

@ -64,7 +64,6 @@ class RigidShapeData : public ShapeBaseData
} body; } body;
DECLARE_SOUNDASSET_ARRAY(RigidShapeData, BodySounds, Body::Sounds::MaxSounds) DECLARE_SOUNDASSET_ARRAY(RigidShapeData, BodySounds, Body::Sounds::MaxSounds)
DECLARE_ASSET_ARRAY_SETGET(RigidShapeData, BodySounds);
enum RigidShapeConsts enum RigidShapeConsts
{ {

View file

@ -1572,7 +1572,7 @@ void ShapeBase::setControllingClient( GameConnection* client )
gSFX3DWorld->setListener( NULL ); gSFX3DWorld->setListener( NULL );
} }
else if( client && client->isConnectionToServer() && !getControllingObject() ) else if( client && client->isConnectionToServer() && (getControllingObject() != this) )
{ {
// We're on the local client and not controlled by another object, so make // We're on the local client and not controlled by another object, so make
// us the current SFX listener. // us the current SFX listener.

View file

@ -116,7 +116,7 @@ FlyingVehicleData::FlyingVehicleData()
jetEmitter[j] = 0; jetEmitter[j] = 0;
for (S32 i = 0; i < MaxSounds; i++) for (S32 i = 0; i < MaxSounds; i++)
INIT_ASSET_ARRAY(FlyingSounds, i); INIT_SOUNDASSET_ARRAY(FlyingSounds, i);
vertThrustMultiple = 1.0; vertThrustMultiple = 1.0;
} }
@ -241,7 +241,7 @@ void FlyingVehicleData::packData(BitStream* stream)
for (S32 i = 0; i < MaxSounds; i++) for (S32 i = 0; i < MaxSounds; i++)
{ {
PACKDATA_ASSET_ARRAY(FlyingSounds, i); PACKDATA_SOUNDASSET_ARRAY(FlyingSounds, i);
} }
for (S32 j = 0; j < MaxJetEmitters; j++) for (S32 j = 0; j < MaxJetEmitters; j++)
@ -276,7 +276,7 @@ void FlyingVehicleData::unpackData(BitStream* stream)
for (S32 i = 0; i < MaxSounds; i++) for (S32 i = 0; i < MaxSounds; i++)
{ {
UNPACKDATA_ASSET_ARRAY(FlyingSounds, i); UNPACKDATA_SOUNDASSET_ARRAY(FlyingSounds, i);
} }
for (S32 j = 0; j < MaxJetEmitters; j++) { for (S32 j = 0; j < MaxJetEmitters; j++) {

View file

@ -73,9 +73,9 @@ DefineEnumType(hoverSoundsEnum);
ImplementEnumType(hoverSoundsEnum, "enum types.\n" ImplementEnumType(hoverSoundsEnum, "enum types.\n"
"@ingroup HoverVehicleData\n\n") "@ingroup HoverVehicleData\n\n")
{ HoverVehicleData::JetSound, "JetSound", "..." }, { hoverSoundsEnum::JetSound, "JetSound", "..." },
{ HoverVehicleData::EngineSound, "EngineSound", "..." }, { hoverSoundsEnum::EngineSound, "EngineSound", "..." },
{ HoverVehicleData::FloatSound, "FloatSound", "..." }, { hoverSoundsEnum::FloatSound, "FloatSound", "..." },
EndImplementEnumType; EndImplementEnumType;
namespace { namespace {
@ -162,7 +162,7 @@ HoverVehicleData::HoverVehicleData()
jetEmitter[j] = 0; jetEmitter[j] = 0;
for (S32 i = 0; i < MaxSounds; i++) for (S32 i = 0; i < MaxSounds; i++)
INIT_ASSET_ARRAY(HoverSounds, i); INIT_SOUNDASSET_ARRAY(HoverSounds, i);
} }
HoverVehicleData::~HoverVehicleData() HoverVehicleData::~HoverVehicleData()
@ -370,7 +370,7 @@ void HoverVehicleData::packData(BitStream* stream)
for (S32 i = 0; i < MaxSounds; i++) for (S32 i = 0; i < MaxSounds; i++)
{ {
PACKDATA_ASSET_ARRAY(HoverSounds, i); PACKDATA_SOUNDASSET_ARRAY(HoverSounds, i);
} }
for (S32 j = 0; j < MaxJetEmitters; j++) for (S32 j = 0; j < MaxJetEmitters; j++)
@ -419,7 +419,7 @@ void HoverVehicleData::unpackData(BitStream* stream)
for (S32 i = 0; i < MaxSounds; i++) for (S32 i = 0; i < MaxSounds; i++)
{ {
UNPACKDATA_ASSET_ARRAY(HoverSounds, i); UNPACKDATA_SOUNDASSET_ARRAY(HoverSounds, i);
} }
for (S32 j = 0; j < MaxJetEmitters; j++) { for (S32 j = 0; j < MaxJetEmitters; j++) {

View file

@ -80,28 +80,6 @@ static U32 sTriggerMask = ItemObjectType |
IMPLEMENT_CONOBJECT(VehicleData); IMPLEMENT_CONOBJECT(VehicleData);
typedef VehicleData::Body::Sounds bodySounds;
DefineEnumType(bodySounds);
ImplementEnumType(bodySounds, "enum types.\n"
"@ingroup VehicleData\n\n")
{ VehicleData::Body::SoftImpactSound, "SoftImpactSound", "..." },
{ VehicleData::Body::HardImpactSound, "HardImpactSound", "..." },
EndImplementEnumType;
typedef VehicleData::Sounds vehSoundsEnum;
DefineEnumType(vehSoundsEnum);
ImplementEnumType(vehSoundsEnum, "enum types.\n"
"@ingroup VehicleData\n\n")
{ VehicleData::ExitWater, "ExitWater", "..." },
{ VehicleData::ImpactSoft, "ImpactSoft", "..." },
{ VehicleData::ImpactMedium, "ImpactMedium", "..." },
{ VehicleData::ImpactHard, "ImpactHard", "..." },
{ VehicleData::Wake, "Wake", "..." },
EndImplementEnumType;
ConsoleDocClass( VehicleData, ConsoleDocClass( VehicleData,
"@brief Base properties shared by all Vehicles (FlyingVehicle, HoverVehicle, " "@brief Base properties shared by all Vehicles (FlyingVehicle, HoverVehicle, "
"WheeledVehicle).\n\n" "WheeledVehicle).\n\n"
@ -152,70 +130,21 @@ VehicleData::VehicleData()
shadowEnable = true; shadowEnable = true;
shadowSize = 256; shadowSize = 256;
shadowProjectionDistance = 14.0f; shadowProjectionDistance = 14.0f;
body.friction = 0;
body.restitution = 1;
minImpactSpeed = 25;
softImpactSpeed = 25;
hardImpactSpeed = 50;
minRollSpeed = 0;
maxSteeringAngle = M_PI_F/4.0f; // 45 deg. maxSteeringAngle = M_PI_F/4.0f; // 45 deg.
cameraRoll = true;
cameraLag = 0;
cameraDecay = 0;
cameraOffset = 0;
minDrag = 0;
maxDrag = 0;
integration = 1;
collisionTol = 0.1f;
contactTol = 0.1f;
massCenter.set(0,0,0);
massBox.set(0,0,0);
drag = 0.7f;
density = 4;
jetForce = 500; jetForce = 500;
jetEnergyDrain = 0.8f; jetEnergyDrain = 0.8f;
minJetEnergy = 1; minJetEnergy = 1;
steeringReturn = 0.0f; steeringReturn = 0.0f;
steeringReturnSpeedScale = 0.01f; steeringReturnSpeedScale = 0.01f;
powerSteering = false; powerSteering = false;
for (S32 i = 0; i < Body::MaxSounds; i++)
{
INIT_ASSET_ARRAY(VehicleBodySounds, i);
}
dustEmitter = NULL;
dustID = 0;
triggerDustHeight = 3.0;
dustHeight = 1.0;
dMemset( damageEmitterList, 0, sizeof( damageEmitterList ) ); dMemset( damageEmitterList, 0, sizeof( damageEmitterList ) );
dMemset( damageEmitterOffset, 0, sizeof( damageEmitterOffset ) ); dMemset( damageEmitterOffset, 0, sizeof( damageEmitterOffset ) );
dMemset( damageEmitterIDList, 0, sizeof( damageEmitterIDList ) ); dMemset( damageEmitterIDList, 0, sizeof( damageEmitterIDList ) );
dMemset( damageLevelTolerance, 0, sizeof( damageLevelTolerance ) ); dMemset( damageLevelTolerance, 0, sizeof( damageLevelTolerance ) );
dMemset( splashEmitterList, 0, sizeof( splashEmitterList ) );
dMemset( splashEmitterIDList, 0, sizeof( splashEmitterIDList ) );
numDmgEmitterAreas = 0; numDmgEmitterAreas = 0;
splashFreqMod = 300.0;
splashVelEpsilon = 0.50;
exitSplashSoundVel = 2.0;
softSplashSoundVel = 1.0;
medSplashSoundVel = 2.0;
hardSplashSoundVel = 3.0;
for (S32 i = 0; i < Sounds::MaxSounds; i++)
INIT_ASSET_ARRAY(VehicleWaterSounds, i);
collDamageThresholdVel = 20; collDamageThresholdVel = 20;
collDamageMultiplier = 0.05f; collDamageMultiplier = 0.05f;
enablePhysicsRep = true; enablePhysicsRep = true;
@ -237,33 +166,6 @@ bool VehicleData::preload(bool server, String &errorStr)
return false; return false;
} }
// Resolve objects transmitted from server
if (!server) {
for (S32 i = 0; i < Body::MaxSounds; i++)
{
if (getVehicleBodySounds(i) != StringTable->EmptyString() )
{
_setVehicleBodySounds(getVehicleBodySounds(i), i);
}
}
for (S32 j = 0; j < Sounds::MaxSounds; j++)
{
if (getVehicleWaterSounds(j) != StringTable->EmptyString())
{
_setVehicleWaterSounds(getVehicleWaterSounds(j), j);
}
}
}
if( !dustEmitter && dustID != 0 )
{
if( !Sim::findObject( dustID, dustEmitter ) )
{
Con::errorf( ConsoleLogEntry::General, "VehicleData::preload Invalid packet, bad datablockId(dustEmitter): 0x%x", dustID );
}
}
U32 i; U32 i;
for( i=0; i<VC_NUM_DAMAGE_EMITTERS; i++ ) for( i=0; i<VC_NUM_DAMAGE_EMITTERS; i++ )
{ {
@ -276,17 +178,6 @@ bool VehicleData::preload(bool server, String &errorStr)
} }
} }
for( i=0; i<VC_NUM_SPLASH_EMITTERS; i++ )
{
if( !splashEmitterList[i] && splashEmitterIDList[i] != 0 )
{
if( !Sim::findObject( splashEmitterIDList[i], splashEmitterList[i] ) )
{
Con::errorf( ConsoleLogEntry::General, "VehicleData::preload Invalid packet, bad datablockId(splashEmitter): 0x%x", splashEmitterIDList[i] );
}
}
}
return true; return true;
} }
@ -298,27 +189,8 @@ void VehicleData::packData(BitStream* stream)
S32 i; S32 i;
Parent::packData(stream); Parent::packData(stream);
stream->write(body.restitution);
stream->write(body.friction);
for (i = 0; i < Body::MaxSounds; i++)
{
PACKDATA_ASSET_ARRAY(VehicleBodySounds, i);
}
stream->write(minImpactSpeed);
stream->write(softImpactSpeed);
stream->write(hardImpactSpeed);
stream->write(minRollSpeed);
stream->write(maxSteeringAngle); stream->write(maxSteeringAngle);
stream->write(maxDrag);
stream->write(minDrag);
stream->write(integration);
stream->write(collisionTol);
stream->write(contactTol);
mathWrite(*stream,massCenter);
mathWrite(*stream,massBox);
stream->write(jetForce); stream->write(jetForce);
stream->write(jetEnergyDrain); stream->write(jetEnergyDrain);
stream->write(minJetEnergy); stream->write(minJetEnergy);
@ -327,33 +199,10 @@ void VehicleData::packData(BitStream* stream)
stream->write(steeringReturnSpeedScale); stream->write(steeringReturnSpeedScale);
stream->writeFlag(powerSteering); stream->writeFlag(powerSteering);
stream->writeFlag(cameraRoll);
stream->write(cameraLag);
stream->write(cameraDecay);
stream->write(cameraOffset);
stream->write( triggerDustHeight );
stream->write( dustHeight );
stream->write( numDmgEmitterAreas ); stream->write( numDmgEmitterAreas );
stream->write(exitSplashSoundVel);
stream->write(softSplashSoundVel);
stream->write(medSplashSoundVel);
stream->write(hardSplashSoundVel);
stream->write(enablePhysicsRep); stream->write(enablePhysicsRep);
// write the water sound profiles
for (i = 0; i < MaxSounds; i++)
{
PACKDATA_ASSET_ARRAY(VehicleWaterSounds, i);
}
if (stream->writeFlag( dustEmitter ))
{
stream->writeRangedU32( dustEmitter->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast );
}
for (i = 0; i < VC_NUM_DAMAGE_EMITTERS; i++) for (i = 0; i < VC_NUM_DAMAGE_EMITTERS; i++)
{ {
if( stream->writeFlag( damageEmitterList[i] != NULL ) ) if( stream->writeFlag( damageEmitterList[i] != NULL ) )
@ -362,14 +211,6 @@ void VehicleData::packData(BitStream* stream)
} }
} }
for (i = 0; i < VC_NUM_SPLASH_EMITTERS; i++)
{
if( stream->writeFlag( splashEmitterList[i] != NULL ) )
{
stream->writeRangedU32( splashEmitterList[i]->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast );
}
}
for (S32 j = 0; j < VC_NUM_DAMAGE_EMITTER_AREAS; j++) for (S32 j = 0; j < VC_NUM_DAMAGE_EMITTER_AREAS; j++)
{ {
stream->write( damageEmitterOffset[j].x ); stream->write( damageEmitterOffset[j].x );
@ -382,9 +223,6 @@ void VehicleData::packData(BitStream* stream)
stream->write( damageLevelTolerance[k] ); stream->write( damageLevelTolerance[k] );
} }
stream->write(splashFreqMod);
stream->write(splashVelEpsilon);
stream->write(collDamageThresholdVel); stream->write(collDamageThresholdVel);
stream->write(collDamageMultiplier); stream->write(collDamageMultiplier);
} }
@ -393,28 +231,9 @@ void VehicleData::unpackData(BitStream* stream)
{ {
Parent::unpackData(stream); Parent::unpackData(stream);
stream->read(&body.restitution);
stream->read(&body.friction);
S32 i; S32 i;
for (i = 0; i < Body::MaxSounds; i++)
{
UNPACKDATA_ASSET_ARRAY(VehicleBodySounds, i);
}
stream->read(&minImpactSpeed);
stream->read(&softImpactSpeed);
stream->read(&hardImpactSpeed);
stream->read(&minRollSpeed);
stream->read(&maxSteeringAngle); stream->read(&maxSteeringAngle);
stream->read(&maxDrag);
stream->read(&minDrag);
stream->read(&integration);
stream->read(&collisionTol);
stream->read(&contactTol);
mathRead(*stream,&massCenter);
mathRead(*stream,&massBox);
stream->read(&jetForce); stream->read(&jetForce);
stream->read(&jetEnergyDrain); stream->read(&jetEnergyDrain);
stream->read(&minJetEnergy); stream->read(&minJetEnergy);
@ -423,33 +242,10 @@ void VehicleData::unpackData(BitStream* stream)
stream->read(&steeringReturnSpeedScale); stream->read(&steeringReturnSpeedScale);
powerSteering = stream->readFlag(); powerSteering = stream->readFlag();
cameraRoll = stream->readFlag();
stream->read(&cameraLag);
stream->read(&cameraDecay);
stream->read(&cameraOffset);
stream->read( &triggerDustHeight );
stream->read( &dustHeight );
stream->read( &numDmgEmitterAreas ); stream->read( &numDmgEmitterAreas );
stream->read(&exitSplashSoundVel);
stream->read(&softSplashSoundVel);
stream->read(&medSplashSoundVel);
stream->read(&hardSplashSoundVel);
stream->read(&enablePhysicsRep); stream->read(&enablePhysicsRep);
// write the water sound profiles
for (i = 0; i < Sounds::MaxSounds; i++)
{
UNPACKDATA_ASSET_ARRAY(VehicleWaterSounds, i);
}
if( stream->readFlag() )
{
dustID = (S32) stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast);
}
for (i = 0; i < VC_NUM_DAMAGE_EMITTERS; i++) for (i = 0; i < VC_NUM_DAMAGE_EMITTERS; i++)
{ {
if( stream->readFlag() ) if( stream->readFlag() )
@ -458,14 +254,6 @@ void VehicleData::unpackData(BitStream* stream)
} }
} }
for (i = 0; i < VC_NUM_SPLASH_EMITTERS; i++)
{
if( stream->readFlag() )
{
splashEmitterIDList[i] = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );
}
}
for( S32 j=0; j<VC_NUM_DAMAGE_EMITTER_AREAS; j++ ) for( S32 j=0; j<VC_NUM_DAMAGE_EMITTER_AREAS; j++ )
{ {
stream->read( &damageEmitterOffset[j].x ); stream->read( &damageEmitterOffset[j].x );
@ -478,9 +266,6 @@ void VehicleData::unpackData(BitStream* stream)
stream->read( &damageLevelTolerance[k] ); stream->read( &damageLevelTolerance[k] );
} }
stream->read(&splashFreqMod);
stream->read(&splashVelEpsilon);
stream->read(&collDamageThresholdVel); stream->read(&collDamageThresholdVel);
stream->read(&collDamageMultiplier); stream->read(&collDamageMultiplier);
} }
@ -511,69 +296,9 @@ void VehicleData::initPersistFields()
"Amount of effect the vehicle's speed has on its rate of steering return." ); "Amount of effect the vehicle's speed has on its rate of steering return." );
addField( "powerSteering", TypeBool, Offset(powerSteering, VehicleData), addField( "powerSteering", TypeBool, Offset(powerSteering, VehicleData),
"If true, steering does not auto-centre while the vehicle is being steered by its driver." ); "If true, steering does not auto-centre while the vehicle is being steered by its driver." );
addField( "massCenter", TypePoint3F, Offset(massCenter, VehicleData),
"Defines the vehicle's center of mass (offset from the origin of the model)." );
addField( "massBox", TypePoint3F, Offset(massBox, VehicleData),
"@brief Define the box used to estimate the vehicle's moment of inertia.\n\n"
"Currently only used by WheeledVehicle; other vehicle types use a "
"unit sphere to compute inertia." );
addField( "bodyRestitution", TypeF32, Offset(body.restitution, VehicleData),
"Collision 'bounciness'.\nNormally in the range 0 (not bouncy at all) to "
"1 (100% bounciness)." );
addField( "bodyFriction", TypeF32, Offset(body.friction, VehicleData),
"Collision friction coefficient.\nHow well this object will slide against "
"objects it collides with." );
INITPERSISTFIELD_SOUNDASSET_ENUMED(VehicleBodySounds, bodySounds, Body::Sounds::MaxSounds, VehicleData, "Sounds for vehicle body impacts.");
addField( "minImpactSpeed", TypeF32, Offset(minImpactSpeed, VehicleData),
"Minimum collision speed for the onImpact callback to be invoked." );
addField( "softImpactSpeed", TypeF32, Offset(softImpactSpeed, VehicleData),
"Minimum collision speed for the softImpactSound to be played." );
addField( "hardImpactSpeed", TypeF32, Offset(hardImpactSpeed, VehicleData),
"Minimum collision speed for the hardImpactSound to be played." );
addField( "minRollSpeed", TypeF32, Offset(minRollSpeed, VehicleData),
"Unused" );
addField( "maxSteeringAngle", TypeF32, Offset(maxSteeringAngle, VehicleData), addField( "maxSteeringAngle", TypeF32, Offset(maxSteeringAngle, VehicleData),
"Maximum yaw (horizontal) and pitch (vertical) steering angle in radians." ); "Maximum yaw (horizontal) and pitch (vertical) steering angle in radians." );
addField( "maxDrag", TypeF32, Offset(maxDrag, VehicleData),
"Maximum drag coefficient.\nCurrently unused." );
addField( "minDrag", TypeF32, Offset(minDrag, VehicleData),
"Minimum drag coefficient.\nCurrently only used by FlyingVehicle." );
addField( "integration", TypeS32, Offset(integration, VehicleData),
"Number of integration steps per tick.\nIncrease this to improve simulation "
"stability (also increases simulation processing time)." );
addField( "collisionTol", TypeF32, Offset(collisionTol, VehicleData),
"Minimum distance between objects for them to be considered as colliding." );
addField( "contactTol", TypeF32, Offset(contactTol, VehicleData),
"Maximum relative velocity between objects for collisions to be resolved "
"as contacts.\nVelocities greater than this are handled as collisions." );
addField( "cameraRoll", TypeBool, Offset(cameraRoll, VehicleData),
"If true, the camera will roll with the vehicle. If false, the camera will "
"always have the positive Z axis as up." );
addField( "cameraLag", TypeF32, Offset(cameraLag, VehicleData),
"@brief How much the camera lags behind the vehicle depending on vehicle speed.\n\n"
"Increasing this value will make the camera fall further behind the vehicle "
"as it accelerates away.\n\n@see cameraDecay." );
addField("cameraDecay", TypeF32, Offset(cameraDecay, VehicleData),
"How quickly the camera moves back towards the vehicle when stopped.\n\n"
"@see cameraLag." );
addField("cameraOffset", TypeF32, Offset(cameraOffset, VehicleData),
"Vertical (Z axis) height of the camera above the vehicle." );
addField( "dustEmitter", TYPEID< ParticleEmitterData >(), Offset(dustEmitter, VehicleData),
"Dust particle emitter.\n\n@see triggerDustHeight\n\n@see dustHeight");
addField( "triggerDustHeight", TypeF32, Offset(triggerDustHeight, VehicleData),
"@brief Maximum height above surface to emit dust particles.\n\n"
"If the vehicle is less than triggerDustHeight above a static surface "
"with a material that has 'showDust' set to true, the vehicle will emit "
"particles from the dustEmitter." );
addField( "dustHeight", TypeF32, Offset(dustHeight, VehicleData),
"Height above ground at which to emit particles from the dustEmitter." );
addField( "damageEmitter", TYPEID< ParticleEmitterData >(), Offset(damageEmitterList, VehicleData), VC_NUM_DAMAGE_EMITTERS, addField( "damageEmitter", TYPEID< ParticleEmitterData >(), Offset(damageEmitterList, VehicleData), VC_NUM_DAMAGE_EMITTERS,
"@brief Array of particle emitters used to generate damage (dust, smoke etc) " "@brief Array of particle emitters used to generate damage (dust, smoke etc) "
"effects.\n\n" "effects.\n\n"
@ -601,30 +326,6 @@ void VehicleData::initPersistFields()
addField( "numDmgEmitterAreas", TypeF32, Offset(numDmgEmitterAreas, VehicleData), addField( "numDmgEmitterAreas", TypeF32, Offset(numDmgEmitterAreas, VehicleData),
"Number of damageEmitterOffset values to use for each damageEmitter.\n\n" "Number of damageEmitterOffset values to use for each damageEmitter.\n\n"
"@see damageEmitterOffset" ); "@see damageEmitterOffset" );
addField( "splashEmitter", TYPEID< ParticleEmitterData >(), Offset(splashEmitterList, VehicleData), VC_NUM_SPLASH_EMITTERS,
"Array of particle emitters used to generate splash effects." );
addField( "splashFreqMod", TypeF32, Offset(splashFreqMod, VehicleData),
"@brief Number of splash particles to generate based on vehicle speed.\n\n"
"This value is multiplied by the current speed to determine how many "
"particles to generate each frame." );
addField( "splashVelEpsilon", TypeF32, Offset(splashVelEpsilon, VehicleData),
"Minimum speed when moving through water to generate splash particles." );
addField( "exitSplashSoundVelocity", TypeF32, Offset(exitSplashSoundVel, VehicleData),
"Minimum velocity when leaving the water for the exitingWater sound to play." );
addField( "softSplashSoundVelocity", TypeF32, Offset(softSplashSoundVel, VehicleData),
"Minimum velocity when entering the water for the imapactWaterEasy sound "
"to play.\n\n@see impactWaterEasy" );
addField( "mediumSplashSoundVelocity", TypeF32, Offset(medSplashSoundVel, VehicleData),
"Minimum velocity when entering the water for the imapactWaterMedium sound "
"to play.\n\n@see impactWaterMedium" );
addField( "hardSplashSoundVelocity", TypeF32, Offset(hardSplashSoundVel, VehicleData),
"Minimum velocity when entering the water for the imapactWaterHard sound "
"to play.\n\n@see impactWaterHard" );
INITPERSISTFIELD_SOUNDASSET_ENUMED(WaterSounds, vehSoundsEnum, VehicleData::Sounds::MaxSounds, VehicleData, "Sounds for interacting with water.");
addField( "collDamageThresholdVel", TypeF32, Offset(collDamageThresholdVel, VehicleData), addField( "collDamageThresholdVel", TypeF32, Offset(collDamageThresholdVel, VehicleData),
"Minimum collision velocity to cause damage to this vehicle.\nCurrently unused." ); "Minimum collision velocity to cause damage to this vehicle.\nCurrently unused." );
addField( "collDamageMultiplier", TypeF32, Offset(collDamageMultiplier, VehicleData), addField( "collDamageMultiplier", TypeF32, Offset(collDamageMultiplier, VehicleData),
@ -891,9 +592,6 @@ bool Vehicle::onNewDataBlock(GameBaseData* dptr,bool reload)
// Create the sound ahead of time. This reduces runtime // Create the sound ahead of time. This reduces runtime
// costs and makes the system easier to understand. // costs and makes the system easier to understand.
SFX_DELETE( mWakeSound ); SFX_DELETE( mWakeSound );
if ( mDataBlock->getVehicleWaterSounds(VehicleData::Wake) != NULL )
mWakeSound = SFX->createSource( mDataBlock->getVehicleWaterSoundsProfile(VehicleData::Wake), &getTransform() );
} }
return true; return true;
@ -1151,32 +849,32 @@ void Vehicle::updatePos(F32 dt)
F32 collSpeed = (mRigid.linVelocity - origVelocity).len(); F32 collSpeed = (mRigid.linVelocity - origVelocity).len();
S32 impactSound = -1; S32 impactSound = -1;
if (collSpeed >= mDataBlock->hardImpactSpeed) if (collSpeed >= mDataBlock->hardImpactSpeed)
impactSound = VehicleData::Body::HardImpactSound; impactSound = RigidShapeData::Body::HardImpactSound;
else else
if (collSpeed >= mDataBlock->softImpactSpeed) if (collSpeed >= mDataBlock->softImpactSpeed)
impactSound = VehicleData::Body::SoftImpactSound; impactSound = RigidShapeData::Body::SoftImpactSound;
if (impactSound != -1 && mDataBlock->getVehicleBodySoundsProfile(impactSound) != NULL) if (impactSound != -1 && mDataBlock->getBodySoundsProfile(impactSound) != NULL)
SFX->playOnce( mDataBlock->getVehicleBodySoundsProfile(impactSound), &getTransform() ); SFX->playOnce( mDataBlock->getBodySoundsProfile(impactSound), &getTransform() );
} }
// Water volume sounds // Water volume sounds
F32 vSpeed = getVelocity().len(); F32 vSpeed = getVelocity().len();
if (!inLiquid && mWaterCoverage >= 0.8f) { if (!inLiquid && mWaterCoverage >= 0.8f) {
if (vSpeed >= mDataBlock->hardSplashSoundVel) if (vSpeed >= mDataBlock->hardSplashSoundVel)
SFX->playOnce( mDataBlock->getVehicleWaterSoundsProfile(VehicleData::ImpactHard), &getTransform() ); SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactHard), &getTransform() );
else else
if (vSpeed >= mDataBlock->medSplashSoundVel) if (vSpeed >= mDataBlock->medSplashSoundVel)
SFX->playOnce( mDataBlock->getVehicleWaterSoundsProfile(VehicleData::ImpactMedium), &getTransform() ); SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactMedium), &getTransform() );
else else
if (vSpeed >= mDataBlock->softSplashSoundVel) if (vSpeed >= mDataBlock->softSplashSoundVel)
SFX->playOnce( mDataBlock->getVehicleWaterSoundsProfile(VehicleData::ImpactSoft), &getTransform() ); SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactSoft), &getTransform() );
inLiquid = true; inLiquid = true;
} }
else else
if(inLiquid && mWaterCoverage < 0.8f) { if(inLiquid && mWaterCoverage < 0.8f) {
if (vSpeed >= mDataBlock->exitSplashSoundVel) if (vSpeed >= mDataBlock->exitSplashSoundVel)
SFX->playOnce( mDataBlock->getVehicleWaterSoundsProfile(VehicleData::ExitWater), &getTransform() ); SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ExitWater), &getTransform() );
inLiquid = false; inLiquid = false;
} }
} }
@ -1376,6 +1074,10 @@ void Vehicle::unpackUpdate(NetConnection *con, BitStream *stream)
setEnergyLevel(stream->readFloat(8) * mDataBlock->maxEnergy); setEnergyLevel(stream->readFloat(8) * mDataBlock->maxEnergy);
} }
void Vehicle::setControllingClient(GameConnection* client)
{
ShapeBase::setControllingClient(client);
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View file

@ -39,18 +39,6 @@ struct VehicleData : public RigidShapeData
{ {
typedef RigidShapeData Parent; typedef RigidShapeData Parent;
struct Body {
enum Sounds {
SoftImpactSound,
HardImpactSound,
MaxSounds,
};
F32 restitution;
F32 friction;
} body;
DECLARE_SOUNDASSET_ARRAY(VehicleData, VehicleBodySounds, Body::Sounds::MaxSounds)
enum VehicleConsts enum VehicleConsts
{ {
VC_NUM_DUST_EMITTERS = 1, VC_NUM_DUST_EMITTERS = 1,
@ -62,44 +50,11 @@ struct VehicleData : public RigidShapeData
VC_BUBBLE_EMITTER = VC_NUM_DAMAGE_EMITTERS - VC_NUM_BUBBLE_EMITTERS, VC_BUBBLE_EMITTER = VC_NUM_DAMAGE_EMITTERS - VC_NUM_BUBBLE_EMITTERS,
}; };
enum Sounds {
ExitWater,
ImpactSoft,
ImpactMedium,
ImpactHard,
Wake,
MaxSounds
};
DECLARE_SOUNDASSET_ARRAY(VehicleData, VehicleWaterSounds, Sounds::MaxSounds)
F32 exitSplashSoundVel;
F32 softSplashSoundVel;
F32 medSplashSoundVel;
F32 hardSplashSoundVel;
F32 minImpactSpeed;
F32 softImpactSpeed;
F32 hardImpactSpeed;
F32 minRollSpeed;
F32 maxSteeringAngle; F32 maxSteeringAngle;
F32 collDamageThresholdVel; F32 collDamageThresholdVel;
F32 collDamageMultiplier; F32 collDamageMultiplier;
bool cameraRoll; ///< Roll the 3rd party camera
F32 cameraLag; ///< Amount of camera lag (lag += car velocity * lag)
F32 cameraDecay; ///< Rate at which camera returns to target pos.
F32 cameraOffset; ///< Vertical offset
F32 minDrag;
F32 maxDrag;
S32 integration; ///< # of physics steps per tick
F32 collisionTol; ///< Collision distance tolerance
F32 contactTol; ///< Contact velocity tolerance
Point3F massCenter; ///< Center of mass for rigid body
Point3F massBox; ///< Size of inertial box
F32 jetForce; F32 jetForce;
F32 jetEnergyDrain; ///< Energy drain/tick F32 jetEnergyDrain; ///< Energy drain/tick
F32 minJetEnergy; F32 minJetEnergy;
@ -108,22 +63,12 @@ struct VehicleData : public RigidShapeData
F32 steeringReturnSpeedScale; F32 steeringReturnSpeedScale;
bool powerSteering; bool powerSteering;
ParticleEmitterData * dustEmitter;
S32 dustID;
F32 triggerDustHeight; ///< height vehicle has to be under to kick up dust
F32 dustHeight; ///< dust height above ground
ParticleEmitterData * damageEmitterList[ VC_NUM_DAMAGE_EMITTERS ]; ParticleEmitterData * damageEmitterList[ VC_NUM_DAMAGE_EMITTERS ];
Point3F damageEmitterOffset[ VC_NUM_DAMAGE_EMITTER_AREAS ]; Point3F damageEmitterOffset[ VC_NUM_DAMAGE_EMITTER_AREAS ];
S32 damageEmitterIDList[ VC_NUM_DAMAGE_EMITTERS ]; S32 damageEmitterIDList[ VC_NUM_DAMAGE_EMITTERS ];
F32 damageLevelTolerance[ VC_NUM_DAMAGE_LEVELS ]; F32 damageLevelTolerance[ VC_NUM_DAMAGE_LEVELS ];
F32 numDmgEmitterAreas; F32 numDmgEmitterAreas;
ParticleEmitterData* splashEmitterList[VC_NUM_SPLASH_EMITTERS];
S32 splashEmitterIDList[VC_NUM_SPLASH_EMITTERS];
F32 splashFreqMod;
F32 splashVelEpsilon;
bool enablePhysicsRep; bool enablePhysicsRep;
// //
@ -171,6 +116,7 @@ class Vehicle : public RigidShape
void readPacketData (GameConnection * conn, BitStream *stream); void readPacketData (GameConnection * conn, BitStream *stream);
U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream); U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream);
void unpackUpdate(NetConnection *conn, BitStream *stream); void unpackUpdate(NetConnection *conn, BitStream *stream);
void setControllingClient(GameConnection* connection);
void updateLiftoffDust( F32 dt ); void updateLiftoffDust( F32 dt );
void updateDamageSmoke( F32 dt ); void updateDamageSmoke( F32 dt );

View file

@ -289,15 +289,15 @@ ConsoleDocClass( WheeledVehicleData,
"@ingroup Vehicles\n" "@ingroup Vehicles\n"
); );
typedef WheeledVehicleData::Sounds wheelSoundsEnum; typedef WheeledVehicleData::Sounds WheeledVehicleSoundsEnum;
DefineEnumType(wheelSoundsEnum); DefineEnumType(WheeledVehicleSoundsEnum);
ImplementEnumType(wheelSoundsEnum, "enum types.\n" ImplementEnumType(WheeledVehicleSoundsEnum, "enum types.\n"
"@ingroup WheeledVehicleData\n\n") "@ingroup WheeledVehicleData\n\n")
{WheeledVehicleData::JetSound, "JetSound", "..." }, { WheeledVehicleSoundsEnum::JetSound, "JetSound", "..." },
{WheeledVehicleData::EngineSound, "EngineSound", "..." }, { WheeledVehicleSoundsEnum::EngineSound, "EngineSound", "..." },
{WheeledVehicleData::SquealSound, "SquealSound", "..." }, { WheeledVehicleSoundsEnum::SquealSound, "SquealSound", "..." },
{WheeledVehicleData::WheelImpactSound, "WheelImpactSound", "..." }, { WheeledVehicleSoundsEnum::WheelImpactSound, "WheelImpactSound", "..." },
EndImplementEnumType; EndImplementEnumType;
WheeledVehicleData::WheeledVehicleData() WheeledVehicleData::WheeledVehicleData()
@ -312,7 +312,7 @@ WheeledVehicleData::WheeledVehicleData()
wheelCount = 0; wheelCount = 0;
dMemset(&wheel, 0, sizeof(wheel)); dMemset(&wheel, 0, sizeof(wheel));
for (S32 i = 0; i < MaxSounds; i++) for (S32 i = 0; i < MaxSounds; i++)
INIT_ASSET_ARRAY(WheeledVehicleSounds, i); INIT_SOUNDASSET_ARRAY(WheeledVehicleSounds, i);
} }
@ -448,7 +448,9 @@ bool WheeledVehicleData::mirrorWheel(Wheel* we)
void WheeledVehicleData::initPersistFields() void WheeledVehicleData::initPersistFields()
{ {
INITPERSISTFIELD_SOUNDASSET_ENUMED(WheeledVehicleSounds, wheelSoundsEnum, MaxSounds, WheeledVehicleData, "Sounds related to wheeled vehicle."); addGroup("Sounds");
INITPERSISTFIELD_SOUNDASSET_ENUMED(WheeledVehicleSounds, WheeledVehicleSoundsEnum, MaxSounds, WheeledVehicleData, "Sounds related to wheeled vehicle.");
endGroup("Sounds");
addField("tireEmitter",TYPEID< ParticleEmitterData >(), Offset(tireEmitter, WheeledVehicleData), addField("tireEmitter",TYPEID< ParticleEmitterData >(), Offset(tireEmitter, WheeledVehicleData),
"ParticleEmitterData datablock used to generate particles from each wheel " "ParticleEmitterData datablock used to generate particles from each wheel "
@ -483,7 +485,7 @@ void WheeledVehicleData::packData(BitStream* stream)
for (S32 i = 0; i < MaxSounds; i++) for (S32 i = 0; i < MaxSounds; i++)
{ {
PACKDATA_ASSET_ARRAY(WheeledVehicleSounds, i); PACKDATA_SOUNDASSET_ARRAY(WheeledVehicleSounds, i);
} }
stream->write(maxWheelSpeed); stream->write(maxWheelSpeed);
@ -502,7 +504,7 @@ void WheeledVehicleData::unpackData(BitStream* stream)
for (S32 i = 0; i < MaxSounds; i++) for (S32 i = 0; i < MaxSounds; i++)
{ {
UNPACKDATA_ASSET_ARRAY(WheeledVehicleSounds, i); UNPACKDATA_SOUNDASSET_ARRAY(WheeledVehicleSounds, i);
} }
stream->read(&maxWheelSpeed); stream->read(&maxWheelSpeed);

View file

@ -41,6 +41,7 @@
#include "materials/baseMatInstance.h" #include "materials/baseMatInstance.h"
#include "materials/sceneData.h" #include "materials/sceneData.h"
#include "environment/timeOfDay.h" #include "environment/timeOfDay.h"
#include "materials/materialFeatureTypes.h"
ConsoleDocClass( ScatterSky, ConsoleDocClass( ScatterSky,
@ -913,7 +914,12 @@ void ScatterSky::_initMoon()
if (mMoonMatAsset.notNull()) if (mMoonMatAsset.notNull())
{ {
mMoonMatInst = MATMGR->createMatInstance(mMoonMatAsset->getMaterialDefinitionName(), MATMGR->getDefaultFeatures(), getGFXVertexFormat<GFXVertexPCT>()); FeatureSet features = MATMGR->getDefaultFeatures();
features.removeFeature(MFT_RTLighting);
features.removeFeature(MFT_Visibility);
features.removeFeature(MFT_ReflectionProbes);
features.addFeature(MFT_isBackground);
mMoonMatInst = MATMGR->createMatInstance(mMoonMatAsset->getMaterialDefinitionName(), features, getGFXVertexFormat<GFXVertexPCT>());
} }
} }

View file

@ -572,7 +572,7 @@ void SkyBox::_initRender()
mFogBandMat->mTranslucent = true; mFogBandMat->mTranslucent = true;
mFogBandMat->mVertColor[0] = true; mFogBandMat->mVertColor[0] = true;
mFogBandMat->mDoubleSided = true; mFogBandMat->mDoubleSided = true;
mFogBandMat->mEmissive[0] = true; mFogBandMat->mReceiveShadows[0] = false;
FeatureSet features = MATMGR->getDefaultFeatures(); FeatureSet features = MATMGR->getDefaultFeatures();
features.addFeature(MFT_isBackground); features.addFeature(MFT_isBackground);
@ -610,6 +610,7 @@ void SkyBox::_initMaterial()
FeatureSet features = MATMGR->getDefaultFeatures(); FeatureSet features = MATMGR->getDefaultFeatures();
features.removeFeature( MFT_RTLighting ); features.removeFeature( MFT_RTLighting );
features.removeFeature( MFT_Visibility ); features.removeFeature( MFT_Visibility );
features.removeFeature(MFT_ReflectionProbes);
features.addFeature(MFT_isBackground); features.addFeature(MFT_isBackground);
features.addFeature(MFT_SkyBox); features.addFeature(MFT_SkyBox);

View file

@ -570,7 +570,7 @@ void SkySphere::_initRender()
mFogBandMat->mTranslucent = true; mFogBandMat->mTranslucent = true;
mFogBandMat->mVertColor[0] = true; mFogBandMat->mVertColor[0] = true;
mFogBandMat->mDoubleSided = true; mFogBandMat->mDoubleSided = true;
mFogBandMat->mEmissive[0] = true; mFogBandMat->mReceiveShadows[0] = false;
FeatureSet features = MATMGR->getDefaultFeatures(); FeatureSet features = MATMGR->getDefaultFeatures();
features.addFeature(MFT_isBackground); features.addFeature(MFT_isBackground);
@ -608,6 +608,7 @@ void SkySphere::_initMaterial()
FeatureSet features = MATMGR->getDefaultFeatures(); FeatureSet features = MATMGR->getDefaultFeatures();
features.removeFeature(MFT_RTLighting); features.removeFeature(MFT_RTLighting);
features.removeFeature(MFT_Visibility); features.removeFeature(MFT_Visibility);
features.removeFeature(MFT_ReflectionProbes);
features.addFeature(MFT_isBackground); features.addFeature(MFT_isBackground);
// Now initialize the material. // Now initialize the material.

View file

@ -384,8 +384,7 @@ bool MatInstance::processMaterial()
mUsesHardwareSkinning = finalFeatures.hasFeature( MFT_HardwareSkinning ); mUsesHardwareSkinning = finalFeatures.hasFeature( MFT_HardwareSkinning );
mIsForwardLit = ( custMat && custMat->mForwardLit ) || mIsForwardLit = ( custMat && custMat->mForwardLit ) ||
( !finalFeatures.hasFeature( MFT_IsEmissive ) && ( finalFeatures.hasFeature( MFT_ForwardShading ) );
finalFeatures.hasFeature( MFT_ForwardShading ) );
mIsHardwareSkinned = finalFeatures.hasFeature( MFT_HardwareSkinning ); mIsHardwareSkinned = finalFeatures.hasFeature( MFT_HardwareSkinning );

View file

@ -161,7 +161,7 @@ Material::Material()
mVertColor[i] = false; mVertColor[i] = false;
mGlow[i] = false; mGlow[i] = false;
mEmissive[i] = false; mReceiveShadows[i] = true;
mDetailScale[i].set(2.0f, 2.0f); mDetailScale[i].set(2.0f, 2.0f);
@ -345,7 +345,7 @@ void Material::initPersistFields()
addField("subSurfaceRolloff", TypeF32, Offset(mSubSurfaceRolloff, Material), MAX_STAGES, addField("subSurfaceRolloff", TypeF32, Offset(mSubSurfaceRolloff, Material), MAX_STAGES,
"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("emissive", TypeBool, Offset(mEmissive, Material), MAX_STAGES, addField("receiveShadows", TypeBool, Offset(mReceiveShadows, 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),

View file

@ -305,7 +305,7 @@ public:
F32 mSeqSegSize[MAX_STAGES]; F32 mSeqSegSize[MAX_STAGES];
bool mGlow[MAX_STAGES]; // entire stage glows bool mGlow[MAX_STAGES]; // entire stage glows
bool mEmissive[MAX_STAGES]; bool mReceiveShadows[MAX_STAGES];
Point2I mCellIndex[MAX_STAGES]; Point2I mCellIndex[MAX_STAGES];
Point2I mCellLayout[MAX_STAGES]; Point2I mCellLayout[MAX_STAGES];

View file

@ -78,7 +78,6 @@ ImplementFeatureType( MFT_IsBC3nm, U32(-1), -1, true );
ImplementFeatureType( MFT_IsBC5nm, U32(-1), -1, true); ImplementFeatureType( MFT_IsBC5nm, U32(-1), -1, true);
ImplementFeatureType( MFT_IsTranslucent, U32(-1), -1, true ); ImplementFeatureType( MFT_IsTranslucent, U32(-1), -1, true );
ImplementFeatureType( MFT_IsTranslucentZWrite, U32(-1), -1, true ); ImplementFeatureType( MFT_IsTranslucentZWrite, U32(-1), -1, true );
ImplementFeatureType( MFT_IsEmissive, U32(-1), -1, true );
ImplementFeatureType( MFT_DiffuseMapAtlas, U32(-1), -1, true ); ImplementFeatureType( MFT_DiffuseMapAtlas, U32(-1), -1, true );
ImplementFeatureType( MFT_NormalMapAtlas, U32(-1), -1, true ); ImplementFeatureType( MFT_NormalMapAtlas, U32(-1), -1, true );
ImplementFeatureType( MFT_InterlacedDeferred, U32(-1), -1, true ); ImplementFeatureType( MFT_InterlacedDeferred, U32(-1), -1, true );

View file

@ -115,7 +115,6 @@ DeclareFeatureType( MFT_AlphaTest );
DeclareFeatureType( MFT_NormalMap ); DeclareFeatureType( MFT_NormalMap );
DeclareFeatureType( MFT_RTLighting ); DeclareFeatureType( MFT_RTLighting );
DeclareFeatureType( MFT_IsEmissive );
DeclareFeatureType( MFT_SubSurface ); DeclareFeatureType( MFT_SubSurface );
DeclareFeatureType( MFT_LightMap ); DeclareFeatureType( MFT_LightMap );
DeclareFeatureType( MFT_ToneMap ); DeclareFeatureType( MFT_ToneMap );

View file

@ -254,7 +254,7 @@ BaseMatInstance * MaterialManager::createMeshDebugMatInstance(const LinearColorF
debugMat = allocateAndRegister( meshDebugStr ); debugMat = allocateAndRegister( meshDebugStr );
debugMat->mDiffuse[0] = meshColor; debugMat->mDiffuse[0] = meshColor;
debugMat->mEmissive[0] = true; debugMat->mReceiveShadows[0] = false;
} }
BaseMatInstance *debugMatInstance = NULL; BaseMatInstance *debugMatInstance = NULL;

View file

@ -353,15 +353,10 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
if ( mMaterial->mAlphaTest ) if ( mMaterial->mAlphaTest )
fd.features.addFeature( MFT_AlphaTest ); fd.features.addFeature( MFT_AlphaTest );
if (mMaterial->mEmissive[stageNum]) if (mMaterial->isTranslucent())
{
fd.features.addFeature(MFT_IsEmissive);
}
else
{ {
fd.features.addFeature(MFT_RTLighting); fd.features.addFeature(MFT_RTLighting);
if (mMaterial->isTranslucent()) fd.features.addFeature(MFT_ReflectionProbes);
fd.features.addFeature(MFT_ReflectionProbes);
} }
if ( mMaterial->mAnimFlags[stageNum] ) if ( mMaterial->mAnimFlags[stageNum] )
@ -1204,8 +1199,8 @@ void ProcessedShaderMaterial::_setShaderConstants(SceneRenderState * state, cons
// Deferred Shading: Determine Material Info Flags // Deferred Shading: Determine Material Info Flags
S32 matInfoFlags = S32 matInfoFlags =
(mMaterial->mEmissive[stageNum] ? 1 : 0) | //emissive (mMaterial->mReceiveShadows[stageNum] ? 1 : 0) | //ReceiveShadows
(mMaterial->mSubSurface[stageNum] ? 2 : 0); //subsurface (mMaterial->mSubSurface[stageNum] ? 1 << 2 : 0); //subsurface
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() )

View file

@ -27,6 +27,8 @@
/// Compiler intrinsics for GCC. /// Compiler intrinsics for GCC.
#ifdef TORQUE_OS_MAC #ifdef TORQUE_OS_MAC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <libkern/OSAtomic.h> #include <libkern/OSAtomic.h>
#endif #endif
@ -85,4 +87,8 @@ inline U32 dAtomicRead( volatile U32 &ref )
#endif #endif
} }
#ifdef TORQUE_OS_MAC
#pragma GCC diagnostic pop
#endif
#endif // _TORQUE_PLATFORM_PLATFORMINTRINSICS_GCC_H_ #endif // _TORQUE_PLATFORM_PLATFORMINTRINSICS_GCC_H_

View file

@ -74,7 +74,7 @@ void RenderOcclusionMgr::init()
mMaterial = MATMGR->allocateAndRegister( String::EmptyString ); mMaterial = MATMGR->allocateAndRegister( String::EmptyString );
mMaterial->mDiffuse[0] = LinearColorF( 1, 0, 1, 1 ); mMaterial->mDiffuse[0] = LinearColorF( 1, 0, 1, 1 );
mMaterial->mEmissive[0] = true; mMaterial->mReceiveShadows[0] = false;
mMaterial->mAutoGenerated = true; mMaterial->mAutoGenerated = true;
mMatInstance = mMaterial->createMatInstance(); mMatInstance = mMaterial->createMatInstance();
@ -234,4 +234,4 @@ void RenderOcclusionMgr::render( SceneRenderState *state )
// Call setup one more time to end the pass. // Call setup one more time to end the pass.
mMatInstance->setupPass( state, sgData ); mMatInstance->setupPass( state, sgData );
} }

View file

@ -560,8 +560,8 @@ void RenderProbeMgr::bakeProbe(ReflectionProbe* probe)
ReflectorDesc reflDesc; ReflectorDesc reflDesc;
reflDesc.texSize = resolution; reflDesc.texSize = resolution;
reflDesc.farDist = farPlane; reflDesc.farDist = farPlane;
reflDesc.detailAdjust = 1; reflDesc.detailAdjust = (F32)resolution;
reflDesc.objectTypeMask = probe->mProbeShapeType == ReflectionProbe::ProbeInfo::Skylight ? SKYLIGHT_CAPTURE_TYPEMASK : REFLECTION_PROBE_CAPTURE_TYPEMASK; reflDesc.objectTypeMask = probe->mCaptureMask;
CubeReflector cubeRefl; CubeReflector cubeRefl;
cubeRefl.registerReflector(probe, &reflDesc); cubeRefl.registerReflector(probe, &reflDesc);

View file

@ -221,7 +221,7 @@ SFXPlayList::SFXPlayList()
mNumSlotsToPlay( NUM_SLOTS ) mNumSlotsToPlay( NUM_SLOTS )
{ {
for (U32 i=0;i<NUM_SLOTS;i++) for (U32 i=0;i<NUM_SLOTS;i++)
INIT_ASSET_ARRAY(Track, i); INIT_SOUNDASSET_ARRAY(Track, i);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -429,7 +429,7 @@ void SFXPlayList::packData( BitStream* stream )
stream->write( mSlots.mRepeatCount[ i ] ); stream->write( mSlots.mRepeatCount[ i ] );
FOR_EACH_SLOT sfxWrite( stream, mSlots.mState[ i ] ); FOR_EACH_SLOT sfxWrite( stream, mSlots.mState[ i ] );
FOR_EACH_SLOT PACKDATA_ASSET_ARRAY(Track, i); FOR_EACH_SLOT PACKDATA_SOUNDASSET_ARRAY(Track, i);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -468,7 +468,7 @@ void SFXPlayList::unpackData( BitStream* stream )
FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mRepeatCount[ i ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mRepeatCount[ i ] );}
FOR_EACH_SLOT sfxRead( stream, &mSlots.mState[ i ] ); FOR_EACH_SLOT sfxRead( stream, &mSlots.mState[ i ] );
FOR_EACH_SLOT UNPACKDATA_ASSET_ARRAY(Track, i); FOR_EACH_SLOT UNPACKDATA_SOUNDASSET_ARRAY(Track, i);
#undef FOR_EACH_SLOT #undef FOR_EACH_SLOT
} }

View file

@ -323,7 +323,7 @@ void TerrainBaseMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentLis
meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig))); meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig)));
} }
meta->addStatement(new GenOp(" @ = float4(0.0, 1.0, 1.0, 0.0);\r\n", ormConfig)); meta->addStatement(new GenOp(" @ = float4(1.0f/255.0f, 1.0, 1.0, 0.0);\r\n", ormConfig));
output = meta; output = meta;
@ -1109,7 +1109,7 @@ void TerrainORMMapFeatGLSL::processPix(Vector<ShaderComponent*> &componentList,
} }
if (compositeIndex == 0) if (compositeIndex == 0)
{ {
meta->addStatement(new GenOp(" @ = vec4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); meta->addStatement(new GenOp(" @ = vec4(1.0f/255.0f, 1.0, 1.0, 0.0);\r\n", ormConfig));
} }
Var *detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex)); Var *detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex));
@ -1176,7 +1176,7 @@ void TerrainBlankInfoMapFeatGLSL::processPix(Vector<ShaderComponent*> &component
if (compositeIndex == 0) if (compositeIndex == 0)
{ {
meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); meta->addStatement(new GenOp(" @ = float4(1.0f/255.0f, 1.0, 1.0, 0.0);\r\n", ormConfig));
} }
Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex)); Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex));

View file

@ -383,7 +383,7 @@ void TerrainBaseMapFeatHLSL::processPix(Vector<ShaderComponent*>& componentList,
meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig))); meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig)));
} }
meta->addStatement(new GenOp(" @ = float4(0.0, 1.0, 1.0, 0.0);\r\n", ormConfig)); meta->addStatement(new GenOp(" @ = float4(1.0f/255.0f, 1.0, 1.0, 0.0);\r\n", ormConfig));
output = meta; output = meta;
} }
@ -1191,7 +1191,7 @@ void TerrainORMMapFeatHLSL::processPix(Vector<ShaderComponent*> &componentList,
} }
if (compositeIndex == 0) if (compositeIndex == 0)
{ {
meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); meta->addStatement(new GenOp(" @ = float4(1.0f/255.0f, 0.0, 0.0, 0.0);\r\n", ormConfig));
} }
Var *detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex)); Var *detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex));
@ -1256,7 +1256,7 @@ void TerrainBlankInfoMapFeatHLSL::processPix(Vector<ShaderComponent*> &component
if (compositeIndex == 0) if (compositeIndex == 0)
{ {
meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); meta->addStatement(new GenOp(" @ = float4(1.0f/255.0f, 1.0, 1.0, 0.0);\r\n", ormConfig));
} }
Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex)); Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex));

View file

@ -146,13 +146,6 @@ 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);
//early out if emissive
if (getFlag(surface.matFlag, 0))
{
OUT_col = vec4(0, 0, 0, 0);
return;
}
vec3 L = lightPosition - surface.P; vec3 L = lightPosition - surface.P;
float dist = length(L); float dist = length(L);
@ -162,22 +155,22 @@ void main()
float distToLight = dist / lightRange; float distToLight = dist / lightRange;
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L); SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L);
#ifdef NO_SHADOW float shadow = 1.0;
float shadowed = 1.0; #ifndef NO_SHADOW
#else if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
{
#ifdef SHADOW_CUBE #ifdef SHADOW_CUBE
// TODO: We need to fix shadow cube to handle soft shadows! // TODO: We need to fix shadow cube to handle soft shadows!
float occ = texture( shadowMap, tMul( worldToLightProj, -surfaceToLight.L ) ).r; float occ = texture( shadowMap, tMul( worldToLightProj, -surfaceToLight.L ) ).r;
float shadowed = saturate( exp( lightParams.y * ( occ - distToLight ) ) ); shadow = saturate( exp( lightParams.y * ( occ - distToLight ) ) );
#else #else
vec2 shadowCoord = decodeShadowCoord( tMul( worldToLightProj, -surfaceToLight.L ) ).xy; vec2 shadowCoord = decodeShadowCoord( tMul( worldToLightProj, -surfaceToLight.L ) ).xy;
float shadowed = softShadow_filter(shadowMap, ssPos.xy/ssPos.w, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y); shadow = softShadow_filter(shadowMap, ssPos.xy/ssPos.w, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
#endif #endif
}
#endif // !NO_SHADOW #endif // !NO_SHADOW
vec3 lightCol = lightColor.rgb; vec3 lightCol = lightColor.rgb;
#ifdef USE_COOKIE_TEX #ifdef USE_COOKIE_TEX
@ -225,7 +218,7 @@ void main()
#endif #endif
//get punctual light contribution //get punctual light contribution
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed); lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadow);
} }
OUT_col = vec4(lighting, 0); OUT_col = vec4(lighting, 0);

View file

@ -55,13 +55,6 @@ 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);
//early out if emissive
if (getFlag(surface.matFlag, 0))
{
OUT_col = vec4(surface.albedo, 0);
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;

View file

@ -80,13 +80,6 @@ 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);
//early out if emissive
if (getFlag(surface.matFlag, 0))
{
OUT_col = vec4(0, 0, 0, 0);
return;
}
vec3 L = lightPosition - surface.P; vec3 L = lightPosition - surface.P;
float dist = length(L); float dist = length(L);
@ -96,9 +89,10 @@ void main()
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L); SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L);
vec3 lightCol = lightColor.rgb; vec3 lightCol = lightColor.rgb;
#ifdef NO_SHADOW float shadow = 1.0;
float shadowed = 1.0; #ifndef NO_SHADOW
#else if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
{
// Get the shadow texture coordinate // Get the shadow texture coordinate
vec4 pxlPosLightProj = tMul( worldToLightProj, vec4( surface.P, 1 ) ); vec4 pxlPosLightProj = tMul( worldToLightProj, vec4( surface.P, 1 ) );
vec2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + vec2( 0.5, 0.5 ); vec2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + vec2( 0.5, 0.5 );
@ -106,7 +100,7 @@ void main()
//distance to light in shadow map space //distance to light in shadow map space
float distToLight = pxlPosLightProj.z / lightRange; float distToLight = pxlPosLightProj.z / lightRange;
float shadowed = softShadow_filter(shadowMap, ssPos.xy/ssPos.w, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y); shadow = softShadow_filter(shadowMap, ssPos.xy/ssPos.w, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
#ifdef USE_COOKIE_TEX #ifdef USE_COOKIE_TEX
// Lookup the cookie sample. // Lookup the cookie sample.
vec4 cookie = texture(cookieMap, shadowCoord); vec4 cookie = texture(cookieMap, shadowCoord);
@ -117,6 +111,7 @@ void main()
// regions of the cookie texture. // regions of the cookie texture.
lightCol *= max(cookie.r, max(cookie.g, cookie.b)); lightCol *= max(cookie.r, max(cookie.g, cookie.b));
#endif #endif
}
#endif #endif
@ -156,7 +151,7 @@ void main()
#endif #endif
//get Punctual light contribution //get Punctual light contribution
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed); lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadow);
//get spot angle attenuation //get spot angle attenuation
lighting *= getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams ); lighting *= getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
} }

View file

@ -186,24 +186,17 @@ 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);
//early out if emissive
if (getFlag(surface.matFlag, 0))
{
OUT_col = vec4(0, 0, 0, 0);
return;
}
//create surface to light //create surface to light
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, -lightDirection); SurfaceToLight surfaceToLight = createSurfaceToLight(surface, -lightDirection);
//light color might be changed by PSSM_DEBUG_RENDER //light color might be changed by PSSM_DEBUG_RENDER
vec3 lightingColor = lightColor.rgb; vec3 lightingColor = lightColor.rgb;
#ifdef NO_SHADOW float shadow = 1.0;
float shadow = 1.0; #ifndef NO_SHADOW
#else if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
{
// Fade out the shadow at the end of the range. // Fade out the shadow at the end of the range.
vec4 zDist = vec4(zNearFarInvNearFar.x + zNearFarInvNearFar.y * surface.depth); vec4 zDist = vec4(zNearFarInvNearFar.x + zNearFarInvNearFar.y * surface.depth);
float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y; float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y;
@ -211,7 +204,7 @@ void main()
vec4 shadowed_colors = AL_VectorLightShadowCast( shadowMap, uv0.xy, worldToLightProj, surface.P, scaleX, scaleY, offsetX, offsetY, vec4 shadowed_colors = AL_VectorLightShadowCast( shadowMap, uv0.xy, worldToLightProj, surface.P, scaleX, scaleY, offsetX, offsetY,
farPlaneScalePSSM, surfaceToLight.NdotL); farPlaneScalePSSM, surfaceToLight.NdotL);
float shadow = shadowed_colors.a; shadow = shadowed_colors.a;
#ifdef PSSM_DEBUG_RENDER #ifdef PSSM_DEBUG_RENDER
lightingColor = shadowed_colors.rgb; lightingColor = shadowed_colors.rgb;
@ -223,7 +216,7 @@ void main()
if ( fadeOutAmt > 1.0 ) if ( fadeOutAmt > 1.0 )
lightingColor = vec3(1.0,1.0,1.0); lightingColor = vec3(1.0,1.0,1.0);
#endif #endif
}
#endif //NO_SHADOW #endif //NO_SHADOW
#ifdef DIFFUSE_LIGHT_VIZ #ifdef DIFFUSE_LIGHT_VIZ

View file

@ -101,7 +101,7 @@ TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
#ifdef SHADOW_CUBE #ifdef SHADOW_CUBE
TORQUE_UNIFORM_SAMPLERCUBE(shadowMap, 1); TORQUE_UNIFORM_SAMPLERCUBE(shadowMap, 1);
#else #else
TORQUE_UNIFORM_SAMPLER2DCMP(shadowMap, 1); TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1);
#endif #endif
//contains gTapRotationTex sampler //contains gTapRotationTex sampler
#include "softShadow.hlsl" #include "softShadow.hlsl"
@ -147,12 +147,6 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
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);
//early out if emissive
if (getFlag(surface.matFlag, 0))
{
return float4(0, 0, 0, 0);
}
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;
@ -162,22 +156,21 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
float distToLight = dist / lightRange; float distToLight = dist / lightRange;
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L); SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L);
#ifdef NO_SHADOW float shadow = 1.0;
float shadowed = 1.0; #ifndef NO_SHADOW
#else if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
{
#ifdef SHADOW_CUBE #ifdef SHADOW_CUBE
// TODO: We need to fix shadow cube to handle soft shadows! // TODO: We need to fix shadow cube to handle soft shadows!
float occ = TORQUE_TEXCUBE( shadowMap, mul( worldToLightProj, -surfaceToLight.L ) ).r; float occ = TORQUE_TEXCUBE( shadowMap, mul( worldToLightProj, -surfaceToLight.L ) ).r;
float shadowed = saturate( exp( lightParams.y * ( occ - distToLight ) ) ); shadow = saturate( exp( lightParams.y * ( occ - distToLight ) ) );
#else #else
float2 shadowCoord = decodeShadowCoord( mul( worldToLightProj, -surfaceToLight.L ) ).xy; float2 shadowCoord = decodeShadowCoord( mul( worldToLightProj, -surfaceToLight.L ) ).xy;
float4 shadowed = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(shadowMap), IN.pos.xy, ssPos.xy, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y); shadow = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(shadowMap), ssPos.xy, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
float shadowed = shadowed_colors.a;
#endif #endif
}
#endif // !NO_SHADOW #endif // !NO_SHADOW
float3 lightCol = lightColor.rgb; float3 lightCol = lightColor.rgb;
@ -222,7 +215,7 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
#endif #endif
//get punctual light contribution //get punctual light contribution
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed); lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadow);
} }
return float4(lighting, 0); return float4(lighting, 0);

View file

@ -51,12 +51,6 @@ float4 main(PFXVertToPix IN) : SV_TARGET
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);
//early out if emissive
if (getFlag(surface.matFlag, 0))
{
return float4(surface.albedo, 0);
}
#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);

View file

@ -86,12 +86,6 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
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);
//early out if emissive
if (getFlag(surface.matFlag, 0))
{
return float4(0, 0, 0, 0);
}
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;
@ -100,17 +94,18 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
{ {
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L); SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L);
float3 lightCol = lightColor.rgb; float3 lightCol = lightColor.rgb;
#ifdef NO_SHADOW float shadow = 1.0;
float shadowed = 1.0; #ifndef NO_SHADOW
#else if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
{
// Get the shadow texture coordinate // Get the shadow texture coordinate
float4 pxlPosLightProj = mul( worldToLightProj, float4( surface.P, 1 ) ); float4 pxlPosLightProj = mul( worldToLightProj, float4( surface.P, 1 ) );
float2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + float2( 0.5, 0.5 ); float2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + float2( 0.5, 0.5 );
shadowCoord.y = 1.0f - shadowCoord.y; shadowCoord.y = 1.0f - shadowCoord.y;
//distance to light in shadow map space //distance to light in shadow map space
float distToLight = pxlPosLightProj.z / lightRange; float distToLight = pxlPosLightProj.z / lightRange;
float shadowed = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(shadowMap), ssPos.xy, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y); shadow = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(shadowMap), ssPos.xy, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
#ifdef USE_COOKIE_TEX #ifdef USE_COOKIE_TEX
// Lookup the cookie sample. // Lookup the cookie sample.
float4 cookie = TORQUE_TEX2D(cookieMap, shadowCoord); float4 cookie = TORQUE_TEX2D(cookieMap, shadowCoord);
@ -121,6 +116,7 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
// regions of the cookie texture. // regions of the cookie texture.
lightCol *= max(cookie.r, max(cookie.g, cookie.b)); lightCol *= max(cookie.r, max(cookie.g, cookie.b));
#endif #endif
}
#endif #endif
#ifdef DIFFUSE_LIGHT_VIZ #ifdef DIFFUSE_LIGHT_VIZ
@ -153,16 +149,9 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
#endif #endif
//get Punctual light contribution //get Punctual light contribution
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadow);
//get spot angle attenuation //get spot angle attenuation
float att = 1; lighting *= getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
att *= getDistanceAtt(surfaceToLight.L, lightInvSqrRange);
att *= getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams, lightRange);
float3 lCol = lightColor.rgb *(lightBrightness / (4.0 * 3.14159265359));
float3 radince = lCol * att;
float3 factor = saturate(surfaceToLight.NdotL) * shadowed * radince;
lighting = evaluateStandardBRDF(surface,surfaceToLight) * factor;
//
} }
return float4(lighting, 0); return float4(lighting, 0);

View file

@ -186,23 +186,17 @@ 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);
//early out if emissive
if (getFlag(surface.matFlag, 0))
{
return float4(0, 0, 0, 0);
}
//create surface to light //create surface to light
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, -lightDirection); SurfaceToLight surfaceToLight = createSurfaceToLight(surface, -lightDirection);
//light color might be changed by PSSM_DEBUG_RENDER //light color might be changed by PSSM_DEBUG_RENDER
float3 lightingColor = lightColor.rgb; float3 lightingColor = lightColor.rgb;
#ifdef NO_SHADOW float shadow = 1.0;
float shadow = 1.0; #ifndef NO_SHADOW
#else if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
{
// Fade out the shadow at the end of the range. // Fade out the shadow at the end of the range.
float4 zDist = (zNearFarInvNearFar.x + zNearFarInvNearFar.y * surface.depth); float4 zDist = (zNearFarInvNearFar.x + zNearFarInvNearFar.y * surface.depth);
float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y; float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y;
@ -221,7 +215,7 @@ float4 main(FarFrustumQuadConnectP IN) : SV_TARGET
farPlaneScalePSSM, farPlaneScalePSSM,
surfaceToLight.NdotL); surfaceToLight.NdotL);
float shadow = shadowed_colors.a; shadow = shadowed_colors.a;
#ifdef PSSM_DEBUG_RENDER #ifdef PSSM_DEBUG_RENDER
lightingColor = shadowed_colors.rgb; lightingColor = shadowed_colors.rgb;
@ -233,7 +227,7 @@ float4 main(FarFrustumQuadConnectP IN) : SV_TARGET
if ( fadeOutAmt > 1.0 ) if ( fadeOutAmt > 1.0 )
lightingColor = 1.0; lightingColor = 1.0;
#endif #endif
}
#endif //NO_SHADOW #endif //NO_SHADOW
#ifdef DIFFUSE_LIGHT_VIZ #ifdef DIFFUSE_LIGHT_VIZ

View file

@ -78,6 +78,12 @@ function spawnGameObject(%name, %addToScene)
return 0; return 0;
} }
function GameBaseData::onNewDataBlock(%this, %obj)
{
%this.onRemove(%obj);
%this.onAdd(%obj);
}
function saveGameObject(%name, %tamlPath, %scriptPath) function saveGameObject(%name, %tamlPath, %scriptPath)
{ {
%gameObjectAsset = findGameObject(%name); %gameObjectAsset = findGameObject(%name);

View file

@ -3156,7 +3156,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
}; };
new GuiCheckBoxCtrl() { new GuiCheckBoxCtrl() {
canSaveDynamicFields = "0"; canSaveDynamicFields = "0";
internalName = "emissiveCheckbox"; internalName = "receiveShadowsCheckbox";
Enabled = "1"; Enabled = "1";
isContainer = "0"; isContainer = "0";
Profile = "ToolsGuiCheckBoxProfile"; Profile = "ToolsGuiCheckBoxProfile";
@ -3167,11 +3167,11 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
MinExtent = "8 2"; MinExtent = "8 2";
canSave = "1"; canSave = "1";
Visible = "1"; Visible = "1";
Command = "MaterialEditorGui.updateActiveMaterial(\"emissive[\" @ MaterialEditorGui.currentLayer @ \"]\",$ThisControl.getValue());"; Command = "MaterialEditorGui.updateActiveMaterial(\"receiveShadows[\" @ MaterialEditorGui.currentLayer @ \"]\",$ThisControl.getValue());";
tooltipprofile = "ToolsGuiDefaultProfile"; tooltipprofile = "ToolsGuiDefaultProfile";
ToolTip = "Emissive causes an object to not be affected by lights. Good for light sources."; ToolTip = "Do we recieve shadows?";
hovertime = "1000"; hovertime = "1000";
text = "Emissive"; text = "receiveShadows";
groupNum = "-1"; groupNum = "-1";
buttonType = "ToggleButton"; buttonType = "ToggleButton";
useMouseEvents = "0"; useMouseEvents = "0";

View file

@ -935,7 +935,7 @@ function MaterialEditorGui::guiSync( %this, %material )
MaterialEditorPropertiesWindow-->glowMulTextEdit.setText((%material).glowMul[%layer]); MaterialEditorPropertiesWindow-->glowMulTextEdit.setText((%material).glowMul[%layer]);
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-->emissiveCheckbox.setValue((%material).emissive[%layer]); MaterialEditorPropertiesWindow-->receiveShadowsCheckbox.setValue((%material).receiveShadows[%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]);