first commit
This commit is contained in:
120
include/engine/core/texture_parm.h
Normal file
120
include/engine/core/texture_parm.h
Normal file
@ -0,0 +1,120 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __NTEXTUREPARM__
|
||||
#define __NTEXTUREPARM__
|
||||
|
||||
|
||||
#include "reflection/c_refl.h"
|
||||
#include "reflection/nenum_string.h"
|
||||
#include "nstring/nstring.h"
|
||||
|
||||
|
||||
namespace GS {
|
||||
class Picture;
|
||||
|
||||
namespace NML { class Tag; }
|
||||
namespace Render {
|
||||
struct Texture;
|
||||
|
||||
//
|
||||
struct TextureParm
|
||||
{
|
||||
/// Get texture parameter file name from texture name.
|
||||
static String GetParmFileName(const char *);
|
||||
|
||||
static Reflection::Property serializable[];
|
||||
|
||||
enum Filtering
|
||||
{
|
||||
FilterDefault = 0,
|
||||
FilterNearest,
|
||||
FilterBilinear,
|
||||
FilterTrilinear,
|
||||
|
||||
FilterLast
|
||||
};
|
||||
static Reflection::Enum::Dict filtering_dict[];
|
||||
|
||||
enum Anisotropy
|
||||
{
|
||||
AnisotropyDefault = 0,
|
||||
AnisotropyNone,
|
||||
Anisotropy2x,
|
||||
Anisotropy4x,
|
||||
Anisotropy8x,
|
||||
Anisotropy16x,
|
||||
|
||||
AnisotropyLast
|
||||
};
|
||||
static Reflection::Enum::Dict anisotropic_dict[];
|
||||
|
||||
enum Wrap
|
||||
{
|
||||
WrapDefault = 0,
|
||||
WrapRepeat,
|
||||
WrapClamp,
|
||||
|
||||
WrapLast
|
||||
};
|
||||
static Reflection::Enum::Dict wrap_dict[];
|
||||
|
||||
enum Swizzle
|
||||
{
|
||||
SwizzleRGBA = 0, // identity
|
||||
SwizzleBGRA,
|
||||
SwizzleARGB,
|
||||
SwizzleABGR,
|
||||
SwizzleXYZ, // identity
|
||||
SwizzleXZY,
|
||||
SwizzleYXZ,
|
||||
SwizzleYZX,
|
||||
SwizzleZXY,
|
||||
SwizzleZYX,
|
||||
|
||||
SwizzleLast
|
||||
};
|
||||
static Reflection::Enum::Dict swizzle_dict[];
|
||||
|
||||
static const char *GetSwizzleFlags(Swizzle);
|
||||
|
||||
Wrap wrap_u, wrap_v;
|
||||
Filtering filtering;
|
||||
Anisotropy anisotropy;
|
||||
|
||||
float lod_bias;
|
||||
|
||||
Swizzle swizzle;
|
||||
|
||||
bool invert[4];
|
||||
bool flip[2];
|
||||
|
||||
void Apply(Picture &) const;
|
||||
void Apply(Texture &) const;
|
||||
|
||||
bool FromMetaTag(NML::Tag &);
|
||||
NML::Tag *AsMetaTag() const;
|
||||
|
||||
TextureParm()
|
||||
{
|
||||
wrap_u = wrap_v = WrapDefault;
|
||||
filtering = FilterDefault;
|
||||
anisotropy = AnisotropyDefault;
|
||||
|
||||
lod_bias = 0.f;
|
||||
|
||||
swizzle = SwizzleRGBA;
|
||||
for (uchar n = 0; n < 4; ++n)
|
||||
invert[n] = false;
|
||||
flip[0] = flip[1] = false;
|
||||
}
|
||||
};
|
||||
|
||||
} // Render
|
||||
} // GS
|
||||
|
||||
|
||||
#endif // __NTEXTUREPARM__
|
||||
Reference in New Issue
Block a user