diff --git a/Engine/source/afx/afxMagicMissile.cpp b/Engine/source/afx/afxMagicMissile.cpp index 2c4d9e64d..93d4ef237 100644 --- a/Engine/source/afx/afxMagicMissile.cpp +++ b/Engine/source/afx/afxMagicMissile.cpp @@ -141,7 +141,7 @@ U32 Projectile::smProjectileWarpTicks = 5; // afxMagicMissileData::afxMagicMissileData() { - projectileShapeName = ST_NULLSTRING; + INIT_SHAPEASSET(ProjectileShape); sound = NULL; @@ -246,7 +246,7 @@ afxMagicMissileData::afxMagicMissileData() afxMagicMissileData::afxMagicMissileData(const afxMagicMissileData& other, bool temp_clone) : GameBaseData(other, temp_clone) { - projectileShapeName = other.projectileShapeName; + CLONE_SHAPEASSET(ProjectileShape); projectileShape = other.projectileShape; // -- TSShape loads using projectileShapeName sound = other.sound; splash = other.splash; @@ -335,7 +335,7 @@ void afxMagicMissileData::initPersistFields() addField("particleEmitter", TYPEID(), Offset(particleEmitter, afxMagicMissileData)); addField("particleWaterEmitter", TYPEID(), Offset(particleWaterEmitter, afxMagicMissileData)); - addField("projectileShapeName", TypeFilename, Offset(projectileShapeName, afxMagicMissileData)); + INITPERSISTFIELD_SHAPEASSET(ProjectileShape, afxMagicMissileData, "Shape for the projectile"); addField("scale", TypePoint3F, Offset(scale, afxMagicMissileData)); addField("sound", TypeSFXTrackName, Offset(sound, afxMagicMissileData)); @@ -375,7 +375,7 @@ void afxMagicMissileData::initPersistFields() // FIELDS ADDED BY MAGIC-MISSILE - addField("missileShapeName", TypeFilename, myOffset(projectileShapeName)); + //addField("missileShapeName", TypeFilename, myOffset(projectileShapeName)); addField("missileShapeScale", TypePoint3F, myOffset(scale)); addField("startingVelocityVector",TypePoint3F, myOffset(starting_vel_vec)); @@ -542,12 +542,12 @@ bool afxMagicMissileData::preload(bool server, String &errorStr) Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet, bad datablockid(lightDesc): %d", lightDescId); } - if (projectileShapeName != ST_NULLSTRING) + if (!mProjectileShapeAsset.isNull()) { - projectileShape = ResourceManager::get().load(projectileShapeName); + projectileShape = mProjectileShapeAsset->getShapeResource(); if (bool(projectileShape) == false) { - errorStr = String::ToString("afxMagicMissileData::load: Couldn't load shape \"%s\"", projectileShapeName); + errorStr = String::ToString("afxMagicMissileData::load: Couldn't load shape \"%s\"", mProjectileShapeAssetId); return false; } /* From stock Projectile code... @@ -599,7 +599,8 @@ void afxMagicMissileData::packData(BitStream* stream) { Parent::packData(stream); - stream->writeString(projectileShapeName); + PACKDATA_SHAPEASSET(ProjectileShape); + /* From stock Projectile code... stream->writeFlag(faceViewer); */ @@ -709,7 +710,7 @@ void afxMagicMissileData::unpackData(BitStream* stream) { Parent::unpackData(stream); - projectileShapeName = stream->readSTString(); + UNPACKDATA_SHAPEASSET(ProjectileShape); /* From stock Projectile code... faceViewer = stream->readFlag(); */ diff --git a/Engine/source/afx/afxMagicMissile.h b/Engine/source/afx/afxMagicMissile.h index 332d69d3c..1206354fd 100644 --- a/Engine/source/afx/afxMagicMissile.h +++ b/Engine/source/afx/afxMagicMissile.h @@ -65,11 +65,15 @@ protected: public: enum { MaxLifetimeTicks = 4095 }; + + void onShapeChanged() {} public: // variables set in datablock definition: // Shape related - StringTableEntry projectileShapeName; + DECLARE_SHAPEASSET(afxMagicMissileData, ProjectileShape, onShapeChanged); + DECLARE_SHAPEASSET_SETGET(afxMagicMissileData, ProjectileShape); + //StringTableEntry projectileShapeName; //bool hasLight; //F32 lightRadius; diff --git a/Engine/source/afx/ce/afxBillboard.cpp b/Engine/source/afx/ce/afxBillboard.cpp index 85f816962..553c2942f 100644 --- a/Engine/source/afx/ce/afxBillboard.cpp +++ b/Engine/source/afx/ce/afxBillboard.cpp @@ -51,7 +51,7 @@ ConsoleDocClass( afxBillboardData, afxBillboardData::afxBillboardData() { color.set(1.0f, 1.0f, 1.0f, 1.0f); - txr_name = ST_NULLSTRING; + INIT_IMAGEASSET(Texture); dimensions.set(1.0f, 1.0f); texCoords[0].set(0.0f, 0.0f); texCoords[1].set(0.0f, 1.0f); @@ -66,8 +66,7 @@ afxBillboardData::afxBillboardData(const afxBillboardData& other, bool temp_clon : GameBaseData(other, temp_clone) { color = other.color; - txr_name = other.txr_name; - txr = other.txr; + CLONE_IMAGEASSET(Texture); dimensions = other.dimensions; texCoords[0] = other.texCoords[0]; texCoords[1] = other.texCoords[1]; @@ -95,8 +94,9 @@ void afxBillboardData::initPersistFields() addField("color", TypeColorF, myOffset(color), "The color assigned to the quadrangle geometry. The way it combines with the given " "texture varies according to the setting of the textureFunction field."); - addField("texture", TypeFilename, myOffset(txr_name), - "An image to use as the billboard's texture."); + + INITPERSISTFIELD_IMAGEASSET(Texture, afxBillboardData, "An image to use as the billboard's texture."); + addField("dimensions", TypePoint2F, myOffset(dimensions), "A value-pair that specifies the horizontal and vertical dimensions of the billboard " "in scene units."); @@ -123,7 +123,8 @@ void afxBillboardData::packData(BitStream* stream) Parent::packData(stream); stream->write(color); - stream->writeString(txr_name); + PACKDATA_IMAGEASSET(Texture); + mathWrite(*stream, dimensions); mathWrite(*stream, texCoords[0]); mathWrite(*stream, texCoords[1]); @@ -139,8 +140,7 @@ void afxBillboardData::unpackData(BitStream* stream) Parent::unpackData(stream); stream->read(&color); - txr_name = stream->readSTString(); - txr = GFXTexHandle(); + UNPACKDATA_IMAGEASSET(Texture); mathRead(*stream, &dimensions); mathRead(*stream, &texCoords[0]); mathRead(*stream, &texCoords[1]); @@ -156,14 +156,6 @@ bool afxBillboardData::preload(bool server, String &errorStr) if (!Parent::preload(server, errorStr)) return false; - if (!server) - { - if (txr_name && txr_name[0] != '\0') - { - txr.set(txr_name, &GFXStaticTextureSRGBProfile, "Billboard Texture"); - } - } - // if blend-style is set to User, check for defined blend-factors if (blendStyle == BlendUser && (srcBlendFactor == BLEND_UNDEFINED || dstBlendFactor == BLEND_UNDEFINED)) { diff --git a/Engine/source/afx/ce/afxBillboard.h b/Engine/source/afx/ce/afxBillboard.h index 208b8b0f0..1183500a2 100644 --- a/Engine/source/afx/ce/afxBillboard.h +++ b/Engine/source/afx/ce/afxBillboard.h @@ -47,8 +47,9 @@ public: }; public: - StringTableEntry txr_name; - GFXTexHandle txr; + DECLARE_IMAGEASSET(afxBillboardData, Texture, onChangeTexture, GFXStaticTextureSRGBProfile); + DECLARE_IMAGEASSET_SETGET(afxBillboardData, Texture); + LinearColorF color; Point2F texCoords[4]; @@ -70,6 +71,8 @@ public: static void initPersistFields(); + void onChangeTexture() {} + DECLARE_CONOBJECT(afxBillboardData); DECLARE_CATEGORY("AFX"); }; diff --git a/Engine/source/afx/ce/afxBillboard_T3D.cpp b/Engine/source/afx/ce/afxBillboard_T3D.cpp index 2162f7143..81d84ebc4 100644 --- a/Engine/source/afx/ce/afxBillboard_T3D.cpp +++ b/Engine/source/afx/ce/afxBillboard_T3D.cpp @@ -87,7 +87,7 @@ void afxBillboard::_renderBillboard(ObjectRenderInst *ri, SceneRenderState* stat GFXTransformSaver saver; GFX->multWorld(getRenderTransform()); - GFX->setTexture(0, mDataBlock->txr); + GFX->setTexture(0, mDataBlock->mTexture); MatrixF worldmod = GFX->getWorldMatrix(); MatrixF viewmod = GFX->getViewMatrix(); diff --git a/Engine/source/afx/ce/afxModel.cpp b/Engine/source/afx/ce/afxModel.cpp index 95a190deb..ba452156b 100644 --- a/Engine/source/afx/ce/afxModel.cpp +++ b/Engine/source/afx/ce/afxModel.cpp @@ -54,7 +54,7 @@ ConsoleDocClass( afxModelData, afxModelData::afxModelData() { - shapeName = ST_NULLSTRING; + INIT_SHAPEASSET(Shape); sequence = ST_NULLSTRING; seq_rate = 1.0f; seq_offset = 0.0f; @@ -84,8 +84,7 @@ afxModelData::afxModelData() afxModelData::afxModelData(const afxModelData& other, bool temp_clone) : GameBaseData(other, temp_clone) { - shapeName = other.shapeName; - shape = other.shape; // -- + CLONE_SHAPEASSET(Shape); sequence = other.sequence; seq_rate = other.seq_rate; seq_offset = other.seq_offset; @@ -127,12 +126,11 @@ bool afxModelData::preload(bool server, String &errorStr) if (server) return true; - if (shapeName != ST_NULLSTRING && !shape) + if (mShapeAsset.notNull()) { - shape = ResourceManager::get().load(shapeName); - if (!shape) + if (!mShape) { - errorStr = String::ToString("afxModelData::load: Failed to load shape \"%s\"", shapeName); + errorStr = String::ToString("afxModelData::load: Failed to load shape \"%s\"", mShapeAssetId); return false; } @@ -164,7 +162,7 @@ bool afxModelData::preload(bool server, String &errorStr) if (txr_tag_remappings.size() == 0) { // this little hack forces the textures to preload - TSShapeInstance* pDummy = new TSShapeInstance(shape); + TSShapeInstance* pDummy = new TSShapeInstance(mShape); delete pDummy; } } @@ -176,9 +174,8 @@ bool afxModelData::preload(bool server, String &errorStr) void afxModelData::initPersistFields() { - addField("shapeFile", TypeFilename, myOffset(shapeName), - "The name of a .dts format file to use for the model."); - addField("sequence", TypeFilename, myOffset(sequence), + INITPERSISTFIELD_SHAPEASSET(Shape, afxModelData, "The name of a .dts format file to use for the model."); + addField("sequence", TypeString, myOffset(sequence), "The name of an animation sequence to play in the model."); addField("sequenceRate", TypeF32, myOffset(seq_rate), "The rate of playback for the sequence."); @@ -256,7 +253,7 @@ void afxModelData::packData(BitStream* stream) { Parent::packData(stream); - stream->writeString(shapeName); + PACKDATA_SHAPEASSET(Shape); stream->writeString(sequence); stream->write(seq_rate); stream->write(seq_offset); @@ -288,7 +285,7 @@ void afxModelData::unpackData(BitStream* stream) { Parent::unpackData(stream); - shapeName = stream->readSTString(); + UNPACKDATA_SHAPEASSET(Shape); sequence = stream->readSTString(); stream->read(&seq_rate); stream->read(&seq_offset); @@ -316,19 +313,24 @@ void afxModelData::unpackData(BitStream* stream) stream->read(&shadowSphereAdjust); } -void afxModelData::onPerformSubstitutions() -{ - if (shapeName != ST_NULLSTRING) - { - shape = ResourceManager::get().load(shapeName); - if (!shape) - { - Con::errorf("afxModelData::onPerformSubstitutions: Failed to load shape \"%s\"", shapeName); - return; - } +void afxModelData::onPerformSubstitutions() +{ + if (mShapeAssetId != StringTable->EmptyString()) + { + mShapeAsset = mShapeAssetId; + if (mShapeAsset.notNull()) + { + mShape = mShapeAsset->getShapeResource(); + } - // REMAP-TEXTURE-TAGS ISSUES? - } + if (!mShape) + { + Con::errorf("afxModelData::onPerformSubstitutions: Failed to load shape \"%s\"", mShapeAssetId); + return; + } + + // REMAP-TEXTURE-TAGS ISSUES? + } } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -401,18 +403,18 @@ bool afxModel::onAdd() return false; // setup our bounding box - if (mDataBlock->shape) - mObjBox = mDataBlock->shape->mBounds; + if (mDataBlock->mShape) + mObjBox = mDataBlock->mShape->mBounds; else mObjBox = Box3F(Point3F(-1, -1, -1), Point3F(1, 1, 1)); // setup the shape instance and sequence - if (mDataBlock->shape) + if (mDataBlock->mShape) { if (/*isClientObject() && */mDataBlock->txr_tag_remappings.size() > 0) { // temporarily substitute material tags with alternates - TSMaterialList* mat_list = mDataBlock->shape->materialList; + TSMaterialList* mat_list = mDataBlock->mShape->materialList; if (mat_list) { for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++) @@ -433,7 +435,7 @@ bool afxModel::onAdd() } } - shape_inst = new TSShapeInstance(mDataBlock->shape); + shape_inst = new TSShapeInstance(mDataBlock->mShape); if (true) // isClientObject()) { @@ -442,7 +444,7 @@ bool afxModel::onAdd() // restore the material tags to original form if (mDataBlock->txr_tag_remappings.size() > 0) { - TSMaterialList* mat_list = mDataBlock->shape->materialList; + TSMaterialList* mat_list = mDataBlock->mShape->materialList; if (mat_list) { for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++) @@ -508,14 +510,14 @@ bool afxModel::onAdd() resetWorldBox(); - if (mDataBlock->shape) + if (mDataBlock->mShape) { // Scan out the collision hulls... static const String sCollisionStr( "collision-" ); - for (U32 i = 0; i < mDataBlock->shape->details.size(); i++) + for (U32 i = 0; i < mDataBlock->mShape->details.size(); i++) { - const String &name = mDataBlock->shape->names[mDataBlock->shape->details[i].nameIndex]; + const String &name = mDataBlock->mShape->names[mDataBlock->mShape->details[i].nameIndex]; if (name.compare( sCollisionStr, sCollisionStr.length(), String::NoCase ) == 0) { @@ -529,7 +531,7 @@ bool afxModel::onAdd() char buff[128]; dSprintf(buff, sizeof(buff), "LOS-%d", i + 1 + 8/*MaxCollisionShapes*/); - U32 los = mDataBlock->shape->findDetail(buff); + U32 los = mDataBlock->mShape->findDetail(buff); if (los == -1) mLOSDetails.last() = i; else @@ -540,9 +542,9 @@ bool afxModel::onAdd() // Snag any "unmatched" LOS details static const String sLOSStr( "LOS-" ); - for (U32 i = 0; i < mDataBlock->shape->details.size(); i++) + for (U32 i = 0; i < mDataBlock->mShape->details.size(); i++) { - const String &name = mDataBlock->shape->names[mDataBlock->shape->details[i].nameIndex]; + const String &name = mDataBlock->mShape->names[mDataBlock->mShape->details[i].nameIndex]; if (name.compare( sLOSStr, sLOSStr.length(), String::NoCase ) == 0) { diff --git a/Engine/source/afx/ce/afxModel.h b/Engine/source/afx/ce/afxModel.h index 931f89287..0d13692ef 100644 --- a/Engine/source/afx/ce/afxModel.h +++ b/Engine/source/afx/ce/afxModel.h @@ -27,6 +27,7 @@ #define _AFX_MODEL_H_ #include "renderInstance/renderPassManager.h" +#include "T3D/assets/ShapeAsset.h" class ParticleEmitterData; class ParticleEmitter; @@ -42,8 +43,11 @@ struct afxModelData : public GameBaseData { typedef GameBaseData Parent; - StringTableEntry shapeName; + DECLARE_SHAPEASSET(afxModelData, Shape, onShapeChanged); + DECLARE_SHAPEASSET_SETGET(afxModelData, Shape); + StringTableEntry sequence; + F32 seq_rate; F32 seq_offset; F32 alpha_mult; @@ -63,8 +67,6 @@ struct afxModelData : public GameBaseData StringTableEntry remap_txr_tags; - Resource shape; - bool overrideLightingOptions; bool receiveSunLight; bool receiveLMLighting; @@ -93,6 +95,9 @@ public: static void initPersistFields(); + void onShapeChanged() {} + void onSequenceChanged() {} + DECLARE_CONOBJECT(afxModelData); DECLARE_CATEGORY("AFX"); }; @@ -148,9 +153,9 @@ public: void setSequenceRateFactor(F32 factor); void setSortPriority(S8 priority) { sort_priority = priority; } - const char* getShapeFileName() const { return mDataBlock->shapeName; } + const char* getShapeFileName() const { return mDataBlock->getShape(); } void setVisibility(bool flag) { is_visible = flag; } - TSShape* getTSShape() { return mDataBlock->shape; } + TSShape* getTSShape() { return mDataBlock->getShapeResource(); } TSShapeInstance* getTSShapeInstance() { return shape_inst; } U32 setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans); diff --git a/Engine/source/afx/ce/afxStaticShape.cpp b/Engine/source/afx/ce/afxStaticShape.cpp index ffe731b55..4aad448f8 100644 --- a/Engine/source/afx/ce/afxStaticShape.cpp +++ b/Engine/source/afx/ce/afxStaticShape.cpp @@ -70,7 +70,7 @@ afxStaticShapeData::afxStaticShapeData(const afxStaticShapeData& other, bool tem void afxStaticShapeData::initPersistFields() { - addField("sequence", TypeFilename, myOffset(sequence), + addField("sequence", TypeString, myOffset(sequence), "An animation sequence in the StaticShape to play."); addField("ignoreSceneAmbient", TypeBool, myOffset(ignore_scene_amb), "..."); diff --git a/Engine/source/afx/ce/afxZodiac.cpp b/Engine/source/afx/ce/afxZodiac.cpp index 62f6996ae..eca56af5a 100644 --- a/Engine/source/afx/ce/afxZodiac.cpp +++ b/Engine/source/afx/ce/afxZodiac.cpp @@ -78,7 +78,8 @@ bool afxZodiacData::sPreferDestinationGradients = false; afxZodiacData::afxZodiacData() { - txr_name = ST_NULLSTRING; + INIT_IMAGEASSET(Texture); + radius_xy = 1; vert_range.set(0.0f, 0.0f); start_ang = 0; @@ -119,8 +120,8 @@ afxZodiacData::afxZodiacData() afxZodiacData::afxZodiacData(const afxZodiacData& other, bool temp_clone) : GameBaseData(other, temp_clone) { - txr_name = other.txr_name; - txr = other.txr; + CLONE_IMAGEASSET(Texture); + radius_xy = other.radius_xy; vert_range = other.vert_range; start_ang = other.start_ang; @@ -155,8 +156,7 @@ EndImplementEnumType; void afxZodiacData::initPersistFields() { - addField("texture", TypeFilename, Offset(txr_name, afxZodiacData), - "An image to use as the zodiac's texture."); + INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacData, "An image to use as the zodiac's texture."); addField("radius", TypeF32, Offset(radius_xy, afxZodiacData), "The zodiac's radius in scene units."); addField("verticalRange", TypePoint2F, Offset(vert_range, afxZodiacData), @@ -269,7 +269,7 @@ void afxZodiacData::packData(BitStream* stream) merge_zflags(); - stream->writeString(txr_name); + PACKDATA_IMAGEASSET(Texture); stream->write(radius_xy); stream->write(vert_range.x); stream->write(vert_range.y); @@ -294,8 +294,7 @@ void afxZodiacData::unpackData(BitStream* stream) { Parent::unpackData(stream); - txr_name = stream->readSTString(); - txr = GFXTexHandle(); + UNPACKDATA_IMAGEASSET(Texture); stream->read(&radius_xy); stream->read(&vert_range.x); stream->read(&vert_range.y); @@ -323,14 +322,6 @@ bool afxZodiacData::preload(bool server, String &errorStr) if (!Parent::preload(server, errorStr)) return false; - if (!server) - { - if (txr_name && txr_name[0] != '\0') - { - txr.set(txr_name, &AFX_GFXZodiacTextureProfile, "Zodiac Texture"); - } - } - if (vert_range.x == 0.0f && vert_range.y == 0.0f) vert_range.x = vert_range.y = radius_xy; @@ -349,11 +340,23 @@ void afxZodiacData::onStaticModified(const char* slot, const char* newValue) } void afxZodiacData::onPerformSubstitutions() -{ - if (txr_name && txr_name[0] != '\0') - { - txr.set(txr_name, &AFX_GFXZodiacTextureProfile, "Zodiac Texture"); - } +{ + if (mTextureAssetId != StringTable->EmptyString()) + { + mTextureAsset = mTextureAssetId; + if (mTextureAsset.notNull()) + { + if (getTexture() != StringTable->EmptyString() && mTextureName != StringTable->insert("texhandle")) + { + if (mTextureAsset.notNull()) + { + mTextureAsset->getChangedSignal().notify(this, &afxZodiacData::onImageChanged); + } + + mTexture.set(getTexture(), mTextureProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__)); + } + } + } } F32 afxZodiacData::calcRotationAngle(F32 elapsed, F32 rate_factor) diff --git a/Engine/source/afx/ce/afxZodiac.h b/Engine/source/afx/ce/afxZodiac.h index c6adb7625..d03fcf593 100644 --- a/Engine/source/afx/ce/afxZodiac.h +++ b/Engine/source/afx/ce/afxZodiac.h @@ -35,6 +35,8 @@ #include "console/typeValidators.h" +GFX_DeclareTextureProfile(AFX_GFXZodiacTextureProfile); + //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// // afxZodiacData @@ -54,9 +56,12 @@ public: static void convertGradientRangeFromDegrees(Point2F& gradrange, const Point2F& gradrange_deg); + void onImageChanged() {} + public: - StringTableEntry txr_name; - GFXTexHandle txr; + DECLARE_IMAGEASSET(afxZodiacData, Texture, onImageChanged, AFX_GFXZodiacTextureProfile); + DECLARE_IMAGEASSET_SETGET(afxZodiacData, Texture); + F32 radius_xy; Point2F vert_range; F32 start_ang; @@ -125,8 +130,6 @@ public: typedef afxZodiacData::BlendType afxZodiac_BlendType; DefineEnumType( afxZodiac_BlendType ); -GFX_DeclareTextureProfile(AFX_GFXZodiacTextureProfile); - //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #endif // _AFX_ZODIAC_H_ diff --git a/Engine/source/afx/ce/afxZodiacMgr.cpp b/Engine/source/afx/ce/afxZodiacMgr.cpp index abc8c38e2..fe9924128 100644 --- a/Engine/source/afx/ce/afxZodiacMgr.cpp +++ b/Engine/source/afx/ce/afxZodiacMgr.cpp @@ -61,7 +61,7 @@ void afxZodiacMgr::addTerrainZodiac(Point3F& pos, F32 radius, LinearColorF& colo z.color = color.toColorI(); z.angle = mDegToRad(angle); z.zflags = zode->zflags; - z.txr = &zode->txr; + z.txr = &zode->mTexture; z.distance_max = zode->distance_max*zode->distance_max; z.distance_falloff = zode->distance_falloff*zode->distance_falloff; @@ -84,7 +84,7 @@ void afxZodiacMgr::addInteriorZodiac(Point3F& pos, F32 radius, Point2F& vert_ran z.color = color.toColorI(); z.angle = mDegToRad(angle); z.zflags = zode->zflags; - z.txr = &zode->txr; + z.txr = &zode->mTexture; z.distance_max = zode->distance_max*zode->distance_max; z.distance_falloff = zode->distance_falloff*zode->distance_falloff; diff --git a/Engine/source/afx/ce/afxZodiacPlane.cpp b/Engine/source/afx/ce/afxZodiacPlane.cpp index 7af581f2f..aaea763e7 100644 --- a/Engine/source/afx/ce/afxZodiacPlane.cpp +++ b/Engine/source/afx/ce/afxZodiacPlane.cpp @@ -51,7 +51,8 @@ ConsoleDocClass( afxZodiacPlaneData, afxZodiacPlaneData::afxZodiacPlaneData() { - txr_name = ST_NULLSTRING; + INIT_IMAGEASSET(Texture); + radius_xy = 1; start_ang = 0; ang_per_sec = 0; @@ -70,8 +71,8 @@ afxZodiacPlaneData::afxZodiacPlaneData() afxZodiacPlaneData::afxZodiacPlaneData(const afxZodiacPlaneData& other, bool temp_clone) : GameBaseData(other, temp_clone) { - txr_name = other.txr_name; - txr = other.txr; + CLONE_IMAGEASSET(Texture); + radius_xy = other.radius_xy; start_ang = other.start_ang; ang_per_sec = other.ang_per_sec; @@ -110,8 +111,8 @@ EndImplementEnumType; void afxZodiacPlaneData::initPersistFields() { - addField("texture", TypeFilename, myOffset(txr_name), - "An image to use as the zodiac's texture."); + INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacPlaneData, "An image to use as the zodiac's texture."); + addField("radius", TypeF32, myOffset(radius_xy), "The zodiac's radius in scene units."); addField("startAngle", TypeF32, myOffset(start_ang), @@ -164,7 +165,8 @@ void afxZodiacPlaneData::packData(BitStream* stream) merge_zflags(); - stream->writeString(txr_name); + PACKDATA_IMAGEASSET(Texture); + stream->write(radius_xy); stream->write(start_ang); stream->write(ang_per_sec); @@ -182,8 +184,8 @@ void afxZodiacPlaneData::unpackData(BitStream* stream) { Parent::unpackData(stream); - txr_name = stream->readSTString(); - txr = GFXTexHandle(); + UNPACKDATA_IMAGEASSET(Texture); + stream->read(&radius_xy); stream->read(&start_ang); stream->read(&ang_per_sec); @@ -204,14 +206,6 @@ bool afxZodiacPlaneData::preload(bool server, String &errorStr) if (!Parent::preload(server, errorStr)) return false; - if (!server) - { - if (txr_name && txr_name[0] != '\0') - { - txr.set(txr_name, &AFX_GFXZodiacTextureProfile, "Zodiac Texture"); - } - } - return true; } diff --git a/Engine/source/afx/ce/afxZodiacPlane.h b/Engine/source/afx/ce/afxZodiacPlane.h index 05b7ad56f..e99702b4c 100644 --- a/Engine/source/afx/ce/afxZodiacPlane.h +++ b/Engine/source/afx/ce/afxZodiacPlane.h @@ -28,6 +28,10 @@ #include "afx/ce/afxZodiacDefs.h" +#ifndef _AFX_ZODIAC_H_ +#include "afx/ce/afxZodiac.h" +#endif + class afxZodiacPlaneData : public GameBaseData, public afxZodiacDefs { typedef GameBaseData Parent; @@ -52,9 +56,12 @@ public: FACES_BITS = 3 }; + void onImageChanged() {} + public: - StringTableEntry txr_name; - GFXTexHandle txr; + DECLARE_IMAGEASSET(afxZodiacPlaneData, Texture, onImageChanged, AFX_GFXZodiacTextureProfile); + DECLARE_IMAGEASSET_SETGET(afxZodiacPlaneData, Texture); + F32 radius_xy; F32 start_ang; F32 ang_per_sec; diff --git a/Engine/source/afx/ce/afxZodiacPlane_T3D.cpp b/Engine/source/afx/ce/afxZodiacPlane_T3D.cpp index 476f353c3..59ea81763 100644 --- a/Engine/source/afx/ce/afxZodiacPlane_T3D.cpp +++ b/Engine/source/afx/ce/afxZodiacPlane_T3D.cpp @@ -207,7 +207,7 @@ void afxZodiacPlane::_renderZodiacPlane(ObjectRenderInst *ri, SceneRenderState* GFXTransformSaver saver; GFX->multWorld(getRenderTransform()); - GFX->setTexture(0, mDataBlock->txr); + GFX->setTexture(0, mDataBlock->mTexture); PrimBuild::begin(GFXTriangleStrip, 4); { diff --git a/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript b/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript index 9c0b1691f..a798a9b1d 100644 --- a/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript +++ b/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript @@ -831,6 +831,11 @@ T3Dpre4ProjectImporter::genProcessor("LevelInfo", "accuTexture accuTextureAsset" T3Dpre4ProjectImporter::genProcessor("TSStatic", "shape shapeAsset shapeName shapeAsset"); T3Dpre4ProjectImporter::genProcessor("TSForestItemData", "shape shapeAsset shapeName shapeAsset shapeFile shapeAsset"); T3Dpre4ProjectImporter::genProcessor("TerrainBlock", "terrainFile terrainAsset"); +T3Dpre4ProjectImporter::genProcessor("afxMagicMissileData", "projectileShapeName projectileShapeAsset"); +T3Dpre4ProjectImporter::genProcessor("afxBillboardData", "texture textureAsset"); +T3Dpre4ProjectImporter::genProcessor("afxModelData", "shapeName shapeAsset shapeFile shapeAsset"); +T3Dpre4ProjectImporter::genProcessor("afxZodiacData", "texture textureAsset"); +T3Dpre4ProjectImporter::genProcessor("afxZodiacPlaneData", "texture textureAsset"); //============================================================================== // Levels //==============================================================================