Torque3D Documentation / _generateds / TerrainMaterialAsset.h

TerrainMaterialAsset.h

Engine/source/T3D/assets/TerrainMaterialAsset.h

More...

Classes:

Public Defines

Public Functions

DefineConsoleType(TypeTerrainMaterialAssetPtr , TerrainMaterialAsset )

Detailed Description

Public Defines

TERRAINMATERIALASSET_H() 

Public Functions

DefineConsoleType(TypeTerrainMaterialAssetPtr , TerrainMaterialAsset )

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2013 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23#pragma once
 24#ifndef TERRAINMATERIALASSET_H
 25#define TERRAINMATERIALASSET_H
 26
 27#ifndef _ASSET_BASE_H_
 28#include "assets/assetBase.h"
 29#endif
 30
 31#ifndef _ASSET_DEFINITION_H_
 32#include "assets/assetDefinition.h"
 33#endif
 34
 35#ifndef _STRINGUNIT_H_
 36#include "string/stringUnit.h"
 37#endif
 38
 39#ifndef _ASSET_FIELD_TYPES_H_
 40#include "assets/assetFieldTypes.h"
 41#endif
 42
 43#ifndef _GFXDEVICE_H_
 44#include "gfx/gfxDevice.h"
 45#endif
 46
 47#ifndef _GUI_INSPECTOR_TYPES_H_
 48#include "gui/editor/guiInspectorTypes.h"
 49#endif
 50
 51#include "terrain/terrMaterial.h"
 52
 53//-----------------------------------------------------------------------------
 54class TerrainMaterialAsset : public AssetBase
 55{
 56   typedef AssetBase Parent;
 57
 58   StringTableEntry        mScriptFile;
 59   StringTableEntry        mScriptPath;
 60   StringTableEntry        mMatDefinitionName;
 61
 62public:
 63   TerrainMaterialAsset();
 64   virtual ~TerrainMaterialAsset();
 65
 66   /// Engine.
 67   static void initPersistFields();
 68   virtual void copyTo(SimObject* object);
 69
 70   void compileShader();
 71
 72   StringTableEntry getMaterialDefinitionName() { return mMatDefinitionName; }
 73
 74   void                    setScriptFile(const char* pScriptFile);
 75   inline StringTableEntry getScriptFile(void) const { return mScriptFile; };
 76
 77   inline StringTableEntry getScriptPath(void) const { return mScriptPath; };
 78
 79   /// Declare Console Object.
 80   DECLARE_CONOBJECT(TerrainMaterialAsset);
 81
 82protected:
 83   virtual void initializeAsset();
 84   virtual void onAssetRefresh(void);
 85
 86   static bool setScriptFile(void *obj, const char *index, const char *data) { static_cast<TerrainMaterialAsset*>(obj)->setScriptFile(data); return false; }
 87   static const char* getScriptFile(void* obj, const char* data) { return static_cast<TerrainMaterialAsset*>(obj)->getScriptFile(); }
 88};
 89
 90DefineConsoleType(TypeTerrainMaterialAssetPtr, TerrainMaterialAsset)
 91
 92//-----------------------------------------------------------------------------
 93// TypeAssetId GuiInspectorField Class
 94//-----------------------------------------------------------------------------
 95class GuiInspectorTypeTerrainMaterialAssetPtr : public GuiInspectorField
 96{
 97   typedef GuiInspectorField Parent;
 98public:
 99
100   GuiControl*       mMatEdContainer;
101   GuiBitmapButtonCtrl  *mMatPreviewButton;
102   GuiTextEditCtrl *mMatAssetIdTxt;
103
104   DECLARE_CONOBJECT(GuiInspectorTypeTerrainMaterialAssetPtr);
105   static void consoleInit();
106
107   virtual GuiControl* constructEditControl();
108   virtual bool updateRects();
109   void setMaterialAsset(String assetId);
110};
111
112#endif // _ASSET_BASE_H_
113
114