mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
Converts all game, gui editor, and system classes to utilize assets
Processed core, tools and default modules to utilize assets Converted all console types that were string based, such as TypeImageFilename to utilize const char*/the string table, which avoids a lot of type swapping shenanigans and avoids string corruption Removed unneeded MainEditor mockup module Removed some unused/duplicate image assets from the tools
This commit is contained in:
parent
83b0432283
commit
5525f8ecdd
1708 changed files with 19619 additions and 4596 deletions
|
|
@ -38,6 +38,8 @@
|
|||
#include "lighting/lightInfo.h"
|
||||
#include "math/mathIO.h"
|
||||
|
||||
#include "sim/netConnection.h"
|
||||
|
||||
ConsoleDocClass( CloudLayer,
|
||||
"@brief A layer of clouds which change shape over time and are affected by scene lighting.\n\n"
|
||||
|
||||
|
|
@ -110,6 +112,8 @@ CloudLayer::CloudLayer()
|
|||
mTexOffset[0] = mTexOffset[1] = mTexOffset[2] = Point2F::Zero;
|
||||
|
||||
mHeight = 4.0f;
|
||||
|
||||
INIT_IMAGEASSET(Texture);
|
||||
}
|
||||
|
||||
IMPLEMENT_CO_NETOBJECT_V1( CloudLayer );
|
||||
|
|
@ -127,9 +131,10 @@ bool CloudLayer::onAdd()
|
|||
|
||||
addToScene();
|
||||
|
||||
LOAD_IMAGEASSET(Texture);
|
||||
|
||||
if ( isClientObject() )
|
||||
{
|
||||
_initTexture();
|
||||
_initBuffers();
|
||||
|
||||
// Find ShaderData
|
||||
|
|
@ -186,11 +191,10 @@ void CloudLayer::onRemove()
|
|||
|
||||
void CloudLayer::initPersistFields()
|
||||
{
|
||||
addGroup( "CloudLayer" );
|
||||
|
||||
addField( "texture", TypeImageFilename, Offset( mTextureName, CloudLayer ),
|
||||
"An RGBA texture which should contain normals and opacity (density)." );
|
||||
addGroup( "CloudLayer" );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET(Texture, CloudLayer, "An RGBA texture which should contain normals and opacity (density).");
|
||||
|
||||
addArray( "Textures", TEX_COUNT );
|
||||
|
||||
addField( "texScale", TypeF32, Offset( mTexScale, CloudLayer ), TEX_COUNT,
|
||||
|
|
@ -238,7 +242,7 @@ U32 CloudLayer::packUpdate( NetConnection *conn, U32 mask, BitStream *stream )
|
|||
{
|
||||
U32 retMask = Parent::packUpdate( conn, mask, stream );
|
||||
|
||||
stream->write( mTextureName );
|
||||
PACK_IMAGEASSET(conn, Texture);
|
||||
|
||||
for ( U32 i = 0; i < TEX_COUNT; i++ )
|
||||
{
|
||||
|
|
@ -260,8 +264,10 @@ void CloudLayer::unpackUpdate( NetConnection *conn, BitStream *stream )
|
|||
{
|
||||
Parent::unpackUpdate( conn, stream );
|
||||
|
||||
String oldTextureName = mTextureName;
|
||||
stream->read( &mTextureName );
|
||||
UNPACK_IMAGEASSET(conn, Texture);
|
||||
|
||||
if(mTextureAssetId != StringTable->EmptyString())
|
||||
mTextureAsset = mTextureAssetId;
|
||||
|
||||
for ( U32 i = 0; i < TEX_COUNT; i++ )
|
||||
{
|
||||
|
|
@ -283,8 +289,6 @@ void CloudLayer::unpackUpdate( NetConnection *conn, BitStream *stream )
|
|||
|
||||
if ( isProperlyAdded() )
|
||||
{
|
||||
if ( ( oldTextureName != mTextureName ) || ( ( oldCoverage == 0.0f ) != ( mCoverage == 0.0f ) ) )
|
||||
_initTexture();
|
||||
if ( oldHeight != mHeight )
|
||||
_initBuffers();
|
||||
}
|
||||
|
|
@ -330,6 +334,9 @@ void CloudLayer::renderObject( ObjectRenderInst *ri, SceneRenderState *state, Ba
|
|||
{
|
||||
GFXTransformSaver saver;
|
||||
|
||||
if (!mTextureAsset || !mTextureAsset->isAssetValid())
|
||||
return;
|
||||
|
||||
const Point3F &camPos = state->getCameraPosition();
|
||||
MatrixF xfm(true);
|
||||
xfm.setPosition(camPos);
|
||||
|
|
@ -378,7 +385,7 @@ void CloudLayer::renderObject( ObjectRenderInst *ri, SceneRenderState *state, Ba
|
|||
|
||||
mShaderConsts->setSafe( mExposureSC, mExposure );
|
||||
|
||||
GFX->setTexture( mNormalHeightMapSC->getSamplerRegister(), mTexture );
|
||||
GFX->setTexture( mNormalHeightMapSC->getSamplerRegister(), getTextureResource());
|
||||
GFX->setVertexBuffer( mVB );
|
||||
GFX->setPrimitiveBuffer( mPB );
|
||||
|
||||
|
|
@ -389,21 +396,6 @@ void CloudLayer::renderObject( ObjectRenderInst *ri, SceneRenderState *state, Ba
|
|||
// CloudLayer Internal Methods....
|
||||
|
||||
|
||||
void CloudLayer::_initTexture()
|
||||
{
|
||||
if ( mCoverage <= 0.0f )
|
||||
{
|
||||
mTexture = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mTextureName.isNotEmpty() )
|
||||
mTexture.set( mTextureName, &GFXNormalMapProfile, "CloudLayer" );
|
||||
|
||||
if ( mTexture.isNull() )
|
||||
mTexture.set( GFXTextureManager::getWarningTexturePath(), &GFXNormalMapProfile, "CloudLayer" );
|
||||
}
|
||||
|
||||
void CloudLayer::_initBuffers()
|
||||
{
|
||||
// Vertex Buffer...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue