inspector cleanups

clustering work for datablocks for both consistent scanning for object parameters, as well as an eye towards orgainizing things to make reviewing what variations of components we'll be needing down the line clearer
This commit is contained in:
AzaezelX 2023-01-24 17:12:23 -06:00
parent 23895e365a
commit f07c8745b2
27 changed files with 692 additions and 700 deletions

View file

@ -50,6 +50,15 @@ const static U32 sCollisionMoveMask = ( TerrainObjectType | WaterObjectType
static U32 sServerCollisionMask = sCollisionMoveMask; // ItemObjectType
static U32 sClientCollisionMask = sCollisionMoveMask;
typedef FlyingVehicleData::Sounds engineSounds;
DefineEnumType(engineSounds);
ImplementEnumType(engineSounds, "enum types.\n"
"@ingroup VehicleData\n\n")
{ engineSounds::JetSound, "JetSound", "..." },
{ engineSounds::EngineSound, "EngineSound", "..." },
EndImplementEnumType;
//
const char* FlyingVehicle::sJetSequence[FlyingVehicle::JetAnimCount] =
{
@ -166,15 +175,27 @@ bool FlyingVehicleData::preload(bool server, String &errorStr)
void FlyingVehicleData::initPersistFields()
{
INITPERSISTFIELD_SOUNDASSET_ARRAY(FlyingSounds, Sounds::MaxSounds, FlyingVehicleData, "Sounds for flying vehicle");
addField( "maneuveringForce", TypeF32, Offset(maneuveringForce, FlyingVehicleData),
"@brief Maximum X and Y (horizontal plane) maneuvering force.\n\n"
"The actual force applied depends on the current thrust." );
addGroup("Physics");
addField( "rollForce", TypeF32, Offset(rollForce, FlyingVehicleData),
"@brief Damping torque against rolling maneuvers (rotation about the y-axis), "
"proportional to linear velocity.\n\n"
"Acts to adjust roll to a stable position over time as the vehicle moves." );
addField( "rotationalDrag", TypeF32, Offset(rotationalDrag, FlyingVehicleData),
"Rotational drag factor (slows vehicle rotation speed in all axes)." );
addField( "horizontalSurfaceForce", TypeF32, Offset(horizontalSurfaceForce, FlyingVehicleData),
"@brief Damping force in the opposite direction to sideways velocity.\n\n"
"Provides \"bite\" into the wind for climbing/diving and turning)." );
addField( "hoverHeight", TypeF32, Offset(hoverHeight, FlyingVehicleData),
"The vehicle's height off the ground when at rest." );
addField( "createHoverHeight", TypeF32, Offset(createHoverHeight, FlyingVehicleData),
"@brief The vehicle's height off the ground when useCreateHeight is active.\n\n"
"This can help avoid problems with spawning the vehicle." );
endGroup("Physics");
addGroup("Steering");
addField( "maneuveringForce", TypeF32, Offset(maneuveringForce, FlyingVehicleData),
"@brief Maximum X and Y (horizontal plane) maneuvering force.\n\n"
"The actual force applied depends on the current thrust." );
addField( "verticalSurfaceForce", TypeF32, Offset(verticalSurfaceForce, FlyingVehicleData),
"@brief Damping force in the opposite direction to vertical velocity.\n\n"
"Controls side slip; lower numbers give more slide." );
@ -186,13 +207,9 @@ void FlyingVehicleData::initPersistFields()
addField( "steeringRollForce", TypeF32, Offset(steeringRollForce, FlyingVehicleData),
"Roll force induced by sideways steering input value (controls how much "
"the vehicle rolls when turning)." );
addField( "rollForce", TypeF32, Offset(rollForce, FlyingVehicleData),
"@brief Damping torque against rolling maneuvers (rotation about the y-axis), "
"proportional to linear velocity.\n\n"
"Acts to adjust roll to a stable position over time as the vehicle moves." );
addField( "rotationalDrag", TypeF32, Offset(rotationalDrag, FlyingVehicleData),
"Rotational drag factor (slows vehicle rotation speed in all axes)." );
endGroup("Steering");
addGroup("AutoCorrection");
addField( "maxAutoSpeed", TypeF32, Offset(maxAutoSpeed, FlyingVehicleData),
"Maximum speed for automatic vehicle control assistance - vehicles "
"travelling at speeds above this value do not get control assitance." );
@ -208,13 +225,9 @@ void FlyingVehicleData::initPersistFields()
"@brief Corrective torque applied to level out the vehicle when moving at less "
"than maxAutoSpeed.\n\n"
"The torque is inversely proportional to vehicle speed." );
endGroup("AutoCorrection");
addField( "hoverHeight", TypeF32, Offset(hoverHeight, FlyingVehicleData),
"The vehicle's height off the ground when at rest." );
addField( "createHoverHeight", TypeF32, Offset(createHoverHeight, FlyingVehicleData),
"@brief The vehicle's height off the ground when useCreateHeight is active.\n\n"
"This can help avoid problems with spawning the vehicle." );
addGroup("Particle Effects");
addField( "forwardJetEmitter",TYPEID< ParticleEmitterData >(), Offset(jetEmitter[ForwardJetEmitter], FlyingVehicleData),
"@brief Emitter to generate particles for forward jet thrust.\n\n"
"Forward jet thrust particles are emitted from model nodes JetNozzle0 "
@ -231,7 +244,11 @@ void FlyingVehicleData::initPersistFields()
"Emitter to generate contrail particles from model nodes contrail0 - contrail3." );
addField( "minTrailSpeed", TypeF32, Offset(minTrailSpeed, FlyingVehicleData),
"Minimum speed at which to start generating contrail particles." );
endGroup("Particle Effects");
addGroup("Sounds");
INITPERSISTFIELD_SOUNDASSET_ENUMED(FlyingSounds, engineSounds, Sounds::MaxSounds, FlyingVehicleData, "EngineSounds.");
endGroup("Sounds");
Parent::initPersistFields();
}
@ -404,8 +421,17 @@ void FlyingVehicle::onRemove()
//----------------------------------------------------------------------------
void FlyingVehicle::interpolateTick(F32 dt)
{
PROFILE_SCOPE(FlyingVehicle_InterpolateTick);
Parent::interpolateTick(dt);
updateEngineSound(1);
updateJet(dt);
}
void FlyingVehicle::advanceTime(F32 dt)
{
PROFILE_SCOPE(FlyingVehicle_AdvanceTime);
Parent::advanceTime(dt);
updateEngineSound(1);

View file

@ -187,6 +187,7 @@ class FlyingVehicle: public Vehicle
bool onAdd();
void onRemove();
void interpolateTick(F32 dt);
void advanceTime(F32 dt);
void writePacketData(GameConnection *conn, BitStream *stream);

View file

@ -174,79 +174,86 @@ HoverVehicleData::~HoverVehicleData()
//--------------------------------------------------------------------------
void HoverVehicleData::initPersistFields()
{
addField( "dragForce", TypeF32, Offset(dragForce, HoverVehicleData),
addGroup("Physics");
addField( "normalForce", TypeF32, Offset(normalForce, HoverVehicleData),
"Force generated in the ground normal direction when the vehicle is not "
"floating (within stabalizer length from the ground).\n\n"
"@see stabLenMin" );
addField( "stabLenMin", TypeF32, Offset(stabLenMin, HoverVehicleData),
"Length of the base stabalizer when travelling at minimum speed (0).\n"
"Each tick, the vehicle performs 2 raycasts (from the center back and "
"center front of the vehicle) to check for contact with the ground. The "
"base stabalizer length determines the length of that raycast; if "
"neither raycast hit the ground, the vehicle is floating, stabalizer "
"spring and ground normal forces are not applied.\n\n"
"<img src=\"images/hoverVehicle_forces.png\">\n"
"@see stabSpringConstant" );
addField( "stabLenMax", TypeF32, Offset(stabLenMax, HoverVehicleData),
"Length of the base stabalizer when travelling at maximum speed "
"(maxThrustSpeed).\n\n@see stabLenMin\n\n@see mainThrustForce" );
addField("vertFactor", TypeF32, Offset(vertFactor, HoverVehicleData),
"Scalar applied to the vertical portion of the velocity drag acting on "
"the vehicle.\nFor the horizontal (X and Y) components of velocity drag, "
"a factor of 0.25 is applied when the vehicle is floating, and a factor "
"of 1.0 is applied when the vehicle is not floating. This velocity drag "
"is multiplied by the vehicle's dragForce, as defined above, and the "
"result is subtracted from it's movement force.\n"
"@note The vertFactor must be between 0.0 and 1.0 (inclusive).");
addField("stabSpringConstant", TypeF32, Offset(stabSpringConstant, HoverVehicleData),
"Value used to generate stabalizer spring force. The force generated "
"depends on stabilizer compression, that is how close the vehicle is "
"to the ground proportional to current stabalizer length.\n\n"
"@see stabLenMin");
addField("stabDampingConstant", TypeF32, Offset(stabDampingConstant, HoverVehicleData),
"Damping spring force acting against changes in the stabalizer length.\n\n"
"@see stabLenMin");
endGroup("Physics");
addGroup("Steering");
addField( "steeringForce", TypeF32, Offset(steeringForce, HoverVehicleData),
"Yaw (rotation about the Z-axis) force applied when steering in the x-axis direction."
"about the vehicle's Z-axis)" );
addField( "rollForce", TypeF32, Offset(rollForce, HoverVehicleData),
"Roll (rotation about the Y-axis) force applied when steering in the x-axis direction." );
addField( "pitchForce", TypeF32, Offset(pitchForce, HoverVehicleData),
"Pitch (rotation about the X-axis) force applied when steering in the y-axis direction." );
addField( "dragForce", TypeF32, Offset(dragForce, HoverVehicleData),
"Drag force factor that acts opposite to the vehicle velocity.\nAlso "
"used to determnine the vehicle's maxThrustSpeed.\n@see mainThrustForce" );
addField( "vertFactor", TypeF32, Offset(vertFactor, HoverVehicleData),
"Scalar applied to the vertical portion of the velocity drag acting on "
"the vehicle.\nFor the horizontal (X and Y) components of velocity drag, "
"a factor of 0.25 is applied when the vehicle is floating, and a factor "
"of 1.0 is applied when the vehicle is not floating. This velocity drag "
"is multiplied by the vehicle's dragForce, as defined above, and the "
"result is subtracted from it's movement force.\n"
"@note The vertFactor must be between 0.0 and 1.0 (inclusive)." );
addField( "floatingThrustFactor", TypeF32, Offset(floatingThrustFactor, HoverVehicleData),
"Scalar applied to the vehicle's thrust force when the vehicle is floating.\n"
"@note The floatingThrustFactor must be between 0.0 and 1.0 (inclusive)." );
addField( "mainThrustForce", TypeF32, Offset(mainThrustForce, HoverVehicleData),
"Force generated by thrusting the vehicle forward.\nAlso used to determine "
"the maxThrustSpeed:\n\n"
"@tsexample\n"
"maxThrustSpeed = (mainThrustForce + strafeThrustForce) / dragForce;\n"
"@endtsexample\n" );
addField( "reverseThrustForce", TypeF32, Offset(reverseThrustForce, HoverVehicleData),
"Force generated by thrusting the vehicle backward." );
addField( "strafeThrustForce", TypeF32, Offset(strafeThrustForce, HoverVehicleData),
"Force generated by thrusting the vehicle to one side.\nAlso used to "
"determine the vehicle's maxThrustSpeed.\n@see mainThrustForce" );
addField( "turboFactor", TypeF32, Offset(turboFactor, HoverVehicleData),
"Scale factor applied to the vehicle's thrust force when jetting." );
addField( "stabLenMin", TypeF32, Offset(stabLenMin, HoverVehicleData),
"Length of the base stabalizer when travelling at minimum speed (0).\n"
"Each tick, the vehicle performs 2 raycasts (from the center back and "
"center front of the vehicle) to check for contact with the ground. The "
"base stabalizer length determines the length of that raycast; if "
"neither raycast hit the ground, the vehicle is floating, stabalizer "
"spring and ground normal forces are not applied.\n\n"
"<img src=\"images/hoverVehicle_forces.png\">\n"
"@see stabSpringConstant" );
addField( "stabLenMax", TypeF32, Offset(stabLenMax, HoverVehicleData),
"Length of the base stabalizer when travelling at maximum speed "
"(maxThrustSpeed).\n\n@see stabLenMin\n\n@see mainThrustForce" );
addField( "stabSpringConstant", TypeF32, Offset(stabSpringConstant, HoverVehicleData),
"Value used to generate stabalizer spring force. The force generated "
"depends on stabilizer compression, that is how close the vehicle is "
"to the ground proportional to current stabalizer length.\n\n"
"@see stabLenMin" );
addField( "stabDampingConstant", TypeF32, Offset(stabDampingConstant, HoverVehicleData),
"Damping spring force acting against changes in the stabalizer length.\n\n"
"@see stabLenMin" );
addField( "mainThrustForce", TypeF32, Offset(mainThrustForce, HoverVehicleData),
"Force generated by thrusting the vehicle forward.\nAlso used to determine "
"the maxThrustSpeed:\n\n"
"@tsexample\n"
"maxThrustSpeed = (mainThrustForce + strafeThrustForce) / dragForce;\n"
"@endtsexample\n" );
addField( "reverseThrustForce", TypeF32, Offset(reverseThrustForce, HoverVehicleData),
"Force generated by thrusting the vehicle backward." );
addField( "strafeThrustForce", TypeF32, Offset(strafeThrustForce, HoverVehicleData),
"Force generated by thrusting the vehicle to one side.\nAlso used to "
"determine the vehicle's maxThrustSpeed.\n@see mainThrustForce" );
addField( "turboFactor", TypeF32, Offset(turboFactor, HoverVehicleData),
"Scale factor applied to the vehicle's thrust force when jetting." );
addField( "floatingThrustFactor", TypeF32, Offset(floatingThrustFactor, HoverVehicleData),
"Scalar applied to the vehicle's thrust force when the vehicle is floating.\n"
"@note The floatingThrustFactor must be between 0.0 and 1.0 (inclusive)." );
endGroup("Steering");
addGroup("AutoCorrection");
addField( "gyroDrag", TypeF32, Offset(gyroDrag, HoverVehicleData),
"Damping torque that acts against the vehicle's current angular momentum." );
addField( "normalForce", TypeF32, Offset(normalForce, HoverVehicleData),
"Force generated in the ground normal direction when the vehicle is not "
"floating (within stabalizer length from the ground).\n\n"
"@see stabLenMin" );
addField( "restorativeForce", TypeF32, Offset(restorativeForce, HoverVehicleData),
"Force generated to stabalize the vehicle (return it to neutral pitch/roll) "
"when the vehicle is floating (more than stabalizer length from the "
"ground.\n\n@see stabLenMin" );
addField( "steeringForce", TypeF32, Offset(steeringForce, HoverVehicleData),
"Yaw (rotation about the Z-axis) force applied when steering in the x-axis direction."
"about the vehicle's Z-axis)" );
addField( "rollForce", TypeF32, Offset(rollForce, HoverVehicleData),
"Roll (rotation about the Y-axis) force applied when steering in the x-axis direction." );
addField( "pitchForce", TypeF32, Offset(pitchForce, HoverVehicleData),
"Pitch (rotation about the X-axis) force applied when steering in the y-axis direction." );
endGroup("AutoCorrection");
INITPERSISTFIELD_SOUNDASSET_ENUMED(HoverSounds, hoverSoundsEnum, Sounds::MaxSounds, HoverVehicleData, "Sounds for hover vehicle.");
addGroup("Particle Effects");
addField( "dustTrailEmitter", TYPEID< ParticleEmitterData >(), Offset(dustTrailEmitter, HoverVehicleData),
"Emitter to generate particles for the vehicle's dust trail.\nThe trail "
"of dust particles is generated only while the vehicle is moving." );
addField( "forwardJetEmitter", TYPEID< ParticleEmitterData >(), Offset(jetEmitter[ForwardJetEmitter], HoverVehicleData),
"Emitter to generate particles for forward jet thrust.\nForward jet "
"thrust particles are emitted from model nodes JetNozzle0 and JetNozzle1." );
addField( "dustTrailOffset", TypePoint3F, Offset(dustTrailOffset, HoverVehicleData),
"\"X Y Z\" offset from the vehicle's origin from which to generate dust "
"trail particles.\nBy default particles are emitted directly beneath the "
@ -261,21 +268,13 @@ void HoverVehicleData::initPersistFields()
"vehicle's speed is divided by this value to determine how many particles "
"to generate each frame. Lower values give a more dense trail, higher "
"values a more sparse trail." );
endGroup("Sounds");
addGroup("Particle Effects");
INITPERSISTFIELD_SOUNDASSET_ENUMED(HoverSounds, hoverSoundsEnum, Sounds::MaxSounds, HoverVehicleData, "Sounds for hover vehicle.");
endGroup("Sounds");
addField( "floatingGravMag", TypeF32, Offset(floatingGravMag, HoverVehicleData),
"Scale factor applied to the vehicle gravitational force when the vehicle "
"is floating.\n\n@see stabLenMin" );
addField( "brakingForce", TypeF32, Offset(brakingForce, HoverVehicleData),
"Force generated by braking.\nThe vehicle is considered to be braking if "
"it is moving, but the throttle is off, and no left or right thrust is "
"being applied. This force is only applied when the vehicle's velocity is "
"less than brakingActivationSpeed." );
addField( "brakingActivationSpeed", TypeF32, Offset(brakingActivationSpeed, HoverVehicleData),
"Maximum speed below which a braking force is applied.\n\n@see brakingForce" );
addField( "forwardJetEmitter", TYPEID< ParticleEmitterData >(), Offset(jetEmitter[ForwardJetEmitter], HoverVehicleData),
"Emitter to generate particles for forward jet thrust.\nForward jet "
"thrust particles are emitted from model nodes JetNozzle0 and JetNozzle1." );
Parent::initPersistFields();
}

View file

@ -127,7 +127,6 @@ ConsoleDocClass( VehicleData,
VehicleData::VehicleData()
{
shadowEnable = true;
shadowSize = 256;
shadowProjectionDistance = 14.0f;
maxSteeringAngle = M_PI_F/4.0f; // 45 deg.
@ -280,25 +279,38 @@ void VehicleData::initPersistFields()
"@brief Creates a representation of the object in the physics plugin.\n");
endGroup("Physics");
addField( "jetForce", TypeF32, Offset(jetForce, VehicleData),
"@brief Additional force applied to the vehicle when it is jetting.\n\n"
"For WheeledVehicles, the force is applied in the forward direction. For "
"FlyingVehicles, the force is applied in the thrust direction." );
addField( "jetEnergyDrain", TypeF32, Offset(jetEnergyDrain, VehicleData),
"@brief Energy amount to drain for each tick the vehicle is jetting.\n\n"
"Once the vehicle's energy level reaches 0, it will no longer be able to jet." );
addField( "minJetEnergy", TypeF32, Offset(minJetEnergy, VehicleData),
"Minimum vehicle energy level to begin jetting." );
addGroup("Collision");
addField( "collDamageThresholdVel", TypeF32, Offset(collDamageThresholdVel, VehicleData),
"Minimum collision velocity to cause damage to this vehicle.\nCurrently unused." );
addField( "collDamageMultiplier", TypeF32, Offset(collDamageMultiplier, VehicleData),
"@brief Damage to this vehicle after a collision (multiplied by collision "
"velocity).\n\nCurrently unused." );
endGroup("Collision");
addGroup("Steering");
addField( "jetForce", TypeF32, Offset(jetForce, VehicleData),
"@brief Additional force applied to the vehicle when it is jetting.\n\n"
"For WheeledVehicles, the force is applied in the forward direction. For "
"FlyingVehicles, the force is applied in the thrust direction." );
addField( "jetEnergyDrain", TypeF32, Offset(jetEnergyDrain, VehicleData),
"@brief Energy amount to drain for each tick the vehicle is jetting.\n\n"
"Once the vehicle's energy level reaches 0, it will no longer be able to jet." );
addField( "minJetEnergy", TypeF32, Offset(minJetEnergy, VehicleData),
"Minimum vehicle energy level to begin jetting." );
addField( "maxSteeringAngle", TypeF32, Offset(maxSteeringAngle, VehicleData),
"Maximum yaw (horizontal) and pitch (vertical) steering angle in radians." );
endGroup("Steering");
addGroup("AutoCorrection");
addField( "powerSteering", TypeBool, Offset(powerSteering, VehicleData),
"If true, steering does not auto-centre while the vehicle is being steered by its driver." );
addField( "steeringReturn", TypeF32, Offset(steeringReturn, VehicleData),
"Rate at which the vehicle's steering returns to forwards when it is moving." );
addField( "steeringReturnSpeedScale", TypeF32, Offset(steeringReturnSpeedScale, VehicleData),
"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( "maxSteeringAngle", TypeF32, Offset(maxSteeringAngle, VehicleData),
"Maximum yaw (horizontal) and pitch (vertical) steering angle in radians." );
endGroup("AutoCorrection");
addGroup("Particle Effects");
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"
@ -326,11 +338,7 @@ void VehicleData::initPersistFields()
addField( "numDmgEmitterAreas", TypeF32, Offset(numDmgEmitterAreas, VehicleData),
"Number of damageEmitterOffset values to use for each damageEmitter.\n\n"
"@see damageEmitterOffset" );
addField( "collDamageThresholdVel", TypeF32, Offset(collDamageThresholdVel, VehicleData),
"Minimum collision velocity to cause damage to this vehicle.\nCurrently unused." );
addField( "collDamageMultiplier", TypeF32, Offset(collDamageMultiplier, VehicleData),
"@brief Damage to this vehicle after a collision (multiplied by collision "
"velocity).\n\nCurrently unused." );
endGroup("Particle Effects");
Parent::initPersistFields();
}

View file

@ -448,13 +448,7 @@ bool WheeledVehicleData::mirrorWheel(Wheel* we)
void WheeledVehicleData::initPersistFields()
{
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 "
"when the vehicle is moving and the wheel is in contact with the ground.");
addGroup("Steering");
addField("maxWheelSpeed", TypeF32, Offset(maxWheelSpeed, WheeledVehicleData),
"@brief Maximum linear velocity of each wheel.\n\n"
"This caps the maximum speed of the vehicle." );
@ -468,6 +462,17 @@ void WheeledVehicleData::initPersistFields()
addField("brakeTorque", TypeF32, Offset(brakeTorque, WheeledVehicleData),
"@brief Torque applied when braking.\n\n"
"This controls how fast the vehicle will stop when the brakes are applied." );
endGroup("Steering");
addGroup("Particle Effects");
addField("tireEmitter",TYPEID< ParticleEmitterData >(), Offset(tireEmitter, WheeledVehicleData),
"ParticleEmitterData datablock used to generate particles from each wheel "
"when the vehicle is moving and the wheel is in contact with the ground.");
endGroup("Particle Effects");
addGroup("Sounds");
INITPERSISTFIELD_SOUNDASSET_ENUMED(WheeledVehicleSounds, WheeledVehicleSoundsEnum, MaxSounds, WheeledVehicleData, "Sounds related to wheeled vehicle.");
endGroup("Sounds");
Parent::initPersistFields();
}