2012-09-19 15:15:01 +00:00
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
2017-07-26 21:05:04 +00:00
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
// Copyright (C) 2015 Faust Logic, Inc.
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
2012-09-19 15:15:01 +00:00
# include "platform/platform.h"
# include "T3D/tsStatic.h"
# include "core/resourceManager.h"
# include "core/stream/bitStream.h"
# include "scene/sceneRenderState.h"
# include "scene/sceneManager.h"
# include "scene/sceneObjectLightingPlugin.h"
# include "lighting/lightManager.h"
# include "math/mathIO.h"
# include "ts/tsShapeInstance.h"
# include "ts/tsMaterialList.h"
# include "console/consoleTypes.h"
# include "T3D/shapeBase.h"
# include "sim/netConnection.h"
# include "gfx/gfxDevice.h"
# include "gfx/gfxTransformSaver.h"
# include "ts/tsRenderState.h"
# include "collision/boxConvex.h"
# include "T3D/physics/physicsPlugin.h"
# include "T3D/physics/physicsBody.h"
# include "T3D/physics/physicsCollision.h"
# include "materials/materialDefinition.h"
# include "materials/materialManager.h"
# include "materials/matInstance.h"
# include "materials/materialFeatureData.h"
# include "materials/materialFeatureTypes.h"
# include "console/engineAPI.h"
2014-12-21 20:07:42 +00:00
# include "T3D/accumulationVolume.h"
2021-11-04 02:15:00 +00:00
# include "math/mTransform.h"
2012-09-19 15:15:01 +00:00
2019-11-18 09:30:04 +00:00
# include "gui/editor/inspector/group.h"
2020-07-04 03:58:27 +00:00
# include "console/typeValidators.h"
2013-07-28 17:55:52 +00:00
using namespace Torque ;
2012-09-19 15:15:01 +00:00
extern bool gEditingMission ;
2018-01-23 22:03:18 +00:00
# ifdef TORQUE_AFX_ENABLED
2017-07-26 21:05:04 +00:00
# include "afx/ce/afxZodiacMgr.h"
2018-01-23 22:03:18 +00:00
# endif
2017-07-26 21:05:04 +00:00
2012-09-19 15:15:01 +00:00
IMPLEMENT_CO_NETOBJECT_V1 ( TSStatic ) ;
2020-04-15 17:15:12 +00:00
ConsoleDocClass ( TSStatic ,
2012-09-19 15:15:01 +00:00
" @brief A static object derived from a 3D model file and placed within the game world. \n \n "
" TSStatic is the most basic 3D shape in Torque. Unlike StaticShape it doesn't make use of "
" a datablock. It derrives directly from SceneObject. This makes TSStatic extremely light "
" weight, which is why the Tools use this class when you want to drop in a DTS or DAE object. \n \n "
" While a TSStatic doesn't provide any motion -- it stays were you initally put it -- it does allow for "
" a single ambient animation sequence to play when the object is first added to the scene. \n \n "
" @tsexample \n "
2020-04-15 17:15:12 +00:00
" new TSStatic(Team1Base) { \n "
" shapeName = \" art/shapes/desertStructures/station01.dts \" ; \n "
" playAmbient = \" 1 \" ; \n "
" receiveSunLight = \" 1 \" ; \n "
" receiveLMLighting = \" 1 \" ; \n "
" useCustomAmbientLighting = \" 0 \" ; \n "
" customAmbientLighting = \" 0 0 0 1 \" ; \n "
" collisionType = \" Visible Mesh \" ; \n "
" decalType = \" Collision Mesh \" ; \n "
" allowPlayerStep = \" 1 \" ; \n "
" renderNormals = \" 0 \" ; \n "
" forceDetail = \" -1 \" ; \n "
" position = \" 315.18 -180.418 244.313 \" ; \n "
" rotation = \" 0 0 1 195.952 \" ; \n "
" scale = \" 1 1 1 \" ; \n "
" isRenderEnabled = \" true \" ; \n "
" canSaveDynamicFields = \" 1 \" ; \n "
" }; \n "
2012-09-19 15:15:01 +00:00
" @endtsexample \n "
" @ingroup gameObjects \n "
) ;
2020-08-03 03:33:10 +00:00
bool TSStatic : : smUseStaticObjectFade = false ;
F32 TSStatic : : smStaticObjectFadeStart = 50 ;
F32 TSStatic : : smStaticObjectFadeEnd = 75 ;
F32 TSStatic : : smStaticObjectUnfadeableSize = 75 ;
2012-09-19 15:15:01 +00:00
TSStatic : : TSStatic ( )
2020-04-15 17:15:12 +00:00
:
cubeDescId ( 0 ) ,
reflectorDesc ( NULL )
2012-09-19 15:15:01 +00:00
{
mNetFlags . set ( Ghostable | ScopeAlways ) ;
mTypeMask | = StaticObjectType | StaticShapeObjectType ;
2020-04-15 17:15:12 +00:00
mShapeInstance = NULL ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
mPlayAmbient = true ;
mAmbientThread = NULL ;
2012-09-19 15:15:01 +00:00
2015-07-17 19:33:02 +00:00
mAllowPlayerStep = false ;
2012-09-19 15:15:01 +00:00
mConvexList = new Convex ;
mRenderNormalScalar = 0 ;
mForceDetail = - 1 ;
mMeshCulling = false ;
mUseOriginSort = false ;
2020-04-15 17:15:12 +00:00
mUseAlphaFade = false ;
mAlphaFadeStart = 100.0f ;
mAlphaFadeEnd = 150.0f ;
mInvertAlphaFade = false ;
2014-11-20 13:00:26 +00:00
mAlphaFade = 1.0f ;
2012-09-19 15:15:01 +00:00
mPhysicsRep = NULL ;
mCollisionType = CollisionMesh ;
mDecalType = CollisionMesh ;
2017-07-26 21:05:04 +00:00
mIgnoreZodiacs = false ;
mHasGradients = false ;
mInvertGradientRange = false ;
mGradientRangeUser . set ( 0.0f , 180.0f ) ;
2018-01-23 22:03:18 +00:00
# ifdef TORQUE_AFX_ENABLED
2017-07-26 21:05:04 +00:00
afxZodiacData : : convertGradientRangeFromDegrees ( mGradientRange , mGradientRangeUser ) ;
2018-01-23 22:03:18 +00:00
# endif
2020-06-13 17:08:01 +00:00
mAnimOffset = 0.0f ;
mAnimSpeed = 1.0f ;
2019-11-18 09:30:04 +00:00
2021-10-03 07:56:26 +00:00
INIT_ASSET ( Shape ) ;
2012-09-19 15:15:01 +00:00
}
TSStatic : : ~ TSStatic ( )
{
delete mConvexList ;
mConvexList = NULL ;
}
2020-04-15 17:15:12 +00:00
ImplementEnumType ( TSMeshType ,
2012-09-19 15:15:01 +00:00
" Type of mesh data available in a shape. \n "
2020-04-15 17:15:12 +00:00
" @ingroup gameObjects " )
{
TSStatic : : None , " None " , " No mesh data. "
} ,
2012-09-19 15:15:01 +00:00
{ TSStatic : : Bounds , " Bounds " , " Bounding box of the shape. " } ,
{ TSStatic : : CollisionMesh , " Collision Mesh " , " Specifically desingated \" collision \" meshes. " } ,
{ TSStatic : : VisibleMesh , " Visible Mesh " , " Rendered mesh polygons. " } ,
2020-04-15 17:15:12 +00:00
EndImplementEnumType ;
2012-09-19 15:15:01 +00:00
2020-06-13 17:08:01 +00:00
FRangeValidator percentValidator ( 0.0f , 1.0f ) ;
F32 AnimSpeedMax = 4.0f ;
FRangeValidator speedValidator ( 0.0f , AnimSpeedMax ) ;
2012-09-19 15:15:01 +00:00
void TSStatic : : initPersistFields ( )
{
2020-06-13 17:08:01 +00:00
addFieldV ( " AnimOffset " , TypeF32 , Offset ( mAnimOffset , TSStatic ) , & percentValidator ,
" Percent Animation Offset. " ) ;
addFieldV ( " AnimSpeed " , TypeF32 , Offset ( mAnimSpeed , TSStatic ) , & speedValidator ,
" Percent Animation Speed. " ) ;
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
addGroup ( " Shape " ) ;
2012-09-19 15:15:01 +00:00
2021-07-19 06:07:08 +00:00
INITPERSISTFIELD_SHAPEASSET ( Shape , TSStatic , " Model to use for this TSStatic " ) ;
2019-11-18 09:30:04 +00:00
2020-04-15 17:15:12 +00:00
addProtectedField ( " shapeName " , TypeShapeFilename , Offset ( mShapeName , TSStatic ) ,
2021-07-19 06:07:08 +00:00
& TSStatic : : _setShapeData , & defaultProtectedGetFn ,
" %Path and filename of the model file (.DTS, .DAE) to use for this TSStatic. Legacy field. Any loose files assigned here will attempt to be auto-imported in as an asset. " , AbstractClassRep : : FIELD_HideInInspectors ) ;
2012-09-19 15:15:01 +00:00
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
endGroup ( " Shape " ) ;
addGroup ( " Materials " ) ;
2020-04-15 17:15:12 +00:00
addProtectedField ( " skin " , TypeRealString , Offset ( mAppliedSkinName , TSStatic ) , & _setFieldSkin , & _getFieldSkin ,
2012-09-19 15:15:01 +00:00
" @brief The skin applied to the shape. \n \n "
" 'Skinning' the shape effectively renames the material targets, allowing "
" different materials to be used on different instances of the same model. \n \n "
" Any material targets that start with the old skin name have that part "
" of the name replaced with the new skin name. The initial old skin name is "
" \" base \" . For example, if a new skin of \" blue \" was applied to a model "
" that had material targets <i>base_body</i> and <i>face</i>, the new targets "
" would be <i>blue_body</i> and <i>face</i>. Note that <i>face</i> was not "
" renamed since it did not start with the old skin name of \" base \" . \n \n "
" To support models that do not use the default \" base \" naming convention, "
" you can also specify the part of the name to replace in the skin field "
" itself. For example, if a model had a material target called <i>shapemat</i>, "
" we could apply a new skin \" shape=blue \" , and the material target would be "
" renamed to <i>bluemat</i> (note \" shape \" has been replaced with \" blue \" ). \n \n "
" Multiple skin updates can also be applied at the same time by separating "
" them with a semicolon. For example: \" base=blue;face=happy_face \" . \n \n "
" Material targets are only renamed if an existing Material maps to that "
" name, or if there is a diffuse texture in the model folder with the same "
2020-04-15 17:15:12 +00:00
" name as the new target. \n \n " ) ;
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
endGroup ( " Materials " ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
addGroup ( " Rendering " ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
addField ( " playAmbient " , TypeBool , Offset ( mPlayAmbient , TSStatic ) ,
" Enables automatic playing of the animation sequence named \" ambient \" (if it exists) when the TSStatic is loaded. " ) ;
addField ( " meshCulling " , TypeBool , Offset ( mMeshCulling , TSStatic ) ,
" Enables detailed culling of meshes within the TSStatic. Should only be used "
" with large complex shapes like buildings which contain many submeshes. " ) ;
addField ( " originSort " , TypeBool , Offset ( mUseOriginSort , TSStatic ) ,
" Enables translucent sorting of the TSStatic by its origin instead of the bounds. " ) ;
2017-10-17 13:48:31 +00:00
2012-09-19 15:15:01 +00:00
endGroup ( " Rendering " ) ;
2020-04-15 17:15:12 +00:00
addGroup ( " Reflection " ) ;
addField ( " cubeReflectorDesc " , TypeRealString , Offset ( cubeDescName , TSStatic ) ,
" References a ReflectorDesc datablock that defines performance and quality properties for dynamic reflections. \n " ) ;
endGroup ( " Reflection " ) ;
2012-09-19 15:15:01 +00:00
addGroup ( " Collision " ) ;
2020-04-15 17:15:12 +00:00
addField ( " collisionType " , TypeTSMeshType , Offset ( mCollisionType , TSStatic ) ,
" The type of mesh data to use for collision queries. " ) ;
addField ( " decalType " , TypeTSMeshType , Offset ( mDecalType , TSStatic ) ,
" The type of mesh data used to clip decal polygons against. " ) ;
addField ( " allowPlayerStep " , TypeBool , Offset ( mAllowPlayerStep , TSStatic ) ,
" @brief Allow a Player to walk up sloping polygons in the TSStatic (based on the collisionType). \n \n "
" When set to false, the slightest bump will stop the player from walking on top of the object. \n " ) ;
2012-09-19 15:15:01 +00:00
endGroup ( " Collision " ) ;
2020-04-15 17:15:12 +00:00
addGroup ( " AlphaFade " ) ;
addField ( " alphaFadeEnable " , TypeBool , Offset ( mUseAlphaFade , TSStatic ) , " Turn on/off Alpha Fade " ) ;
addField ( " alphaFadeStart " , TypeF32 , Offset ( mAlphaFadeStart , TSStatic ) , " Distance of start Alpha Fade " ) ;
addField ( " alphaFadeEnd " , TypeF32 , Offset ( mAlphaFadeEnd , TSStatic ) , " Distance of end Alpha Fade " ) ;
addField ( " alphaFadeInverse " , TypeBool , Offset ( mInvertAlphaFade , TSStatic ) , " Invert Alpha Fade's Start & End Distance " ) ;
endGroup ( " AlphaFade " ) ;
2014-11-06 13:54:49 +00:00
2012-09-19 15:15:01 +00:00
addGroup ( " Debug " ) ;
2020-04-15 17:15:12 +00:00
addField ( " renderNormals " , TypeF32 , Offset ( mRenderNormalScalar , TSStatic ) ,
" Debug rendering mode shows the normals for each point in the TSStatic's mesh. " ) ;
addField ( " forceDetail " , TypeS32 , Offset ( mForceDetail , TSStatic ) ,
" Forces rendering to a particular detail level. " ) ;
2012-09-19 15:15:01 +00:00
endGroup ( " Debug " ) ;
2017-07-26 21:05:04 +00:00
addGroup ( " AFX " ) ;
2020-04-15 17:15:12 +00:00
addField ( " ignoreZodiacs " , TypeBool , Offset ( mIgnoreZodiacs , TSStatic ) ) ;
addField ( " useGradientRange " , TypeBool , Offset ( mHasGradients , TSStatic ) ) ;
addField ( " gradientRange " , TypePoint2F , Offset ( mGradientRangeUser , TSStatic ) ) ;
addField ( " invertGradientRange " , TypeBool , Offset ( mInvertGradientRange , TSStatic ) ) ;
2017-07-26 21:05:04 +00:00
endGroup ( " AFX " ) ;
2012-09-19 15:15:01 +00:00
Parent : : initPersistFields ( ) ;
}
2020-08-03 03:33:10 +00:00
void TSStatic : : consoleInit ( )
{
Parent : : consoleInit ( ) ;
// Vars for debug rendering while the RoadEditor is open, only used if smEditorOpen is true.
Con : : addVariable ( " $pref::useStaticObjectFade " , TypeBool , & TSStatic : : smUseStaticObjectFade , " Indicates if all statics should utilize the distance-based object fadeout logic. \n " ) ;
Con : : addVariable ( " $pref::staticObjectFadeStart " , TypeF32 , & TSStatic : : smStaticObjectFadeStart , " Distance at which static object fading begins if $pref::useStaticObjectFade is on. \n " ) ;
Con : : addVariable ( " $pref::staticObjectFadeEnd " , TypeF32 , & TSStatic : : smStaticObjectFadeEnd , " Distance at which static object fading should have fully faded if $pref::useStaticObjectFade is on. \n " ) ;
Con : : addVariable ( " $pref::staticObjectUnfadeableSize " , TypeF32 , & TSStatic : : smStaticObjectUnfadeableSize , " Size of object where if the bounds is at or bigger than this, it will be ignored in the $pref::useStaticObjectFade logic. Useful for very large, distance-important objects. \n " ) ;
}
2020-04-15 17:15:12 +00:00
bool TSStatic : : _setFieldSkin ( void * object , const char * index , const char * data )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
TSStatic * ts = static_cast < TSStatic * > ( object ) ;
if ( ts )
ts - > setSkinName ( data ) ;
2012-09-19 15:15:01 +00:00
return false ;
}
2020-04-15 17:15:12 +00:00
const char * TSStatic : : _getFieldSkin ( void * object , const char * data )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
TSStatic * ts = static_cast < TSStatic * > ( object ) ;
2012-09-19 15:15:01 +00:00
return ts ? ts - > mSkinNameHandle . getString ( ) : " " ;
}
void TSStatic : : inspectPostApply ( )
{
// Apply any transformations set in the editor
Parent : : inspectPostApply ( ) ;
2020-04-15 17:15:12 +00:00
if ( isServerObject ( ) )
2012-09-19 15:15:01 +00:00
{
2019-12-06 02:42:47 +00:00
setMaskBits ( - 1 ) ;
2012-09-19 15:15:01 +00:00
prepCollision ( ) ;
}
_updateShouldTick ( ) ;
}
bool TSStatic : : onAdd ( )
{
PROFILE_SCOPE ( TSStatic_onAdd ) ;
2020-04-15 17:15:12 +00:00
if ( isServerObject ( ) )
2012-09-19 15:15:01 +00:00
{
// Handle the old "usePolysoup" field
SimFieldDictionary * fieldDict = getFieldDictionary ( ) ;
2020-04-15 17:15:12 +00:00
if ( fieldDict )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
StringTableEntry slotName = StringTable - > insert ( " usePolysoup " ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
SimFieldDictionary : : Entry * entry = fieldDict - > findDynamicField ( slotName ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( entry )
2012-09-19 15:15:01 +00:00
{
// Was "usePolysoup" set?
2020-04-15 17:15:12 +00:00
bool usePolysoup = dAtob ( entry - > value ) ;
2012-09-19 15:15:01 +00:00
// "usePolysoup" maps to the new VisibleMesh type
2020-04-15 17:15:12 +00:00
if ( usePolysoup )
2012-09-19 15:15:01 +00:00
mCollisionType = VisibleMesh ;
// Remove the field in favor on the new "collisionType" field
2020-04-15 17:15:12 +00:00
fieldDict - > setFieldValue ( slotName , " " ) ;
2012-09-19 15:15:01 +00:00
}
}
}
2020-04-15 17:15:12 +00:00
if ( ! Parent : : onAdd ( ) )
2012-09-19 15:15:01 +00:00
return false ;
// Setup the shape.
2020-04-15 17:15:12 +00:00
if ( ! _createShape ( ) )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
Con : : errorf ( " TSStatic::onAdd() - Shape creation failed! " ) ;
2012-09-19 15:15:01 +00:00
return false ;
}
setRenderTransform ( mObjToWorld ) ;
// Register for the resource change signal.
2020-09-13 22:57:19 +00:00
//ResourceManager::get().getChangedSignal().notify(this, &TSStatic::_onResourceChanged);
2012-09-19 15:15:01 +00:00
addToScene ( ) ;
2020-04-15 17:15:12 +00:00
if ( isClientObject ( ) )
{
mCubeReflector . unregisterReflector ( ) ;
if ( reflectorDesc )
mCubeReflector . registerReflector ( this , reflectorDesc ) ;
}
2012-09-19 15:15:01 +00:00
_updateShouldTick ( ) ;
2016-06-20 21:47:01 +00:00
// Accumulation and environment mapping
if ( isClientObject ( ) & & mShapeInstance )
2014-12-21 20:07:42 +00:00
{
2016-06-20 21:47:01 +00:00
AccumulationVolume : : addObject ( this ) ;
2014-12-21 20:07:42 +00:00
}
2012-09-19 15:15:01 +00:00
return true ;
}
bool TSStatic : : _createShape ( )
{
// Cleanup before we create.
mCollisionDetails . clear ( ) ;
2017-07-26 21:05:04 +00:00
mDecalDetails . clear ( ) ;
mDecalDetailsPtr = 0 ;
2012-09-19 15:15:01 +00:00
mLOSDetails . clear ( ) ;
2020-04-15 17:15:12 +00:00
SAFE_DELETE ( mPhysicsRep ) ;
SAFE_DELETE ( mShapeInstance ) ;
2012-09-19 15:15:01 +00:00
mAmbientThread = NULL ;
2020-04-15 17:15:12 +00:00
mShape = NULL ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( ! mShapeAsset . isNull ( ) )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
//Special-case handling, usually because we set noShape
mShape = mShapeAsset - > getShapeResource ( ) ;
2019-11-18 09:30:04 +00:00
}
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( ! mShape )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
Con : : errorf ( " TSStatic::_createShape() - Shape Asset %s had no valid shape! " , mShapeAsset . getAssetId ( ) ) ;
2012-09-19 15:15:01 +00:00
return false ;
}
2020-04-15 17:15:12 +00:00
if ( isClientObject ( ) & &
! mShape - > preloadMaterialList ( mShape . getPath ( ) ) & &
NetConnection : : filesWereDownloaded ( ) )
2012-09-19 15:15:01 +00:00
return false ;
2020-04-15 17:15:12 +00:00
mObjBox = mShape - > mBounds ;
2012-09-19 15:15:01 +00:00
resetWorldBox ( ) ;
2020-04-15 17:15:12 +00:00
mShapeInstance = new TSShapeInstance ( mShape , isClientObject ( ) ) ;
2018-09-16 01:19:57 +00:00
if ( isClientObject ( ) )
mShapeInstance - > cloneMaterialList ( ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( isGhost ( ) )
2012-09-19 15:15:01 +00:00
{
// Reapply the current skin
mAppliedSkinName = " " ;
reSkin ( ) ;
2022-05-25 05:12:12 +00:00
updateMaterials ( ) ;
2012-09-19 15:15:01 +00:00
}
prepCollision ( ) ;
// Find the "ambient" animation if it exists
2020-04-15 17:15:12 +00:00
S32 ambientSeq = mShape - > findSequence ( " ambient " ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( ambientSeq > - 1 & & ! mAmbientThread )
2012-09-19 15:15:01 +00:00
mAmbientThread = mShapeInstance - > addThread ( ) ;
2020-06-13 17:08:01 +00:00
if ( mAmbientThread )
mShapeInstance - > setSequence ( mAmbientThread , ambientSeq , mAnimOffset ) ;
2020-04-15 17:15:12 +00:00
// Resolve CubeReflectorDesc.
if ( cubeDescName . isNotEmpty ( ) )
{
Sim : : findObject ( cubeDescName , reflectorDesc ) ;
}
else if ( cubeDescId > 0 )
{
Sim : : findObject ( cubeDescId , reflectorDesc ) ;
}
2012-09-19 15:15:01 +00:00
2019-12-06 02:42:47 +00:00
//Set up the material slot vars for easy manipulation
2020-09-02 06:26:43 +00:00
/*S32 materialCount = mShape->materialList->getMaterialNameList().size(); //mMeshAsset->getMaterialCount();
2019-12-06 02:42:47 +00:00
2020-09-02 06:26:43 +00:00
//Temporarily disabled until fixup of materialName->assetId lookup logic is sorted for easy persistance
2019-12-06 02:42:47 +00:00
if ( isServerObject ( ) )
{
char matFieldName [ 128 ] ;
for ( U32 i = 0 ; i < materialCount ; i + + )
{
2020-04-15 17:15:12 +00:00
StringTableEntry materialname = StringTable - > insert ( mShape - > materialList - > getMaterialName ( i ) . c_str ( ) ) ;
2019-12-06 02:42:47 +00:00
dSprintf ( matFieldName , 128 , " MaterialSlot%d " , i ) ;
StringTableEntry matFld = StringTable - > insert ( matFieldName ) ;
setDataField ( matFld , NULL , materialname ) ;
}
2020-09-02 06:26:43 +00:00
} */
2019-12-06 02:42:47 +00:00
2012-09-19 15:15:01 +00:00
return true ;
}
2019-12-06 02:42:47 +00:00
void TSStatic : : onDynamicModified ( const char * slotName , const char * newValue )
{
if ( FindMatch : : isMatch ( " materialslot* " , slotName , false ) )
{
if ( ! getShape ( ) )
return ;
S32 slot = - 1 ;
String outStr ( String : : GetTrailingNumber ( slotName , slot ) ) ;
if ( slot = = - 1 )
return ;
//Safe to assume the inbound value for the material will be a MaterialAsset, so lets do a lookup on the name
MaterialAsset * matAsset = AssetDatabase . acquireAsset < MaterialAsset > ( newValue ) ;
if ( ! matAsset )
return ;
bool found = false ;
for ( U32 i = 0 ; i < mChangingMaterials . size ( ) ; i + + )
{
if ( mChangingMaterials [ i ] . slot = = slot )
{
mChangingMaterials [ i ] . matAsset = matAsset ;
mChangingMaterials [ i ] . assetId = newValue ;
found = true ;
}
}
if ( ! found )
{
matMap newMatMap ;
newMatMap . slot = slot ;
newMatMap . matAsset = matAsset ;
newMatMap . assetId = newValue ;
mChangingMaterials . push_back ( newMatMap ) ;
}
setMaskBits ( MaterialMask ) ;
}
Parent : : onDynamicModified ( slotName , newValue ) ;
}
2012-09-19 15:15:01 +00:00
void TSStatic : : prepCollision ( )
{
// Let the client know that the collision was updated
2020-04-15 17:15:12 +00:00
setMaskBits ( UpdateCollisionMask ) ;
2012-09-19 15:15:01 +00:00
// Allow the ShapeInstance to prep its collision if it hasn't already
2020-02-17 06:32:50 +00:00
if ( mShapeInstance )
2012-09-19 15:15:01 +00:00
mShapeInstance - > prepCollision ( ) ;
// Cleanup any old collision data
mCollisionDetails . clear ( ) ;
2017-07-26 21:05:04 +00:00
mDecalDetails . clear ( ) ;
mDecalDetailsPtr = 0 ;
2012-09-19 15:15:01 +00:00
mLOSDetails . clear ( ) ;
mConvexList - > nukeList ( ) ;
2020-04-15 17:15:12 +00:00
if ( mCollisionType = = CollisionMesh | | mCollisionType = = VisibleMesh )
2017-07-26 21:05:04 +00:00
{
2020-04-15 17:15:12 +00:00
mShape - > findColDetails ( mCollisionType = = VisibleMesh , & mCollisionDetails , & mLOSDetails ) ;
if ( mDecalType = = mCollisionType )
2017-07-26 21:05:04 +00:00
{
mDecalDetailsPtr = & mCollisionDetails ;
}
2020-04-15 17:15:12 +00:00
else if ( mDecalType = = CollisionMesh | | mDecalType = = VisibleMesh )
2017-07-26 21:05:04 +00:00
{
2020-04-15 17:15:12 +00:00
mShape - > findColDetails ( mDecalType = = VisibleMesh , & mDecalDetails , 0 ) ;
2017-07-26 21:05:04 +00:00
mDecalDetailsPtr = & mDecalDetails ;
}
}
2020-04-15 17:15:12 +00:00
else if ( mDecalType = = CollisionMesh | | mDecalType = = VisibleMesh )
2017-07-26 21:05:04 +00:00
{
2020-04-15 17:15:12 +00:00
mShape - > findColDetails ( mDecalType = = VisibleMesh , & mDecalDetails , 0 ) ;
2017-07-26 21:05:04 +00:00
mDecalDetailsPtr = & mDecalDetails ;
}
2012-09-19 15:15:01 +00:00
_updatePhysics ( ) ;
}
void TSStatic : : _updatePhysics ( )
{
2020-04-15 17:15:12 +00:00
SAFE_DELETE ( mPhysicsRep ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( ! PHYSICSMGR | | mCollisionType = = None )
2012-09-19 15:15:01 +00:00
return ;
2020-04-15 17:15:12 +00:00
PhysicsCollision * colShape = NULL ;
if ( mCollisionType = = Bounds )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
MatrixF offset ( true ) ;
offset . setPosition ( mShape - > center ) ;
2012-09-19 15:15:01 +00:00
colShape = PHYSICSMGR - > createCollision ( ) ;
2020-04-15 17:15:12 +00:00
colShape - > addBox ( getObjBox ( ) . getExtents ( ) * 0.5f * mObjScale , offset ) ;
2012-09-19 15:15:01 +00:00
}
else
2020-04-15 17:15:12 +00:00
colShape = mShape - > buildColShape ( mCollisionType = = VisibleMesh , getScale ( ) ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( colShape )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
PhysicsWorld * world = PHYSICSMGR - > getWorld ( isServerObject ( ) ? " server " : " client " ) ;
2012-09-19 15:15:01 +00:00
mPhysicsRep = PHYSICSMGR - > createBody ( ) ;
2020-04-15 17:15:12 +00:00
mPhysicsRep - > init ( colShape , 0 , 0 , this , world ) ;
mPhysicsRep - > setTransform ( getTransform ( ) ) ;
2012-09-19 15:15:01 +00:00
}
}
void TSStatic : : onRemove ( )
{
2020-04-15 17:15:12 +00:00
SAFE_DELETE ( mPhysicsRep ) ;
2012-09-19 15:15:01 +00:00
2014-12-21 20:07:42 +00:00
// Accumulation
2020-04-15 17:15:12 +00:00
if ( isClientObject ( ) & & mShapeInstance )
2014-12-21 20:07:42 +00:00
{
2020-04-15 17:15:12 +00:00
if ( mShapeInstance - > hasAccumulation ( ) )
2014-12-21 20:07:42 +00:00
AccumulationVolume : : removeObject ( this ) ;
}
2012-09-19 15:15:01 +00:00
mConvexList - > nukeList ( ) ;
removeFromScene ( ) ;
// Remove the resource change signal.
2020-09-13 22:57:19 +00:00
//ResourceManager::get().getChangedSignal().remove(this, &TSStatic::_onResourceChanged);
2012-09-19 15:15:01 +00:00
delete mShapeInstance ;
mShapeInstance = NULL ;
mAmbientThread = NULL ;
2020-04-15 17:15:12 +00:00
if ( isClientObject ( ) )
mCubeReflector . unregisterReflector ( ) ;
2012-09-19 15:15:01 +00:00
Parent : : onRemove ( ) ;
}
2020-04-15 17:15:12 +00:00
void TSStatic : : _onResourceChanged ( const Torque : : Path & path )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
if ( path ! = Path ( mShapeName ) )
2012-09-19 15:15:01 +00:00
return ;
2020-04-15 17:15:12 +00:00
2012-09-19 15:15:01 +00:00
_createShape ( ) ;
_updateShouldTick ( ) ;
}
2021-07-19 06:07:08 +00:00
void TSStatic : : onShapeChanged ( )
2020-09-13 22:57:19 +00:00
{
_createShape ( ) ;
_updateShouldTick ( ) ;
}
2020-04-15 17:15:12 +00:00
void TSStatic : : setSkinName ( const char * name )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
if ( ! isGhost ( ) )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
if ( name [ 0 ] ! = ' \0 ' )
2012-09-19 15:15:01 +00:00
{
// Use tags for better network performance
// Should be a tag, but we'll convert to one if it isn't.
2020-04-15 17:15:12 +00:00
if ( name [ 0 ] = = StringTagPrefixByte )
mSkinNameHandle = NetStringHandle ( U32 ( dAtoi ( name + 1 ) ) ) ;
2012-09-19 15:15:01 +00:00
else
2020-04-15 17:15:12 +00:00
mSkinNameHandle = NetStringHandle ( name ) ;
2012-09-19 15:15:01 +00:00
}
else
mSkinNameHandle = NetStringHandle ( ) ;
2020-04-15 17:15:12 +00:00
setMaskBits ( SkinMask ) ;
2012-09-19 15:15:01 +00:00
}
}
void TSStatic : : reSkin ( )
{
2019-05-21 17:03:19 +00:00
if ( isGhost ( ) & & mShapeInstance )
2012-09-19 15:15:01 +00:00
{
2019-05-21 17:03:19 +00:00
if ( mSkinNameHandle . isValidString ( ) )
2012-09-19 15:15:01 +00:00
{
2019-05-21 17:03:19 +00:00
mShapeInstance - > resetMaterialList ( ) ;
Vector < String > skins ;
String ( mSkinNameHandle . getString ( ) ) . split ( " ; " , skins ) ;
for ( S32 i = 0 ; i < skins . size ( ) ; i + + )
2012-09-19 15:15:01 +00:00
{
2019-05-21 17:03:19 +00:00
String oldSkin ( mAppliedSkinName . c_str ( ) ) ;
String newSkin ( skins [ i ] ) ;
// Check if the skin handle contains an explicit "old" base string. This
// allows all models to support skinning, even if they don't follow the
// "base_xxx" material naming convention.
S32 split = newSkin . find ( ' = ' ) ; // "old=new" format skin?
if ( split ! = String : : NPos )
{
oldSkin = newSkin . substr ( 0 , split ) ;
newSkin = newSkin . erase ( 0 , split + 1 ) ;
}
else
{
oldSkin = " " ;
}
mShapeInstance - > reSkin ( newSkin , oldSkin ) ;
mAppliedSkinName = newSkin ;
2012-09-19 15:15:01 +00:00
}
2019-05-21 17:03:19 +00:00
}
else
{
mShapeInstance - > reSkin ( " " , mAppliedSkinName ) ;
mAppliedSkinName = " " ;
2012-09-19 15:15:01 +00:00
}
}
}
2020-04-15 17:15:12 +00:00
void TSStatic : : processTick ( const Move * move )
2012-09-19 15:15:01 +00:00
{
2020-06-13 17:08:01 +00:00
if ( isServerObject ( ) & & mPlayAmbient & & mAmbientThread )
{
mShapeInstance - > setTimeScale ( mAmbientThread , mAnimSpeed ) ;
mShapeInstance - > advanceTime ( TickSec , mAmbientThread ) ;
}
2020-04-15 17:15:12 +00:00
if ( isMounted ( ) )
2014-06-17 01:11:15 +00:00
{
2020-04-15 17:15:12 +00:00
MatrixF mat ( true ) ;
mMount . object - > getMountTransform ( mMount . node , mMount . xfm , & mat ) ;
setTransform ( mat ) ;
2014-06-17 01:11:15 +00:00
}
2012-09-19 15:15:01 +00:00
}
2020-04-15 17:15:12 +00:00
void TSStatic : : interpolateTick ( F32 delta )
2012-09-19 15:15:01 +00:00
{
}
2020-04-15 17:15:12 +00:00
void TSStatic : : advanceTime ( F32 dt )
2012-09-19 15:15:01 +00:00
{
2020-06-13 17:08:01 +00:00
if ( mPlayAmbient & & mAmbientThread )
{
mShapeInstance - > setTimeScale ( mAmbientThread , mAnimSpeed ) ;
mShapeInstance - > advanceTime ( dt , mAmbientThread ) ;
}
2014-06-17 01:11:15 +00:00
2020-04-15 17:15:12 +00:00
if ( isMounted ( ) )
2014-06-17 01:11:15 +00:00
{
2020-04-15 17:15:12 +00:00
MatrixF mat ( true ) ;
mMount . object - > getRenderMountTransform ( dt , mMount . node , mMount . xfm , & mat ) ;
setRenderTransform ( mat ) ;
2014-06-17 01:11:15 +00:00
}
2012-09-19 15:15:01 +00:00
}
void TSStatic : : _updateShouldTick ( )
{
2014-06-17 01:11:15 +00:00
bool shouldTick = ( mPlayAmbient & & mAmbientThread ) | | isMounted ( ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( isTicking ( ) ! = shouldTick )
setProcessTick ( shouldTick ) ;
2012-09-19 15:15:01 +00:00
}
2020-04-15 17:15:12 +00:00
void TSStatic : : prepRenderImage ( SceneRenderState * state )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
if ( ! mShapeInstance )
2012-09-19 15:15:01 +00:00
return ;
Point3F cameraOffset ;
2020-04-15 17:15:12 +00:00
getRenderTransform ( ) . getColumn ( 3 , & cameraOffset ) ;
2012-09-19 15:15:01 +00:00
cameraOffset - = state - > getDiffuseCameraPosition ( ) ;
F32 dist = cameraOffset . len ( ) ;
if ( dist < 0.01f )
dist = 0.01f ;
2014-11-20 13:00:26 +00:00
if ( mUseAlphaFade )
2014-11-06 13:54:49 +00:00
{
2014-11-20 13:00:26 +00:00
mAlphaFade = 1.0f ;
if ( ( mAlphaFadeStart < mAlphaFadeEnd ) & & mAlphaFadeStart > 0.1f )
2014-11-06 13:54:49 +00:00
{
2014-11-20 13:00:26 +00:00
if ( mInvertAlphaFade )
2014-11-06 15:44:55 +00:00
{
2014-11-20 13:00:26 +00:00
if ( dist < = mAlphaFadeStart )
2014-11-06 15:44:55 +00:00
{
2014-11-06 13:54:49 +00:00
return ;
2014-11-06 15:44:55 +00:00
}
2014-11-20 13:00:26 +00:00
if ( dist < mAlphaFadeEnd )
2014-11-06 15:44:55 +00:00
{
2014-11-20 13:00:26 +00:00
mAlphaFade = ( ( dist - mAlphaFadeStart ) / ( mAlphaFadeEnd - mAlphaFadeStart ) ) ;
2014-11-06 15:44:55 +00:00
}
2014-11-06 13:54:49 +00:00
}
else
2014-11-06 15:44:55 +00:00
{
2014-11-20 13:00:26 +00:00
if ( dist > = mAlphaFadeEnd )
2014-11-06 15:44:55 +00:00
{
2014-11-06 13:54:49 +00:00
return ;
2014-11-06 15:44:55 +00:00
}
2014-11-20 13:00:26 +00:00
if ( dist > mAlphaFadeStart )
2014-11-06 15:44:55 +00:00
{
2014-11-20 13:00:26 +00:00
mAlphaFade - = ( ( dist - mAlphaFadeStart ) / ( mAlphaFadeEnd - mAlphaFadeStart ) ) ;
2014-11-06 15:44:55 +00:00
}
2014-11-06 13:54:49 +00:00
}
}
}
2020-08-03 03:33:10 +00:00
else if ( smUseStaticObjectFade )
{
2020-08-03 23:12:21 +00:00
F32 boundsLen = getWorldSphere ( ) . radius ;
2020-08-03 03:33:10 +00:00
if ( boundsLen < smStaticObjectUnfadeableSize )
{
F32 distAdjust = ( boundsLen ) / ( smStaticObjectUnfadeableSize ) ;
distAdjust = 1 - distAdjust ;
dist * = distAdjust ;
mAlphaFade = 1.0f ;
if ( ( smStaticObjectFadeStart < smStaticObjectFadeEnd ) & & smStaticObjectFadeStart > 0.1f )
{
if ( dist > = smStaticObjectFadeEnd )
{
return ;
}
if ( dist > smStaticObjectFadeStart )
{
mAlphaFade - = ( ( dist - smStaticObjectFadeStart ) / ( smStaticObjectFadeEnd - smStaticObjectFadeStart ) ) ;
}
}
}
}
2014-11-06 13:54:49 +00:00
2020-04-15 17:15:12 +00:00
F32 invScale = ( 1.0f / getMax ( getMax ( mObjScale . x , mObjScale . y ) , mObjScale . z ) ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
// If we're currently rendering our own reflection we
// don't want to render ourselves into it.
if ( mCubeReflector . isRendering ( ) )
return ;
if ( mForceDetail = = - 1 )
mShapeInstance - > setDetailFromDistance ( state , dist * invScale ) ;
2012-09-19 15:15:01 +00:00
else
2020-04-15 17:15:12 +00:00
mShapeInstance - > setCurrentDetail ( mForceDetail ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( mShapeInstance - > getCurrentDetail ( ) < 0 )
2012-09-19 15:15:01 +00:00
return ;
GFXTransformSaver saver ;
2020-04-15 17:15:12 +00:00
2012-09-19 15:15:01 +00:00
// Set up our TS render state.
TSRenderState rdata ;
2020-04-15 17:15:12 +00:00
rdata . setSceneState ( state ) ;
rdata . setFadeOverride ( 1.0f ) ;
rdata . setOriginSort ( mUseOriginSort ) ;
if ( mCubeReflector . isEnabled ( ) )
rdata . setCubemap ( mCubeReflector . getCubemap ( ) ) ;
2012-09-19 15:15:01 +00:00
2014-12-21 20:07:42 +00:00
// Acculumation
rdata . setAccuTex ( mAccuTex ) ;
2012-09-19 15:15:01 +00:00
// If we have submesh culling enabled then prepare
// the object space frustum to pass to the shape.
Frustum culler ;
2020-04-15 17:15:12 +00:00
if ( mMeshCulling )
2012-09-19 15:15:01 +00:00
{
2013-11-07 20:07:16 +00:00
culler = state - > getCullingFrustum ( ) ;
2020-04-15 17:15:12 +00:00
MatrixF xfm ( true ) ;
xfm . scale ( Point3F : : One / getScale ( ) ) ;
xfm . mul ( getRenderWorldTransform ( ) ) ;
xfm . mul ( culler . getTransform ( ) ) ;
culler . setTransform ( xfm ) ;
rdata . setCuller ( & culler ) ;
2012-09-19 15:15:01 +00:00
}
// We might have some forward lit materials
// so pass down a query to gather lights.
LightQuery query ;
2020-04-15 17:15:12 +00:00
query . init ( getWorldSphere ( ) ) ;
rdata . setLightQuery ( & query ) ;
2012-09-19 15:15:01 +00:00
MatrixF mat = getRenderTransform ( ) ;
2020-04-15 17:15:12 +00:00
mat . scale ( mObjScale ) ;
GFX - > setWorldMatrix ( mat ) ;
if ( state - > isDiffusePass ( ) & & mCubeReflector . isEnabled ( ) & & mCubeReflector . getOcclusionQuery ( ) )
{
RenderPassManager * pass = state - > getRenderPass ( ) ;
OccluderRenderInst * ri = pass - > allocInst < OccluderRenderInst > ( ) ;
ri - > type = RenderPassManager : : RIT_Occluder ;
ri - > query = mCubeReflector . getOcclusionQuery ( ) ;
mObjToWorld . mulP ( mObjBox . getCenter ( ) , & ri - > position ) ;
ri - > scale . set ( mObjBox . getExtents ( ) ) ;
ri - > orientation = pass - > allocUniqueXform ( mObjToWorld ) ;
ri - > isSphere = false ;
state - > getRenderPass ( ) - > addInst ( ri ) ;
}
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( mShapeInstance )
2014-11-06 13:54:49 +00:00
{
2020-09-13 22:57:19 +00:00
mShapeInstance - > animate ( ) ;
2020-08-03 03:33:10 +00:00
if ( mUseAlphaFade | | smUseStaticObjectFade )
2014-11-06 13:54:49 +00:00
{
2014-11-20 13:00:26 +00:00
mShapeInstance - > setAlphaAlways ( mAlphaFade ) ;
2014-11-06 13:54:49 +00:00
S32 s = mShapeInstance - > mMeshObjects . size ( ) ;
2020-04-15 17:15:12 +00:00
for ( S32 x = 0 ; x < s ; x + + )
2014-11-06 13:54:49 +00:00
{
2014-11-20 13:00:26 +00:00
mShapeInstance - > mMeshObjects [ x ] . visible = mAlphaFade ;
2014-11-06 13:54:49 +00:00
}
}
}
2020-04-15 17:15:12 +00:00
mShapeInstance - > render ( rdata ) ;
2018-01-23 22:03:18 +00:00
# ifdef TORQUE_AFX_ENABLED
2017-07-26 21:05:04 +00:00
if ( ! mIgnoreZodiacs & & mDecalDetailsPtr ! = 0 )
afxZodiacMgr : : renderPolysoupZodiacs ( state , this ) ;
2018-01-23 22:03:18 +00:00
# endif
2020-04-15 17:15:12 +00:00
if ( mRenderNormalScalar > 0 )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
ObjectRenderInst * ri = state - > getRenderPass ( ) - > allocInst < ObjectRenderInst > ( ) ;
ri - > renderDelegate . bind ( this , & TSStatic : : _renderNormals ) ;
2012-09-19 15:15:01 +00:00
ri - > type = RenderPassManager : : RIT_Editor ;
2020-04-15 17:15:12 +00:00
state - > getRenderPass ( ) - > addInst ( ri ) ;
2012-09-19 15:15:01 +00:00
}
}
2020-04-15 17:15:12 +00:00
void TSStatic : : _renderNormals ( ObjectRenderInst * ri , SceneRenderState * state , BaseMatInstance * overrideMat )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
PROFILE_SCOPE ( TSStatic_RenderNormals ) ;
2012-09-19 15:15:01 +00:00
GFXTransformSaver saver ;
MatrixF mat = getRenderTransform ( ) ;
2020-04-15 17:15:12 +00:00
mat . scale ( mObjScale ) ;
GFX - > multWorld ( mat ) ;
2012-09-19 15:15:01 +00:00
S32 dl = mShapeInstance - > getCurrentDetail ( ) ;
2020-04-15 17:15:12 +00:00
mShapeInstance - > renderDebugNormals ( mRenderNormalScalar , dl ) ;
2012-09-19 15:15:01 +00:00
}
void TSStatic : : onScaleChanged ( )
{
Parent : : onScaleChanged ( ) ;
2020-04-15 17:15:12 +00:00
if ( mPhysicsRep )
2012-09-19 15:15:01 +00:00
{
// If the editor is enabled delay the scale operation
// by a few milliseconds so that we're not rebuilding
// during an active scale drag operation.
2020-04-15 17:15:12 +00:00
if ( gEditingMission )
mPhysicsRep - > queueCallback ( 500 , Delegate < void ( ) > ( this , & TSStatic : : _updatePhysics ) ) ;
2012-09-19 15:15:01 +00:00
else
_updatePhysics ( ) ;
}
2014-06-17 01:11:15 +00:00
2020-04-15 17:15:12 +00:00
setMaskBits ( ScaleMask ) ;
2012-09-19 15:15:01 +00:00
}
2020-04-15 17:15:12 +00:00
void TSStatic : : setTransform ( const MatrixF & mat )
2012-09-19 15:15:01 +00:00
{
Parent : : setTransform ( mat ) ;
2020-04-15 17:15:12 +00:00
if ( ! isMounted ( ) )
setMaskBits ( TransformMask ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( mPhysicsRep )
mPhysicsRep - > setTransform ( mat ) ;
2012-09-19 15:15:01 +00:00
2014-12-21 20:07:42 +00:00
// Accumulation
2020-04-15 17:15:12 +00:00
if ( isClientObject ( ) & & mShapeInstance )
2014-12-21 20:07:42 +00:00
{
2020-04-15 17:15:12 +00:00
if ( mShapeInstance - > hasAccumulation ( ) )
2014-12-21 20:07:42 +00:00
AccumulationVolume : : updateObject ( this ) ;
}
2012-09-19 15:15:01 +00:00
// Since this is a static it's render transform changes 1
// to 1 with it's collision transform... no interpolation.
setRenderTransform ( mat ) ;
}
2020-04-15 17:15:12 +00:00
U32 TSStatic : : packUpdate ( NetConnection * con , U32 mask , BitStream * stream )
2012-09-19 15:15:01 +00:00
{
U32 retMask = Parent : : packUpdate ( con , mask , stream ) ;
2020-04-15 17:15:12 +00:00
if ( stream - > writeFlag ( mask & TransformMask ) )
mathWrite ( * stream , getTransform ( ) ) ;
2014-06-17 01:11:15 +00:00
2020-04-15 17:15:12 +00:00
if ( stream - > writeFlag ( mask & ScaleMask ) )
2014-06-17 01:11:15 +00:00
{
// Only write one bit if the scale is one.
2020-04-15 17:15:12 +00:00
if ( stream - > writeFlag ( mObjScale ! = Point3F : : One ) )
mathWrite ( * stream , mObjScale ) ;
2014-06-17 01:11:15 +00:00
}
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( stream - > writeFlag ( mask & UpdateCollisionMask ) )
stream - > write ( ( U32 ) mCollisionType ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( stream - > writeFlag ( mask & SkinMask ) )
con - > packNetStringHandleU ( stream , mSkinNameHandle ) ;
2012-09-19 15:15:01 +00:00
2016-06-20 18:14:19 +00:00
if ( stream - > writeFlag ( mask & AdvancedStaticOptionsMask ) )
2014-06-17 01:11:15 +00:00
{
2021-10-03 07:56:26 +00:00
PACK_ASSET ( con , Shape ) ;
2020-04-15 17:15:12 +00:00
2016-06-20 18:14:19 +00:00
stream - > write ( ( U32 ) mDecalType ) ;
2012-09-19 15:15:01 +00:00
2016-06-20 18:14:19 +00:00
stream - > writeFlag ( mAllowPlayerStep ) ;
stream - > writeFlag ( mMeshCulling ) ;
stream - > writeFlag ( mUseOriginSort ) ;
2012-09-19 15:15:01 +00:00
2016-06-20 18:14:19 +00:00
stream - > write ( mRenderNormalScalar ) ;
2012-09-19 15:15:01 +00:00
2016-06-20 18:14:19 +00:00
stream - > write ( mForceDetail ) ;
2012-09-19 15:15:01 +00:00
2020-06-13 17:08:01 +00:00
if ( stream - > writeFlag ( mAnimOffset ! = 0.0f ) )
stream - > writeFloat ( mAnimOffset , 7 ) ;
if ( stream - > writeFlag ( mAnimSpeed ! = 1.0f ) )
stream - > writeSignedFloat ( mAnimSpeed / AnimSpeedMax , 7 ) ;
2016-06-20 18:14:19 +00:00
stream - > writeFlag ( mPlayAmbient ) ;
}
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( stream - > writeFlag ( mUseAlphaFade ) )
{
stream - > write ( mAlphaFadeStart ) ;
stream - > write ( mAlphaFadeEnd ) ;
stream - > write ( mInvertAlphaFade ) ;
}
2014-11-06 13:54:49 +00:00
2017-07-26 21:05:04 +00:00
stream - > writeFlag ( mIgnoreZodiacs ) ;
if ( stream - > writeFlag ( mHasGradients ) )
{
stream - > writeFlag ( mInvertGradientRange ) ;
stream - > write ( mGradientRange . x ) ;
stream - > write ( mGradientRange . y ) ;
}
2020-04-15 17:15:12 +00:00
if ( mLightPlugin )
2012-09-19 15:15:01 +00:00
retMask | = mLightPlugin - > packUpdate ( this , AdvancedStaticOptionsMask , con , mask , stream ) ;
2020-04-15 17:15:12 +00:00
if ( stream - > writeFlag ( reflectorDesc ! = NULL ) )
{
stream - > writeRangedU32 ( reflectorDesc - > getId ( ) , DataBlockObjectIdFirst , DataBlockObjectIdLast ) ;
}
2017-10-17 13:48:31 +00:00
stream - > write ( mOverrideColor ) ;
2019-12-06 02:42:47 +00:00
if ( stream - > writeFlag ( mask & MaterialMask ) )
{
stream - > writeInt ( mChangingMaterials . size ( ) , 16 ) ;
for ( U32 i = 0 ; i < mChangingMaterials . size ( ) ; i + + )
{
stream - > writeInt ( mChangingMaterials [ i ] . slot , 16 ) ;
NetStringHandle matNameStr = mChangingMaterials [ i ] . assetId . c_str ( ) ;
con - > packNetStringHandleU ( stream , matNameStr ) ;
}
2021-09-10 07:13:56 +00:00
//mChangingMaterials.clear();
2019-12-06 02:42:47 +00:00
}
2012-09-19 15:15:01 +00:00
return retMask ;
}
2020-04-15 17:15:12 +00:00
void TSStatic : : unpackUpdate ( NetConnection * con , BitStream * stream )
2012-09-19 15:15:01 +00:00
{
Parent : : unpackUpdate ( con , stream ) ;
2020-04-15 17:15:12 +00:00
if ( stream - > readFlag ( ) ) // TransformMask
2014-06-17 01:11:15 +00:00
{
MatrixF mat ;
2020-04-15 17:15:12 +00:00
mathRead ( * stream , & mat ) ;
2014-06-17 01:11:15 +00:00
setTransform ( mat ) ;
setRenderTransform ( mat ) ;
}
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( stream - > readFlag ( ) ) // ScaleMask
2014-06-17 01:11:15 +00:00
{
2020-04-15 17:15:12 +00:00
if ( stream - > readFlag ( ) )
2014-06-17 01:11:15 +00:00
{
VectorF scale ;
2020-04-15 17:15:12 +00:00
mathRead ( * stream , & scale ) ;
setScale ( scale ) ;
2014-06-17 01:11:15 +00:00
}
else
2020-04-15 17:15:12 +00:00
setScale ( Point3F : : One ) ;
2014-06-17 01:11:15 +00:00
}
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( stream - > readFlag ( ) ) // UpdateCollisionMask
2012-09-19 15:15:01 +00:00
{
U32 collisionType = CollisionMesh ;
2020-04-15 17:15:12 +00:00
stream - > read ( & collisionType ) ;
2012-09-19 15:15:01 +00:00
// Handle it if we have changed CollisionType's
2020-04-15 17:15:12 +00:00
if ( ( MeshType ) collisionType ! = mCollisionType )
2012-09-19 15:15:01 +00:00
{
mCollisionType = ( MeshType ) collisionType ;
2020-04-15 17:15:12 +00:00
if ( isProperlyAdded ( ) & & mShapeInstance )
2012-09-19 15:15:01 +00:00
prepCollision ( ) ;
}
}
if ( stream - > readFlag ( ) ) // SkinMask
{
NetStringHandle skinDesiredNameHandle = con - > unpackNetStringHandleU ( stream ) ; ;
if ( mSkinNameHandle ! = skinDesiredNameHandle )
{
mSkinNameHandle = skinDesiredNameHandle ;
reSkin ( ) ;
}
}
2016-06-20 18:14:19 +00:00
if ( stream - > readFlag ( ) ) // AdvancedStaticOptionsMask
2014-06-17 01:11:15 +00:00
{
2021-10-03 07:56:26 +00:00
UNPACK_ASSET ( con , Shape ) ;
2012-09-19 15:15:01 +00:00
2016-06-20 18:14:19 +00:00
stream - > read ( ( U32 * ) & mDecalType ) ;
2012-09-19 15:15:01 +00:00
2014-06-17 01:11:15 +00:00
mAllowPlayerStep = stream - > readFlag ( ) ;
2016-06-20 18:14:19 +00:00
mMeshCulling = stream - > readFlag ( ) ;
2014-06-17 01:11:15 +00:00
mUseOriginSort = stream - > readFlag ( ) ;
2012-09-19 15:15:01 +00:00
2016-06-20 18:14:19 +00:00
stream - > read ( & mRenderNormalScalar ) ;
2012-09-19 15:15:01 +00:00
2016-06-20 18:14:19 +00:00
stream - > read ( & mForceDetail ) ;
2020-06-13 17:08:01 +00:00
Adjusted callback handling of asset inspector fields when invoking AB to select asset for more consistent behavior and better handling of updating the objects and inspector
Added logic to forcefully acquire newly imported asset definition to better try and ensure it's loaded immediately after import
Added logic to asset importer so if a file is not found for an importing material asset, if populate maps is on, then it will try and find a matching image asset in the destination module
Added logic to tsStatic to better handle fields being updated via the editor, forcing updates and refreshes of the shape and materialSlots
Fixed handling of guiBitmapButtonCtrl so it will update the bitmap used when edited via the Gui Editor
Updated image ref to the hudFill image asset for the console GUI
Cleaned up names for the default camera model/material
Defaulted import config to utilize the Prune action instead of rename for more predictable default behavior
Added icons next to AB's preview slider bar for additional visual feedback of slider intent
Added missing checkbox to asset import window and cleaned up scaling behavior
Fixed handling of drag-n-drop behavior in GUI editor so it doesn't block further interaction
Added logic for drag-n-drop of image assets to GUI Editor so it will create a GuiBitmapCtrl with the image
Added handling for drag-n-drop import of folders of assets to AB/Asset Import
Added missing asset import config option to indicate if config supported import of sound assets
Added logic when opening asset import config editor, where if there is a default import config set in the settings, it will open that one by default
Hid the collision section of the import config editor, as those options are currently unutilized
Improved behavior for Create New Folder window in the AB, now always pushing to the front, and also selecting the text by default, so the user can just start typing the new name
Also added return and escape key accelerators to Create New Folder window for better UX
Fixed display of editor windows, adding a distinct blue color to highlighted windows' title bar and fixing display of minimize/maximize/window/close buttons
Moved GUIEditor's onControlDropped function to the AB script to match placement of sibling world editor function
Fixed issue with material editor where the ORM Config map slot was getting the normal map instead of the correct ORM map
2021-11-26 22:40:15 +00:00
if ( stream - > readFlag ( ) )
mAnimOffset = stream - > readFloat ( 7 ) ;
2020-06-13 17:08:01 +00:00
Adjusted callback handling of asset inspector fields when invoking AB to select asset for more consistent behavior and better handling of updating the objects and inspector
Added logic to forcefully acquire newly imported asset definition to better try and ensure it's loaded immediately after import
Added logic to asset importer so if a file is not found for an importing material asset, if populate maps is on, then it will try and find a matching image asset in the destination module
Added logic to tsStatic to better handle fields being updated via the editor, forcing updates and refreshes of the shape and materialSlots
Fixed handling of guiBitmapButtonCtrl so it will update the bitmap used when edited via the Gui Editor
Updated image ref to the hudFill image asset for the console GUI
Cleaned up names for the default camera model/material
Defaulted import config to utilize the Prune action instead of rename for more predictable default behavior
Added icons next to AB's preview slider bar for additional visual feedback of slider intent
Added missing checkbox to asset import window and cleaned up scaling behavior
Fixed handling of drag-n-drop behavior in GUI editor so it doesn't block further interaction
Added logic for drag-n-drop of image assets to GUI Editor so it will create a GuiBitmapCtrl with the image
Added handling for drag-n-drop import of folders of assets to AB/Asset Import
Added missing asset import config option to indicate if config supported import of sound assets
Added logic when opening asset import config editor, where if there is a default import config set in the settings, it will open that one by default
Hid the collision section of the import config editor, as those options are currently unutilized
Improved behavior for Create New Folder window in the AB, now always pushing to the front, and also selecting the text by default, so the user can just start typing the new name
Also added return and escape key accelerators to Create New Folder window for better UX
Fixed display of editor windows, adding a distinct blue color to highlighted windows' title bar and fixing display of minimize/maximize/window/close buttons
Moved GUIEditor's onControlDropped function to the AB script to match placement of sibling world editor function
Fixed issue with material editor where the ORM Config map slot was getting the normal map instead of the correct ORM map
2021-11-26 22:40:15 +00:00
if ( stream - > readFlag ( ) )
mAnimSpeed = stream - > readSignedFloat ( 7 ) * AnimSpeedMax ;
2020-06-13 17:08:01 +00:00
2016-07-03 12:23:45 +00:00
mPlayAmbient = stream - > readFlag ( ) ;
2020-04-15 17:15:12 +00:00
Adjusted callback handling of asset inspector fields when invoking AB to select asset for more consistent behavior and better handling of updating the objects and inspector
Added logic to forcefully acquire newly imported asset definition to better try and ensure it's loaded immediately after import
Added logic to asset importer so if a file is not found for an importing material asset, if populate maps is on, then it will try and find a matching image asset in the destination module
Added logic to tsStatic to better handle fields being updated via the editor, forcing updates and refreshes of the shape and materialSlots
Fixed handling of guiBitmapButtonCtrl so it will update the bitmap used when edited via the Gui Editor
Updated image ref to the hudFill image asset for the console GUI
Cleaned up names for the default camera model/material
Defaulted import config to utilize the Prune action instead of rename for more predictable default behavior
Added icons next to AB's preview slider bar for additional visual feedback of slider intent
Added missing checkbox to asset import window and cleaned up scaling behavior
Fixed handling of drag-n-drop behavior in GUI editor so it doesn't block further interaction
Added logic for drag-n-drop of image assets to GUI Editor so it will create a GuiBitmapCtrl with the image
Added handling for drag-n-drop import of folders of assets to AB/Asset Import
Added missing asset import config option to indicate if config supported import of sound assets
Added logic when opening asset import config editor, where if there is a default import config set in the settings, it will open that one by default
Hid the collision section of the import config editor, as those options are currently unutilized
Improved behavior for Create New Folder window in the AB, now always pushing to the front, and also selecting the text by default, so the user can just start typing the new name
Also added return and escape key accelerators to Create New Folder window for better UX
Fixed display of editor windows, adding a distinct blue color to highlighted windows' title bar and fixing display of minimize/maximize/window/close buttons
Moved GUIEditor's onControlDropped function to the AB script to match placement of sibling world editor function
Fixed issue with material editor where the ORM Config map slot was getting the normal map instead of the correct ORM map
2021-11-26 22:40:15 +00:00
//update our shape, figuring that it likely changed
_createShape ( ) ;
2016-06-20 18:14:19 +00:00
}
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
mUseAlphaFade = stream - > readFlag ( ) ;
2014-11-20 13:00:26 +00:00
if ( mUseAlphaFade )
2014-11-06 13:54:49 +00:00
{
2020-04-15 17:15:12 +00:00
stream - > read ( & mAlphaFadeStart ) ;
stream - > read ( & mAlphaFadeEnd ) ;
stream - > read ( & mInvertAlphaFade ) ;
2014-11-06 13:54:49 +00:00
}
2017-07-26 21:05:04 +00:00
mIgnoreZodiacs = stream - > readFlag ( ) ;
mHasGradients = stream - > readFlag ( ) ;
if ( mHasGradients )
{
mInvertGradientRange = stream - > readFlag ( ) ;
stream - > read ( & mGradientRange . x ) ;
stream - > read ( & mGradientRange . y ) ;
}
2020-04-15 17:15:12 +00:00
if ( mLightPlugin )
2012-09-19 15:15:01 +00:00
{
mLightPlugin - > unpackUpdate ( this , con , stream ) ;
}
2020-04-15 17:15:12 +00:00
if ( stream - > readFlag ( ) )
{
cubeDescId = stream - > readRangedU32 ( DataBlockObjectIdFirst , DataBlockObjectIdLast ) ;
}
2017-10-17 13:48:31 +00:00
stream - > read ( & mOverrideColor ) ;
2019-12-06 02:42:47 +00:00
if ( stream - > readFlag ( ) )
{
mChangingMaterials . clear ( ) ;
U32 materialCount = stream - > readInt ( 16 ) ;
for ( U32 i = 0 ; i < materialCount ; i + + )
{
matMap newMatMap ;
newMatMap . slot = stream - > readInt ( 16 ) ;
newMatMap . assetId = String ( con - > unpackNetStringHandleU ( stream ) . getString ( ) ) ;
//do the lookup, now
newMatMap . matAsset = AssetDatabase . acquireAsset < MaterialAsset > ( newMatMap . assetId ) ;
mChangingMaterials . push_back ( newMatMap ) ;
}
updateMaterials ( ) ;
}
2020-04-15 17:15:12 +00:00
if ( isProperlyAdded ( ) )
2012-09-19 15:15:01 +00:00
_updateShouldTick ( ) ;
2017-07-26 21:05:04 +00:00
set_special_typing ( ) ;
2012-09-19 15:15:01 +00:00
}
//----------------------------------------------------------------------------
2020-04-15 17:15:12 +00:00
bool TSStatic : : castRay ( const Point3F & start , const Point3F & end , RayInfo * info )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
if ( mCollisionType = = None )
2012-09-19 15:15:01 +00:00
return false ;
2020-04-15 17:15:12 +00:00
if ( ! mShapeInstance )
2012-09-19 15:15:01 +00:00
return false ;
2020-04-15 17:15:12 +00:00
if ( mCollisionType = = Bounds )
2012-09-19 15:15:01 +00:00
{
2014-10-30 22:11:07 +00:00
F32 fst ;
if ( ! mObjBox . collideLine ( start , end , & fst , & info - > normal ) )
return false ;
2012-09-19 15:15:01 +00:00
info - > t = fst ;
info - > object = this ;
2020-04-15 17:15:12 +00:00
info - > point . interpolate ( start , end , fst ) ;
2012-09-19 15:15:01 +00:00
info - > material = NULL ;
return true ;
}
else
{
RayInfo shortest = * info ;
RayInfo localInfo ;
shortest . t = 1e8 f ;
localInfo . generateTexCoord = info - > generateTexCoord ;
2020-04-15 17:15:12 +00:00
for ( U32 i = 0 ; i < mLOSDetails . size ( ) ; i + + )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
mShapeInstance - > animate ( mLOSDetails [ i ] ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( mShapeInstance - > castRayOpcode ( mLOSDetails [ i ] , start , end , & localInfo ) )
2012-09-19 15:15:01 +00:00
{
localInfo . object = this ;
if ( localInfo . t < shortest . t )
shortest = localInfo ;
}
}
if ( shortest . object = = this )
{
// Copy out the shortest time...
* info = shortest ;
return true ;
}
}
return false ;
}
2020-04-15 17:15:12 +00:00
bool TSStatic : : castRayRendered ( const Point3F & start , const Point3F & end , RayInfo * info )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
if ( ! mShapeInstance )
2012-09-19 15:15:01 +00:00
return false ;
// Cast the ray against the currently visible detail
RayInfo localInfo ;
2018-06-09 00:32:38 +00:00
if ( info & & info - > generateTexCoord )
localInfo . generateTexCoord = true ;
2020-04-15 17:15:12 +00:00
bool res = mShapeInstance - > castRayOpcode ( mShapeInstance - > getCurrentDetail ( ) , start , end , & localInfo ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( res )
2012-09-19 15:15:01 +00:00
{
* info = localInfo ;
info - > object = this ;
return true ;
}
return false ;
}
2020-04-15 17:15:12 +00:00
bool TSStatic : : buildPolyList ( PolyListContext context , AbstractPolyList * polyList , const Box3F & box , const SphereF & )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
if ( ! mShapeInstance )
2012-09-19 15:15:01 +00:00
return false ;
// This is safe to set even if we're not outputing
2020-04-15 17:15:12 +00:00
polyList - > setTransform ( & mObjToWorld , mObjScale ) ;
polyList - > setObject ( this ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( context = = PLC_Export )
2012-09-19 15:15:01 +00:00
{
// Use highest detail level
S32 dl = 0 ;
// Try to call on the client so we can export materials
2020-04-15 17:15:12 +00:00
if ( isServerObject ( ) & & getClientObject ( ) )
dynamic_cast < TSStatic * > ( getClientObject ( ) ) - > mShapeInstance - > buildPolyList ( polyList , dl ) ;
2012-09-19 15:15:01 +00:00
else
2020-04-15 17:15:12 +00:00
mShapeInstance - > buildPolyList ( polyList , dl ) ;
2012-09-19 15:15:01 +00:00
}
2020-04-15 17:15:12 +00:00
else if ( context = = PLC_Selection )
2012-09-19 15:15:01 +00:00
{
// Use the last rendered detail level
S32 dl = mShapeInstance - > getCurrentDetail ( ) ;
2020-04-15 17:15:12 +00:00
mShapeInstance - > buildPolyListOpcode ( dl , polyList , box ) ;
2012-09-19 15:15:01 +00:00
}
else
{
// Figure out the mesh type we're looking for.
2020-04-15 17:15:12 +00:00
MeshType meshType = ( context = = PLC_Decal ) ? mDecalType : mCollisionType ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
if ( meshType = = None )
2012-09-19 15:15:01 +00:00
return false ;
2020-04-15 17:15:12 +00:00
else if ( meshType = = Bounds )
polyList - > addBox ( mObjBox ) ;
else if ( meshType = = VisibleMesh )
mShapeInstance - > buildPolyList ( polyList , 0 ) ;
2017-07-26 21:05:04 +00:00
else if ( context = = PLC_Decal & & mDecalDetailsPtr ! = 0 )
{
2020-04-15 17:15:12 +00:00
for ( U32 i = 0 ; i < mDecalDetailsPtr - > size ( ) ; i + + )
mShapeInstance - > buildPolyListOpcode ( ( * mDecalDetailsPtr ) [ i ] , polyList , box ) ;
2017-07-26 21:05:04 +00:00
}
2012-09-19 15:15:01 +00:00
else
{
// Everything else is done from the collision meshes
// which may be built from either the visual mesh or
// special collision geometry.
2020-04-15 17:15:12 +00:00
for ( U32 i = 0 ; i < mCollisionDetails . size ( ) ; i + + )
mShapeInstance - > buildPolyListOpcode ( mCollisionDetails [ i ] , polyList , box ) ;
2012-09-19 15:15:01 +00:00
}
}
return true ;
}
2020-04-15 17:15:12 +00:00
bool TSStatic : : buildExportPolyList ( ColladaUtils : : ExportData * exportData , const Box3F & box , const SphereF & )
2018-03-01 07:51:18 +00:00
{
if ( ! mShapeInstance )
return false ;
if ( mCollisionType = = Bounds )
{
ColladaUtils : : ExportData : : colMesh * colMesh ;
exportData - > colMeshes . increment ( ) ;
colMesh = & exportData - > colMeshes . last ( ) ;
colMesh - > mesh . setTransform ( & mObjToWorld , mObjScale ) ;
colMesh - > mesh . setObject ( this ) ;
colMesh - > mesh . addBox ( mObjBox ) ;
colMesh - > colMeshName = String : : ToString ( " ColBox%d-1 " , exportData - > colMeshes . size ( ) ) ;
}
else if ( mCollisionType = = VisibleMesh )
{
ColladaUtils : : ExportData : : colMesh * colMesh ;
exportData - > colMeshes . increment ( ) ;
colMesh = & exportData - > colMeshes . last ( ) ;
colMesh - > mesh . setTransform ( & mObjToWorld , mObjScale ) ;
colMesh - > mesh . setObject ( this ) ;
mShapeInstance - > buildPolyList ( & colMesh - > mesh , 0 ) ;
colMesh - > colMeshName = String : : ToString ( " ColMesh%d-1 " , exportData - > colMeshes . size ( ) ) ;
}
else if ( mCollisionType = = CollisionMesh )
{
// Everything else is done from the collision meshes
// which may be built from either the visual mesh or
// special collision geometry.
for ( U32 i = 0 ; i < mCollisionDetails . size ( ) ; i + + )
{
ColladaUtils : : ExportData : : colMesh * colMesh ;
exportData - > colMeshes . increment ( ) ;
colMesh = & exportData - > colMeshes . last ( ) ;
colMesh - > mesh . setTransform ( & mObjToWorld , mObjScale ) ;
colMesh - > mesh . setObject ( this ) ;
mShapeInstance - > buildPolyListOpcode ( mCollisionDetails [ i ] , & colMesh - > mesh , box ) ;
colMesh - > colMeshName = String : : ToString ( " ColMesh%d-1 " , exportData - > colMeshes . size ( ) ) ;
}
}
//Next, process the LOD levels and materials.
if ( isServerObject ( ) & & getClientObject ( ) )
{
TSStatic * clientShape = dynamic_cast < TSStatic * > ( getClientObject ( ) ) ;
exportData - > meshData . increment ( ) ;
//Prep a meshData for this shape in particular
ColladaUtils : : ExportData : : meshLODData * meshData = & exportData - > meshData . last ( ) ;
//Fill out the info we'll need later to actually append our mesh data for the detail levels during the processing phase
meshData - > shapeInst = clientShape - > mShapeInstance ;
meshData - > originatingObject = this ;
meshData - > meshTransform = mObjToWorld ;
meshData - > scale = mObjScale ;
//Iterate over all our detail levels
for ( U32 i = 0 ; i < clientShape - > mShapeInstance - > getNumDetails ( ) ; i + + )
{
TSShape : : Detail detail = clientShape - > mShapeInstance - > getShape ( ) - > details [ i ] ;
String detailName = String : : ToLower ( clientShape - > mShapeInstance - > getShape ( ) - > getName ( detail . nameIndex ) ) ;
//Skip it if it's a collision or line of sight element
if ( detailName . startsWith ( " col " ) | | detailName . startsWith ( " los " ) )
continue ;
meshData - > meshDetailLevels . increment ( ) ;
ColladaUtils : : ExportData : : detailLevel * curDetail = & meshData - > meshDetailLevels . last ( ) ;
//Make sure we denote the size this detail level has
2020-06-13 16:58:16 +00:00
curDetail - > size = getNextPow2 ( detail . size ) ;
2018-03-01 07:51:18 +00:00
}
}
return true ;
}
2012-09-19 15:15:01 +00:00
void TSStatic : : buildConvex ( const Box3F & box , Convex * convex )
{
2020-04-15 17:15:12 +00:00
if ( mCollisionType = = None )
2012-09-19 15:15:01 +00:00
return ;
2020-04-15 17:15:12 +00:00
if ( mShapeInstance = = NULL )
2012-09-19 15:15:01 +00:00
return ;
// These should really come out of a pool
mConvexList - > collectGarbage ( ) ;
2020-04-15 17:15:12 +00:00
if ( mCollisionType = = Bounds )
2012-09-19 15:15:01 +00:00
{
// Just return a box convex for the entire shape...
Convex * cc = 0 ;
CollisionWorkingList & wl = convex - > getWorkingList ( ) ;
for ( CollisionWorkingList * itr = wl . wLink . mNext ; itr ! = & wl ; itr = itr - > wLink . mNext )
{
if ( itr - > mConvex - > getType ( ) = = BoxConvexType & &
2020-04-15 17:15:12 +00:00
itr - > mConvex - > getObject ( ) = = this )
2012-09-19 15:15:01 +00:00
{
cc = itr - > mConvex ;
break ;
}
}
if ( cc )
return ;
// Create a new convex.
BoxConvex * cp = new BoxConvex ;
mConvexList - > registerObject ( cp ) ;
convex - > addToWorkingList ( cp ) ;
cp - > init ( this ) ;
mObjBox . getCenter ( & cp - > mCenter ) ;
cp - > mSize . x = mObjBox . len_x ( ) / 2.0f ;
cp - > mSize . y = mObjBox . len_y ( ) / 2.0f ;
cp - > mSize . z = mObjBox . len_z ( ) / 2.0f ;
}
else // CollisionMesh || VisibleMesh
{
TSStaticPolysoupConvex : : smCurObject = this ;
for ( U32 i = 0 ; i < mCollisionDetails . size ( ) ; i + + )
2020-04-15 17:15:12 +00:00
mShapeInstance - > buildConvexOpcode ( mObjToWorld , mObjScale , mCollisionDetails [ i ] , box , convex , mConvexList ) ;
2012-09-19 15:15:01 +00:00
TSStaticPolysoupConvex : : smCurObject = NULL ;
}
}
SceneObject * TSStaticPolysoupConvex : : smCurObject = NULL ;
TSStaticPolysoupConvex : : TSStaticPolysoupConvex ( )
2020-04-15 17:15:12 +00:00
: box ( 0.0f , 0.0f , 0.0f , 0.0f , 0.0f , 0.0f ) ,
normal ( 0.0f , 0.0f , 0.0f , 0.0f ) ,
idx ( 0 ) ,
mesh ( NULL )
2012-09-19 15:15:01 +00:00
{
mType = TSPolysoupConvexType ;
2020-04-15 17:15:12 +00:00
for ( U32 i = 0 ; i < 4 ; + + i )
2012-09-19 15:15:01 +00:00
{
2020-04-15 17:15:12 +00:00
verts [ i ] . set ( 0.0f , 0.0f , 0.0f ) ;
2012-09-19 15:15:01 +00:00
}
}
Point3F TSStaticPolysoupConvex : : support ( const VectorF & vec ) const
{
2020-04-15 17:15:12 +00:00
F32 bestDot = mDot ( verts [ 0 ] , vec ) ;
2012-09-19 15:15:01 +00:00
2020-04-15 17:15:12 +00:00
const Point3F * bestP = & verts [ 0 ] ;
for ( S32 i = 1 ; i < 4 ; i + + )
2012-09-19 15:15:01 +00:00
{
2015-03-04 00:55:30 +00:00
F32 newD = mDot ( verts [ i ] , vec ) ;
2020-04-15 17:15:12 +00:00
if ( newD > bestDot )
2012-09-19 15:15:01 +00:00
{
bestDot = newD ;
2015-03-04 00:55:30 +00:00
bestP = & verts [ i ] ;
2012-09-19 15:15:01 +00:00
}
}
return * bestP ;
}
Box3F TSStaticPolysoupConvex : : getBoundingBox ( ) const
{
2015-03-04 00:55:30 +00:00
Box3F wbox = box ;
2020-04-15 17:15:12 +00:00
wbox . minExtents . convolve ( mObject - > getScale ( ) ) ;
wbox . maxExtents . convolve ( mObject - > getScale ( ) ) ;
2012-09-19 15:15:01 +00:00
mObject - > getTransform ( ) . mul ( wbox ) ;
return wbox ;
}
Box3F TSStaticPolysoupConvex : : getBoundingBox ( const MatrixF & mat , const Point3F & scale ) const
{
AssertISV ( false , " TSStaticPolysoupConvex::getBoundingBox(m,p) - Not implemented. -- XEA " ) ;
2015-03-04 00:55:30 +00:00
return box ;
2012-09-19 15:15:01 +00:00
}
2020-04-15 17:15:12 +00:00
void TSStaticPolysoupConvex : : getPolyList ( AbstractPolyList * list )
2012-09-19 15:15:01 +00:00
{
// Transform the list into object space and set the pointer to the object
2020-04-15 17:15:12 +00:00
MatrixF i ( mObject - > getTransform ( ) ) ;
Point3F iS ( mObject - > getScale ( ) ) ;
2012-09-19 15:15:01 +00:00
list - > setTransform ( & i , iS ) ;
list - > setObject ( mObject ) ;
// Add only the original collision triangle
2020-04-15 17:15:12 +00:00
S32 base = list - > addPoint ( verts [ 0 ] ) ;
list - > addPoint ( verts [ 2 ] ) ;
list - > addPoint ( verts [ 1 ] ) ;
2012-09-19 15:15:01 +00:00
2015-03-04 00:55:30 +00:00
list - > begin ( 0 , ( U32 ) idx ^ ( uintptr_t ) mesh ) ;
2012-09-19 15:15:01 +00:00
list - > vertex ( base + 2 ) ;
list - > vertex ( base + 1 ) ;
list - > vertex ( base + 0 ) ;
list - > plane ( base + 0 , base + 1 , base + 2 ) ;
list - > end ( ) ;
}
2020-04-15 17:15:12 +00:00
void TSStaticPolysoupConvex : : getFeatures ( const MatrixF & mat , const VectorF & n , ConvexFeature * cf )
2012-09-19 15:15:01 +00:00
{
cf - > material = 0 ;
2020-05-11 19:33:59 +00:00
cf - > mObject = mObject ;
2012-09-19 15:15:01 +00:00
// For a tetrahedron this is pretty easy... first
// convert everything into world space.
Point3F tverts [ 4 ] ;
2015-03-04 00:55:30 +00:00
mat . mulP ( verts [ 0 ] , & tverts [ 0 ] ) ;
mat . mulP ( verts [ 1 ] , & tverts [ 1 ] ) ;
mat . mulP ( verts [ 2 ] , & tverts [ 2 ] ) ;
mat . mulP ( verts [ 3 ] , & tverts [ 3 ] ) ;
2012-09-19 15:15:01 +00:00
// points...
S32 firstVert = cf - > mVertexList . size ( ) ;
cf - > mVertexList . increment ( ) ; cf - > mVertexList . last ( ) = tverts [ 0 ] ;
cf - > mVertexList . increment ( ) ; cf - > mVertexList . last ( ) = tverts [ 1 ] ;
cf - > mVertexList . increment ( ) ; cf - > mVertexList . last ( ) = tverts [ 2 ] ;
cf - > mVertexList . increment ( ) ; cf - > mVertexList . last ( ) = tverts [ 3 ] ;
// edges...
cf - > mEdgeList . increment ( ) ;
2020-04-15 17:15:12 +00:00
cf - > mEdgeList . last ( ) . vertex [ 0 ] = firstVert + 0 ;
cf - > mEdgeList . last ( ) . vertex [ 1 ] = firstVert + 1 ;
2012-09-19 15:15:01 +00:00
cf - > mEdgeList . increment ( ) ;
2020-04-15 17:15:12 +00:00
cf - > mEdgeList . last ( ) . vertex [ 0 ] = firstVert + 1 ;
cf - > mEdgeList . last ( ) . vertex [ 1 ] = firstVert + 2 ;
2012-09-19 15:15:01 +00:00
cf - > mEdgeList . increment ( ) ;
2020-04-15 17:15:12 +00:00
cf - > mEdgeList . last ( ) . vertex [ 0 ] = firstVert + 2 ;
cf - > mEdgeList . last ( ) . vertex [ 1 ] = firstVert + 0 ;
2012-09-19 15:15:01 +00:00
cf - > mEdgeList . increment ( ) ;
2020-04-15 17:15:12 +00:00
cf - > mEdgeList . last ( ) . vertex [ 0 ] = firstVert + 3 ;
cf - > mEdgeList . last ( ) . vertex [ 1 ] = firstVert + 0 ;
2012-09-19 15:15:01 +00:00
cf - > mEdgeList . increment ( ) ;
2020-04-15 17:15:12 +00:00
cf - > mEdgeList . last ( ) . vertex [ 0 ] = firstVert + 3 ;
cf - > mEdgeList . last ( ) . vertex [ 1 ] = firstVert + 1 ;
2012-09-19 15:15:01 +00:00
cf - > mEdgeList . increment ( ) ;
2020-04-15 17:15:12 +00:00
cf - > mEdgeList . last ( ) . vertex [ 0 ] = firstVert + 3 ;
cf - > mEdgeList . last ( ) . vertex [ 1 ] = firstVert + 2 ;
2012-09-19 15:15:01 +00:00
// triangles...
cf - > mFaceList . increment ( ) ;
cf - > mFaceList . last ( ) . normal = PlaneF ( tverts [ 2 ] , tverts [ 1 ] , tverts [ 0 ] ) ;
2020-04-15 17:15:12 +00:00
cf - > mFaceList . last ( ) . vertex [ 0 ] = firstVert + 2 ;
cf - > mFaceList . last ( ) . vertex [ 1 ] = firstVert + 1 ;
cf - > mFaceList . last ( ) . vertex [ 2 ] = firstVert + 0 ;
2012-09-19 15:15:01 +00:00
cf - > mFaceList . increment ( ) ;
cf - > mFaceList . last ( ) . normal = PlaneF ( tverts [ 1 ] , tverts [ 0 ] , tverts [ 3 ] ) ;
2020-04-15 17:15:12 +00:00
cf - > mFaceList . last ( ) . vertex [ 0 ] = firstVert + 1 ;
cf - > mFaceList . last ( ) . vertex [ 1 ] = firstVert + 0 ;
cf - > mFaceList . last ( ) . vertex [ 2 ] = firstVert + 3 ;
2012-09-19 15:15:01 +00:00
cf - > mFaceList . increment ( ) ;
cf - > mFaceList . last ( ) . normal = PlaneF ( tverts [ 2 ] , tverts [ 1 ] , tverts [ 3 ] ) ;
2020-04-15 17:15:12 +00:00
cf - > mFaceList . last ( ) . vertex [ 0 ] = firstVert + 2 ;
cf - > mFaceList . last ( ) . vertex [ 1 ] = firstVert + 1 ;
cf - > mFaceList . last ( ) . vertex [ 2 ] = firstVert + 3 ;
2012-09-19 15:15:01 +00:00
cf - > mFaceList . increment ( ) ;
cf - > mFaceList . last ( ) . normal = PlaneF ( tverts [ 0 ] , tverts [ 2 ] , tverts [ 3 ] ) ;
2020-04-15 17:15:12 +00:00
cf - > mFaceList . last ( ) . vertex [ 0 ] = firstVert + 0 ;
cf - > mFaceList . last ( ) . vertex [ 1 ] = firstVert + 2 ;
cf - > mFaceList . last ( ) . vertex [ 2 ] = firstVert + 3 ;
2012-09-19 15:15:01 +00:00
// All done!
}
2020-04-15 17:15:12 +00:00
void TSStatic : : onMount ( SceneObject * obj , S32 node )
2014-06-17 01:11:15 +00:00
{
Parent : : onMount ( obj , node ) ;
_updateShouldTick ( ) ;
}
2020-04-15 17:15:12 +00:00
void TSStatic : : onUnmount ( SceneObject * obj , S32 node )
2014-06-17 01:11:15 +00:00
{
2020-04-15 17:15:12 +00:00
Parent : : onUnmount ( obj , node ) ;
setMaskBits ( TransformMask ) ;
2014-06-17 01:11:15 +00:00
_updateShouldTick ( ) ;
}
2018-03-01 07:51:18 +00:00
U32 TSStatic : : getNumDetails ( )
{
2020-04-15 17:15:12 +00:00
if ( isServerObject ( ) & & getClientObject ( ) )
{
TSStatic * clientShape = dynamic_cast < TSStatic * > ( getClientObject ( ) ) ;
return clientShape - > mShapeInstance - > getNumDetails ( ) ;
}
return 0 ;
2018-03-01 07:51:18 +00:00
} ;
2019-12-06 02:42:47 +00:00
void TSStatic : : updateMaterials ( )
{
2021-11-27 20:29:30 +00:00
if ( mChangingMaterials . empty ( ) | | ! mShapeInstance )
2019-12-06 02:42:47 +00:00
return ;
TSMaterialList * pMatList = mShapeInstance - > getMaterialList ( ) ;
String path ;
if ( mShapeAsset - > isAssetValid ( ) )
2021-07-19 06:07:08 +00:00
path = mShapeAsset - > getShapeFileName ( ) ;
2019-12-06 02:42:47 +00:00
else
path = mShapeName ;
pMatList - > setTextureLookupPath ( path ) ;
bool found = false ;
const Vector < String > & materialNames = pMatList - > getMaterialNameList ( ) ;
for ( S32 i = 0 ; i < materialNames . size ( ) ; i + + )
{
if ( found )
break ;
for ( U32 m = 0 ; m < mChangingMaterials . size ( ) ; m + + )
{
if ( mChangingMaterials [ m ] . slot = = i )
{
//Fetch the actual material asset
pMatList - > renameMaterial ( i , mChangingMaterials [ m ] . matAsset - > getMaterialDefinitionName ( ) ) ;
found = true ;
break ;
}
}
}
// Initialize the material instances
mShapeInstance - > initMaterialList ( ) ;
}
2020-08-19 23:30:42 +00:00
void TSStatic : : getUtilizedAssets ( Vector < StringTableEntry > * usedAssetsList )
{
2021-07-19 06:07:08 +00:00
if ( ! mShapeAsset . isNull ( ) & & mShapeAsset - > getAssetId ( ) ! = ShapeAsset : : smNoShapeAssetFallback )
2020-09-08 06:04:41 +00:00
usedAssetsList - > push_back_unique ( mShapeAsset - > getAssetId ( ) ) ;
2020-08-19 23:30:42 +00:00
}
2012-09-19 15:15:01 +00:00
//------------------------------------------------------------------------
2013-04-05 16:39:26 +00:00
//These functions are duplicated in tsStatic and shapeBase.
2012-09-19 15:15:01 +00:00
//They each function a little differently; but achieve the same purpose of gathering
//target names/counts without polluting simObject.
2022-06-13 17:38:08 +00:00
# ifdef TORQUE_TOOLS
2019-11-18 09:30:04 +00:00
void TSStatic : : onInspect ( GuiInspector * inspector )
{
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
if ( mShapeAsset = = nullptr )
return ;
2019-11-18 09:30:04 +00:00
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
//Put the GameObject group before everything that'd be gameobject-effecting, for orginazational purposes
GuiInspectorGroup * materialGroup = inspector - > findExistentGroup ( StringTable - > insert ( " Materials " ) ) ;
2020-08-12 18:11:13 +00:00
if ( ! materialGroup )
return ;
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
GuiControl * stack = dynamic_cast < GuiControl * > ( materialGroup - > findObjectByInternalName ( StringTable - > insert ( " Stack " ) ) ) ;
2020-04-15 17:15:12 +00:00
2019-11-18 09:30:04 +00:00
//Do this on both the server and client
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
S32 materialCount = mShapeAsset - > getShape ( ) - > materialList - > getMaterialNameList ( ) . size ( ) ; //mMeshAsset->getMaterialCount();
2019-11-18 09:30:04 +00:00
if ( isServerObject ( ) )
{
//we need to update the editor
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
/*for (U32 i = 0; i < mFields.size(); i++)
2019-11-18 09:30:04 +00:00
{
//find any with the materialslot title and clear them out
if ( FindMatch : : isMatch ( " MaterialSlot* " , mFields [ i ] . mFieldName , false ) )
{
setDataField ( mFields [ i ] . mFieldName , NULL , " " ) ;
mFields . erase ( i ) ;
continue ;
}
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
} */
2019-11-18 09:30:04 +00:00
//next, get a listing of our materials in the shape, and build our field list for them
char matFieldName [ 128 ] ;
for ( U32 i = 0 ; i < materialCount ; i + + )
{
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
StringTableEntry materialname = StringTable - > insert ( mShapeAsset - > getShape ( ) - > materialList - > getMaterialName ( i ) . c_str ( ) ) ;
2019-11-18 09:30:04 +00:00
2021-09-10 07:13:56 +00:00
AssetPtr < MaterialAsset > matAsset ;
if ( MaterialAsset : : getAssetByMaterialName ( materialname , & matAsset ) = = MaterialAsset : : Ok )
2019-11-18 09:30:04 +00:00
{
2021-09-10 07:13:56 +00:00
dSprintf ( matFieldName , 128 , " MaterialSlot%d " , i ) ;
2019-11-18 09:30:04 +00:00
2021-09-10 07:13:56 +00:00
GuiInspectorField * fieldGui = materialGroup - > constructField ( TypeMaterialAssetPtr ) ;
fieldGui - > init ( inspector , materialGroup ) ;
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
2021-09-10 07:13:56 +00:00
fieldGui - > setSpecialEditField ( true ) ;
fieldGui - > setTargetObject ( this ) ;
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
2021-09-10 07:13:56 +00:00
StringTableEntry fldnm = StringTable - > insert ( matFieldName ) ;
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
2021-09-10 07:13:56 +00:00
fieldGui - > setSpecialEditVariableName ( fldnm ) ;
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
2021-09-10 07:13:56 +00:00
fieldGui - > setInspectorField ( NULL , fldnm ) ;
fieldGui - > setDocs ( " " ) ;
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
2021-09-10 07:13:56 +00:00
if ( fieldGui - > registerObject ( ) )
{
StringTableEntry fieldValue = matAsset - > getAssetId ( ) ;
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
2021-09-10 07:13:56 +00:00
//Check if we'd already actually changed it, and display the modified value
for ( U32 c = 0 ; c < mChangingMaterials . size ( ) ; c + + )
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
{
2021-09-10 07:13:56 +00:00
if ( mChangingMaterials [ c ] . slot = = i )
{
fieldValue = StringTable - > insert ( mChangingMaterials [ i ] . assetId . c_str ( ) ) ;
break ;
}
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
}
2021-09-10 07:13:56 +00:00
fieldGui - > setValue ( fieldValue ) ;
stack - > addObject ( fieldGui ) ;
}
else
{
SAFE_DELETE ( fieldGui ) ;
2019-11-18 09:30:04 +00:00
}
}
}
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc
Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector
Adjusted expand behavior of guiTree to be more reliable
Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields
Removed redundant PreMult translucency type code
Added setting of feature so probes work when in forward/basic lit mode
Corrected indexing error in SQLiteObject class so it properly parses with the updated console API
Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy
Fixed var when trying to bind the camera to the client
Added project setting field to dictate the default render mode between Forward or Deferred
Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field
Integrated DOF PostFX into updated PostFX Editor paradigm
Updated setting group name for vignette postFX
Shifted shaderCache to be in data/cache along with other cached files
Added helper function to replace strings in a file
Fixed ExampleCppObject asset to have correct loose file references
Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default
Fixed verve reference to root scene group
Adjusted location of a nonmodal gui profile so it loads at the correct time
Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag
Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful
Initial work into zip and folder drag-and-drop asset importing support
Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions
Updated example asset type file
Ensured all asset types have proper handling for move, rename and delete actions
Fixed double-click behavior on folders in the AB
Fixed CPP asset preview
Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser
Added ability to convert a non-module top-level folder in the AB into a module
Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules
Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake
Fixed convex editor's material handling to work with AB and reference back properly
Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow
Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open
Added some additional common text gui profiles
Disabled calls to old editor settings logic in various editors to remove spam
Added callOnModules call so tools can initialize properly when the world editor is opened
Fixed logic test for visualizers
Added ability for cmake to scan tools directory for any tools that add source files
2020-02-04 07:47:28 +00:00
}
2019-11-18 09:30:04 +00:00
}
2022-06-13 17:38:08 +00:00
# endif
2020-04-15 17:15:12 +00:00
DefineEngineMethod ( TSStatic , getTargetName , const char * , ( S32 index ) , ( 0 ) ,
2012-09-19 15:15:01 +00:00
" Get the name of the indexed shape material. \n "
" @param index index of the material to get (valid range is 0 - getTargetCount()-1). \n "
" @return the name of the indexed material. \n "
" @see getTargetCount() \n " )
{
2020-04-15 17:15:12 +00:00
TSStatic * obj = dynamic_cast < TSStatic * > ( object ) ;
if ( obj )
2017-01-06 23:04:28 +00:00
{
// Try to use the client object (so we get the reskinned targets in the Material Editor)
if ( ( TSStatic * ) obj - > getClientObject ( ) )
obj = ( TSStatic * ) obj - > getClientObject ( ) ;
2012-09-19 15:15:01 +00:00
2017-01-06 23:04:28 +00:00
return obj - > getShapeInstance ( ) - > getTargetName ( index ) ;
}
2012-09-19 15:15:01 +00:00
2017-01-06 23:04:28 +00:00
return " " ;
2012-09-19 15:15:01 +00:00
}
2020-04-15 17:15:12 +00:00
DefineEngineMethod ( TSStatic , getTargetCount , S32 , ( ) , ,
2012-09-19 15:15:01 +00:00
" Get the number of materials in the shape. \n "
" @return the number of materials in the shape. \n "
" @see getTargetName() \n " )
{
2020-04-15 17:15:12 +00:00
TSStatic * obj = dynamic_cast < TSStatic * > ( object ) ;
if ( obj )
2017-01-06 23:04:28 +00:00
{
// Try to use the client object (so we get the reskinned targets in the Material Editor)
if ( ( TSStatic * ) obj - > getClientObject ( ) )
obj = ( TSStatic * ) obj - > getClientObject ( ) ;
2012-09-19 15:15:01 +00:00
2017-01-06 23:04:28 +00:00
return obj - > getShapeInstance ( ) - > getTargetCount ( ) ;
}
2012-09-19 15:15:01 +00:00
2017-01-06 23:04:28 +00:00
return - 1 ;
2012-09-19 15:15:01 +00:00
}
// This method is able to change materials per map to with others. The material that is being replaced is being mapped to
// unmapped_mat as a part of this transition
2020-04-15 17:15:12 +00:00
DefineEngineMethod ( TSStatic , changeMaterial , void , ( const char * mapTo , Material * oldMat , Material * newMat ) , ( " " , nullAsType < Material * > ( ) , nullAsType < Material * > ( ) ) ,
2012-09-19 15:15:01 +00:00
" @brief Change one of the materials on the shape. \n \n "
" This method changes materials per mapTo with others. The material that "
" is being replaced is mapped to unmapped_mat as a part of this transition. \n "
" @note Warning, right now this only sort of works. It doesn't do a live "
" update like it should. \n "
" @param mapTo the name of the material target to remap (from getTargetName) \n "
" @param oldMat the old Material that was mapped \n "
" @param newMat the new Material to map \n \n "
" @tsexample \n "
2020-04-15 17:15:12 +00:00
" // remap the first material in the shape \n "
" %mapTo = %obj.getTargetName( 0 ); \n "
" %obj.changeMaterial( %mapTo, 0, MyMaterial ); \n "
" @endtsexample \n " )
2012-09-19 15:15:01 +00:00
{
// if no valid new material, theres no reason for doing this
2020-04-15 17:15:12 +00:00
if ( ! newMat )
2012-09-19 15:15:01 +00:00
{
Con : : errorf ( " TSShape::changeMaterial failed: New material does not exist! " ) ;
return ;
}
2021-07-19 06:07:08 +00:00
TSMaterialList * shapeMaterialList = object - > getShapeResource ( ) - > materialList ;
2015-07-14 03:51:17 +00:00
2012-09-19 15:15:01 +00:00
// Check the mapTo name exists for this shape
2015-07-14 03:51:17 +00:00
S32 matIndex = shapeMaterialList - > getMaterialNameList ( ) . find_next ( String ( mapTo ) ) ;
2012-09-19 15:15:01 +00:00
if ( matIndex < 0 )
{
Con : : errorf ( " TSShape::changeMaterial failed: Invalid mapTo name '%s' " , mapTo ) ;
return ;
}
// Lets remap the old material off, so as to let room for our current material room to claim its spot
2020-04-15 17:15:12 +00:00
if ( oldMat )
2012-09-19 15:15:01 +00:00
oldMat - > mMapTo = String ( " unmapped_mat " ) ;
newMat - > mMapTo = mapTo ;
2013-03-28 01:36:17 +00:00
// Map the material by name in the matmgr
2020-04-15 17:15:12 +00:00
MATMGR - > mapMaterial ( mapTo , newMat - > getName ( ) ) ;
2012-09-19 15:15:01 +00:00
// Replace instances with the new material being traded in. Lets make sure that we only
// target the specific targets per inst, this is actually doing more than we thought
2015-07-14 03:51:17 +00:00
delete shapeMaterialList - > mMatInstList [ matIndex ] ;
shapeMaterialList - > mMatInstList [ matIndex ] = newMat - > createMatInstance ( ) ;
2012-09-19 15:15:01 +00:00
// Finish up preparing the material instances for rendering
2020-04-15 17:15:12 +00:00
const GFXVertexFormat * flags = getGFXVertexFormat < GFXVertexPNTTB > ( ) ;
2012-09-19 15:15:01 +00:00
FeatureSet features = MATMGR - > getDefaultFeatures ( ) ;
2015-07-14 03:51:17 +00:00
shapeMaterialList - > getMaterialInst ( matIndex ) - > init ( features , flags ) ;
2012-09-19 15:15:01 +00:00
}
2020-04-15 17:15:12 +00:00
DefineEngineMethod ( TSStatic , getModelFile , const char * , ( ) , ,
2012-09-19 15:15:01 +00:00
" @brief Get the model filename used by this shape. \n \n "
" @return the shape filename \n \n "
" @tsexample \n "
2020-04-15 17:15:12 +00:00
" // Acquire the model filename used on this shape. \n "
" %modelFilename = %obj.getModelFile(); \n "
2012-09-19 15:15:01 +00:00
" @endtsexample \n "
2020-04-15 17:15:12 +00:00
)
2012-09-19 15:15:01 +00:00
{
2021-07-19 06:07:08 +00:00
return object - > getShape ( ) ;
2017-01-06 19:50:41 +00:00
}
2017-07-26 21:05:04 +00:00
void TSStatic : : set_special_typing ( )
{
if ( mCollisionType = = VisibleMesh | | mCollisionType = = CollisionMesh )
mTypeMask | = InteriorLikeObjectType ;
else
mTypeMask & = ~ InteriorLikeObjectType ;
}
2020-04-15 17:15:12 +00:00
void TSStatic : : onStaticModified ( const char * slotName , const char * newValue )
2017-07-26 21:05:04 +00:00
{
2018-01-23 22:03:18 +00:00
# ifdef TORQUE_AFX_ENABLED
2017-07-26 21:05:04 +00:00
if ( slotName = = afxZodiacData : : GradientRangeSlot )
{
afxZodiacData : : convertGradientRangeFromDegrees ( mGradientRange , mGradientRangeUser ) ;
return ;
}
2018-01-23 22:03:18 +00:00
# endif
2017-07-26 21:05:04 +00:00
set_special_typing ( ) ;
}
2017-07-26 22:48:29 +00:00
void TSStatic : : setSelectionFlags ( U8 flags )
{
Parent : : setSelectionFlags ( flags ) ;
2020-04-15 17:15:12 +00:00
if ( ! mShapeInstance | | ! isClientObject ( ) )
return ;
if ( ! mShapeInstance - > ownMaterialList ( ) )
return ;
TSMaterialList * pMatList = mShapeInstance - > getMaterialList ( ) ;
for ( S32 j = 0 ; j < pMatList - > size ( ) ; j + + )
{
BaseMatInstance * bmi = pMatList - > getMaterialInst ( j ) ;
bmi - > setSelectionHighlighting ( needsSelectionHighlighting ( ) ) ;
}
2017-07-26 22:48:29 +00:00
}
2021-11-04 02:15:00 +00:00
void TSStatic : : getNodeTransform ( const char * nodeName , const MatrixF & xfm , MatrixF * outMat )
{
S32 nodeIDx = getShapeResource ( ) - > findNode ( nodeName ) ;
MatrixF mountTransform = mShapeInstance - > mNodeTransforms [ nodeIDx ] ;
mountTransform . mul ( xfm ) ;
const Point3F & scale = getScale ( ) ;
// The position of the mount point needs to be scaled.
Point3F position = mountTransform . getPosition ( ) ;
position . convolve ( scale ) ;
mountTransform . setPosition ( position ) ;
// Also we would like the object to be scaled to the model.
outMat - > mul ( mObjToWorld , mountTransform ) ;
return ;
}
DefineEngineMethod ( TSStatic , getNodeTransform , TransformF , ( const char * nodeName ) , ,
" @brief Get the world transform of the specified mount slot. \n \n "
" @param slot Image slot to query \n "
" @return the mount transform \n \n " )
{
MatrixF xf ( true ) ;
object - > getNodeTransform ( nodeName , MatrixF : : Identity , & xf ) ;
return xf ;
}