mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-03 04:20:30 +00:00
all DECLARE_IMAGEASSET refactored
This commit is contained in:
parent
24b374f545
commit
fa8110ce8f
44 changed files with 248 additions and 306 deletions
|
|
@ -264,7 +264,7 @@ void afxZodiacGroundPlaneRenderer::render(SceneRenderState* state)
|
|||
GFX->setShaderConstBuffer(shader_consts);
|
||||
|
||||
// set the texture
|
||||
GFX->setTexture(0, *zode->txr);
|
||||
GFX->setTexture(0, zode->txr);
|
||||
LinearColorF zode_color = (LinearColorF)zode->color;
|
||||
zode_color.alpha *= fadebias;
|
||||
shader_consts->set(color_sc, zode_color);
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ void afxZodiacMeshRoadRenderer::render(SceneRenderState* state)
|
|||
GFX->setShaderConstBuffer(shader_consts);
|
||||
|
||||
// set the texture
|
||||
GFX->setTexture(0, *zode->txr);
|
||||
GFX->setTexture(0, zode->txr);
|
||||
LinearColorF zode_color = (LinearColorF)zode->color;
|
||||
zode_color.alpha *= fadebias;
|
||||
shader_consts->set(color_sc, zode_color);
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ void afxZodiacPolysoupRenderer::render(SceneRenderState* state)
|
|||
GFX->setShaderConstBuffer(shader_consts);
|
||||
|
||||
// set the texture
|
||||
GFX->setTexture(0, *zode->txr);
|
||||
GFX->setTexture(0, zode->txr);
|
||||
LinearColorF zode_color = (LinearColorF)zode->color;
|
||||
zode_color.alpha *= fadebias;
|
||||
shader_consts->set(color_sc, zode_color);
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ void afxZodiacTerrainRenderer::render(SceneRenderState* state)
|
|||
GFX->setShaderConstBuffer(shader_consts);
|
||||
|
||||
// set the texture
|
||||
GFX->setTexture(0, *zode->txr);
|
||||
GFX->setTexture(0, zode->txr);
|
||||
LinearColorF zode_color = (LinearColorF)zode->color;
|
||||
zode_color.alpha *= fadebias;
|
||||
shader_consts->set(color_sc, zode_color);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ ConsoleDocClass( afxBillboardData,
|
|||
afxBillboardData::afxBillboardData()
|
||||
{
|
||||
color.set(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
INIT_ASSET(Texture);
|
||||
dimensions.set(1.0f, 1.0f);
|
||||
texCoords[0].set(0.0f, 0.0f);
|
||||
texCoords[1].set(0.0f, 1.0f);
|
||||
|
|
@ -66,7 +65,7 @@ afxBillboardData::afxBillboardData(const afxBillboardData& other, bool temp_clon
|
|||
: GameBaseData(other, temp_clone)
|
||||
{
|
||||
color = other.color;
|
||||
CLONE_ASSET(Texture);
|
||||
CLONE_ASSET_REFACTOR(Texture);
|
||||
dimensions = other.dimensions;
|
||||
texCoords[0] = other.texCoords[0];
|
||||
texCoords[1] = other.texCoords[1];
|
||||
|
|
@ -96,7 +95,7 @@ void afxBillboardData::initPersistFields()
|
|||
"The color assigned to the quadrangle geometry. The way it combines with the given "
|
||||
"texture varies according to the setting of the textureFunction field.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(Texture, afxBillboardData, "An image to use as the billboard's texture.");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(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 "
|
||||
|
|
@ -124,7 +123,7 @@ void afxBillboardData::packData(BitStream* stream)
|
|||
Parent::packData(stream);
|
||||
|
||||
stream->write(color);
|
||||
PACKDATA_ASSET(Texture);
|
||||
PACKDATA_ASSET_REFACTOR(Texture);
|
||||
|
||||
mathWrite(*stream, dimensions);
|
||||
mathWrite(*stream, texCoords[0]);
|
||||
|
|
@ -141,7 +140,7 @@ void afxBillboardData::unpackData(BitStream* stream)
|
|||
Parent::unpackData(stream);
|
||||
|
||||
stream->read(&color);
|
||||
UNPACKDATA_ASSET(Texture);
|
||||
UNPACKDATA_ASSET_REFACTOR(Texture);
|
||||
mathRead(*stream, &dimensions);
|
||||
mathRead(*stream, &texCoords[0]);
|
||||
mathRead(*stream, &texCoords[1]);
|
||||
|
|
|
|||
|
|
@ -47,8 +47,7 @@ public:
|
|||
};
|
||||
|
||||
public:
|
||||
DECLARE_IMAGEASSET(afxBillboardData, Texture, onChangeTexture, GFXStaticTextureSRGBProfile);
|
||||
DECLARE_ASSET_SETGET(afxBillboardData, Texture);
|
||||
DECLARE_IMAGEASSET_REFACTOR(afxBillboardData, Texture, GFXStaticTextureSRGBProfile)
|
||||
|
||||
|
||||
LinearColorF color;
|
||||
|
|
@ -71,8 +70,6 @@ public:
|
|||
|
||||
static void initPersistFields();
|
||||
|
||||
void onChangeTexture() {}
|
||||
|
||||
DECLARE_CONOBJECT(afxBillboardData);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ void afxBillboard::_renderBillboard(ObjectRenderInst *ri, SceneRenderState* stat
|
|||
GFXTransformSaver saver;
|
||||
GFX->multWorld(getRenderTransform());
|
||||
|
||||
GFX->setTexture(0, mDataBlock->mTexture);
|
||||
GFX->setTexture(0, mDataBlock->getTexture());
|
||||
|
||||
MatrixF worldmod = GFX->getWorldMatrix();
|
||||
MatrixF viewmod = GFX->getViewMatrix();
|
||||
|
|
|
|||
|
|
@ -78,8 +78,6 @@ bool afxZodiacData::sPreferDestinationGradients = false;
|
|||
|
||||
afxZodiacData::afxZodiacData()
|
||||
{
|
||||
INIT_ASSET(Texture);
|
||||
|
||||
radius_xy = 1;
|
||||
vert_range.set(0.0f, 0.0f);
|
||||
start_ang = 0;
|
||||
|
|
@ -120,7 +118,7 @@ afxZodiacData::afxZodiacData()
|
|||
|
||||
afxZodiacData::afxZodiacData(const afxZodiacData& other, bool temp_clone) : GameBaseData(other, temp_clone)
|
||||
{
|
||||
CLONE_ASSET(Texture);
|
||||
CLONE_ASSET_REFACTOR(Texture);
|
||||
|
||||
radius_xy = other.radius_xy;
|
||||
vert_range = other.vert_range;
|
||||
|
|
@ -157,7 +155,7 @@ EndImplementEnumType;
|
|||
void afxZodiacData::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacData, "An image to use as the zodiac's texture.");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(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),
|
||||
|
|
@ -270,7 +268,7 @@ void afxZodiacData::packData(BitStream* stream)
|
|||
|
||||
merge_zflags();
|
||||
|
||||
PACKDATA_ASSET(Texture);
|
||||
PACKDATA_ASSET_REFACTOR(Texture);
|
||||
stream->write(radius_xy);
|
||||
stream->write(vert_range.x);
|
||||
stream->write(vert_range.y);
|
||||
|
|
@ -295,7 +293,7 @@ void afxZodiacData::unpackData(BitStream* stream)
|
|||
{
|
||||
Parent::unpackData(stream);
|
||||
|
||||
UNPACKDATA_ASSET(Texture);
|
||||
UNPACKDATA_ASSET_REFACTOR(Texture);
|
||||
stream->read(&radius_xy);
|
||||
stream->read(&vert_range.x);
|
||||
stream->read(&vert_range.y);
|
||||
|
|
@ -342,16 +340,9 @@ void afxZodiacData::onStaticModified(const char* slot, const char* newValue)
|
|||
|
||||
void afxZodiacData::onPerformSubstitutions()
|
||||
{
|
||||
if (mTextureAssetId != StringTable->EmptyString())
|
||||
if (mTextureAsset.notNull())
|
||||
{
|
||||
mTextureAsset = mTextureAssetId;
|
||||
if (mTextureAsset.notNull())
|
||||
{
|
||||
if (getTexture() != StringTable->EmptyString() && mTextureName != StringTable->insert("texhandle"))
|
||||
{
|
||||
mTexture.set(getTexture(), mTextureProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__));
|
||||
}
|
||||
}
|
||||
getTexture();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,11 +56,8 @@ public:
|
|||
|
||||
static void convertGradientRangeFromDegrees(Point2F& gradrange, const Point2F& gradrange_deg);
|
||||
|
||||
void onImageChanged() {}
|
||||
|
||||
public:
|
||||
DECLARE_IMAGEASSET(afxZodiacData, Texture, onImageChanged, AFX_GFXZodiacTextureProfile);
|
||||
DECLARE_ASSET_SETGET(afxZodiacData, Texture);
|
||||
DECLARE_IMAGEASSET_REFACTOR(afxZodiacData, Texture, AFX_GFXZodiacTextureProfile)
|
||||
|
||||
F32 radius_xy;
|
||||
Point2F vert_range;
|
||||
|
|
|
|||
|
|
@ -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->mTexture;
|
||||
z.txr = zode->getTexture();
|
||||
|
||||
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->mTexture;
|
||||
z.txr = zode->getTexture();
|
||||
|
||||
z.distance_max = zode->distance_max*zode->distance_max;
|
||||
z.distance_falloff = zode->distance_falloff*zode->distance_falloff;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ private:
|
|||
ColorI color; // 4// color of zodiac
|
||||
F32 angle; // 4// angle in radians
|
||||
U32 zflags; // 4// 0=normal,1=additive,2=subtractive
|
||||
GFXTexHandle* txr; // 4// zodiac texture
|
||||
GFXTexHandle txr; // 4// zodiac texture
|
||||
|
||||
F32 distance_max;
|
||||
F32 distance_falloff;
|
||||
|
|
|
|||
|
|
@ -51,8 +51,6 @@ ConsoleDocClass( afxZodiacPlaneData,
|
|||
|
||||
afxZodiacPlaneData::afxZodiacPlaneData()
|
||||
{
|
||||
INIT_ASSET(Texture);
|
||||
|
||||
radius_xy = 1;
|
||||
start_ang = 0;
|
||||
ang_per_sec = 0;
|
||||
|
|
@ -71,7 +69,7 @@ afxZodiacPlaneData::afxZodiacPlaneData()
|
|||
afxZodiacPlaneData::afxZodiacPlaneData(const afxZodiacPlaneData& other, bool temp_clone)
|
||||
: GameBaseData(other, temp_clone)
|
||||
{
|
||||
CLONE_ASSET(Texture);
|
||||
CLONE_ASSET_REFACTOR(Texture);
|
||||
|
||||
radius_xy = other.radius_xy;
|
||||
start_ang = other.start_ang;
|
||||
|
|
@ -112,7 +110,7 @@ EndImplementEnumType;
|
|||
void afxZodiacPlaneData::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacPlaneData, "An image to use as the zodiac's texture.");
|
||||
INITPERSISTFIELD_IMAGEASSET_REFACTOR(Texture, afxZodiacPlaneData, "An image to use as the zodiac's texture.");
|
||||
|
||||
addField("radius", TypeF32, myOffset(radius_xy),
|
||||
"The zodiac's radius in scene units.");
|
||||
|
|
@ -166,7 +164,7 @@ void afxZodiacPlaneData::packData(BitStream* stream)
|
|||
|
||||
merge_zflags();
|
||||
|
||||
PACKDATA_ASSET(Texture);
|
||||
PACKDATA_ASSET_REFACTOR(Texture);
|
||||
|
||||
stream->write(radius_xy);
|
||||
stream->write(start_ang);
|
||||
|
|
@ -185,7 +183,7 @@ void afxZodiacPlaneData::unpackData(BitStream* stream)
|
|||
{
|
||||
Parent::unpackData(stream);
|
||||
|
||||
UNPACKDATA_ASSET(Texture);
|
||||
UNPACKDATA_ASSET_REFACTOR(Texture);
|
||||
|
||||
stream->read(&radius_xy);
|
||||
stream->read(&start_ang);
|
||||
|
|
|
|||
|
|
@ -56,11 +56,8 @@ public:
|
|||
FACES_BITS = 3
|
||||
};
|
||||
|
||||
void onImageChanged() {}
|
||||
|
||||
public:
|
||||
DECLARE_IMAGEASSET(afxZodiacPlaneData, Texture, onImageChanged, AFX_GFXZodiacTextureProfile);
|
||||
DECLARE_ASSET_SETGET(afxZodiacPlaneData, Texture);
|
||||
DECLARE_IMAGEASSET_REFACTOR(afxZodiacPlaneData, Texture, AFX_GFXZodiacTextureProfile)
|
||||
|
||||
F32 radius_xy;
|
||||
F32 start_ang;
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ void afxZodiacPlane::_renderZodiacPlane(ObjectRenderInst *ri, SceneRenderState*
|
|||
GFXTransformSaver saver;
|
||||
GFX->multWorld(getRenderTransform());
|
||||
|
||||
GFX->setTexture(0, mDataBlock->mTexture);
|
||||
GFX->setTexture(0, mDataBlock->getTexture());
|
||||
|
||||
PrimBuild::begin(GFXTriangleStrip, 4);
|
||||
{
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ void afxParticlePool::pool_renderObject_Normal(RenderPassManager *renderManager,
|
|||
if (main_emitter_data->textureHandle)
|
||||
ri->diffuseTex = &*(main_emitter_data->textureHandle);
|
||||
else
|
||||
ri->diffuseTex = &*(main_emitter_data->particleDataBlocks[0]->getTextureResource());
|
||||
ri->diffuseTex = &*(main_emitter_data->particleDataBlocks[0]->getTexture());
|
||||
|
||||
ri->softnessDistance = main_emitter_data->softnessDistance;
|
||||
|
||||
|
|
@ -277,7 +277,7 @@ void afxParticlePool::pool_renderObject_TwoPass(RenderPassManager *renderManager
|
|||
//if (main_emitter_data->textureHandle)
|
||||
// ri->diffuseTex = &*(main_emitter_data->textureHandle);
|
||||
//else
|
||||
ri->diffuseTex = &*(main_emitter_data->particleDataBlocks[0]->getTextureExtResource());
|
||||
ri->diffuseTex = &*(main_emitter_data->particleDataBlocks[0]->getTextureExt());
|
||||
|
||||
F32 save_sort_dist = ri->sortDistSq;
|
||||
|
||||
|
|
@ -481,7 +481,7 @@ void afxParticlePool::pool_renderObject_TwoPass(RenderPassManager *renderManager
|
|||
if (main_emitter_data->textureHandle)
|
||||
ri->diffuseTex = &*(main_emitter_data->textureHandle);
|
||||
else
|
||||
ri->diffuseTex = &*(main_emitter_data->particleDataBlocks[0]->getTextureResource());
|
||||
ri->diffuseTex = &*(main_emitter_data->particleDataBlocks[0]->getTexture());
|
||||
|
||||
ri->softnessDistance = main_emitter_data->softnessDistance;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue