/*---------------------------------------------------------------------------* Project: NintendoWare File: gfx_ResProceduralTexture.h Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo and/or its licensed developers and are protected by national and international copyright laws. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. The content herein is highly confidential and should be handled accordingly. $Revision: $ *---------------------------------------------------------------------------*/ #ifndef NW_GFX_RESPROCEDURALTEXTURE_H_ #define NW_GFX_RESPROCEDURALTEXTURE_H_ #include #include #include #include #include #include #include #include namespace nw { namespace gfx { namespace res { //! @details :private struct ResProceduralNoiseData { nw::ut::ResBool m_IsNoiseEnabled; u8 _padding_0[3]; nw::ut::ResVec3 m_NoiseU; nw::ut::ResVec3 m_NoiseV; nw::ut::Offset toNoiseTable; }; //! @details :private struct ResProceduralClampShiftData { nw::ut::ResU32 m_ClampU; nw::ut::ResU32 m_ClampV; nw::ut::ResU32 m_ShiftU; nw::ut::ResU32 m_ShiftV; }; //! @details :private struct ResProceduralMappingData { nw::ut::ResBool m_IsAlphaSeparate; u8 _padding_0[3]; nw::ut::ResU32 m_MappingFunction; nw::ut::ResU32 m_AlphaMappingFunction; nw::ut::Offset toMappingTable; nw::ut::Offset toAlphaMappingTable; }; //! @details :private struct ResProceduralColorData { nw::ut::ResS32 m_TextureWidth; nw::ut::ResS32 m_TextureOffset; nw::ut::ResF32 m_TextureLodBias; nw::ut::ResU32 m_MinFilter; nw::ut::Offset toColorTables[4]; }; //! @details :private struct ResProceduralTextureData : public ResTextureData { ResProceduralNoiseData m_Noise; ResProceduralClampShiftData m_ClampShift; ResProceduralMappingData m_Mapping; ResProceduralColorData m_Color; }; //-------------------------------------------------------------------------- //! @brief プロシージャルテクスチャのノイズを表すバイナリリソースクラスです。 //! @details :private //--------------------------------------------------------------------------- class ResProceduralNoise : public nw::ut::ResCommon { public: NW_RES_CTOR( ResProceduralNoise ) NW_RES_FIELD_BOOL_PRIMITIVE_DECL( NoiseEnabled ) // IsNoiseEnabled(), SetNoiseEnabled() NW_RES_FIELD_VECTOR3_DECL( nw::math::VEC3, NoiseU ) // GetNoiseU() NW_RES_FIELD_VECTOR3_DECL( nw::math::VEC3, NoiseV ) // GetNoiseV() NW_RES_FIELD_CLASS_DECL( ResImageLookupTable, NoiseTable ) // GetNoiseTable() }; //-------------------------------------------------------------------------- //! @brief プロシージャルテクスチャのクランプを表すバイナリリソースクラスです。 //! @details :private //--------------------------------------------------------------------------- class ResProceduralClampShift : public nw::ut::ResCommon { public: enum Clamp { CLAMP_REPEAT = GL_SYMMETRICAL_REPEAT_DMP, CLAMP_MIRRORED = GL_MIRRORED_REPEAT, CLAMP_PULSE = GL_PULSE_DMP, CLAMP_EDGE = GL_CLAMP_TO_EDGE, CLAMP_ZERO = GL_CLAMP_TO_ZERO_DMP }; enum Shift { SHIFT_EVEN = GL_EVEN_DMP, SHIFT_ODD = GL_ODD_DMP, SHIFT_NONE = GL_NONE_DMP }; NW_RES_CTOR( ResProceduralClampShift ) NW_RES_FIELD_PRIMITIVE_DECL( Clamp, ClampU ) // GetClampU(), SetClampU() NW_RES_FIELD_PRIMITIVE_DECL( Clamp, ClampV ) // GetClampV(), SetClampV() NW_RES_FIELD_PRIMITIVE_DECL( Shift, ShiftU ) // GetShiftU(), SetShiftU() NW_RES_FIELD_PRIMITIVE_DECL( Shift, ShiftV ) // GetShiftV(), SetShiftV() }; //-------------------------------------------------------------------------- //! @brief プロシージャルテクスチャのマッピングを表すバイナリリソースクラスです。 //! @details :private //--------------------------------------------------------------------------- class ResProceduralMapping : public nw::ut::ResCommon { public: enum Function { FUNCTION_U = GL_PROCTEX_U_DMP, FUNCTION_V = GL_PROCTEX_V_DMP, FUNCTION_U2 = GL_PROCTEX_U2_DMP, FUNCTION_V2 = GL_PROCTEX_V2_DMP, FUNCTION_ADD = GL_PROCTEX_ADD_DMP, FUNCTION_ADD2 = GL_PROCTEX_ADD2_DMP, FUNCTION_ADDSQRT2 = GL_PROCTEX_ADDSQRT2_DMP, FUNCTION_MIN = GL_PROCTEX_MIN_DMP, FUNCTION_MAX = GL_PROCTEX_MAX_DMP, FUNCTION_RMAX = GL_PROCTEX_RMAX_DMP }; NW_RES_CTOR( ResProceduralMapping ) NW_RES_FIELD_BOOL_PRIMITIVE_DECL( AlphaSeparate ) // IsAlphaSeparate(), SetAlphaSeparate() NW_RES_FIELD_PRIMITIVE_DECL( Function, MappingFunction ) // GetMappingFunction(), SetMappingFunction() NW_RES_FIELD_PRIMITIVE_DECL( Function, AlphaMappingFunction ) // GetAlphaMappingFunction(), SetAlphaMappingFunction() NW_RES_FIELD_CLASS_DECL( ResImageLookupTable, MappingTable ) // GetMappingTable() NW_RES_FIELD_CLASS_DECL( ResImageLookupTable, AlphaMappingTable ) // GetAlphaMappingTable() }; //-------------------------------------------------------------------------- //! @brief プロシージャルテクスチャのカラーを表すバイナリリソースクラスです。 //! @details :private //--------------------------------------------------------------------------- class ResProceduralColor : public nw::ut::ResCommon { public: enum MinFilter { MINFILTER_NEAREST = GL_NEAREST, MINFILTER_LINEAR = GL_LINEAR, MINFILTER_NEAREST_MIPMAP_NEAREST = GL_NEAREST_MIPMAP_NEAREST, MINFILTER_NEAREST_MIPMAP_LINEAR = GL_NEAREST_MIPMAP_LINEAR, MINFILTER_LINEAR_MIPMAP_NEAREST = GL_LINEAR_MIPMAP_NEAREST, MINFILTER_LINEAR_MIPMAP_LINEAR = GL_LINEAR_MIPMAP_LINEAR }; NW_RES_CTOR( ResProceduralColor ) NW_RES_FIELD_PRIMITIVE_DECL( s32, TextureWidth ) // GetTextureWidth(), SetTextureWidth() NW_RES_FIELD_PRIMITIVE_DECL( s32, TextureOffset ) // GetTextureOffset(), SetTextureOffset() NW_RES_FIELD_PRIMITIVE_DECL( f32, TextureLodBias ) // GetTextureLodBias(), SetTextureLodBias() NW_RES_FIELD_PRIMITIVE_DECL( MinFilter, MinFilter ) // GetMinFilter(), SetMinFilter() NW_RES_FIELD_CLASS_FIXED_LIST_DECL( ResImageLookupTable, ColorTables ) // GetColorTables(int idx), GetColorTablesCount() }; //-------------------------------------------------------------------------- //! @brief プロシージャルテクスチャを表すバイナリリソースクラスです。 //! @details :private //--------------------------------------------------------------------------- class ResProceduralTexture : public ResTexture { public: enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResProceduralTexture) }; enum { SIGNATURE = NW_RES_SIGNATURE32('TXPR') }; NW_RES_CTOR_INHERIT( ResProceduralTexture, ResTexture ) NW_RES_FIELD_RESSTRUCT_DECL( ResProceduralNoise, Noise ) // GetNoise(), GetNoiseData() NW_RES_FIELD_RESSTRUCT_DECL( ResProceduralClampShift, ClampShift ) // GetClampShift(), GetClampShiftData() NW_RES_FIELD_RESSTRUCT_DECL( ResProceduralMapping, Mapping ) // GetMapping(), GetMappingData() NW_RES_FIELD_RESSTRUCT_DECL( ResProceduralColor, Color ) // GetColor(), GetColorData() }; } // namespace res } // namespace gfx } // namespace nw #endif // NW_GFX_RESPROCEDURALTEXTURE_H_