Skip to content

Commit

Permalink
Main: TextureUnitState - alias EnvMapType to TexCoordCalcMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Aug 25, 2024
1 parent 27b69b1 commit 5ee9c17
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 31 deletions.
1 change: 1 addition & 0 deletions OgreMain/include/Ogre.i
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ typedef uint8_t uint8;
%ignore Ogre::GpuConstantType;
%ignore Ogre::GpuProgramParameters::ElementType;
%ignore Ogre::Capabilities;
%ignore Ogre::TextureUnitState::EnvMapType;
%typemap(csbase) Ogre::SceneManager::QueryTypeMask "uint";
%csmethodmodifiers *::ToString "public override";
// wrong "override" because of multiple inheritance
Expand Down
11 changes: 8 additions & 3 deletions OgreMain/include/OgreRenderSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ THE SOFTWARE.
// Precompiler options
#include "OgrePrerequisites.h"

#include "OgreTextureUnitState.h"
#include "OgreCommon.h"
#include "OgreBlendMode.h"

#include "OgreRenderSystemCapabilities.h"
#include "OgreConfigOptionMap.h"
Expand All @@ -43,6 +43,9 @@ THE SOFTWARE.

namespace Ogre
{
class Sampler;
class TextureUnitState;

/** \addtogroup Core
* @{
*/
Expand All @@ -61,11 +64,13 @@ namespace Ogre
{
/// No calculated texture coordinates
TEXCALC_NONE,
/// Environment map based on vertex normals
/// 2D texture coordinates using spherical reflection mapping based on vertex normals
TEXCALC_ENVIRONMENT_MAP,
/// Environment map based on vertex positions
/// 2D texture coordinates using view space position. Same as #TEXCALC_ENVIRONMENT_MAP on all backends.
TEXCALC_ENVIRONMENT_MAP_PLANAR,
/// 3D texture coordinates using the reflection vector
TEXCALC_ENVIRONMENT_MAP_REFLECTION,
/// 3D texture coordinates using the normal vector
TEXCALC_ENVIRONMENT_MAP_NORMAL,
/// Projective texture
TEXCALC_PROJECTIVE_TEXTURE
Expand Down
23 changes: 12 additions & 11 deletions OgreMain/include/OgreTextureUnitState.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ THE SOFTWARE.
#include "OgreMatrix4.h"
#include "OgreTexture.h"
#include "OgreHeaderPrefix.h"
#include "OgreRenderSystem.h"

namespace Ogre {
enum TexCoordCalcMethod : uint8;
Expand Down Expand Up @@ -264,17 +265,17 @@ namespace Ogre {

};

/// %Texture coordinate generation method for environment mapping.
enum EnvMapType
/// rather use @ref TexCoordCalcMethod
enum EnvMapType : uint8
{
/// 2D texture coordinates using view space position. Same as ENV_CURVED on all backends.
ENV_PLANAR,
/// 2D texture coordinates using spherical reflection mapping
ENV_CURVED,
/// Cubic texture coordinates using the reflection vector
ENV_REFLECTION,
/// Cubic texture coordinates using the normal vector
ENV_NORMAL
/// same as #TEXCALC_ENVIRONMENT_MAP_PLANAR
ENV_PLANAR = TEXCALC_ENVIRONMENT_MAP_PLANAR,
/// same as #TEXCALC_ENVIRONMENT_MAP
ENV_CURVED = TEXCALC_ENVIRONMENT_MAP,
/// same as #TEXCALC_ENVIRONMENT_MAP_REFLECTION
ENV_REFLECTION = TEXCALC_ENVIRONMENT_MAP_REFLECTION,
/// same as #TEXCALC_ENVIRONMENT_MAP_NORMAL
ENV_NORMAL = TEXCALC_ENVIRONMENT_MAP_NORMAL
};

/** Useful enumeration when dealing with procedural transforms.
Expand Down Expand Up @@ -884,7 +885,7 @@ namespace Ogre {
True to enable, false to disable
@param texGenType texture coordinate generation type
*/
void setEnvironmentMap(bool enable, EnvMapType texGenType = ENV_CURVED);
void setEnvironmentMap(bool enable, int texGenType = TEXCALC_ENVIRONMENT_MAP);

/** Sets up an animated scroll for the texture layer.
Expand Down
19 changes: 2 additions & 17 deletions OgreMain/src/OgreTextureUnitState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ namespace Ogre {
return mAlphaBlendMode;
}
//-----------------------------------------------------------------------
void TextureUnitState::setEnvironmentMap(bool enable, EnvMapType envMapType)
void TextureUnitState::setEnvironmentMap(bool enable, int envMapType)
{
if (enable)
{
Expand Down Expand Up @@ -1226,22 +1226,7 @@ namespace Ogre {
switch (effi.second.type)
{
case ET_ENVIRONMENT_MAP:
if (effi.second.subtype == ENV_CURVED)
{
texCoordCalcMethod = TEXCALC_ENVIRONMENT_MAP;
}
else if (effi.second.subtype == ENV_PLANAR)
{
texCoordCalcMethod = TEXCALC_ENVIRONMENT_MAP_PLANAR;
}
else if (effi.second.subtype == ENV_REFLECTION)
{
texCoordCalcMethod = TEXCALC_ENVIRONMENT_MAP_REFLECTION;
}
else if (effi.second.subtype == ENV_NORMAL)
{
texCoordCalcMethod = TEXCALC_ENVIRONMENT_MAP_NORMAL;
}
texCoordCalcMethod = (TexCoordCalcMethod)effi.second.subtype;
break;
case ET_UVSCROLL:
case ET_USCROLL:
Expand Down
1 change: 1 addition & 0 deletions RenderSystems/Tiny/include/OgreTinyRenderSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "OgreRenderWindow.h"
#include "OgreRenderSystem.h"
#include "OgreImage.h"

namespace Ogre {
/** \addtogroup RenderSystems RenderSystems
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ THE SOFTWARE.
#include "OgreShaderPrerequisites.h"
#ifdef RTSHADER_SYSTEM_BUILD_EXT_SHADERS
#include "OgreShaderSubRenderState.h"
#include "OgreTextureUnitState.h"

#define TAS_MAX_TEXTURES 4
namespace Ogre {
Expand Down

0 comments on commit 5ee9c17

Please sign in to comment.