Converts most of AFX classes to utilize assets

Adds modified classes to project importer convert logic
This commit is contained in:
Areloch 2021-08-22 02:15:14 -05:00
parent 1dafb3463e
commit 64b98b0c10
15 changed files with 137 additions and 118 deletions

View file

@ -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))
{