|
@@ -112,8 +112,6 @@ CloudLayer::CloudLayer()
|
|
mTexOffset[0] = mTexOffset[1] = mTexOffset[2] = Point2F::Zero;
|
|
mTexOffset[0] = mTexOffset[1] = mTexOffset[2] = Point2F::Zero;
|
|
|
|
|
|
mHeight = 4.0f;
|
|
mHeight = 4.0f;
|
|
-
|
|
|
|
- INIT_ASSET(Texture);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
IMPLEMENT_CO_NETOBJECT_V1( CloudLayer );
|
|
IMPLEMENT_CO_NETOBJECT_V1( CloudLayer );
|
|
@@ -131,8 +129,6 @@ bool CloudLayer::onAdd()
|
|
|
|
|
|
addToScene();
|
|
addToScene();
|
|
|
|
|
|
- LOAD_IMAGEASSET(Texture);
|
|
|
|
-
|
|
|
|
if ( isClientObject() )
|
|
if ( isClientObject() )
|
|
{
|
|
{
|
|
_initBuffers();
|
|
_initBuffers();
|
|
@@ -194,8 +190,8 @@ void CloudLayer::initPersistFields()
|
|
docsURL;
|
|
docsURL;
|
|
addGroup( "CloudLayer" );
|
|
addGroup( "CloudLayer" );
|
|
|
|
|
|
- INITPERSISTFIELD_IMAGEASSET(Texture, CloudLayer, "An RGBA texture which should contain normals and opacity (density).");
|
|
|
|
-
|
|
|
|
|
|
+ INITPERSISTFIELD_IMAGEASSET_REFACTOR(Texture, CloudLayer, "An RGBA texture which should contain normals and opacity (density).")
|
|
|
|
+
|
|
addArray( "Textures", TEX_COUNT );
|
|
addArray( "Textures", TEX_COUNT );
|
|
|
|
|
|
addField( "texScale", TypeF32, Offset( mTexScale, CloudLayer ), TEX_COUNT,
|
|
addField( "texScale", TypeF32, Offset( mTexScale, CloudLayer ), TEX_COUNT,
|
|
@@ -243,7 +239,9 @@ U32 CloudLayer::packUpdate( NetConnection *conn, U32 mask, BitStream *stream )
|
|
{
|
|
{
|
|
U32 retMask = Parent::packUpdate( conn, mask, stream );
|
|
U32 retMask = Parent::packUpdate( conn, mask, stream );
|
|
|
|
|
|
- PACK_ASSET(conn, Texture);
|
|
|
|
|
|
+ if (stream->writeFlag(mTextureAsset.notNull())) {
|
|
|
|
+ NetStringHandle assetIdStr = mTextureAsset.getAssetId(); conn->packNetStringHandleU(stream, assetIdStr);
|
|
|
|
+ }
|
|
|
|
|
|
for ( U32 i = 0; i < TEX_COUNT; i++ )
|
|
for ( U32 i = 0; i < TEX_COUNT; i++ )
|
|
{
|
|
{
|
|
@@ -265,10 +263,9 @@ void CloudLayer::unpackUpdate( NetConnection *conn, BitStream *stream )
|
|
{
|
|
{
|
|
Parent::unpackUpdate( conn, stream );
|
|
Parent::unpackUpdate( conn, stream );
|
|
|
|
|
|
- UNPACK_ASSET(conn, Texture);
|
|
|
|
-
|
|
|
|
- if(mTextureAssetId != StringTable->EmptyString())
|
|
|
|
- mTextureAsset = mTextureAssetId;
|
|
|
|
|
|
+ if (stream->readFlag()) {
|
|
|
|
+ mTextureAsset.setAssetId(_getStringTable()->insert(conn->unpackNetStringHandleU(stream).getString()));
|
|
|
|
+ }
|
|
|
|
|
|
for ( U32 i = 0; i < TEX_COUNT; i++ )
|
|
for ( U32 i = 0; i < TEX_COUNT; i++ )
|
|
{
|
|
{
|
|
@@ -334,7 +331,7 @@ void CloudLayer::renderObject( ObjectRenderInst *ri, SceneRenderState *state, Ba
|
|
{
|
|
{
|
|
GFXTransformSaver saver;
|
|
GFXTransformSaver saver;
|
|
|
|
|
|
- if (!mTextureAsset || !mTextureAsset->isAssetValid())
|
|
|
|
|
|
+ if (!mTextureAsset)
|
|
return;
|
|
return;
|
|
|
|
|
|
const Point3F &camPos = state->getCameraPosition();
|
|
const Point3F &camPos = state->getCameraPosition();
|
|
@@ -385,7 +382,7 @@ void CloudLayer::renderObject( ObjectRenderInst *ri, SceneRenderState *state, Ba
|
|
|
|
|
|
mShaderConsts->setSafe( mExposureSC, mExposure );
|
|
mShaderConsts->setSafe( mExposureSC, mExposure );
|
|
|
|
|
|
- GFX->setTexture( mNormalHeightMapSC->getSamplerRegister(), getTextureResource());
|
|
|
|
|
|
+ GFX->setTexture( mNormalHeightMapSC->getSamplerRegister(), mTextureAsset->getTexture(&GFXStaticTextureSRGBProfile));
|
|
GFX->setVertexBuffer( mVB );
|
|
GFX->setVertexBuffer( mVB );
|
|
GFX->setPrimitiveBuffer( mPB );
|
|
GFX->setPrimitiveBuffer( mPB );
|
|
|
|
|