2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 10:37:41 -04:00

Eliminate hsScalar and hsFixed

Modern CPUs support floats just fine... hsFixed was crazy.
This commit is contained in:
2012-01-21 02:03:37 -05:00
parent 5027b5a4ac
commit e020651e4b
584 changed files with 5401 additions and 6399 deletions

View File

@ -121,7 +121,7 @@ class KRStatus : public KeyReduceStatus
int Progress(int p) { return KEYREDUCE_CONTINUE; }
};
void hsControlConverter::ReduceKeys(Control *control, hsScalar threshold)
void hsControlConverter::ReduceKeys(Control *control, float threshold)
{
if (control == nil || threshold <= 0)
return;
@ -172,7 +172,7 @@ void hsControlConverter::ReduceKeys(Control *control, hsScalar threshold)
}
plController *hsControlConverter::ConvertTMAnim(plSceneObject *obj, plMaxNode *node, hsAffineParts *parts,
hsScalar start /* = -1 */, hsScalar end /* = -1 */)
float start /* = -1 */, float end /* = -1 */)
{
Control* maxTm = node->GetTMController();
plController *tmc = hsControlConverter::Instance().MakeTransformController(maxTm, node, start, end);
@ -249,7 +249,7 @@ plLeafController* hsControlConverter::MakeMatrix44Controller(StdUVGen* uvGen, co
CompositeKeyTimes(vAngCtl, kTimes);
CompositeKeyTimes(wAngCtl, kTimes);
const float kMaxRads = 30.f * hsScalarPI / 180.f;
const float kMaxRads = 30.f * M_PI / 180.f;
MaxSampleAngles(nodeName, uAngCtl, kTimes, kMaxRads);
MaxSampleAngles(nodeName, vAngCtl, kTimes, kMaxRads);
MaxSampleAngles(nodeName, wAngCtl, kTimes, kMaxRads);
@ -339,7 +339,7 @@ plLeafController* hsControlConverter::MakeMatrix44Controller(Control* prsControl
// Create a plScalarController and store the nodes parm behavior in it.
//
plLeafController* hsControlConverter::MakeScalarController(Control* control, plMaxNode* node,
hsScalar start /* = -1 */, hsScalar end /* = -1 */)
float start /* = -1 */, float end /* = -1 */)
{
hsGuardBegin("hsControlConverter::MakeScalarController");
@ -354,7 +354,7 @@ plLeafController* hsControlConverter::MakeScalarController(Control* control, plM
}
plController* hsControlConverter::MakeColorController(Control* control, plMaxNode* node,
hsScalar start /* = -1 */, hsScalar end /* = -1 */)
float start /* = -1 */, float end /* = -1 */)
{
return MakePosController(control, node, start, end);
}
@ -362,7 +362,7 @@ plController* hsControlConverter::MakeColorController(Control* control, plMaxNod
// Create a plPosController and store the nodes parm behavior in it.
//
plController* hsControlConverter::MakePosController(Control* control, plMaxNode* node,
hsScalar start /* = -1 */, hsScalar end /* = -1 */)
float start /* = -1 */, float end /* = -1 */)
{
hsGuardBegin("hsControlConverter::MakePosController");
@ -412,7 +412,7 @@ plController* hsControlConverter::MakePosController(Control* control, plMaxNode*
}
plController *hsControlConverter::MakeScaleController(Control *control, plMaxNode* node,
hsScalar start /* = -1 */, hsScalar end /* = -1 */)
float start /* = -1 */, float end /* = -1 */)
{
ISetSegRange(start, end);
@ -435,7 +435,7 @@ plController *hsControlConverter::MakeScaleController(Control *control, plMaxNod
}
plController *hsControlConverter::MakeRotController(Control *control, plMaxNode *node, hsBool camRot /* = false */,
hsScalar start /* = -1 */, hsScalar end /* = -1 */)
float start /* = -1 */, float end /* = -1 */)
{
ISetSegRange(start, end);
@ -532,7 +532,7 @@ plController *hsControlConverter::MakeRotController(Control *control, plMaxNode
return NULL;
}
void hsControlConverter::ScalePositionController(plController* ctl, hsScalar scale)
void hsControlConverter::ScalePositionController(plController* ctl, float scale)
{
plLeafController* simp = plLeafController::ConvertNoRef(ctl);
plCompoundController* comp;
@ -565,7 +565,7 @@ void hsControlConverter::ScalePositionController(plController* ctl, hsScalar sca
}
}
void hsControlConverter::MaxSampleAngles(const char* nodeName, Control* ctl, Tab<TimeValue>& kTimes, hsScalar maxRads)
void hsControlConverter::MaxSampleAngles(const char* nodeName, Control* ctl, Tab<TimeValue>& kTimes, float maxRads)
{
hsGuardBegin("hsControlConverter::MaxSampleAngles");
@ -596,7 +596,7 @@ void hsControlConverter::MaxSampleAngles(const char* nodeName, Control* ctl, Tab
}
plCompoundController *hsControlConverter::MakeTransformController(Control *control, plMaxNode *node,
hsScalar start /* = -1 */, hsScalar end /* = -1 */)
float start /* = -1 */, float end /* = -1 */)
{
hsGuardBegin("hsControlConverter::MakeTransformController");
@ -658,7 +658,7 @@ plCompoundController *hsControlConverter::MakeTransformController(Control *contr
hsGuardEnd;
}
void hsControlConverter::ISetSegRange(hsScalar start, hsScalar end)
void hsControlConverter::ISetSegRange(float start, float end)
{
fSegStart = (start >= 0 ? fTicksPerSec * start : fInterface->GetAnimRange().Start());
fSegEnd = (end >= 0 ? fTicksPerSec * end : fInterface->GetAnimRange().End());
@ -666,7 +666,7 @@ void hsControlConverter::ISetSegRange(hsScalar start, hsScalar end)
void hsControlConverter::IConvertSubTransform(Control *control, char *ctlName, plMaxNode *node, plCompoundController *tmc,
hsScalar start, hsScalar end)
float start, float end)
{
if (control)
{
@ -776,7 +776,7 @@ plLeafController* hsControlConverter::ICreateQuatController(plMaxNode* node, Con
{
// Get key
ikeys->GetKey(i, key);
const float kMaxRads = hsScalarPI* 0.5f;
const float kMaxRads = M_PI* 0.5f;
Tab<TimeValue> kTimes;
kTimes.ZeroCount();
if( rotation )
@ -985,7 +985,7 @@ int hsControlConverter::IAddPartsKeys(Control* control,
{
// Get key
ikeys->GetKey(i, key);
hsScalar frameTime = key->time / GetTicksPerSec();
float frameTime = key->time / GetTicksPerSec();
int frameNum = key->time / GetTicksPerFrame();
hsAssert(frameNum <= hsKeyFrame::kMaxFrameNumber, "Anim is too long.");
@ -1067,7 +1067,7 @@ bool hsControlConverter::StdUVGenToHsMatrix44(hsMatrix44* hsMat, StdUVGen* uvGen
for( i = 0; i < 2; i++ )
{
if( fabsf(hsMat->fMap[i][3]) > 1.f )
hsMat->fMap[i][3] -= hsScalar(int(hsMat->fMap[i][3]));
hsMat->fMap[i][3] -= float(int(hsMat->fMap[i][3]));
}
}
@ -2095,8 +2095,8 @@ void hsControlConverter::IExportAnimatedCameraFOV(plMaxNode* node, hsTArray <hsG
plConvert::Instance().AddMessageToQueue(pCamMsg);
Object* obj = node->EvalWorldState(hsConverterUtils::Instance().GetTime(node->GetInterface())).obj;
GenCamera* theCam;
hsTArray<hsScalar> fovW;
hsTArray<hsScalar> fovH;
hsTArray<float> fovW;
hsTArray<float> fovH;
for (i=0; i < kfArray->Count(); i++)
{
TimeValue t = TimeValue(GetTicksPerFrame() * (kfArray[0][i].fFrame));
@ -2107,7 +2107,7 @@ void hsControlConverter::IExportAnimatedCameraFOV(plMaxNode* node, hsTArray <hsG
// convert
FOVvalue = FOVvalue*(180/3.141592);
int FOVType = theCam->GetFOVType();
hsScalar wDeg, hDeg;
float wDeg, hDeg;
switch(FOVType)
{
case 0: // FOV_W

View File

@ -106,17 +106,17 @@ public:
// (ISetSegRange(-1, -1) will give you the entire anim.)
plLeafController* MakeMatrix44Controller(StdUVGen* uvGen, const char* nodeName);
plLeafController* MakeMatrix44Controller(Control* prsControl);
plLeafController* MakeScalarController(Control* control, plMaxNode* node, hsScalar start = -1, hsScalar end = -1);
plController* MakeColorController(Control* control, plMaxNode* node, hsScalar start = -1, hsScalar end = -1);
plController* MakePosController(Control* control, plMaxNode* node, hsScalar start = -1, hsScalar end = -1);
plController* MakeScaleController(Control* control, plMaxNode* node, hsScalar start = -1, hsScalar end = -1);
plController* MakeRotController(Control* control, plMaxNode* node, hsBool camRot = false, hsScalar start = -1, hsScalar end = -1);
plCompoundController* MakeTransformController(Control* control, plMaxNode* node, hsScalar start = -1, hsScalar end = -1);
plLeafController* MakeScalarController(Control* control, plMaxNode* node, float start = -1, float end = -1);
plController* MakeColorController(Control* control, plMaxNode* node, float start = -1, float end = -1);
plController* MakePosController(Control* control, plMaxNode* node, float start = -1, float end = -1);
plController* MakeScaleController(Control* control, plMaxNode* node, float start = -1, float end = -1);
plController* MakeRotController(Control* control, plMaxNode* node, hsBool camRot = false, float start = -1, float end = -1);
plCompoundController* MakeTransformController(Control* control, plMaxNode* node, float start = -1, float end = -1);
// This last one was in tempAnim.cpp on its own for some time, apparently created
// as an initial attempt to get anims working in Max. It's still used, so I don't want
// to nuke it, but it made sense to move it here.
plController* ConvertTMAnim(plSceneObject *obj, plMaxNode *node, hsAffineParts *parts, hsScalar start = -1, hsScalar end = -1);
plController* ConvertTMAnim(plSceneObject *obj, plMaxNode *node, hsAffineParts *parts, float start = -1, float end = -1);
//
//
//////////////////////////////////////////////////////////////////////////
@ -124,10 +124,10 @@ public:
void Matrix3ToHsMatrix44(Matrix3* m3, hsMatrix44* hsM);
Matrix3 StdUVGenToMatrix3(StdUVGen* uvGen);
bool StdUVGenToHsMatrix44(hsMatrix44* hsMat, StdUVGen* uvGen, bool preserveOffset=false);
void MaxSampleAngles(const char* nodeName, Control* ctl, Tab<TimeValue>& kTimes, hsScalar maxRads);
void ScalePositionController(plController* ctl, hsScalar scale);
void MaxSampleAngles(const char* nodeName, Control* ctl, Tab<TimeValue>& kTimes, float maxRads);
void ScalePositionController(plController* ctl, float scale);
void ReduceKeys(Control *control, hsScalar threshold);
void ReduceKeys(Control *control, float threshold);
hsBool HasKeyTimes(Control* ctl);
uint8_t GetKeyType(Control* ctl, hsBool rotQuat = false);
@ -150,8 +150,8 @@ public:
float GetAnimLength() { return fAnimLength; }
private:
void ISetSegRange(hsScalar start, hsScalar end);
void IConvertSubTransform(Control *control, char *ctlName, plMaxNode *node, plCompoundController *tmc, hsScalar start, hsScalar end);
void ISetSegRange(float start, float end);
void IConvertSubTransform(Control *control, char *ctlName, plMaxNode *node, plCompoundController *tmc, float start, float end);
plLeafController* ICreateSimpleRotController(plMaxNode* node, Control* control, hsBool camRot = false);
plLeafController* ICreateSimpleScaleController(plMaxNode* node, Control* control);
@ -189,7 +189,7 @@ private:
int32_t fStartFrame;
int32_t fEndFrame;
int32_t fNumFrames;
hsScalar fAnimLength;
float fAnimLength;
hsBool fWarned;
hsBool fForceLocal;

View File

@ -287,8 +287,8 @@ hsBool hsMaterialConverter::PreserveUVOffset(Mtl* mtl)
void AttachLinkMtlAnims(plMaxNode *node, hsGMaterial *mat)
{
const int numKeys = 2;
hsScalar times[] = {0.f, 1.5f};
hsScalar values[numKeys] = {100.f, 0.f};
float times[] = {0.f, 1.5f};
float values[numKeys] = {100.f, 0.f};
hsBool leaving[] = {true, false};
char *animName = "_link_anim";
@ -304,7 +304,7 @@ void AttachLinkMtlAnims(plMaxNode *node, hsGMaterial *mat)
sprintf(suff, "%d", k);
opaCtl = TRACKED_NEW plLeafController;
opaCtl->QuickScalarController(numKeys, times, values, sizeof(hsScalar));
opaCtl->QuickScalarController(numKeys, times, values, sizeof(float));
animLayer = TRACKED_NEW plLayerLinkAnimation;
animLayer->SetLinkKey(node->GetAvatarSO()->GetKey());
//animLayer->fLeavingAge = leaving[x];
@ -1344,9 +1344,9 @@ hsGMaterial *hsMaterialConverter::IAddDefaultMaterial(plMaxNode *node)
hsgResMgr::ResMgr()->NewKey(TSTR(hMat->GetKeyName()) + TSTR("_DefLay"), layer, loc);
DWORD color = node->GetWireColor();
hsScalar r = hsScalar(GetRValue(color)) / 255.f;
hsScalar g = hsScalar(GetGValue(color)) / 255.f;
hsScalar b = hsScalar(GetBValue(color)) / 255.f;
float r = float(GetRValue(color)) / 255.f;
float g = float(GetGValue(color)) / 255.f;
float b = float(GetBValue(color)) / 255.f;
layer->SetRuntimeColor(hsColorRGBA().Set(r, g, b, 1.f));
layer->SetPreshadeColor(hsColorRGBA().Set(r, g, b, 1.f));
layer->SetOpacity(1.f);
@ -1793,8 +1793,8 @@ hsGMaterial *hsMaterialConverter::IProcessParticleMtl(Mtl *mtl, plMaxNode *node,
baseLay->SetSpecularColor( hsColorRGBA().Set(0,0,0,1.f) );
baseLay->SetSpecularPower( 0 );
baseLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, hsScalar1));
baseLay->SetRuntimeColor(hsColorRGBA().Set(col.r, col.g, col.b, hsScalar1));
baseLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, 1.f));
baseLay->SetRuntimeColor(hsColorRGBA().Set(col.r, col.g, col.b, 1.f));
baseLay->SetPreshadeColor(hsColorRGBA().Set(0.f,0.f,0.f,1.f));
baseLay->SetOpacity( opac ); // Don't scale the material color by this if we're add blending; do that later
@ -1870,8 +1870,8 @@ void ISetDefaultAnim(plPassMtlBase* mtl, plAnimTimeConvert& tc, SegmentMap* segM
if (mtl->GetLoop())
{
// Default to the entire anim
hsScalar loopStart = tc.GetBegin();
hsScalar loopEnd = tc.GetEnd();
float loopStart = tc.GetBegin();
float loopEnd = tc.GetEnd();
// If there's a loop, use it
const char *loopName = mtl->GetAnimLoopName();
@ -1885,7 +1885,7 @@ void ISetDefaultAnim(plPassMtlBase* mtl, plAnimTimeConvert& tc, SegmentMap* segM
tc.Loop(false);
}
void StuffStopPoints(SegmentMap *segMap, hsTArray<hsScalar> &out)
void StuffStopPoints(SegmentMap *segMap, hsTArray<float> &out)
{
if (segMap == nil)
return;
@ -2111,7 +2111,7 @@ plLayerInterface* IProcessAnimation(plPassMtlBase *mtl, plMaxNode *node, const c
{
hsControlConverter& cc = hsControlConverter::Instance();
hsScalar maxLength = 0;
float maxLength = 0;
//
// Look for animations. These will get tacked onto the base pass layer
Control *maxColCtl = mtl->GetPreshadeColorController();
@ -2451,13 +2451,13 @@ hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hs
if (baseLay->GetShadeFlags() & hsGMatState::kShadeSpecular)
{
baseLay->SetSpecularColor( hsColorRGBA().Set( specColor.r, specColor.g, specColor.b, hsScalar1 ) );
baseLay->SetSpecularColor( hsColorRGBA().Set( specColor.r, specColor.g, specColor.b, 1.f ) );
baseLay->SetSpecularPower(shine);
}
baseLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, hsScalar1));
baseLay->SetPreshadeColor(hsColorRGBA().Set(col.r, col.g, col.b, hsScalar1));
baseLay->SetRuntimeColor(hsColorRGBA().Set(runDif.r, runDif.g, runDif.b, hsScalar1));
baseLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, 1.f));
baseLay->SetPreshadeColor(hsColorRGBA().Set(col.r, col.g, col.b, 1.f));
baseLay->SetRuntimeColor(hsColorRGBA().Set(runDif.r, runDif.g, runDif.b, 1.f));
baseLay->SetOpacity( opac ); // Don't scale the material color by this if we're add blending; do that later
uint32_t blendType = 0;
@ -2550,13 +2550,13 @@ hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hs
if (hLay->GetShadeFlags() & hsGMatState::kShadeSpecular)
{
hLay->SetSpecularColor( hsColorRGBA().Set( specColor.r, specColor.g, specColor.b, hsScalar1 ) );
hLay->SetSpecularColor( hsColorRGBA().Set( specColor.r, specColor.g, specColor.b, 1.f ) );
hLay->SetSpecularPower(shine);
}
hLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, hsScalar1));
hLay->SetPreshadeColor(hsColorRGBA().Set(col.r, col.g, col.b, hsScalar1));
hLay->SetRuntimeColor(hsColorRGBA().Set(runDif.r, runDif.g, runDif.b, hsScalar1));
hLay->SetAmbientColor(hsColorRGBA().Set(amb.r, amb.g, amb.b, 1.f));
hLay->SetPreshadeColor(hsColorRGBA().Set(col.r, col.g, col.b, 1.f));
hLay->SetRuntimeColor(hsColorRGBA().Set(runDif.r, runDif.g, runDif.b, 1.f));
hLay->SetOpacity( opac );
if( IsBumpLayer(texMap) || IsBumpMtl( mtl ) )
@ -2713,7 +2713,7 @@ hsBool hsMaterialConverter::IUVGenHasDynamicScale(plMaxNode* node, StdUVGen *uvG
hsGuardEnd;
}
void hsMaterialConverter::IScaleLayerOpacity(plLayer* hLay, hsScalar scale)
void hsMaterialConverter::IScaleLayerOpacity(plLayer* hLay, float scale)
{
hsGuardBegin("hsMaterialConverter::IScaleLayerOpacity");
@ -2724,7 +2724,7 @@ void hsMaterialConverter::IScaleLayerOpacity(plLayer* hLay, hsScalar scale)
hLay->SetBlendFlags(hLay->GetBlendFlags() | hsGMatState::kBlendAlpha);
}
hsScalar opac = hLay->GetOpacity();
float opac = hLay->GetOpacity();
opac *= scale;
hLay->SetOpacity(scale);
}
@ -2894,7 +2894,7 @@ static float IClampToRange(float v, float lo, float hi)
return v;
}
uint32_t hsMaterialConverter::IGetOpacityRanges(plMaxNode* node, Texmap* texMap, hsScalar& tr0, hsScalar& op0, hsScalar& op1, hsScalar& tr1)
uint32_t hsMaterialConverter::IGetOpacityRanges(plMaxNode* node, Texmap* texMap, float& tr0, float& op0, float& op1, float& tr1)
{
if( node->HasFade() )
{
@ -2984,7 +2984,7 @@ uint32_t hsMaterialConverter::IGetOpacityRanges(plMaxNode* node, Texmap* texMap,
}
if( tr0 > tr1 )
{
hsScalar t;
float t;
t = tr0;
tr0 = tr1;
tr1 = t;
@ -3010,16 +3010,16 @@ uint32_t hsMaterialConverter::IGetOpacityRanges(plMaxNode* node, Texmap* texMap,
break;
case kFunkyNormal:
case kFunkyUp:
tr0 = hsCosine(hsScalarDegToRad(tr0));
op0 = hsCosine(hsScalarDegToRad(op0));
op1 = hsCosine(hsScalarDegToRad(op1));
tr1 = hsCosine(hsScalarDegToRad(tr1));
tr0 = cos(hsDegreesToRadians(tr0));
op0 = cos(hsDegreesToRadians(op0));
op1 = cos(hsDegreesToRadians(op1));
tr1 = cos(hsDegreesToRadians(tr1));
break;
case kFunkyReflect:
tr0 = hsCosine(hsScalarDegToRad(tr0));
op0 = hsCosine(hsScalarDegToRad(op0));
op1 = hsCosine(hsScalarDegToRad(op1));
tr1 = hsCosine(hsScalarDegToRad(tr1));
tr0 = cos(hsDegreesToRadians(tr0));
op0 = cos(hsDegreesToRadians(op0));
op1 = cos(hsDegreesToRadians(op1));
tr1 = cos(hsDegreesToRadians(tr1));
break;
}
return funkyType;
@ -3267,14 +3267,14 @@ void hsMaterialConverter::IAppendWetLayer(plMaxNode* node, hsGMaterial* mat)
}
hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, int iSubMtl, hsScalar& minDist, hsScalar& maxDist)
hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, int iSubMtl, float& minDist, float& maxDist)
{
const char* dbgNodeName = node->GetName();
const char* dbgMatName = node->GetMtl() ? node->GetMtl()->GetName() : "Dunno";
if( node->HasFade() )
{
const hsScalar kMaxMaxDist = 1.e10f;
const float kMaxMaxDist = 1.e10f;
Box3 fade = node->GetFade();
minDist = maxDist = 0;
if( fade.Min()[2] < 0 )
@ -3300,7 +3300,7 @@ hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, int iSubMtl, hsScalar&
return HasVisDists(node, mtl, minDist, maxDist);
}
hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, Mtl* mtl, hsScalar& minDist, hsScalar& maxDist)
hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, Mtl* mtl, float& minDist, float& maxDist)
{
const char* dbgNodeName = node->GetName();
const char* dbgMatName = node->GetMtl() ? node->GetMtl()->GetName() : "Dunno";
@ -3328,7 +3328,7 @@ hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, Mtl* mtl, hsScalar& min
hsBool baseFunky = false;
hsBool topFunky = true;
plPassMtl* passMtl = (plPassMtl*)mtl;
hsScalar tr0, op0, op1, tr1;
float tr0, op0, op1, tr1;
uint32_t funkyType = IGetOpacityRanges(node, mtl->GetSubTexmap(0), tr0, op0, op1, tr1);
if( kFunkyDistance == (funkyType & kFunkyMask) )
@ -3375,7 +3375,7 @@ hsBool hsMaterialConverter::HasVisDists(plMaxNode* node, Mtl* mtl, hsScalar& min
int i;
for( i = 0; i < mtl->NumSubMtls(); i++ )
{
hsScalar minD, maxD;
float minD, maxD;
if( !HasVisDists(node, mtl->GetSubMtl(i), minD, maxD) )
return false;
@ -3995,22 +3995,22 @@ BMM_Color_64 hsMaterialConverter::ICubeSample(Bitmap *bitmap[6], double phi, dou
}
else
{
if( (theta <= (hsScalarPI / 2.0 - hsScalarPI/4.0))
||(theta >= (hsScalarPI * 2.0 - hsScalarPI/4.0)) )
if( (theta <= (M_PI / 2.0 - M_PI/4.0))
||(theta >= (M_PI * 2.0 - M_PI/4.0)) )
{
map = bitmap[VIEW_FR];
xMap = x / y;
yMap = -z / y;
}
else
if( theta <= (hsScalarPI - hsScalarPI/4.0) )
if( theta <= (M_PI - M_PI/4.0) )
{
map = bitmap[VIEW_LF];
xMap = -y / x;
yMap = -z / x;
}
else
if( theta <= (hsScalarPI * 3.0/2.0 - hsScalarPI/4.0) )
if( theta <= (M_PI * 3.0/2.0 - M_PI/4.0) )
{
map = bitmap[VIEW_BK];
xMap = x / y;

View File

@ -150,8 +150,8 @@ public:
static hsBool HasBumpLayer(plMaxNode* node, Mtl* mtl);
static BitmapTex* GetBumpLayer(plMaxNode* node, Mtl* mtl);
static hsBool HasVisDists(plMaxNode* node, Mtl* subMtl, hsScalar& minDist, hsScalar& maxDist);
static hsBool HasVisDists(plMaxNode* node, int iSubMtl, hsScalar& minDist, hsScalar& maxDist);
static hsBool HasVisDists(plMaxNode* node, Mtl* subMtl, float& minDist, float& maxDist);
static hsBool HasVisDists(plMaxNode* node, int iSubMtl, float& minDist, float& maxDist);
static hsBool IMustBeUniqueMaterial( Mtl *mtl );
static hsBool IMustBeUniqueLayer( Texmap *layer );
@ -303,7 +303,7 @@ private:
#endif
// ... and so forth
hsBool IUVGenHasDynamicScale(plMaxNode* node, StdUVGen *uvGen);
void IScaleLayerOpacity(plLayer* hLay, hsScalar scale);
void IScaleLayerOpacity(plLayer* hLay, float scale);
hsGMaterial *ICheckForProjectedTexture(plMaxNode *node);
hsGMaterial *IWrapTextureInMaterial(Texmap *texMap, plMaxNode *node);
@ -329,7 +329,7 @@ private:
static void IAppendFunkyLayer(plMaxNode* node, Texmap* texMap, hsGMaterial* mat);
static hsBool IHasFunkyOpacity(plMaxNode* node, Texmap* texMap);
static uint32_t IGetFunkyType(Texmap* texMap);
static uint32_t IGetOpacityRanges(plMaxNode* node, Texmap* texMap, hsScalar& tr0, hsScalar& op0, hsScalar& op1, hsScalar& tr1);
static uint32_t IGetOpacityRanges(plMaxNode* node, Texmap* texMap, float& tr0, float& op0, float& op1, float& tr1);
Interface *fInterface;
hsConverterUtils& fConverterUtils;

View File

@ -63,10 +63,10 @@ public:
const char *fileName;
uint32_t texFlags;
uint32_t createFlags;
hsScalar detailDropoffStart;
hsScalar detailDropoffStop;
hsScalar detailMax;
hsScalar detailMin;
float detailDropoffStart;
float detailDropoffStop;
float detailMax;
float detailMin;
float sig;
hsBool isStaticCubicEnvMap;
hsBool invertAlpha;

View File

@ -85,7 +85,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
plConst(int) kDefMinFaces(200);
plConst(int) kDefMaxFaces(1000);
plConst(hsScalar) kDefMinSize(50.f);
plConst(float) kDefMinSize(50.f);
plClusterUtil::plClusterUtil()
: fGroup(nil),
@ -159,11 +159,11 @@ void plClusterUtil::ISetupGroupFromTemplate(plMaxNode* templ)
}
if( templ->HasFade() )
{
hsScalar maxDist = 0;
hsScalar minDist = 0;
float maxDist = 0;
float minDist = 0;
Box3 fade = templ->GetFade();
const hsScalar kMaxMaxDist = 1.e10f;
const float kMaxMaxDist = 1.e10f;
if( fade.Min()[2] < 0 )
{
minDist = fade.Min()[0];
@ -197,10 +197,10 @@ public:
uint16_t fIdx0;
uint16_t fIdx1;
uint16_t fIdx2;
hsScalar fDist;
float fDist;
sortData() {}
sortData(uint16_t idx0, uint16_t idx1, uint16_t idx2, hsScalar dist)
sortData(uint16_t idx0, uint16_t idx1, uint16_t idx2, float dist)
: fIdx0(idx0), fIdx1(idx1), fIdx2(idx2), fDist(dist)
{
}
@ -520,19 +520,19 @@ void plClusterUtil::IFreeClustersRecur(plL2WTabTab& dst) const
delete dst[i];
}
inline hsScalar inlGetAlpha(uint32_t* color)
inline float inlGetAlpha(uint32_t* color)
{
return hsScalar(*color >> 24) / 255.99f;
return float(*color >> 24) / 255.99f;
}
plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColorTabTab& colorsTab)
{
hsBool hasColor = false;
hsBool hasAlpha = false;
hsScalar maxLenSq = 0;
hsScalar maxX = 0;
hsScalar maxY = 0;
hsScalar maxZ = 0;
float maxLenSq = 0;
float maxX = 0;
float maxY = 0;
float maxZ = 0;
int i;
for( i = 0; i < delPosTab.Count(); i++ )
{
@ -542,10 +542,10 @@ plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColor
plPoint3Tab& delPos = *delPosTab[i];
for( j = 0; j < delPos.Count(); j++ )
{
hsScalar lenSq = delPos[j].MagnitudeSquared();
float lenSq = delPos[j].MagnitudeSquared();
if( lenSq > maxLenSq )
maxLenSq = lenSq;
hsScalar d = fabs(delPos[j].fX);
float d = fabs(delPos[j].fX);
if( d > maxX )
maxX = d;
d = fabs(delPos[j].fY);
@ -573,7 +573,7 @@ plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColor
}
uint32_t code = 0;
hsScalar posScale = 1.f;
float posScale = 1.f;
if( hasColor && hasAlpha )
code |= plSpanEncoding::kColAI88;
@ -582,8 +582,8 @@ plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColor
else if( hasAlpha )
code |= plSpanEncoding::kColA8;
plConst(hsScalar) kPosQuantum(0.5 / 12.f); // 1/2 inch.
hsScalar maxLen = hsSquareRoot(maxLenSq);
plConst(float) kPosQuantum(0.5 / 12.f); // 1/2 inch.
float maxLen = sqrt(maxLenSq);
if( maxLen > kPosQuantum )
{
if( (maxX < kPosQuantum) && (maxY < kPosQuantum) )
@ -596,15 +596,15 @@ plSpanEncoding plClusterUtil::ISelectEncoding(plPoint3TabTab& delPosTab, plColor
code |= plSpanEncoding::kPos888;
posScale = maxLen / 255.9f;
}
else if( (maxLen / hsScalar(1 << 10)) < kPosQuantum )
else if( (maxLen / float(1 << 10)) < kPosQuantum )
{
code |= plSpanEncoding::kPos101010;
posScale = maxLen / hsScalar(1 << 10);
posScale = maxLen / float(1 << 10);
}
else
{
code |= plSpanEncoding::kPos161616;
posScale = maxLen / hsScalar(1 << 16);
posScale = maxLen / float(1 << 16);
}
}
return plSpanEncoding(code, posScale);
@ -615,8 +615,8 @@ static int CompTemplates(const void *elem1, const void *elem2)
plSpanTemplateB* templA = *((plSpanTemplateB**)elem1);
plSpanTemplateB* templB = *((plSpanTemplateB**)elem2);
hsScalar hA = templA->GetLocalBounds().GetMaxs().fZ;
hsScalar hB = templB->GetLocalBounds().GetMaxs().fZ;
float hA = templA->GetLocalBounds().GetMaxs().fZ;
float hB = templB->GetLocalBounds().GetMaxs().fZ;
if( hA < hB )
return -1;

View File

@ -99,7 +99,7 @@ protected:
int fMinFaces;
int fMaxFaces;
hsScalar fMinSize;
float fMinSize;
int fMinInsts;
int fMaxInsts;

View File

@ -140,7 +140,7 @@ void plDistributor::IClear()
fPolarRange = 0;
fTanPolarRange = 0;
fAzimuthRange = hsScalarPI;
fAzimuthRange = M_PI;
fOverallProb = 1.f;
@ -219,26 +219,26 @@ void plDistributor::ISetAngProbCosines() const
float maxAng, minAng;
if( fAngProbHi > fAngProbLo )
{
maxAng = hsScalarDegToRad(fAngProbHi);
minAng = hsScalarDegToRad(fAngProbLo);
maxAng = hsDegreesToRadians(fAngProbHi);
minAng = hsDegreesToRadians(fAngProbLo);
}
else
{
maxAng = hsScalarDegToRad(fAngProbLo);
minAng = hsScalarDegToRad(fAngProbHi);
maxAng = hsDegreesToRadians(fAngProbLo);
minAng = hsDegreesToRadians(fAngProbHi);
}
float transAng = hsScalarDegToRad(fAngProbTrans);
float transAng = hsDegreesToRadians(fAngProbTrans);
if( transAng > (maxAng - minAng) * 0.5f )
transAng = (maxAng - minAng) * 0.5f;
float transAngMax = maxAng < hsScalarPI ? transAng : 0;
float transAngMax = maxAng < M_PI ? transAng : 0;
float transAngMin = minAng > 0 ? transAng : 0;
fCosAngProbHi = hsCosine(minAng);
fCosAngProbLo = hsCosine(maxAng);
fCosAngProbHiTrans = hsCosine(minAng + transAngMin);
fCosAngProbLoTrans = hsCosine(maxAng - transAngMax);
fCosAngProbHi = cos(minAng);
fCosAngProbLo = cos(maxAng);
fCosAngProbHiTrans = cos(minAng + transAngMin);
fCosAngProbLoTrans = cos(maxAng - transAngMax);
}
BOOL plDistributor::ISetSurfaceNode(INode* surfNode) const
@ -375,15 +375,15 @@ Box3 plDistributor::ISetupGrid(const Point3& p0, const Point3& p1, const Point3&
int i;
for( i = 0; i < 3; i++ )
{
hsScalar t = box.Min()[i];
float t = box.Min()[i];
t /= fSpacing;
t = hsFloor(t);
t = floor(t);
t *= fSpacing;
mins[i] = t;
t = box.Max()[i];
t /= fSpacing;
t = hsCeil(t);
t = ceil(t);
t *= fSpacing;
maxs[i] = t + fSpacing*0.5f;
}
@ -643,7 +643,7 @@ hsBool plDistributor::IProbablyDoIt(int iFace, Point3& del, const Point3& bary)
Point3 plDistributor::IPerpAxis(const Point3& p) const
{
const hsScalar kMinLengthSquared = 1.e-1f;
const float kMinLengthSquared = 1.e-1f;
int minAx = p.MinComponent();
Point3 ax(0,0,0);
@ -721,7 +721,7 @@ Matrix3 plDistributor::IGenerateTransform(int iRepNode, int iFace, const Point3&
Point3 rndDir = IPerpAxis(norm);
Point3 rndOut = rndDir ^ norm;
rndDir *= fRand.RandMinusOneToOne();
float len = hsSquareRoot(1.f - rndDir.LengthSquared());
float len = sqrt(1.f - rndDir.LengthSquared());
rndOut *= len;
if( fRand.RandMinusOneToOne() < 0 )
rndOut *= -1.f;
@ -742,7 +742,7 @@ Matrix3 plDistributor::IGenerateTransform(int iRepNode, int iFace, const Point3&
Point3 out = dir ^ norm;
if( out.LengthSquared() < kMinVecLengthSq )
{
if( fAzimuthRange < hsScalarPI * 0.5f )
if( fAzimuthRange < M_PI * 0.5f )
{
l2w.IdentityMatrix();
return l2w;
@ -1311,9 +1311,9 @@ void plDistributor::IDistributeOverFace(int iFace, plDistribInstTab& reps, plMes
Box3 grid = ISetupGrid(p0, p1, p2);
hsScalar delta = fSpacing;
float delta = fSpacing;
hsScalar x, y, z;
float x, y, z;
for( x = grid.Min().x; x < grid.Max().x; x += delta )
{
for( y = grid.Min().y; y < grid.Max().y; y += delta )
@ -1464,7 +1464,7 @@ void plDistributor::SetRandSeed(int seed)
void plDistributor::SetPolarRange(float deg)
{
fPolarRange = hsScalarDegToRad(deg);
fPolarRange = hsDegreesToRadians(deg);
fTanPolarRange = tan(fPolarRange);
}

View File

@ -325,10 +325,10 @@ public:
float GetAlignmentWeight() const { return fAlignWgt * 100.f; }
void SetPolarRange(float deg);
float GetPolarRange() const { return hsScalarRadToDeg(fPolarRange); }
float GetPolarRange() const { return hsRadiansToDegrees(fPolarRange); }
void SetAzimuthRange(float deg) { fAzimuthRange = hsScalarDegToRad(deg); }
float GetAzimuthRange() const { return hsScalarRadToDeg(fAzimuthRange); }
void SetAzimuthRange(float deg) { fAzimuthRange = hsDegreesToRadians(deg); }
float GetAzimuthRange() const { return hsRadiansToDegrees(fAzimuthRange); }
void SetOverallProb(float percent) { fOverallProb = percent/100.f; }
float GetOverallProb() const { return fOverallProb * 100.f; }

View File

@ -101,7 +101,7 @@ void getRGC(void* param, NotifyInfo* info)
class LMGScanPoint
{
public:
hsScalar fU;
float fU;
hsPoint3 fBary;
};
@ -191,7 +191,7 @@ hsBool plLightMapGen::Open(Interface* ip, TimeValue t, bool forceRegen)
vp.yon = 30.f;
vp.distance = 1.f;
vp.zoom = 1.f;
vp.fov = hsScalarPI / 4.f;
vp.fov = M_PI / 4.f;
vp.nearRange = 1.f;
vp.farRange = 30.f;
@ -344,7 +344,7 @@ hsBool plLightMapGen::ICompressLightMaps()
if( orig )
{
const hsScalar kFilterSigma = 1.0f;
const float kFilterSigma = 1.0f;
if( IsFresh(orig) )
{
@ -478,7 +478,7 @@ hsBool plLightMapGen::IShadeSpan(plMaxNode* node, const hsMatrix44& l2w, const h
if( !(span.fProps & plGeometrySpan::kDiffuseFoldedIn) )
{
hsBool foldin = 0 != (span.fProps & plGeometrySpan::kLiteVtxNonPreshaded);
hsScalar opacity = 1.f;
float opacity = 1.f;
hsColorRGBA dif = hsColorRGBA().Set(1.f, 1.f, 1.f, 1.f);
if( foldin )
{
@ -584,7 +584,7 @@ hsBool plLightMapGen::IAddToLightMap(plLayerInterface* lay, plMipmap* src) const
dst->SetCurrLevel( 0 );
// BLURLATER
// static hsScalar kFilterSigma = 0.5f;
// static float kFilterSigma = 0.5f;
// src->Filter(kFilterSigma);
// What we really want to do here is antialias our rasterization, so we can
@ -711,8 +711,8 @@ hsBool plLightMapGen::IShadeVerts(plMaxLightContext& ctx, const Color& amb, cons
i1 = i0 == 2 ? 0 : i0+1;
i2 = i1 == 2 ? 0 : i1+1;
hsScalar v0 = uv[i0].fY;
hsScalar v1 = uv[i1].fY;
float v0 = uv[i0].fY;
float v1 = uv[i1].fY;
int vStart = int(v0);
int vEnd = int(v1);
@ -731,7 +731,7 @@ hsBool plLightMapGen::IShadeVerts(plMaxLightContext& ctx, const Color& amb, cons
bary[i0] = (v1 - float(vMid)) / (v1 - v0);
bary[i1] = 1.f - bary[i0];
bary[i2] = 0;
hsScalar u = uv[i0].fX * bary[i0]
float u = uv[i0].fX * bary[i0]
+ uv[i1].fX * bary[i1];
if( scanline[vMid].fEmpty )
{
@ -776,7 +776,7 @@ hsBool plLightMapGen::IShadeVerts(plMaxLightContext& ctx, const Color& amb, cons
int uMid;
for( uMid = uStart; uMid <= uEnd; uMid++ )
{
hsScalar t = (scanline[i].fFar.fU - float(uMid)) / (scanline[i].fFar.fU - scanline[i].fNear.fU);
float t = (scanline[i].fFar.fU - float(uMid)) / (scanline[i].fFar.fU - scanline[i].fNear.fU);
hsPoint3 bary = scanline[i].fNear.fBary * t;
bary += scanline[i].fFar.fBary * (1.f - t);
@ -931,8 +931,8 @@ hsBool plLightMapGen::IDirAffectsNode(plLightMapInfo* liInfo, LightObject* liObj
LightState ls;
liObj->EvalLightState(TimeValue(0), FOREVER, &ls);
hsScalar radX = ls.fallsize;
hsScalar radY = radX;
float radX = ls.fallsize;
float radY = radX;
if( ls.shape == RECT_LIGHT )
radY /= ls.aspect;
@ -968,8 +968,8 @@ hsBool plLightMapGen::ISpotAffectsNode(plLightMapInfo* liInfo, LightObject* liOb
LightState ls;
liObj->EvalLightState(TimeValue(0), FOREVER, &ls);
hsScalar coneRad[2];
coneRad[0] = ls.fallsize * hsScalarPI / 180.f;
float coneRad[2];
coneRad[0] = ls.fallsize * M_PI / 180.f;
coneRad[1] = coneRad[0];
if( ls.shape == RECT_LIGHT )
coneRad[1] /= ls.aspect;
@ -981,13 +981,13 @@ hsBool plLightMapGen::ISpotAffectsNode(plLightMapInfo* liInfo, LightObject* liOb
int j;
for( j = 0; j < 8; j++ )
{
hsScalar rad;
rad = hsScalar(atan2(corners[j].fX, -corners[j].fZ));
float rad;
rad = float(atan2(corners[j].fX, -corners[j].fZ));
if( rad > coneRad[0] )
numPos[0]++;
if( rad < -coneRad[0] )
numPos[2]++;
rad = hsScalar(atan2(corners[j].fY, -corners[j].fZ));
rad = float(atan2(corners[j].fY, -corners[j].fZ));
if( rad > coneRad[1] )
numPos[1]++;
if( rad < -coneRad[1] )
@ -1021,7 +1021,7 @@ hsBool plLightMapGen::IOmniAffectsNode(plLightMapInfo* liInfo, LightObject* liOb
if( bnd.GetType() != kBoundsNormal )
return false;
hsScalar radius = ls.attenEnd;
float radius = ls.attenEnd;
int i;
for( i = 0; i < 3; i++ )

View File

@ -621,7 +621,7 @@ hsBool plMeshConverter::CreateSpans( plMaxNode *node, hsTArray<plGeometrySpan *
{
sharedSpanProps |= plGeometrySpan::kPropNoPreShade;
}
hsScalar waterHeight = 0;
float waterHeight = 0;
if( node->GetHasWaterHeight() )
{
sharedSpanProps |= plGeometrySpan::kWaterHeight;
@ -1214,7 +1214,7 @@ hsBool plMeshConverter::CreateSpans( plMaxNode *node, hsTArray<plGeometrySpan *
span->EndCreate();
hsScalar minDist, maxDist;
float minDist, maxDist;
if( hsMaterialConverter::HasVisDists(node, i, minDist, maxDist) )
{
span->fMinDist = (minDist);
@ -2177,8 +2177,8 @@ void plMAXVertexAccumulator::StuffMyData( plMaxNode* maxNode, plGeometrySpan
}
}
hsScalar maxWgt = 0;
hsScalar penWgt = 0;
float maxWgt = 0;
float penWgt = 0;
int16_t maxIdx = -1;
int16_t penIdx = -1;
// Find the highest two weighted bones. We'll use just these two to calculate our bounds.
@ -2327,7 +2327,7 @@ void plMAXVertexAccumulator::IFindSkinWeights( ISkinContextData *skinData,
if( boneCount )
{
hsScalar defWgt = 1.f;
float defWgt = 1.f;
for( i = 0; i < boneCount; i++ )
{
/// Grab the weight and index for this bone
@ -2444,12 +2444,12 @@ void SetWaterColor(plGeometrySpan* span)
const int nVerts = tri.VertCount();
// Now, set up our accumulators
hsTArray<hsScalar> lens;
hsTArray<float> lens;
lens.SetCount(nVerts);
memset(lens.AcquireArray(), 0, nVerts * sizeof(hsScalar));
hsTArray<hsScalar> wgts;
memset(lens.AcquireArray(), 0, nVerts * sizeof(float));
hsTArray<float> wgts;
wgts.SetCount(nVerts);
memset(wgts.AcquireArray(), 0, nVerts * sizeof(hsScalar));
memset(wgts.AcquireArray(), 0, nVerts * sizeof(float));
// For each triangle
for( triIter.Begin(); triIter.More(); triIter.Advance() )
@ -2461,15 +2461,15 @@ void SetWaterColor(plGeometrySpan* span)
// Actually, I just realized that the area way kind of sucks, because,
// as a parallelogram gets less and less rectangular, the area goes down
// even as the longest edge (the diagonal) gets longer.
hsScalar lenSq20 = hsVector3(&triIter.Position(2), &triIter.Position(0)).MagnitudeSquared();
hsScalar lenSq10 = hsVector3(&triIter.Position(1), &triIter.Position(0)).MagnitudeSquared();
hsScalar lenSq21 = hsVector3(&triIter.Position(2), &triIter.Position(1)).MagnitudeSquared();
hsScalar len = lenSq20;
float lenSq20 = hsVector3(&triIter.Position(2), &triIter.Position(0)).MagnitudeSquared();
float lenSq10 = hsVector3(&triIter.Position(1), &triIter.Position(0)).MagnitudeSquared();
float lenSq21 = hsVector3(&triIter.Position(2), &triIter.Position(1)).MagnitudeSquared();
float len = lenSq20;
if( len < lenSq10 )
len = lenSq10;
if( len < lenSq21 )
len = lenSq21;
len = hsSquareRoot(len);
len = sqrt(len);
lens[triIter.RawIndex(0)] += len;
wgts[triIter.RawIndex(0)] += 1.f;
@ -2492,9 +2492,9 @@ void SetWaterColor(plGeometrySpan* span)
}
// Now we might want to smooth this out some
// This can be repeated for any degree of smoothing
hsTArray<hsScalar> smLens;
hsTArray<float> smLens;
smLens.SetCount(nVerts);
memset(smLens.AcquireArray(), 0, nVerts * sizeof(hsScalar));
memset(smLens.AcquireArray(), 0, nVerts * sizeof(float));
// For each triangle
for( triIter.Begin(); triIter.More(); triIter.Advance() )
{
@ -2508,7 +2508,7 @@ void SetWaterColor(plGeometrySpan* span)
smLens[iVert] += lens[iVert];
wgts[iVert] += 1.f;
const hsScalar kSmooth(8.f);
const float kSmooth(8.f);
smLens[iVertNext] += lens[iVert] * kSmooth;
wgts[iVertNext] += kSmooth;
@ -2526,7 +2526,7 @@ void SetWaterColor(plGeometrySpan* span)
wgts[iVert] = 0.f; // We'll use them again on smoothing.
}
plConst(hsScalar) kNumLens(4.f);
plConst(float) kNumLens(4.f);
// Okay, we have smoothed lengths. We just need to
// iterate over the vertices and stuff 1/len into the alpha channel
// For each vert

View File

@ -55,7 +55,7 @@ public:
plNilView()
{
projType = 1;
fov = hsScalarPI * 0.25f;
fov = M_PI * 0.25f;
pixelSize = 1.f;
affineTM.IdentityMatrix();
worldToView.IdentityMatrix();