mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 07:34:45 +00:00
Updates ImageAsset usage to utilize AssetRef, and standardizes the setter/getter functions and naming conventions, as well as the ability to use and bind named targets.
This commit is contained in:
parent
a858d8624e
commit
34e3f78a22
82 changed files with 1451 additions and 951 deletions
|
|
@ -65,7 +65,7 @@ afxBillboardData::afxBillboardData(const afxBillboardData& other, bool temp_clon
|
|||
: GameBaseData(other, temp_clone)
|
||||
{
|
||||
color = other.color;
|
||||
CLONE_ASSET_REFACTOR(Texture);
|
||||
mTextureAssetRef = other.mTextureAssetRef;
|
||||
dimensions = other.dimensions;
|
||||
texCoords[0] = other.texCoords[0];
|
||||
texCoords[1] = other.texCoords[1];
|
||||
|
|
@ -95,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.");
|
||||
addField("textureAsset", TypeImageAssetRef, Offset(mTextureAssetRef, afxBillboardData), "An image asset 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 "
|
||||
|
|
@ -123,7 +123,7 @@ void afxBillboardData::packData(BitStream* stream)
|
|||
Parent::packData(stream);
|
||||
|
||||
stream->write(color);
|
||||
PACKDATA_ASSET_REFACTOR(Texture);
|
||||
AssetDatabase.packDataAsset(stream, mTextureAssetRef.assetId);
|
||||
|
||||
mathWrite(*stream, dimensions);
|
||||
mathWrite(*stream, texCoords[0]);
|
||||
|
|
@ -140,7 +140,7 @@ void afxBillboardData::unpackData(BitStream* stream)
|
|||
Parent::unpackData(stream);
|
||||
|
||||
stream->read(&color);
|
||||
UNPACKDATA_ASSET_REFACTOR(Texture);
|
||||
mTextureAssetRef = AssetDatabase.unpackDataAsset(stream);
|
||||
mathRead(*stream, &dimensions);
|
||||
mathRead(*stream, &texCoords[0]);
|
||||
mathRead(*stream, &texCoords[1]);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#define _AFX_BILLBOARD_H_
|
||||
|
||||
#include "afx/afxEffectDefs.h"
|
||||
#include "T3D/assets/ImageAsset.h"
|
||||
|
||||
#define BLEND_UNDEFINED GFXBlend_COUNT
|
||||
|
||||
|
|
@ -47,7 +48,9 @@ public:
|
|||
};
|
||||
|
||||
public:
|
||||
DECLARE_IMAGEASSET(afxBillboardData, Texture, GFXStaticTextureSRGBProfile)
|
||||
AssetRef<ImageAsset> mTextureAssetRef;
|
||||
|
||||
GFXTexHandle getTexture() { return mTextureAssetRef.notNull() ? mTextureAssetRef.assetPtr->getTexture(&GFXStaticTextureSRGBProfile) : NULL; }
|
||||
|
||||
|
||||
LinearColorF color;
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ afxZodiacData::afxZodiacData()
|
|||
|
||||
afxZodiacData::afxZodiacData(const afxZodiacData& other, bool temp_clone) : GameBaseData(other, temp_clone)
|
||||
{
|
||||
CLONE_ASSET_REFACTOR(Texture);
|
||||
mTextureAssetRef = other.mTextureAssetRef;
|
||||
|
||||
radius_xy = other.radius_xy;
|
||||
vert_range = other.vert_range;
|
||||
|
|
@ -155,7 +155,7 @@ EndImplementEnumType;
|
|||
void afxZodiacData::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacData, "An image to use as the zodiac's texture.");
|
||||
addField("textureAsset", TypeImageAssetRef, Offset(mTextureAssetRef, afxZodiacData), "An image asset 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),
|
||||
|
|
@ -268,7 +268,7 @@ void afxZodiacData::packData(BitStream* stream)
|
|||
|
||||
merge_zflags();
|
||||
|
||||
PACKDATA_ASSET_REFACTOR(Texture);
|
||||
AssetDatabase.packDataAsset(stream, mTextureAssetRef.assetId);
|
||||
stream->write(radius_xy);
|
||||
stream->write(vert_range.x);
|
||||
stream->write(vert_range.y);
|
||||
|
|
@ -293,7 +293,7 @@ void afxZodiacData::unpackData(BitStream* stream)
|
|||
{
|
||||
Parent::unpackData(stream);
|
||||
|
||||
UNPACKDATA_ASSET_REFACTOR(Texture);
|
||||
mTextureAssetRef = AssetDatabase.unpackDataAsset(stream);
|
||||
stream->read(&radius_xy);
|
||||
stream->read(&vert_range.x);
|
||||
stream->read(&vert_range.y);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#endif
|
||||
|
||||
#include "console/typeValidators.h"
|
||||
#include "T3D/assets/ImageAsset.h"
|
||||
|
||||
GFX_DeclareTextureProfile(AFX_GFXZodiacTextureProfile);
|
||||
|
||||
|
|
@ -57,7 +58,9 @@ public:
|
|||
static void convertGradientRangeFromDegrees(Point2F& gradrange, const Point2F& gradrange_deg);
|
||||
|
||||
public:
|
||||
DECLARE_IMAGEASSET(afxZodiacData, Texture, AFX_GFXZodiacTextureProfile)
|
||||
AssetRef<ImageAsset> mTextureAssetRef;
|
||||
|
||||
GFXTexHandle getTexture() { return mTextureAssetRef.notNull() ? mTextureAssetRef.assetPtr->getTexture(&AFX_GFXZodiacTextureProfile) : NULL; }
|
||||
|
||||
F32 radius_xy;
|
||||
Point2F vert_range;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ afxZodiacPlaneData::afxZodiacPlaneData()
|
|||
afxZodiacPlaneData::afxZodiacPlaneData(const afxZodiacPlaneData& other, bool temp_clone)
|
||||
: GameBaseData(other, temp_clone)
|
||||
{
|
||||
CLONE_ASSET_REFACTOR(Texture);
|
||||
mTextureAssetRef = other.mTextureAssetRef;
|
||||
|
||||
radius_xy = other.radius_xy;
|
||||
start_ang = other.start_ang;
|
||||
|
|
@ -110,7 +110,7 @@ EndImplementEnumType;
|
|||
void afxZodiacPlaneData::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
INITPERSISTFIELD_IMAGEASSET(Texture, afxZodiacPlaneData, "An image to use as the zodiac's texture.");
|
||||
addField("textureAsset", TypeImageAssetRef, Offset(mTextureAssetRef, afxZodiacPlaneData), "An image asset to use as the zodiac's texture.");
|
||||
|
||||
addFieldV("radius", TypeRangedF32, myOffset(radius_xy), &CommonValidators::PositiveFloat,
|
||||
"The zodiac's radius in scene units.");
|
||||
|
|
@ -164,7 +164,7 @@ void afxZodiacPlaneData::packData(BitStream* stream)
|
|||
|
||||
merge_zflags();
|
||||
|
||||
PACKDATA_ASSET_REFACTOR(Texture);
|
||||
AssetDatabase.packDataAsset(stream, mTextureAssetRef.assetId);
|
||||
|
||||
stream->write(radius_xy);
|
||||
stream->write(start_ang);
|
||||
|
|
@ -183,7 +183,7 @@ void afxZodiacPlaneData::unpackData(BitStream* stream)
|
|||
{
|
||||
Parent::unpackData(stream);
|
||||
|
||||
UNPACKDATA_ASSET_REFACTOR(Texture);
|
||||
mTextureAssetRef = AssetDatabase.unpackDataAsset(stream);
|
||||
|
||||
stream->read(&radius_xy);
|
||||
stream->read(&start_ang);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,9 @@ public:
|
|||
};
|
||||
|
||||
public:
|
||||
DECLARE_IMAGEASSET(afxZodiacPlaneData, Texture, AFX_GFXZodiacTextureProfile)
|
||||
AssetRef<ImageAsset> mTextureAssetRef;
|
||||
|
||||
GFXTexHandle getTexture() { return mTextureAssetRef.notNull() ? mTextureAssetRef.assetPtr->getTexture(&AFX_GFXZodiacTextureProfile) : NULL; }
|
||||
|
||||
F32 radius_xy;
|
||||
F32 start_ang;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue