mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-09 15:30:41 +00:00
Merge branch 'development' of https://github.com/TorqueGameEngines/Torque3D into development
This commit is contained in:
commit
1fc7b99bd6
39 changed files with 189 additions and 561 deletions
|
|
@ -159,7 +159,7 @@ DefineConsoleType(TypeSoundAssetId, String)
|
|||
AssetPtr<SoundAsset> m##name##Asset = NULL;\
|
||||
SFXProfile* m##name##Profile = NULL;\
|
||||
SFXDescription* m##name##Desc = NULL;\
|
||||
SimObjectId m##name##SFXId = NULL;\
|
||||
SimObjectId m##name##SFXId = 0;\
|
||||
public: \
|
||||
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());}\
|
||||
|
|
@ -492,9 +492,9 @@ if (m##name##AssetId[index] != StringTable->EmptyString())\
|
|||
}
|
||||
|
||||
#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\
|
||||
{\
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ LightningData::LightningData()
|
|||
|
||||
for (S32 i = 0; i < MaxThunders; i++)
|
||||
{
|
||||
INIT_ASSET_ARRAY(ThunderSound, i);
|
||||
INIT_SOUNDASSET_ARRAY(ThunderSound, i);
|
||||
}
|
||||
|
||||
for (S32 i = 0; i < MaxTextures; i++)
|
||||
|
|
@ -335,7 +335,7 @@ void LightningData::packData(BitStream* stream)
|
|||
U32 i;
|
||||
for (i = 0; i < MaxThunders; i++)
|
||||
{
|
||||
PACKDATA_ASSET_ARRAY(ThunderSound, i);
|
||||
PACKDATA_SOUNDASSET_ARRAY(ThunderSound, i);
|
||||
}
|
||||
|
||||
stream->writeInt(mNumStrikeTextures, 4);
|
||||
|
|
@ -353,7 +353,7 @@ void LightningData::unpackData(BitStream* stream)
|
|||
U32 i;
|
||||
for (i = 0; i < MaxThunders; i++)
|
||||
{
|
||||
UNPACKDATA_ASSET_ARRAY(ThunderSound, i);
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(ThunderSound, i);
|
||||
}
|
||||
|
||||
mNumStrikeTextures = stream->readInt(4);
|
||||
|
|
|
|||
|
|
@ -228,8 +228,8 @@ enum SceneObjectTypeMasks : U32
|
|||
OUTDOOR_OBJECT_TYPEMASK = ( TerrainObjectType |
|
||||
EnvironmentObjectType ),
|
||||
|
||||
SKYLIGHT_CAPTURE_TYPEMASK = (EnvironmentObjectType),
|
||||
REFLECTION_PROBE_CAPTURE_TYPEMASK = (StaticObjectType | StaticShapeObjectType | LightObjectType)
|
||||
SKYLIGHT_CAPTURE_TYPEMASK = (OUTDOOR_OBJECT_TYPEMASK) & ~(PhysicalZoneObjectType | MarkerObjectType | TriggerObjectType),
|
||||
REFLECTION_PROBE_CAPTURE_TYPEMASK = (SKYLIGHT_CAPTURE_TYPEMASK | StaticObjectType | StaticShapeObjectType | LightObjectType)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ PlayerData::PlayerData()
|
|||
boxHeadFrontPercentage = 1;
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
INIT_ASSET_ARRAY(PlayerSound, i);
|
||||
INIT_SOUNDASSET_ARRAY(PlayerSound, i);
|
||||
|
||||
footPuffEmitter = NULL;
|
||||
footPuffID = 0;
|
||||
|
|
@ -469,17 +469,17 @@ bool PlayerData::preload(bool server, String &errorStr)
|
|||
{
|
||||
if(!Parent::preload(server, errorStr))
|
||||
return false;
|
||||
|
||||
for (U32 i = 0; i < MaxSounds; ++i)
|
||||
{
|
||||
_setPlayerSound(getPlayerSound(i), i);
|
||||
if (getPlayerSound(i) != StringTable->EmptyString())
|
||||
if (!server) {
|
||||
for (U32 i = 0; i < MaxSounds; ++i)
|
||||
{
|
||||
if (!getPlayerSoundProfile(i))
|
||||
Con::errorf("PlayerData::Preload() - unable to find sfxProfile for asset %d %s", i, mPlayerSoundAssetId[i]);
|
||||
_setPlayerSound(getPlayerSound(i), 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));
|
||||
jumpSurfaceCos = mCos(mDegToRad(jumpSurfaceAngle));
|
||||
|
|
@ -1271,7 +1271,7 @@ void PlayerData::packData(BitStream* stream)
|
|||
stream->write(minLateralImpactSpeed);
|
||||
|
||||
for (U32 i = 0; i < MaxSounds; i++)
|
||||
PACKDATA_ASSET_ARRAY(PlayerSound, i);
|
||||
PACKDATA_SOUNDASSET_ARRAY(PlayerSound, i);
|
||||
|
||||
mathWrite(*stream, boxSize);
|
||||
mathWrite(*stream, crouchBoxSize);
|
||||
|
|
@ -1452,7 +1452,7 @@ void PlayerData::unpackData(BitStream* stream)
|
|||
stream->read(&minLateralImpactSpeed);
|
||||
|
||||
for (U32 i = 0; i < MaxSounds; i++)
|
||||
UNPACKDATA_ASSET_ARRAY(PlayerSound, i);
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(PlayerSound, i);
|
||||
|
||||
mathRead(*stream, &boxSize);
|
||||
mathRead(*stream, &crouchBoxSize);
|
||||
|
|
|
|||
|
|
@ -207,6 +207,27 @@ TriggerObjectType |
|
|||
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()
|
||||
|
|
@ -238,7 +259,7 @@ RigidShapeData::RigidShapeData()
|
|||
density = 4;
|
||||
|
||||
for (S32 i = 0; i < Body::MaxSounds; i++)
|
||||
INIT_ASSET_ARRAY(BodySounds, i);
|
||||
INIT_SOUNDASSET_ARRAY(BodySounds, i);
|
||||
|
||||
dustEmitter = NULL;
|
||||
dustID = 0;
|
||||
|
|
@ -257,7 +278,7 @@ RigidShapeData::RigidShapeData()
|
|||
enablePhysicsRep = true;
|
||||
|
||||
for (S32 i = 0; i < Sounds::MaxSounds; i++)
|
||||
INIT_ASSET_ARRAY(WaterSounds, i);
|
||||
INIT_SOUNDASSET_ARRAY(WaterSounds, i);
|
||||
|
||||
dragForce = 0;
|
||||
vertFactor = 0.25;
|
||||
|
|
@ -301,7 +322,7 @@ bool RigidShapeData::preload(bool server, String &errorStr)
|
|||
if (!server) {
|
||||
for (S32 i = 0; i < Body::MaxSounds; i++)
|
||||
{
|
||||
if (mBodySounds[i])
|
||||
if (getBodySounds(i) != StringTable->EmptyString())
|
||||
{
|
||||
_setBodySounds(getBodySounds(i), i);
|
||||
}
|
||||
|
|
@ -309,7 +330,7 @@ bool RigidShapeData::preload(bool server, String &errorStr)
|
|||
|
||||
for (S32 j = 0; j < Sounds::MaxSounds; j++)
|
||||
{
|
||||
if (mWaterSounds[j])
|
||||
if (getWaterSounds(j) != StringTable->EmptyString())
|
||||
{
|
||||
_setWaterSounds(getWaterSounds(j), j);
|
||||
}
|
||||
|
|
@ -371,7 +392,7 @@ void RigidShapeData::packData(BitStream* stream)
|
|||
stream->write(body.friction);
|
||||
for (U32 i = 0; i < Body::MaxSounds; ++i)
|
||||
{
|
||||
PACKDATA_ASSET_ARRAY(BodySounds, i);
|
||||
PACKDATA_SOUNDASSET_ARRAY(BodySounds, i);
|
||||
}
|
||||
|
||||
stream->write(minImpactSpeed);
|
||||
|
|
@ -391,8 +412,9 @@ void RigidShapeData::packData(BitStream* stream)
|
|||
stream->write(cameraLag);
|
||||
stream->write(cameraDecay);
|
||||
stream->write(cameraOffset);
|
||||
|
||||
stream->write( dustHeight );
|
||||
|
||||
stream->write(triggerDustHeight);
|
||||
stream->write(dustHeight);
|
||||
|
||||
stream->write(exitSplashSoundVel);
|
||||
stream->write(softSplashSoundVel);
|
||||
|
|
@ -403,7 +425,7 @@ void RigidShapeData::packData(BitStream* stream)
|
|||
// write the water sound profiles
|
||||
for (U32 i = 0; i < Sounds::MaxSounds; ++i)
|
||||
{
|
||||
PACKDATA_ASSET_ARRAY(WaterSounds, i);
|
||||
PACKDATA_SOUNDASSET_ARRAY(WaterSounds, i);
|
||||
}
|
||||
|
||||
if (stream->writeFlag( dustEmitter ))
|
||||
|
|
@ -434,7 +456,7 @@ void RigidShapeData::unpackData(BitStream* stream)
|
|||
|
||||
for (U32 i = 0; i < Body::Sounds::MaxSounds; i++)
|
||||
{
|
||||
UNPACKDATA_ASSET_ARRAY(BodySounds, i);
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(BodySounds, i);
|
||||
}
|
||||
|
||||
stream->read(&minImpactSpeed);
|
||||
|
|
@ -455,6 +477,7 @@ void RigidShapeData::unpackData(BitStream* stream)
|
|||
stream->read(&cameraDecay);
|
||||
stream->read(&cameraOffset);
|
||||
|
||||
stream->read(&triggerDustHeight);
|
||||
stream->read( &dustHeight );
|
||||
|
||||
stream->read(&exitSplashSoundVel);
|
||||
|
|
@ -466,7 +489,7 @@ void RigidShapeData::unpackData(BitStream* stream)
|
|||
// write the water sound profiles
|
||||
for (U32 i = 0; i < Sounds::MaxSounds; ++i)
|
||||
{
|
||||
UNPACKDATA_ASSET_ARRAY(WaterSounds, i);
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(WaterSounds, i);
|
||||
}
|
||||
|
||||
if( stream->readFlag() )
|
||||
|
|
@ -539,14 +562,14 @@ void RigidShapeData::initPersistFields()
|
|||
|
||||
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("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("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" );
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ class RigidShapeData : public ShapeBaseData
|
|||
} body;
|
||||
|
||||
DECLARE_SOUNDASSET_ARRAY(RigidShapeData, BodySounds, Body::Sounds::MaxSounds)
|
||||
DECLARE_ASSET_ARRAY_SETGET(RigidShapeData, BodySounds);
|
||||
|
||||
enum RigidShapeConsts
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1572,7 +1572,7 @@ void ShapeBase::setControllingClient( GameConnection* client )
|
|||
|
||||
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
|
||||
// us the current SFX listener.
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ FlyingVehicleData::FlyingVehicleData()
|
|||
jetEmitter[j] = 0;
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
INIT_ASSET_ARRAY(FlyingSounds, i);
|
||||
INIT_SOUNDASSET_ARRAY(FlyingSounds, i);
|
||||
|
||||
vertThrustMultiple = 1.0;
|
||||
}
|
||||
|
|
@ -241,7 +241,7 @@ void FlyingVehicleData::packData(BitStream* stream)
|
|||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
PACKDATA_ASSET_ARRAY(FlyingSounds, i);
|
||||
PACKDATA_SOUNDASSET_ARRAY(FlyingSounds, i);
|
||||
}
|
||||
|
||||
for (S32 j = 0; j < MaxJetEmitters; j++)
|
||||
|
|
@ -276,7 +276,7 @@ void FlyingVehicleData::unpackData(BitStream* stream)
|
|||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
UNPACKDATA_ASSET_ARRAY(FlyingSounds, i);
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(FlyingSounds, i);
|
||||
}
|
||||
|
||||
for (S32 j = 0; j < MaxJetEmitters; j++) {
|
||||
|
|
|
|||
|
|
@ -73,9 +73,9 @@ DefineEnumType(hoverSoundsEnum);
|
|||
|
||||
ImplementEnumType(hoverSoundsEnum, "enum types.\n"
|
||||
"@ingroup HoverVehicleData\n\n")
|
||||
{ HoverVehicleData::JetSound, "JetSound", "..." },
|
||||
{ HoverVehicleData::EngineSound, "EngineSound", "..." },
|
||||
{ HoverVehicleData::FloatSound, "FloatSound", "..." },
|
||||
{ hoverSoundsEnum::JetSound, "JetSound", "..." },
|
||||
{ hoverSoundsEnum::EngineSound, "EngineSound", "..." },
|
||||
{ hoverSoundsEnum::FloatSound, "FloatSound", "..." },
|
||||
EndImplementEnumType;
|
||||
|
||||
namespace {
|
||||
|
|
@ -162,7 +162,7 @@ HoverVehicleData::HoverVehicleData()
|
|||
jetEmitter[j] = 0;
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
INIT_ASSET_ARRAY(HoverSounds, i);
|
||||
INIT_SOUNDASSET_ARRAY(HoverSounds, i);
|
||||
}
|
||||
|
||||
HoverVehicleData::~HoverVehicleData()
|
||||
|
|
@ -370,7 +370,7 @@ void HoverVehicleData::packData(BitStream* stream)
|
|||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
PACKDATA_ASSET_ARRAY(HoverSounds, i);
|
||||
PACKDATA_SOUNDASSET_ARRAY(HoverSounds, i);
|
||||
}
|
||||
|
||||
for (S32 j = 0; j < MaxJetEmitters; j++)
|
||||
|
|
@ -419,7 +419,7 @@ void HoverVehicleData::unpackData(BitStream* stream)
|
|||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
UNPACKDATA_ASSET_ARRAY(HoverSounds, i);
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(HoverSounds, i);
|
||||
}
|
||||
|
||||
for (S32 j = 0; j < MaxJetEmitters; j++) {
|
||||
|
|
|
|||
|
|
@ -80,28 +80,6 @@ static U32 sTriggerMask = ItemObjectType |
|
|||
|
||||
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,
|
||||
"@brief Base properties shared by all Vehicles (FlyingVehicle, HoverVehicle, "
|
||||
"WheeledVehicle).\n\n"
|
||||
|
|
@ -152,70 +130,21 @@ VehicleData::VehicleData()
|
|||
shadowEnable = true;
|
||||
shadowSize = 256;
|
||||
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.
|
||||
|
||||
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;
|
||||
jetEnergyDrain = 0.8f;
|
||||
minJetEnergy = 1;
|
||||
|
||||
steeringReturn = 0.0f;
|
||||
steeringReturnSpeedScale = 0.01f;
|
||||
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( damageEmitterOffset, 0, sizeof( damageEmitterOffset ) );
|
||||
dMemset( damageEmitterIDList, 0, sizeof( damageEmitterIDList ) );
|
||||
dMemset( damageLevelTolerance, 0, sizeof( damageLevelTolerance ) );
|
||||
dMemset( splashEmitterList, 0, sizeof( splashEmitterList ) );
|
||||
dMemset( splashEmitterIDList, 0, sizeof( splashEmitterIDList ) );
|
||||
|
||||
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;
|
||||
collDamageMultiplier = 0.05f;
|
||||
enablePhysicsRep = true;
|
||||
|
|
@ -237,33 +166,6 @@ bool VehicleData::preload(bool server, String &errorStr)
|
|||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -298,27 +189,8 @@ void VehicleData::packData(BitStream* stream)
|
|||
S32 i;
|
||||
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(maxDrag);
|
||||
stream->write(minDrag);
|
||||
stream->write(integration);
|
||||
stream->write(collisionTol);
|
||||
stream->write(contactTol);
|
||||
mathWrite(*stream,massCenter);
|
||||
mathWrite(*stream,massBox);
|
||||
|
||||
stream->write(jetForce);
|
||||
stream->write(jetEnergyDrain);
|
||||
stream->write(minJetEnergy);
|
||||
|
|
@ -327,33 +199,10 @@ void VehicleData::packData(BitStream* stream)
|
|||
stream->write(steeringReturnSpeedScale);
|
||||
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(exitSplashSoundVel);
|
||||
stream->write(softSplashSoundVel);
|
||||
stream->write(medSplashSoundVel);
|
||||
stream->write(hardSplashSoundVel);
|
||||
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++)
|
||||
{
|
||||
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++)
|
||||
{
|
||||
stream->write( damageEmitterOffset[j].x );
|
||||
|
|
@ -382,9 +223,6 @@ void VehicleData::packData(BitStream* stream)
|
|||
stream->write( damageLevelTolerance[k] );
|
||||
}
|
||||
|
||||
stream->write(splashFreqMod);
|
||||
stream->write(splashVelEpsilon);
|
||||
|
||||
stream->write(collDamageThresholdVel);
|
||||
stream->write(collDamageMultiplier);
|
||||
}
|
||||
|
|
@ -393,28 +231,9 @@ void VehicleData::unpackData(BitStream* stream)
|
|||
{
|
||||
Parent::unpackData(stream);
|
||||
|
||||
stream->read(&body.restitution);
|
||||
stream->read(&body.friction);
|
||||
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(&maxDrag);
|
||||
stream->read(&minDrag);
|
||||
stream->read(&integration);
|
||||
stream->read(&collisionTol);
|
||||
stream->read(&contactTol);
|
||||
mathRead(*stream,&massCenter);
|
||||
mathRead(*stream,&massBox);
|
||||
|
||||
stream->read(&jetForce);
|
||||
stream->read(&jetEnergyDrain);
|
||||
stream->read(&minJetEnergy);
|
||||
|
|
@ -423,33 +242,10 @@ void VehicleData::unpackData(BitStream* stream)
|
|||
stream->read(&steeringReturnSpeedScale);
|
||||
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(&exitSplashSoundVel);
|
||||
stream->read(&softSplashSoundVel);
|
||||
stream->read(&medSplashSoundVel);
|
||||
stream->read(&hardSplashSoundVel);
|
||||
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++)
|
||||
{
|
||||
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++ )
|
||||
{
|
||||
stream->read( &damageEmitterOffset[j].x );
|
||||
|
|
@ -478,9 +266,6 @@ void VehicleData::unpackData(BitStream* stream)
|
|||
stream->read( &damageLevelTolerance[k] );
|
||||
}
|
||||
|
||||
stream->read(&splashFreqMod);
|
||||
stream->read(&splashVelEpsilon);
|
||||
|
||||
stream->read(&collDamageThresholdVel);
|
||||
stream->read(&collDamageMultiplier);
|
||||
}
|
||||
|
|
@ -511,69 +296,9 @@ void VehicleData::initPersistFields()
|
|||
"Amount of effect the vehicle's speed has on its rate of steering return." );
|
||||
addField( "powerSteering", TypeBool, Offset(powerSteering, VehicleData),
|
||||
"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),
|
||||
"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,
|
||||
"@brief Array of particle emitters used to generate damage (dust, smoke etc) "
|
||||
"effects.\n\n"
|
||||
|
|
@ -601,30 +326,6 @@ void VehicleData::initPersistFields()
|
|||
addField( "numDmgEmitterAreas", TypeF32, Offset(numDmgEmitterAreas, VehicleData),
|
||||
"Number of damageEmitterOffset values to use for each damageEmitter.\n\n"
|
||||
"@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),
|
||||
"Minimum collision velocity to cause damage to this vehicle.\nCurrently unused." );
|
||||
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
|
||||
// costs and makes the system easier to understand.
|
||||
SFX_DELETE( mWakeSound );
|
||||
|
||||
if ( mDataBlock->getVehicleWaterSounds(VehicleData::Wake) != NULL )
|
||||
mWakeSound = SFX->createSource( mDataBlock->getVehicleWaterSoundsProfile(VehicleData::Wake), &getTransform() );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -1151,32 +849,32 @@ void Vehicle::updatePos(F32 dt)
|
|||
F32 collSpeed = (mRigid.linVelocity - origVelocity).len();
|
||||
S32 impactSound = -1;
|
||||
if (collSpeed >= mDataBlock->hardImpactSpeed)
|
||||
impactSound = VehicleData::Body::HardImpactSound;
|
||||
impactSound = RigidShapeData::Body::HardImpactSound;
|
||||
else
|
||||
if (collSpeed >= mDataBlock->softImpactSpeed)
|
||||
impactSound = VehicleData::Body::SoftImpactSound;
|
||||
impactSound = RigidShapeData::Body::SoftImpactSound;
|
||||
|
||||
if (impactSound != -1 && mDataBlock->getVehicleBodySoundsProfile(impactSound) != NULL)
|
||||
SFX->playOnce( mDataBlock->getVehicleBodySoundsProfile(impactSound), &getTransform() );
|
||||
if (impactSound != -1 && mDataBlock->getBodySoundsProfile(impactSound) != NULL)
|
||||
SFX->playOnce( mDataBlock->getBodySoundsProfile(impactSound), &getTransform() );
|
||||
}
|
||||
|
||||
// Water volume sounds
|
||||
F32 vSpeed = getVelocity().len();
|
||||
if (!inLiquid && mWaterCoverage >= 0.8f) {
|
||||
if (vSpeed >= mDataBlock->hardSplashSoundVel)
|
||||
SFX->playOnce( mDataBlock->getVehicleWaterSoundsProfile(VehicleData::ImpactHard), &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactHard), &getTransform() );
|
||||
else
|
||||
if (vSpeed >= mDataBlock->medSplashSoundVel)
|
||||
SFX->playOnce( mDataBlock->getVehicleWaterSoundsProfile(VehicleData::ImpactMedium), &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactMedium), &getTransform() );
|
||||
else
|
||||
if (vSpeed >= mDataBlock->softSplashSoundVel)
|
||||
SFX->playOnce( mDataBlock->getVehicleWaterSoundsProfile(VehicleData::ImpactSoft), &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactSoft), &getTransform() );
|
||||
inLiquid = true;
|
||||
}
|
||||
else
|
||||
if(inLiquid && mWaterCoverage < 0.8f) {
|
||||
if (vSpeed >= mDataBlock->exitSplashSoundVel)
|
||||
SFX->playOnce( mDataBlock->getVehicleWaterSoundsProfile(VehicleData::ExitWater), &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ExitWater), &getTransform() );
|
||||
inLiquid = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1376,6 +1074,10 @@ void Vehicle::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
setEnergyLevel(stream->readFloat(8) * mDataBlock->maxEnergy);
|
||||
}
|
||||
|
||||
void Vehicle::setControllingClient(GameConnection* client)
|
||||
{
|
||||
ShapeBase::setControllingClient(client);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -39,18 +39,6 @@ struct VehicleData : public RigidShapeData
|
|||
{
|
||||
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
|
||||
{
|
||||
VC_NUM_DUST_EMITTERS = 1,
|
||||
|
|
@ -62,44 +50,11 @@ struct VehicleData : public RigidShapeData
|
|||
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 collDamageThresholdVel;
|
||||
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 jetEnergyDrain; ///< Energy drain/tick
|
||||
F32 minJetEnergy;
|
||||
|
|
@ -108,22 +63,12 @@ struct VehicleData : public RigidShapeData
|
|||
F32 steeringReturnSpeedScale;
|
||||
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 ];
|
||||
Point3F damageEmitterOffset[ VC_NUM_DAMAGE_EMITTER_AREAS ];
|
||||
S32 damageEmitterIDList[ VC_NUM_DAMAGE_EMITTERS ];
|
||||
F32 damageLevelTolerance[ VC_NUM_DAMAGE_LEVELS ];
|
||||
F32 numDmgEmitterAreas;
|
||||
|
||||
ParticleEmitterData* splashEmitterList[VC_NUM_SPLASH_EMITTERS];
|
||||
S32 splashEmitterIDList[VC_NUM_SPLASH_EMITTERS];
|
||||
F32 splashFreqMod;
|
||||
F32 splashVelEpsilon;
|
||||
|
||||
bool enablePhysicsRep;
|
||||
|
||||
//
|
||||
|
|
@ -171,6 +116,7 @@ class Vehicle : public RigidShape
|
|||
void readPacketData (GameConnection * conn, BitStream *stream);
|
||||
U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream);
|
||||
void unpackUpdate(NetConnection *conn, BitStream *stream);
|
||||
void setControllingClient(GameConnection* connection);
|
||||
|
||||
void updateLiftoffDust( F32 dt );
|
||||
void updateDamageSmoke( F32 dt );
|
||||
|
|
|
|||
|
|
@ -289,15 +289,15 @@ ConsoleDocClass( WheeledVehicleData,
|
|||
"@ingroup Vehicles\n"
|
||||
);
|
||||
|
||||
typedef WheeledVehicleData::Sounds wheelSoundsEnum;
|
||||
DefineEnumType(wheelSoundsEnum);
|
||||
typedef WheeledVehicleData::Sounds WheeledVehicleSoundsEnum;
|
||||
DefineEnumType(WheeledVehicleSoundsEnum);
|
||||
|
||||
ImplementEnumType(wheelSoundsEnum, "enum types.\n"
|
||||
ImplementEnumType(WheeledVehicleSoundsEnum, "enum types.\n"
|
||||
"@ingroup WheeledVehicleData\n\n")
|
||||
{WheeledVehicleData::JetSound, "JetSound", "..." },
|
||||
{WheeledVehicleData::EngineSound, "EngineSound", "..." },
|
||||
{WheeledVehicleData::SquealSound, "SquealSound", "..." },
|
||||
{WheeledVehicleData::WheelImpactSound, "WheelImpactSound", "..." },
|
||||
{ WheeledVehicleSoundsEnum::JetSound, "JetSound", "..." },
|
||||
{ WheeledVehicleSoundsEnum::EngineSound, "EngineSound", "..." },
|
||||
{ WheeledVehicleSoundsEnum::SquealSound, "SquealSound", "..." },
|
||||
{ WheeledVehicleSoundsEnum::WheelImpactSound, "WheelImpactSound", "..." },
|
||||
EndImplementEnumType;
|
||||
|
||||
WheeledVehicleData::WheeledVehicleData()
|
||||
|
|
@ -312,7 +312,7 @@ WheeledVehicleData::WheeledVehicleData()
|
|||
wheelCount = 0;
|
||||
dMemset(&wheel, 0, sizeof(wheel));
|
||||
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()
|
||||
{
|
||||
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),
|
||||
"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++)
|
||||
{
|
||||
PACKDATA_ASSET_ARRAY(WheeledVehicleSounds, i);
|
||||
PACKDATA_SOUNDASSET_ARRAY(WheeledVehicleSounds, i);
|
||||
}
|
||||
|
||||
stream->write(maxWheelSpeed);
|
||||
|
|
@ -502,7 +504,7 @@ void WheeledVehicleData::unpackData(BitStream* stream)
|
|||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
UNPACKDATA_ASSET_ARRAY(WheeledVehicleSounds, i);
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(WheeledVehicleSounds, i);
|
||||
}
|
||||
|
||||
stream->read(&maxWheelSpeed);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#include "materials/baseMatInstance.h"
|
||||
#include "materials/sceneData.h"
|
||||
#include "environment/timeOfDay.h"
|
||||
#include "materials/materialFeatureTypes.h"
|
||||
|
||||
|
||||
ConsoleDocClass( ScatterSky,
|
||||
|
|
@ -913,7 +914,12 @@ void ScatterSky::_initMoon()
|
|||
|
||||
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>());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -572,7 +572,7 @@ void SkyBox::_initRender()
|
|||
mFogBandMat->mTranslucent = true;
|
||||
mFogBandMat->mVertColor[0] = true;
|
||||
mFogBandMat->mDoubleSided = true;
|
||||
mFogBandMat->mEmissive[0] = true;
|
||||
mFogBandMat->mReceiveShadows[0] = false;
|
||||
|
||||
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||
features.addFeature(MFT_isBackground);
|
||||
|
|
@ -610,6 +610,7 @@ void SkyBox::_initMaterial()
|
|||
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||
features.removeFeature( MFT_RTLighting );
|
||||
features.removeFeature( MFT_Visibility );
|
||||
features.removeFeature(MFT_ReflectionProbes);
|
||||
features.addFeature(MFT_isBackground);
|
||||
features.addFeature(MFT_SkyBox);
|
||||
|
||||
|
|
|
|||
|
|
@ -570,7 +570,7 @@ void SkySphere::_initRender()
|
|||
mFogBandMat->mTranslucent = true;
|
||||
mFogBandMat->mVertColor[0] = true;
|
||||
mFogBandMat->mDoubleSided = true;
|
||||
mFogBandMat->mEmissive[0] = true;
|
||||
mFogBandMat->mReceiveShadows[0] = false;
|
||||
|
||||
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||
features.addFeature(MFT_isBackground);
|
||||
|
|
@ -608,6 +608,7 @@ void SkySphere::_initMaterial()
|
|||
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||
features.removeFeature(MFT_RTLighting);
|
||||
features.removeFeature(MFT_Visibility);
|
||||
features.removeFeature(MFT_ReflectionProbes);
|
||||
features.addFeature(MFT_isBackground);
|
||||
|
||||
// Now initialize the material.
|
||||
|
|
|
|||
|
|
@ -384,8 +384,7 @@ bool MatInstance::processMaterial()
|
|||
mUsesHardwareSkinning = finalFeatures.hasFeature( MFT_HardwareSkinning );
|
||||
|
||||
mIsForwardLit = ( custMat && custMat->mForwardLit ) ||
|
||||
( !finalFeatures.hasFeature( MFT_IsEmissive ) &&
|
||||
finalFeatures.hasFeature( MFT_ForwardShading ) );
|
||||
( finalFeatures.hasFeature( MFT_ForwardShading ) );
|
||||
|
||||
mIsHardwareSkinned = finalFeatures.hasFeature( MFT_HardwareSkinning );
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ Material::Material()
|
|||
mVertColor[i] = false;
|
||||
|
||||
mGlow[i] = false;
|
||||
mEmissive[i] = false;
|
||||
mReceiveShadows[i] = true;
|
||||
|
||||
mDetailScale[i].set(2.0f, 2.0f);
|
||||
|
||||
|
|
@ -345,7 +345,7 @@ void Material::initPersistFields()
|
|||
addField("subSurfaceRolloff", TypeF32, Offset(mSubSurfaceRolloff, Material), MAX_STAGES,
|
||||
"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.");
|
||||
|
||||
addField("doubleSided", TypeBool, Offset(mDoubleSided, Material),
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ public:
|
|||
F32 mSeqSegSize[MAX_STAGES];
|
||||
|
||||
bool mGlow[MAX_STAGES]; // entire stage glows
|
||||
bool mEmissive[MAX_STAGES];
|
||||
bool mReceiveShadows[MAX_STAGES];
|
||||
|
||||
Point2I mCellIndex[MAX_STAGES];
|
||||
Point2I mCellLayout[MAX_STAGES];
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ ImplementFeatureType( MFT_IsBC3nm, U32(-1), -1, true );
|
|||
ImplementFeatureType( MFT_IsBC5nm, U32(-1), -1, true);
|
||||
ImplementFeatureType( MFT_IsTranslucent, 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_NormalMapAtlas, U32(-1), -1, true );
|
||||
ImplementFeatureType( MFT_InterlacedDeferred, U32(-1), -1, true );
|
||||
|
|
|
|||
|
|
@ -115,7 +115,6 @@ DeclareFeatureType( MFT_AlphaTest );
|
|||
DeclareFeatureType( MFT_NormalMap );
|
||||
DeclareFeatureType( MFT_RTLighting );
|
||||
|
||||
DeclareFeatureType( MFT_IsEmissive );
|
||||
DeclareFeatureType( MFT_SubSurface );
|
||||
DeclareFeatureType( MFT_LightMap );
|
||||
DeclareFeatureType( MFT_ToneMap );
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ BaseMatInstance * MaterialManager::createMeshDebugMatInstance(const LinearColorF
|
|||
debugMat = allocateAndRegister( meshDebugStr );
|
||||
|
||||
debugMat->mDiffuse[0] = meshColor;
|
||||
debugMat->mEmissive[0] = true;
|
||||
debugMat->mReceiveShadows[0] = false;
|
||||
}
|
||||
|
||||
BaseMatInstance *debugMatInstance = NULL;
|
||||
|
|
|
|||
|
|
@ -353,15 +353,10 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
|
|||
if ( mMaterial->mAlphaTest )
|
||||
fd.features.addFeature( MFT_AlphaTest );
|
||||
|
||||
if (mMaterial->mEmissive[stageNum])
|
||||
{
|
||||
fd.features.addFeature(MFT_IsEmissive);
|
||||
}
|
||||
else
|
||||
if (mMaterial->isTranslucent())
|
||||
{
|
||||
fd.features.addFeature(MFT_RTLighting);
|
||||
if (mMaterial->isTranslucent())
|
||||
fd.features.addFeature(MFT_ReflectionProbes);
|
||||
fd.features.addFeature(MFT_ReflectionProbes);
|
||||
}
|
||||
|
||||
if ( mMaterial->mAnimFlags[stageNum] )
|
||||
|
|
@ -1204,8 +1199,8 @@ void ProcessedShaderMaterial::_setShaderConstants(SceneRenderState * state, cons
|
|||
|
||||
// Deferred Shading: Determine Material Info Flags
|
||||
S32 matInfoFlags =
|
||||
(mMaterial->mEmissive[stageNum] ? 1 : 0) | //emissive
|
||||
(mMaterial->mSubSurface[stageNum] ? 2 : 0); //subsurface
|
||||
(mMaterial->mReceiveShadows[stageNum] ? 1 : 0) | //ReceiveShadows
|
||||
(mMaterial->mSubSurface[stageNum] ? 1 << 2 : 0); //subsurface
|
||||
mMaterial->mMatInfoFlags[stageNum] = matInfoFlags / 255.0f;
|
||||
shaderConsts->setSafe(handles->mMatInfoFlagsSC, mMaterial->mMatInfoFlags[stageNum]);
|
||||
if( handles->mAccuScaleSC->isValid() )
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
/// Compiler intrinsics for GCC.
|
||||
|
||||
#ifdef TORQUE_OS_MAC
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#include <libkern/OSAtomic.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -85,4 +87,8 @@ inline U32 dAtomicRead( volatile U32 &ref )
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef TORQUE_OS_MAC
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // _TORQUE_PLATFORM_PLATFORMINTRINSICS_GCC_H_
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ void RenderOcclusionMgr::init()
|
|||
|
||||
mMaterial = MATMGR->allocateAndRegister( String::EmptyString );
|
||||
mMaterial->mDiffuse[0] = LinearColorF( 1, 0, 1, 1 );
|
||||
mMaterial->mEmissive[0] = true;
|
||||
mMaterial->mReceiveShadows[0] = false;
|
||||
mMaterial->mAutoGenerated = true;
|
||||
|
||||
mMatInstance = mMaterial->createMatInstance();
|
||||
|
|
@ -234,4 +234,4 @@ void RenderOcclusionMgr::render( SceneRenderState *state )
|
|||
|
||||
// Call setup one more time to end the pass.
|
||||
mMatInstance->setupPass( state, sgData );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -560,8 +560,8 @@ void RenderProbeMgr::bakeProbe(ReflectionProbe* probe)
|
|||
ReflectorDesc reflDesc;
|
||||
reflDesc.texSize = resolution;
|
||||
reflDesc.farDist = farPlane;
|
||||
reflDesc.detailAdjust = 1;
|
||||
reflDesc.objectTypeMask = probe->mProbeShapeType == ReflectionProbe::ProbeInfo::Skylight ? SKYLIGHT_CAPTURE_TYPEMASK : REFLECTION_PROBE_CAPTURE_TYPEMASK;
|
||||
reflDesc.detailAdjust = (F32)resolution;
|
||||
reflDesc.objectTypeMask = probe->mCaptureMask;
|
||||
|
||||
CubeReflector cubeRefl;
|
||||
cubeRefl.registerReflector(probe, &reflDesc);
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ SFXPlayList::SFXPlayList()
|
|||
mNumSlotsToPlay( NUM_SLOTS )
|
||||
{
|
||||
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 ] );
|
||||
|
||||
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 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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ void TerrainBaseMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
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;
|
||||
|
||||
|
|
@ -1109,7 +1109,7 @@ void TerrainORMMapFeatGLSL::processPix(Vector<ShaderComponent*> &componentList,
|
|||
}
|
||||
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));
|
||||
|
|
@ -1176,7 +1176,7 @@ void TerrainBlankInfoMapFeatGLSL::processPix(Vector<ShaderComponent*> &component
|
|||
|
||||
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));
|
||||
|
|
|
|||
|
|
@ -383,7 +383,7 @@ void TerrainBaseMapFeatHLSL::processPix(Vector<ShaderComponent*>& componentList,
|
|||
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;
|
||||
}
|
||||
|
|
@ -1191,7 +1191,7 @@ void TerrainORMMapFeatHLSL::processPix(Vector<ShaderComponent*> &componentList,
|
|||
}
|
||||
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));
|
||||
|
|
@ -1256,7 +1256,7 @@ void TerrainBlankInfoMapFeatHLSL::processPix(Vector<ShaderComponent*> &component
|
|||
|
||||
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));
|
||||
|
|
|
|||
|
|
@ -146,13 +146,6 @@ void main()
|
|||
//create surface
|
||||
Surface surface = createSurface( normDepth, colorBuffer, matInfoBuffer,
|
||||
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;
|
||||
float dist = length(L);
|
||||
|
|
@ -162,22 +155,22 @@ void main()
|
|||
float distToLight = dist / lightRange;
|
||||
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L);
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
float shadowed = 1.0;
|
||||
#else
|
||||
|
||||
float shadow = 1.0;
|
||||
#ifndef NO_SHADOW
|
||||
if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
|
||||
{
|
||||
#ifdef SHADOW_CUBE
|
||||
|
||||
// TODO: We need to fix shadow cube to handle soft shadows!
|
||||
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
|
||||
vec2 shadowCoord = decodeShadowCoord( tMul( worldToLightProj, -surfaceToLight.L ) ).xy;
|
||||
float shadowed = softShadow_filter(shadowMap, ssPos.xy/ssPos.w, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
vec2 shadowCoord = decodeShadowCoord( tMul( worldToLightProj, -surfaceToLight.L ) ).xy;
|
||||
shadow = softShadow_filter(shadowMap, ssPos.xy/ssPos.w, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
#endif
|
||||
|
||||
#endif // !NO_SHADOW
|
||||
}
|
||||
#endif // !NO_SHADOW
|
||||
|
||||
vec3 lightCol = lightColor.rgb;
|
||||
#ifdef USE_COOKIE_TEX
|
||||
|
|
@ -225,7 +218,7 @@ void main()
|
|||
#endif
|
||||
|
||||
//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);
|
||||
|
|
|
|||
|
|
@ -55,13 +55,6 @@ void main()
|
|||
|
||||
//create surface
|
||||
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
|
||||
float ssao = 1.0 - texture( ssaoMask, viewportCoordToRenderTarget( IN_uv0.xy, rtParams7 ) ).r;
|
||||
|
|
|
|||
|
|
@ -80,13 +80,6 @@ void main()
|
|||
//create surface
|
||||
Surface surface = createSurface( normDepth, colorBuffer,matInfoBuffer,
|
||||
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;
|
||||
float dist = length(L);
|
||||
|
|
@ -96,9 +89,10 @@ void main()
|
|||
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L);
|
||||
vec3 lightCol = lightColor.rgb;
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
float shadowed = 1.0;
|
||||
#else
|
||||
float shadow = 1.0;
|
||||
#ifndef NO_SHADOW
|
||||
if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
|
||||
{
|
||||
// Get the shadow texture coordinate
|
||||
vec4 pxlPosLightProj = tMul( worldToLightProj, vec4( surface.P, 1 ) );
|
||||
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
|
||||
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
|
||||
// Lookup the cookie sample.
|
||||
vec4 cookie = texture(cookieMap, shadowCoord);
|
||||
|
|
@ -117,6 +111,7 @@ void main()
|
|||
// regions of the cookie texture.
|
||||
lightCol *= max(cookie.r, max(cookie.g, cookie.b));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -156,7 +151,7 @@ void main()
|
|||
#endif
|
||||
|
||||
//get Punctual light contribution
|
||||
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed);
|
||||
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadow);
|
||||
//get spot angle attenuation
|
||||
lighting *= getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,24 +186,17 @@ void main()
|
|||
//create surface
|
||||
Surface surface = createSurface( normDepth, colorBuffer, matInfoBuffer,
|
||||
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
|
||||
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, -lightDirection);
|
||||
|
||||
//light color might be changed by PSSM_DEBUG_RENDER
|
||||
vec3 lightingColor = lightColor.rgb;
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
float shadow = 1.0;
|
||||
#else
|
||||
|
||||
float shadow = 1.0;
|
||||
#ifndef NO_SHADOW
|
||||
if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
|
||||
{
|
||||
// Fade out the shadow at the end of the range.
|
||||
vec4 zDist = vec4(zNearFarInvNearFar.x + zNearFarInvNearFar.y * surface.depth);
|
||||
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,
|
||||
farPlaneScalePSSM, surfaceToLight.NdotL);
|
||||
|
||||
float shadow = shadowed_colors.a;
|
||||
shadow = shadowed_colors.a;
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
lightingColor = shadowed_colors.rgb;
|
||||
|
|
@ -223,7 +216,7 @@ void main()
|
|||
if ( fadeOutAmt > 1.0 )
|
||||
lightingColor = vec3(1.0,1.0,1.0);
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif //NO_SHADOW
|
||||
|
||||
#ifdef DIFFUSE_LIGHT_VIZ
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
|
|||
#ifdef SHADOW_CUBE
|
||||
TORQUE_UNIFORM_SAMPLERCUBE(shadowMap, 1);
|
||||
#else
|
||||
TORQUE_UNIFORM_SAMPLER2DCMP(shadowMap, 1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1);
|
||||
#endif
|
||||
//contains gTapRotationTex sampler
|
||||
#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),
|
||||
uvScene, eyePosWorld, wsEyeRay, cameraToWorld);
|
||||
|
||||
//early out if emissive
|
||||
if (getFlag(surface.matFlag, 0))
|
||||
{
|
||||
return float4(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
float3 L = lightPosition - surface.P;
|
||||
float dist = length(L);
|
||||
float3 lighting = 0.0.xxx;
|
||||
|
|
@ -162,22 +156,21 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
float distToLight = dist / lightRange;
|
||||
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L);
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
float shadowed = 1.0;
|
||||
#else
|
||||
|
||||
float shadow = 1.0;
|
||||
#ifndef NO_SHADOW
|
||||
if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
|
||||
{
|
||||
#ifdef SHADOW_CUBE
|
||||
|
||||
// TODO: We need to fix shadow cube to handle soft shadows!
|
||||
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
|
||||
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);
|
||||
float shadowed = shadowed_colors.a;
|
||||
shadow = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(shadowMap), ssPos.xy, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif // !NO_SHADOW
|
||||
|
||||
float3 lightCol = lightColor.rgb;
|
||||
|
|
@ -222,7 +215,7 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
#endif
|
||||
|
||||
//get punctual light contribution
|
||||
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed);
|
||||
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadow);
|
||||
}
|
||||
|
||||
return float4(lighting, 0);
|
||||
|
|
|
|||
|
|
@ -51,12 +51,6 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
|||
Surface surface = createSurface(normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
||||
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
|
||||
float ssao = 1.0 - TORQUE_TEX2D( ssaoMask, viewportCoordToRenderTarget( IN.uv0.xy, rtParams7 ) ).r;
|
||||
surface.ao = min(surface.ao, ssao);
|
||||
|
|
|
|||
|
|
@ -86,12 +86,6 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
Surface surface = createSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
||||
uvScene, eyePosWorld, wsEyeRay, cameraToWorld);
|
||||
|
||||
//early out if emissive
|
||||
if (getFlag(surface.matFlag, 0))
|
||||
{
|
||||
return float4(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
float3 L = lightPosition - surface.P;
|
||||
float dist = length(L);
|
||||
float3 lighting = 0.0.xxx;
|
||||
|
|
@ -100,17 +94,18 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
{
|
||||
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L);
|
||||
float3 lightCol = lightColor.rgb;
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
float shadowed = 1.0;
|
||||
#else
|
||||
|
||||
float shadow = 1.0;
|
||||
#ifndef NO_SHADOW
|
||||
if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
|
||||
{
|
||||
// Get the shadow texture coordinate
|
||||
float4 pxlPosLightProj = mul( worldToLightProj, float4( surface.P, 1 ) );
|
||||
float2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + float2( 0.5, 0.5 );
|
||||
shadowCoord.y = 1.0f - shadowCoord.y;
|
||||
//distance to light in shadow map space
|
||||
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
|
||||
// Lookup the cookie sample.
|
||||
float4 cookie = TORQUE_TEX2D(cookieMap, shadowCoord);
|
||||
|
|
@ -121,6 +116,7 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
// regions of the cookie texture.
|
||||
lightCol *= max(cookie.r, max(cookie.g, cookie.b));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DIFFUSE_LIGHT_VIZ
|
||||
|
|
@ -153,16 +149,9 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
#endif
|
||||
|
||||
//get Punctual light contribution
|
||||
|
||||
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadow);
|
||||
//get spot angle attenuation
|
||||
float att = 1;
|
||||
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;
|
||||
//
|
||||
lighting *= getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
|
||||
}
|
||||
|
||||
return float4(lighting, 0);
|
||||
|
|
|
|||
|
|
@ -186,23 +186,17 @@ float4 main(FarFrustumQuadConnectP IN) : SV_TARGET
|
|||
//create surface
|
||||
Surface surface = createSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
||||
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
|
||||
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, -lightDirection);
|
||||
|
||||
//light color might be changed by PSSM_DEBUG_RENDER
|
||||
float3 lightingColor = lightColor.rgb;
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
float shadow = 1.0;
|
||||
#else
|
||||
|
||||
float shadow = 1.0;
|
||||
#ifndef NO_SHADOW
|
||||
if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
|
||||
{
|
||||
// Fade out the shadow at the end of the range.
|
||||
float4 zDist = (zNearFarInvNearFar.x + zNearFarInvNearFar.y * surface.depth);
|
||||
float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y;
|
||||
|
|
@ -221,7 +215,7 @@ float4 main(FarFrustumQuadConnectP IN) : SV_TARGET
|
|||
farPlaneScalePSSM,
|
||||
surfaceToLight.NdotL);
|
||||
|
||||
float shadow = shadowed_colors.a;
|
||||
shadow = shadowed_colors.a;
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
lightingColor = shadowed_colors.rgb;
|
||||
|
|
@ -233,7 +227,7 @@ float4 main(FarFrustumQuadConnectP IN) : SV_TARGET
|
|||
if ( fadeOutAmt > 1.0 )
|
||||
lightingColor = 1.0;
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif //NO_SHADOW
|
||||
|
||||
#ifdef DIFFUSE_LIGHT_VIZ
|
||||
|
|
|
|||
|
|
@ -78,6 +78,12 @@ function spawnGameObject(%name, %addToScene)
|
|||
return 0;
|
||||
}
|
||||
|
||||
function GameBaseData::onNewDataBlock(%this, %obj)
|
||||
{
|
||||
%this.onRemove(%obj);
|
||||
%this.onAdd(%obj);
|
||||
}
|
||||
|
||||
function saveGameObject(%name, %tamlPath, %scriptPath)
|
||||
{
|
||||
%gameObjectAsset = findGameObject(%name);
|
||||
|
|
|
|||
|
|
@ -3156,7 +3156,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
};
|
||||
new GuiCheckBoxCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
internalName = "emissiveCheckbox";
|
||||
internalName = "receiveShadowsCheckbox";
|
||||
Enabled = "1";
|
||||
isContainer = "0";
|
||||
Profile = "ToolsGuiCheckBoxProfile";
|
||||
|
|
@ -3167,11 +3167,11 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "MaterialEditorGui.updateActiveMaterial(\"emissive[\" @ MaterialEditorGui.currentLayer @ \"]\",$ThisControl.getValue());";
|
||||
Command = "MaterialEditorGui.updateActiveMaterial(\"receiveShadows[\" @ MaterialEditorGui.currentLayer @ \"]\",$ThisControl.getValue());";
|
||||
tooltipprofile = "ToolsGuiDefaultProfile";
|
||||
ToolTip = "Emissive causes an object to not be affected by lights. Good for light sources.";
|
||||
ToolTip = "Do we recieve shadows?";
|
||||
hovertime = "1000";
|
||||
text = "Emissive";
|
||||
text = "receiveShadows";
|
||||
groupNum = "-1";
|
||||
buttonType = "ToggleButton";
|
||||
useMouseEvents = "0";
|
||||
|
|
|
|||
|
|
@ -935,7 +935,7 @@ function MaterialEditorGui::guiSync( %this, %material )
|
|||
MaterialEditorPropertiesWindow-->glowMulTextEdit.setText((%material).glowMul[%layer]);
|
||||
MaterialEditorPropertiesWindow-->glowMulSlider.setValue((%material).glowMul[%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-->parallaxSlider.setValue((%material).parallaxScale[%layer]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue