27#ifndef _ShaderSGXAtlasTexture_
28#define _ShaderSGXAtlasTexture_
31#ifdef RTSHADER_SYSTEM_BUILD_EXT_SHADERS
35#define TAS_MAX_TEXTURES 4
47 TextureAtlasRecord(
const String & texOriginalName,
const String & texAtlasName,
48 const float texPosU,
const float texPosV,
const float texWidth,
const float texHeight,
49 const size_t texIndexInAtlas) :
54 , originalTextureName(texOriginalName)
55 , atlasTextureName(texAtlasName)
56 , indexInAtlas(texIndexInAtlas)
63 String originalTextureName;
69typedef SharedPtr<TextureAtlasTable> TextureAtlasTablePtr;
138 TextureAtlasSampler();
143 virtual const String& getType()
const;
148 virtual int getExecutionOrder()
const;
153 virtual void copyFrom(
const SubRenderState& rhs);
158 virtual void updateGpuProgramsParams(Renderable* rend, Pass* pass,
const AutoParamDataSource* source,
const LightList* pLightList);
163 virtual bool preAddToRenderState(
const RenderState* renderState, Pass* srcPass, Pass* dstPass);
169 virtual bool resolveParameters(ProgramSet* programSet);
170 virtual bool resolveDependencies(ProgramSet* programSet);
171 virtual bool addFunctionInvocations(ProgramSet* programSet);
185 TextureUnitState::UVWAddressingMode mTextureAddressings[TAS_MAX_TEXTURES];
198 TextureAtlasTablePtr mAtlasTableDatas[TAS_MAX_TEXTURES];
200 bool mIsAtlasTextureUnits[TAS_MAX_TEXTURES];
202 bool mIsTableDataUpdated;
204 bool mAutoAdjustPollPosition;
213class _OgreRTSSExport TextureAtlasSamplerFactory :
public SubRenderStateFactory,
public Singleton<TextureAtlasSamplerFactory>
216 enum IndexPositionMode
222 struct TextureAtlasAttib
224 TextureAtlasAttib(IndexPositionMode _posMode = ipmRelative,
ushort _posOffset = 1,
225 bool _autoBorderAdjust =
true) : positionMode(_posMode), positionOffset(_posOffset),
226 autoBorderAdjust(_autoBorderAdjust) {}
228 IndexPositionMode positionMode;
230 bool autoBorderAdjust;
236 TextureAtlasSamplerFactory();
239 static TextureAtlasSamplerFactory* getSingletonPtr(
void);
240 static TextureAtlasSamplerFactory& getSingleton(
void);
247 virtual const String& getType()
const;
252 virtual SubRenderState* createInstance(ScriptCompiler* compiler, PropertyAbstractNode* prop, Pass* pass, SGScriptTranslator* translator);
257 virtual void writeInstance(MaterialSerializer* ser, SubRenderState* subRenderState, Pass* srcPass, Pass* dstPass);
274 bool addTexutreAtlasDefinition(
const Ogre::String& filename, TextureAtlasTablePtr textureAtlasTable = TextureAtlasTablePtr());
290 bool addTexutreAtlasDefinition(
DataStreamPtr stream, TextureAtlasTablePtr textureAtlasTable = TextureAtlasTablePtr());
300 void setTextureAtlasTable(
const String& textureName,
const TextureAtlasTablePtr& atlasData,
bool autoBorderAdjust =
true);
306 void removeTextureAtlasTable(
const String& textureName);
311 void removeAllTextureAtlasTables();
317 const TextureAtlasTablePtr& getTextureAtlasTable(
const String& textureName)
const;
329 void setDefaultAtlasingAttributes(IndexPositionMode mode,
ushort offset,
bool autoAdjustBorders);
335 const TextureAtlasAttib& getDefaultAtlasingAttributes()
const;
349 IndexPositionMode mode,
ushort offset,
bool autoAdjustBorders);
357 bool hasMaterialAtlasingAttributes(
Ogre::Material* material, TextureAtlasAttib* attrib = NULL)
const;
366 virtual SubRenderState* createInstanceImpl();
371 TextureAtlasMap mAtlases;
373 TextureAtlasAttib mDefaultAtlasAttrib;
Class encapsulates rendering properties of an object.
TextureAddressingMode
Texture addressing modes - default is TAM_WRAP.
std::ostream & operator<<(std::ostream &o, const TRect< T > &r)
HashedVector< Light * > LightList
SharedPtr< Parameter > ParameterPtr
SharedPtr< UniformParameter > UniformParameterPtr
SharedPtr< DataStream > DataStreamPtr
Shared pointer to allow data streams to be passed around without worrying about deallocation.
std::map< K, V, P, A > type