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

Fix line endings and tabs

This commit is contained in:
Branan Purvine-Riley
2011-04-11 16:27:55 -07:00
parent d4250e19b5
commit 908aaeb6f6
2738 changed files with 702562 additions and 702562 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,164 +1,164 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef hsOscillator_inc
#define hsOscillator_inc
#include "hsPerterber.h"
#include "hsTemplates.h"
#include "hsGeometry3.h"
#include "../plIntersect/hsBounds.h"
class hsStream;
class plPipeline;
class hsWave
{
protected:
hsPoint3 fWorldCenter;
hsPoint3 fLocalCenter;
hsScalar fWorldFrequency; // 1.0 / Period
hsScalar fLocalFrequency;
hsScalar fWorldAmplitude;
hsScalar fLocalAmplitude;
hsScalar fPhase;
hsScalar fRate; // how long a crest takes to reach next crest
hsScalar fStartSecs;
hsScalar fSecsToLive;
hsScalar fInnerRadius;
hsScalar fOuterRadius;
hsScalar fAttenuateOutScale;
hsScalar AgeScale(hsScalar secs) const;
public:
void Accumulate(const hsPoint3& pos, const hsVector3& localZ, hsVector3& accum, hsVector3& accumNorm) const;
hsScalar ScaledAmplitude(hsScalar secs) const;
void Init(hsScalar secs, hsPoint3& center, hsScalar per, hsScalar amp, hsScalar rate, hsScalar life, hsBool32 attenOut=false);
void Update(hsScalar secs, const hsMatrix44& l2w, const hsMatrix44& w2l);
hsBool32 IsSpent(hsScalar secs) const;
void Kill() { fStartSecs = fSecsToLive = 0; }
void AttenuateOut(hsBool32 on) { fAttenuateOutScale = (on ? 1.f : 0); }
hsBool32 GetAttenuateOut() { return fAttenuateOutScale > 0; }
void Save(hsStream* s, hsScalar secs);
void Load(hsStream* s, hsScalar secs);
};
class hsOscillator : public hsPerterber
{
protected:
hsTArray<hsWave> fWaves;
hsTArray<hsWave> fTempWaves;
hsMatrix44 fLocalToWorld;
hsMatrix44 fWorldToLocal;
hsPoint3 fWorldCenter;
hsPoint3 fLocalCenter;
hsVector3 fWorldAttenScale;
hsVector3 fLocalAttenScale;
hsBounds3Ext fWorldCenterBounds;
hsScalar fMinPeriod;
hsScalar fMaxPeriod;
hsScalar fMinAmplitude;
hsScalar fMaxAmplitude;
hsScalar fMinRate;
hsScalar fMaxRate;
hsScalar fMinLife;
hsScalar fMaxLife;
hsVector3 fLocalX;
hsVector3 fLocalY;
hsVector3 fLocalZ;
hsScalar IAttenuate(const hsPoint3& in) const;
void ISpawnWave(hsScalar secs, int i);
virtual void IUpdate(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l);
virtual void IPerterb(const hsPoint3& in, hsGVertex3& out) const;
public:
hsOscillator();
virtual ~hsOscillator();
virtual void AdjustWorldBounds(const hsMatrix44& l2w, const hsMatrix44& w2l, hsBounds3Ext& bnd) const;
virtual UInt32 GetType() const { return kTypeOscillator; }
// Don't call these, use base class LabelAndWrite() and CreateAndRead()
virtual void Read(hsStream* s);
virtual void Write(hsStream* s);
virtual void Load(hsStream* s, hsScalar secs);
virtual void Save(hsStream* s, hsScalar secs);
void SetPeriodRange(hsScalar lo, hsScalar hi) { fMinPeriod = lo; fMaxPeriod = hi; }
void SetAmplitudeRange(hsScalar lo, hsScalar hi) { fMinAmplitude = lo; fMaxAmplitude = hi; }
void SetRateRange(hsScalar lo, hsScalar hi) { fMinRate = lo; fMaxRate = hi; }
void SetLifeRange(hsScalar lo, hsScalar hi) { fMinLife = lo; fMaxLife = hi; }
hsScalar GetMinPeriod() const { return fMinPeriod; }
hsScalar GetMaxPeriod() const { return fMaxPeriod; }
hsScalar GetMinAmplitude() const { return fMinAmplitude; }
hsScalar GetMaxAmplitude() const { return fMaxAmplitude; }
hsScalar GetMinRate() const { return fMinRate; }
hsScalar GetMaxRate() const { return fMaxRate; }
hsScalar GetMinLife() const { return fMinLife; }
hsScalar GetMaxLife() const { return fMaxLife; }
void SetWorldAttenScale(const hsVector3& s) { fWorldAttenScale = s; }
void SetWorldCenterBounds(const hsBounds3Ext& bnd) { fWorldCenterBounds = bnd; }
const hsVector3& GetWorldAttenScale() const { return fWorldAttenScale; }
const hsBounds3Ext& GetWorldCenterBounds() const { return fWorldCenterBounds; }
void SetNumWaves(int n);
UInt32 GetNumWaves() const { return fWaves.GetCount(); }
hsWave& GetWeakestWave(hsScalar secs);
hsWave& GetTempWave(hsScalar secs);
virtual void Init(Int32 nParams, hsScalar* params);
static hsGTriMesh* MakeWaveMesh(int nSpokes, const hsPoint3& center, hsScalar minRad, hsScalar maxRad, hsScalar uRange, hsScalar vRange, hsScalar attenStartFrac, hsBool32 stitch);
};
#endif // hsOscillator_inc
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef hsOscillator_inc
#define hsOscillator_inc
#include "hsPerterber.h"
#include "hsTemplates.h"
#include "hsGeometry3.h"
#include "../plIntersect/hsBounds.h"
class hsStream;
class plPipeline;
class hsWave
{
protected:
hsPoint3 fWorldCenter;
hsPoint3 fLocalCenter;
hsScalar fWorldFrequency; // 1.0 / Period
hsScalar fLocalFrequency;
hsScalar fWorldAmplitude;
hsScalar fLocalAmplitude;
hsScalar fPhase;
hsScalar fRate; // how long a crest takes to reach next crest
hsScalar fStartSecs;
hsScalar fSecsToLive;
hsScalar fInnerRadius;
hsScalar fOuterRadius;
hsScalar fAttenuateOutScale;
hsScalar AgeScale(hsScalar secs) const;
public:
void Accumulate(const hsPoint3& pos, const hsVector3& localZ, hsVector3& accum, hsVector3& accumNorm) const;
hsScalar ScaledAmplitude(hsScalar secs) const;
void Init(hsScalar secs, hsPoint3& center, hsScalar per, hsScalar amp, hsScalar rate, hsScalar life, hsBool32 attenOut=false);
void Update(hsScalar secs, const hsMatrix44& l2w, const hsMatrix44& w2l);
hsBool32 IsSpent(hsScalar secs) const;
void Kill() { fStartSecs = fSecsToLive = 0; }
void AttenuateOut(hsBool32 on) { fAttenuateOutScale = (on ? 1.f : 0); }
hsBool32 GetAttenuateOut() { return fAttenuateOutScale > 0; }
void Save(hsStream* s, hsScalar secs);
void Load(hsStream* s, hsScalar secs);
};
class hsOscillator : public hsPerterber
{
protected:
hsTArray<hsWave> fWaves;
hsTArray<hsWave> fTempWaves;
hsMatrix44 fLocalToWorld;
hsMatrix44 fWorldToLocal;
hsPoint3 fWorldCenter;
hsPoint3 fLocalCenter;
hsVector3 fWorldAttenScale;
hsVector3 fLocalAttenScale;
hsBounds3Ext fWorldCenterBounds;
hsScalar fMinPeriod;
hsScalar fMaxPeriod;
hsScalar fMinAmplitude;
hsScalar fMaxAmplitude;
hsScalar fMinRate;
hsScalar fMaxRate;
hsScalar fMinLife;
hsScalar fMaxLife;
hsVector3 fLocalX;
hsVector3 fLocalY;
hsVector3 fLocalZ;
hsScalar IAttenuate(const hsPoint3& in) const;
void ISpawnWave(hsScalar secs, int i);
virtual void IUpdate(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l);
virtual void IPerterb(const hsPoint3& in, hsGVertex3& out) const;
public:
hsOscillator();
virtual ~hsOscillator();
virtual void AdjustWorldBounds(const hsMatrix44& l2w, const hsMatrix44& w2l, hsBounds3Ext& bnd) const;
virtual UInt32 GetType() const { return kTypeOscillator; }
// Don't call these, use base class LabelAndWrite() and CreateAndRead()
virtual void Read(hsStream* s);
virtual void Write(hsStream* s);
virtual void Load(hsStream* s, hsScalar secs);
virtual void Save(hsStream* s, hsScalar secs);
void SetPeriodRange(hsScalar lo, hsScalar hi) { fMinPeriod = lo; fMaxPeriod = hi; }
void SetAmplitudeRange(hsScalar lo, hsScalar hi) { fMinAmplitude = lo; fMaxAmplitude = hi; }
void SetRateRange(hsScalar lo, hsScalar hi) { fMinRate = lo; fMaxRate = hi; }
void SetLifeRange(hsScalar lo, hsScalar hi) { fMinLife = lo; fMaxLife = hi; }
hsScalar GetMinPeriod() const { return fMinPeriod; }
hsScalar GetMaxPeriod() const { return fMaxPeriod; }
hsScalar GetMinAmplitude() const { return fMinAmplitude; }
hsScalar GetMaxAmplitude() const { return fMaxAmplitude; }
hsScalar GetMinRate() const { return fMinRate; }
hsScalar GetMaxRate() const { return fMaxRate; }
hsScalar GetMinLife() const { return fMinLife; }
hsScalar GetMaxLife() const { return fMaxLife; }
void SetWorldAttenScale(const hsVector3& s) { fWorldAttenScale = s; }
void SetWorldCenterBounds(const hsBounds3Ext& bnd) { fWorldCenterBounds = bnd; }
const hsVector3& GetWorldAttenScale() const { return fWorldAttenScale; }
const hsBounds3Ext& GetWorldCenterBounds() const { return fWorldCenterBounds; }
void SetNumWaves(int n);
UInt32 GetNumWaves() const { return fWaves.GetCount(); }
hsWave& GetWeakestWave(hsScalar secs);
hsWave& GetTempWave(hsScalar secs);
virtual void Init(Int32 nParams, hsScalar* params);
static hsGTriMesh* MakeWaveMesh(int nSpokes, const hsPoint3& center, hsScalar minRad, hsScalar maxRad, hsScalar uRange, hsScalar vRange, hsScalar attenStartFrac, hsBool32 stitch);
};
#endif // hsOscillator_inc

View File

@ -1,334 +1,334 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "hsTypes.h"
#include "hsStream.h"
#include "hsPerterber.h"
#include "hsOscillator.h"
#include "hsGMesh.h"
#if 0 // GET_RID_OF_SHAPE_LAYER_DEFER
#include "hsGShape3.h"
#include "hsGShape3MegaMesh.h"
#endif// GET_RID_OF_SHAPE_LAYER_DEFER
#include "../plResMgr/plKey.h"
#include "../plSurface/hsGMaterial.h"
#include "hsTimer.h"
#include "../plPipeline/plPipeline.h"
hsBool32 hsPerterber::fDisabled = false;
hsPerterber::hsPerterber()
{
}
hsPerterber::~hsPerterber()
{
}
void hsPerterber::IUpdate(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l)
{
}
void hsPerterber::TimeStampAndSave(hsStream* s)
{
hsScalar secs = hsTimer::GetSeconds();
hsKeyedObject::Save(s, nil);
Save(s, secs);
}
void hsPerterber::TimeStampAndLoad(hsStream* s)
{
hsScalar secs = hsTimer::GetSeconds();
hsKeyedObject::Load(s, nil);
Load(s, secs);
}
void hsPerterber::LabelAndWrite(hsStream* s)
{
s->WriteSwap32(GetType());
Write(s);
}
hsPerterber* hsPerterber::CreateAndRead(hsStream* s)
{
hsPerterber* retVal = nil;
UInt32 t = s->ReadSwap32();
switch( t )
{
case kTypeOscillator:
retVal = new hsOscillator;
break;
default:
hsAssert(false, "Unknown perterber type");
return nil;
}
retVal->Read(s);
return retVal;
}
hsGMesh* hsPerterber::IGetMesh(hsGShape3* shape)
{
hsGMesh* mesh = nil;
#if 0 // GET_RID_OF_SHAPE_LAYER_DEFER
if( shape->GetShapeType() == hsGShape3::kTypeTriMesh )
{
hsGShape3TriMesh* shp = (hsGShape3TriMesh*)shape;
mesh = shp->GetMesh();
#if 0 // move to export
if( mesh->GetKey() && strstr(mesh->GetKey()->GetName(), "create") )
{
hsTArray<hsGMaterial*> matList;
shp->AppendMaterials(matList);
hsGTriMesh* newMesh = hsOscillator::MakeWaveMesh(40, hsPoint3(0,0,0), 4.f, 75.f, 1200.f, 1200.f, 0.75f, false);
newMesh->SetMaterial(matList[0]);
hsRefCnt_SafeUnRef(matList[0]);
shp->SetMesh(newMesh);
hsRefCnt_SafeUnRef(newMesh);
mesh = newMesh;
}
else if( mesh->GetKey() && strstr(mesh->GetKey()->GetName(), "destroy") )
{
hsTArray<hsGMaterial*> matList;
shp->AppendMaterials(matList);
hsGTriMesh* newMesh = hsOscillator::MakeWaveMesh(50, hsPoint3(0,0,0), 1.5f, 30.f, 600.f, 600.f, 0.6f, true);
newMesh->SetMaterial(matList[0]);
hsRefCnt_SafeUnRef(matList[0]);
shp->SetMesh(newMesh);
hsRefCnt_SafeUnRef(newMesh);
mesh = newMesh;
}
else
#endif // move to export
{
hsGTriMesh* triMesh = (hsGTriMesh*)shp->GetMesh();
if( triMesh->GetTriangle(0)->fFlags & hsTriangle3::kHasFacePlane )
triMesh->TrashPlanes();
mesh = triMesh;
}
}
else if( shape->GetShapeType() == hsGShape3::kTypeMegaMesh )
{
hsGShape3MegaMesh* mega = (hsGShape3MegaMesh*)shape;
hsGMegaMesh* megaMesh = (hsGMegaMesh*)mega->GetMegaMesh();
hsGTriMesh* triMesh = (hsGTriMesh*)megaMesh->GetMesh(0);
if( triMesh->GetTriangle(0)->fFlags & hsTriangle3::kHasFacePlane )
{
int iMesh;
for( iMesh = 0; iMesh < megaMesh->GetMeshCount(); iMesh++ )
{
triMesh = (hsGTriMesh*)megaMesh->GetMesh(iMesh);
triMesh->TrashPlanes();
}
}
mesh = mega->GetMegaMesh();
}
#endif // GET_RID_OF_SHAPE_LAYER_DEFER
return mesh;
}
void hsPerterber::Perterb(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l, hsGShape3* shape)
{
if( GetDisabled() )
return;
hsGMesh* mesh = IGetMesh(shape);
IUpdate(secs, pipe, l2w, w2l);
if( !mesh->HasOrigPoints() )
mesh->StoreOrigPoints();
int i;
for( i = 0; i < mesh->GetNumPoints(); i++ )
{
IPerterb(*mesh->GetOrigPoint(i), *mesh->GetVertex(i));
}
}
const int kPertCount = 6;
const int kMaxPertParams = 32;
struct hsPertDesc
{
char fName[256];
UInt32 fType;
UInt32 fNumParams;
hsScalar fParams[kMaxPertParams];
};
// NumWaves = 1
// AttenScale = 2
// WorldCenterBounds = 6
// Period = 2
// Amp = 2
// Rate = 2
// Life = 2
//
hsPertDesc sPertTable[kPertCount] =
{
{
"mystocean",
hsPerterber::kTypeOscillator,
17,
{
5.f,
1.f/100.f, 1.f/100.f,
-100.f, 100.f, 0, 100.f, 150.f, 0,
2.f, 5.f,
0.5, 0.75f,
0.68f, 0.68f,
5.f, 10.f
}
},
{
"stoneocean",
hsPerterber::kTypeOscillator,
17,
{
5.f,
1.f/100.f, 1.f/100.f,
-100.f, 100.f, 0, 100.f, 150.f, 0,
2.f, 5.f,
0.5, 0.75f,
0.68f, 0.68f,
5.f, 10.f
}
},
{
"seleniticocean",
hsPerterber::kTypeOscillator,
17,
{
5.f,
1.f/100.f, 1.f/100.f,
-100.f, 100.f, 0, 100.f, 150.f, 0,
2.f, 5.f,
0.25, 0.45f,
0.6f, 0.6f,
5.f, 10.f
}
},
{
"channelocean",
hsPerterber::kTypeOscillator,
17,
{
5.f,
1.f/30.f, 1.f/30.f,
-100.f, -100.f, 0, 100.f, 100.f, 0,
0.25f, 0.5f,
0.1, 0.2f,
0.4f, 0.8f,
5.f, 10.f
}
},
{
"mechocean",
hsPerterber::kTypeOscillator,
17,
{
5.f,
1.f/100.f, 1.f/100.f,
-100.f, 100.f, 0, 100.f, 150.f, 0,
2.f, 5.f,
0.5, 0.4f,
0.68f, 0.68f,
5.f, 10.f
}
},
{
"rimeocean",
hsPerterber::kTypeOscillator,
17,
{
5.f,
1.f/100.f, 1.f/100.f,
-100.f, 100.f, 0, 100.f, 150.f, 0,
2.f, 5.f,
0.5, 0.75,
0.68f, 0.68f,
5.f, 10.f
}
}
};
#if 0 // Used Registry...need to change paulg
void hsPerterber::InitSystem(hsRegistry* reg)
{
if( GetDisabled() )
return;
int i;
for( i = 0; i < kPertCount; i++ )
{
switch( sPertTable[i].fType )
{
case kTypeOscillator:
{
hsOscillator* oscar = new hsOscillator;
oscar->Init(sPertTable[i].fNumParams, sPertTable[i].fParams);
#ifdef PAULFIX
oscar->Register(reg, sPertTable[i].fName, 0, true);
#endif
}
break;
default:
hsAssert(false, "Unknown perterber type");
break;
}
}
}
void hsPerterber::Shutdown(hsRegistry* reg)
{
#ifdef PAULFIX
int i;
for( i = 0; i < reg->GetNumKeys(); i++ )
{
hsPerterber* pert = (hsPerterber*)(reg->GetKey(i)->GetObjectPtr());
delete pert;
}
#endif
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#include "hsTypes.h"
#include "hsStream.h"
#include "hsPerterber.h"
#include "hsOscillator.h"
#include "hsGMesh.h"
#if 0 // GET_RID_OF_SHAPE_LAYER_DEFER
#include "hsGShape3.h"
#include "hsGShape3MegaMesh.h"
#endif// GET_RID_OF_SHAPE_LAYER_DEFER
#include "../plResMgr/plKey.h"
#include "../plSurface/hsGMaterial.h"
#include "hsTimer.h"
#include "../plPipeline/plPipeline.h"
hsBool32 hsPerterber::fDisabled = false;
hsPerterber::hsPerterber()
{
}
hsPerterber::~hsPerterber()
{
}
void hsPerterber::IUpdate(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l)
{
}
void hsPerterber::TimeStampAndSave(hsStream* s)
{
hsScalar secs = hsTimer::GetSeconds();
hsKeyedObject::Save(s, nil);
Save(s, secs);
}
void hsPerterber::TimeStampAndLoad(hsStream* s)
{
hsScalar secs = hsTimer::GetSeconds();
hsKeyedObject::Load(s, nil);
Load(s, secs);
}
void hsPerterber::LabelAndWrite(hsStream* s)
{
s->WriteSwap32(GetType());
Write(s);
}
hsPerterber* hsPerterber::CreateAndRead(hsStream* s)
{
hsPerterber* retVal = nil;
UInt32 t = s->ReadSwap32();
switch( t )
{
case kTypeOscillator:
retVal = new hsOscillator;
break;
default:
hsAssert(false, "Unknown perterber type");
return nil;
}
retVal->Read(s);
return retVal;
}
hsGMesh* hsPerterber::IGetMesh(hsGShape3* shape)
{
hsGMesh* mesh = nil;
#if 0 // GET_RID_OF_SHAPE_LAYER_DEFER
if( shape->GetShapeType() == hsGShape3::kTypeTriMesh )
{
hsGShape3TriMesh* shp = (hsGShape3TriMesh*)shape;
mesh = shp->GetMesh();
#if 0 // move to export
if( mesh->GetKey() && strstr(mesh->GetKey()->GetName(), "create") )
{
hsTArray<hsGMaterial*> matList;
shp->AppendMaterials(matList);
hsGTriMesh* newMesh = hsOscillator::MakeWaveMesh(40, hsPoint3(0,0,0), 4.f, 75.f, 1200.f, 1200.f, 0.75f, false);
newMesh->SetMaterial(matList[0]);
hsRefCnt_SafeUnRef(matList[0]);
shp->SetMesh(newMesh);
hsRefCnt_SafeUnRef(newMesh);
mesh = newMesh;
}
else if( mesh->GetKey() && strstr(mesh->GetKey()->GetName(), "destroy") )
{
hsTArray<hsGMaterial*> matList;
shp->AppendMaterials(matList);
hsGTriMesh* newMesh = hsOscillator::MakeWaveMesh(50, hsPoint3(0,0,0), 1.5f, 30.f, 600.f, 600.f, 0.6f, true);
newMesh->SetMaterial(matList[0]);
hsRefCnt_SafeUnRef(matList[0]);
shp->SetMesh(newMesh);
hsRefCnt_SafeUnRef(newMesh);
mesh = newMesh;
}
else
#endif // move to export
{
hsGTriMesh* triMesh = (hsGTriMesh*)shp->GetMesh();
if( triMesh->GetTriangle(0)->fFlags & hsTriangle3::kHasFacePlane )
triMesh->TrashPlanes();
mesh = triMesh;
}
}
else if( shape->GetShapeType() == hsGShape3::kTypeMegaMesh )
{
hsGShape3MegaMesh* mega = (hsGShape3MegaMesh*)shape;
hsGMegaMesh* megaMesh = (hsGMegaMesh*)mega->GetMegaMesh();
hsGTriMesh* triMesh = (hsGTriMesh*)megaMesh->GetMesh(0);
if( triMesh->GetTriangle(0)->fFlags & hsTriangle3::kHasFacePlane )
{
int iMesh;
for( iMesh = 0; iMesh < megaMesh->GetMeshCount(); iMesh++ )
{
triMesh = (hsGTriMesh*)megaMesh->GetMesh(iMesh);
triMesh->TrashPlanes();
}
}
mesh = mega->GetMegaMesh();
}
#endif // GET_RID_OF_SHAPE_LAYER_DEFER
return mesh;
}
void hsPerterber::Perterb(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l, hsGShape3* shape)
{
if( GetDisabled() )
return;
hsGMesh* mesh = IGetMesh(shape);
IUpdate(secs, pipe, l2w, w2l);
if( !mesh->HasOrigPoints() )
mesh->StoreOrigPoints();
int i;
for( i = 0; i < mesh->GetNumPoints(); i++ )
{
IPerterb(*mesh->GetOrigPoint(i), *mesh->GetVertex(i));
}
}
const int kPertCount = 6;
const int kMaxPertParams = 32;
struct hsPertDesc
{
char fName[256];
UInt32 fType;
UInt32 fNumParams;
hsScalar fParams[kMaxPertParams];
};
// NumWaves = 1
// AttenScale = 2
// WorldCenterBounds = 6
// Period = 2
// Amp = 2
// Rate = 2
// Life = 2
//
hsPertDesc sPertTable[kPertCount] =
{
{
"mystocean",
hsPerterber::kTypeOscillator,
17,
{
5.f,
1.f/100.f, 1.f/100.f,
-100.f, 100.f, 0, 100.f, 150.f, 0,
2.f, 5.f,
0.5, 0.75f,
0.68f, 0.68f,
5.f, 10.f
}
},
{
"stoneocean",
hsPerterber::kTypeOscillator,
17,
{
5.f,
1.f/100.f, 1.f/100.f,
-100.f, 100.f, 0, 100.f, 150.f, 0,
2.f, 5.f,
0.5, 0.75f,
0.68f, 0.68f,
5.f, 10.f
}
},
{
"seleniticocean",
hsPerterber::kTypeOscillator,
17,
{
5.f,
1.f/100.f, 1.f/100.f,
-100.f, 100.f, 0, 100.f, 150.f, 0,
2.f, 5.f,
0.25, 0.45f,
0.6f, 0.6f,
5.f, 10.f
}
},
{
"channelocean",
hsPerterber::kTypeOscillator,
17,
{
5.f,
1.f/30.f, 1.f/30.f,
-100.f, -100.f, 0, 100.f, 100.f, 0,
0.25f, 0.5f,
0.1, 0.2f,
0.4f, 0.8f,
5.f, 10.f
}
},
{
"mechocean",
hsPerterber::kTypeOscillator,
17,
{
5.f,
1.f/100.f, 1.f/100.f,
-100.f, 100.f, 0, 100.f, 150.f, 0,
2.f, 5.f,
0.5, 0.4f,
0.68f, 0.68f,
5.f, 10.f
}
},
{
"rimeocean",
hsPerterber::kTypeOscillator,
17,
{
5.f,
1.f/100.f, 1.f/100.f,
-100.f, 100.f, 0, 100.f, 150.f, 0,
2.f, 5.f,
0.5, 0.75,
0.68f, 0.68f,
5.f, 10.f
}
}
};
#if 0 // Used Registry...need to change paulg
void hsPerterber::InitSystem(hsRegistry* reg)
{
if( GetDisabled() )
return;
int i;
for( i = 0; i < kPertCount; i++ )
{
switch( sPertTable[i].fType )
{
case kTypeOscillator:
{
hsOscillator* oscar = new hsOscillator;
oscar->Init(sPertTable[i].fNumParams, sPertTable[i].fParams);
#ifdef PAULFIX
oscar->Register(reg, sPertTable[i].fName, 0, true);
#endif
}
break;
default:
hsAssert(false, "Unknown perterber type");
break;
}
}
}
void hsPerterber::Shutdown(hsRegistry* reg)
{
#ifdef PAULFIX
int i;
for( i = 0; i < reg->GetNumKeys(); i++ )
{
hsPerterber* pert = (hsPerterber*)(reg->GetKey(i)->GetObjectPtr());
delete pert;
}
#endif
}
#endif

View File

@ -1,91 +1,91 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef hsPerterber_inc
#define hsPerterber_inc
#include "../plResMgr/hsKeyedObject.h"
#include "hsGeometry3.h"
class hsStream;
class hsGShape3;
class hsBounds3Ext;
class hsGMesh;
class plPipeline;
struct hsMatrix44;
struct hsGVertex3;
class hsPerterber : public hsKeyedObject
{
public:
enum {
kTypeUndefined = 0x0,
kTypeOscillator = 0x1
};
protected:
static hsBool32 fDisabled;
virtual void IUpdate(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l);
virtual void IPerterb(const hsPoint3& in, hsGVertex3& out) const = 0;
hsGMesh* IGetMesh(hsGShape3* shape);
public:
hsPerterber();
virtual ~hsPerterber();
static void SetDisabled(hsBool32 on) { fDisabled = on; }
static void ToggleDisabled() { fDisabled = !fDisabled; }
static hsBool32 GetDisabled() { return fDisabled; }
virtual void Perterb(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l, hsGShape3* shape);
virtual void AdjustWorldBounds(const hsMatrix44& l2w, const hsMatrix44& w2l, hsBounds3Ext& bnd) const = 0;
virtual UInt32 GetType() const = 0;
virtual void Write(hsStream* s) = 0;
virtual void Read(hsStream* s) = 0;
virtual void Save(hsStream* s, hsScalar secs) = 0;
virtual void Load(hsStream* s, hsScalar secs) = 0;
void TimeStampAndSave(hsStream* s);
void TimeStampAndLoad(hsStream* s);
void LabelAndWrite(hsStream* s);
static hsPerterber* CreateAndRead(hsStream* s);
virtual void Init(Int32 nParams, hsScalar* params) = 0;
#if 0 // Used Registry...need to change paulg
static void InitSystem(plResMgr* reg);
static void Shutdown(plResMgr* reg);
#endif
};
#endif hsPerterber_inc
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef hsPerterber_inc
#define hsPerterber_inc
#include "../plResMgr/hsKeyedObject.h"
#include "hsGeometry3.h"
class hsStream;
class hsGShape3;
class hsBounds3Ext;
class hsGMesh;
class plPipeline;
struct hsMatrix44;
struct hsGVertex3;
class hsPerterber : public hsKeyedObject
{
public:
enum {
kTypeUndefined = 0x0,
kTypeOscillator = 0x1
};
protected:
static hsBool32 fDisabled;
virtual void IUpdate(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l);
virtual void IPerterb(const hsPoint3& in, hsGVertex3& out) const = 0;
hsGMesh* IGetMesh(hsGShape3* shape);
public:
hsPerterber();
virtual ~hsPerterber();
static void SetDisabled(hsBool32 on) { fDisabled = on; }
static void ToggleDisabled() { fDisabled = !fDisabled; }
static hsBool32 GetDisabled() { return fDisabled; }
virtual void Perterb(hsScalar secs, plPipeline* pipe, const hsMatrix44& l2w, const hsMatrix44& w2l, hsGShape3* shape);
virtual void AdjustWorldBounds(const hsMatrix44& l2w, const hsMatrix44& w2l, hsBounds3Ext& bnd) const = 0;
virtual UInt32 GetType() const = 0;
virtual void Write(hsStream* s) = 0;
virtual void Read(hsStream* s) = 0;
virtual void Save(hsStream* s, hsScalar secs) = 0;
virtual void Load(hsStream* s, hsScalar secs) = 0;
void TimeStampAndSave(hsStream* s);
void TimeStampAndLoad(hsStream* s);
void LabelAndWrite(hsStream* s);
static hsPerterber* CreateAndRead(hsStream* s);
virtual void Init(Int32 nParams, hsScalar* params) = 0;
#if 0 // Used Registry...need to change paulg
static void InitSystem(plResMgr* reg);
static void Shutdown(plResMgr* reg);
#endif
};
#endif hsPerterber_inc

View File

@ -1,54 +1,54 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef plGeometryCreatable_inc
#define plGeometryCreatable_inc
#include "../pnFactory/plCreator.h"
/* Taken out 6.12.2001 mcn - You can remove this file entirely if you wish, I just left
it in in case we wanted to use it in the future...
#include "hsGVertexPool.h"
REGISTER_CREATABLE( hsGVertexPool );
#include "hsGMesh.h"
REGISTER_NONCREATABLE( hsGMesh );
#include "hsGTriMesh.h"
REGISTER_CREATABLE( hsGTriMesh );
#include "hsGMegaMesh.h"
REGISTER_CREATABLE( hsGMegaMesh );
*/
#endif plGeometryCreatable_inc
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef plGeometryCreatable_inc
#define plGeometryCreatable_inc
#include "../pnFactory/plCreator.h"
/* Taken out 6.12.2001 mcn - You can remove this file entirely if you wish, I just left
it in in case we wanted to use it in the future...
#include "hsGVertexPool.h"
REGISTER_CREATABLE( hsGVertexPool );
#include "hsGMesh.h"
REGISTER_NONCREATABLE( hsGMesh );
#include "hsGTriMesh.h"
REGISTER_CREATABLE( hsGTriMesh );
#include "hsGMegaMesh.h"
REGISTER_CREATABLE( hsGMegaMesh );
*/
#endif plGeometryCreatable_inc