OSDN Git Service

directx/shader_param.hpp 出来てきたっぽい?
authorMyun2 <myun2@nwhite.info>
Sun, 24 Apr 2011 01:36:43 +0000 (10:36 +0900)
committerMyun2 <myun2@nwhite.info>
Sun, 24 Apr 2011 01:36:43 +0000 (10:36 +0900)
roast_ex/include/roast/graphics/directx/shader_param.hpp
roast_ex/include/roast/graphics/directx/tuple_ul.hpp
roast_ex/test/dx9_test/dx9_test.cpp
roast_ex/test/dx9_test/roast_test_3rd.vcproj

index aaa0eaa..0891468 100644 (file)
@@ -3,6 +3,8 @@
 #ifndef __SFJP_ROAST_EX__graphics__directx__shader_param_HPP__
 #define __SFJP_ROAST_EX__graphics__directx__shader_param_HPP__
 
+#include "roast/graphics/directx/tuple_ul.hpp"
+
 namespace roast
 {
        namespace directx
@@ -18,17 +20,64 @@ namespace roast
                                {
                                        float1,
                                        float2,
+                                       float3,
                                        float4,
                                        float4x4,
-                                       __end
+                                       _null
                                };
+
+                               template <::roast::directx::graphics::shader_param_type::_ e>
+                               struct to_type{ typedef _internal::null_type type; };
+
+                               template<> struct to_type<float1>{ typedef float type; };
+                               template<> struct to_type<float2>{ typedef float type[2]; };
+                               template<> struct to_type<float3>{ typedef float type[3]; };
+                               template<> struct to_type<float4>{ typedef float type[4]; };
                        }
                        typedef shader_param_type::_ shader_param_type_e;
                        
-                       ///////////
+                       ///////////////////
+
+                       ///////////////////
                        
-                       template <shader_param_type_e T1>
-                       struct shader_param_ {};
+                       template <shader_param_type_e T1,
+                               shader_param_type_e T2=shader_param_type::_null,
+                               shader_param_type_e T3=shader_param_type::_null,
+                               shader_param_type_e T4=shader_param_type::_null,
+                               shader_param_type_e T5=shader_param_type::_null,
+                               shader_param_type_e T6=shader_param_type::_null,
+                               shader_param_type_e T7=shader_param_type::_null,
+                               shader_param_type_e T8=shader_param_type::_null,
+                               shader_param_type_e T9=shader_param_type::_null,
+                               shader_param_type_e T10=shader_param_type::_null,
+                               shader_param_type_e T11=shader_param_type::_null,
+                               shader_param_type_e T12=shader_param_type::_null,
+                               shader_param_type_e T13=shader_param_type::_null,
+                               shader_param_type_e T14=shader_param_type::_null,
+                               shader_param_type_e T15=shader_param_type::_null,
+                               shader_param_type_e T16=shader_param_type::_null,
+                               shader_param_type_e T17=shader_param_type::_null,
+                               shader_param_type_e T18=shader_param_type::_null,
+                               shader_param_type_e T19=shader_param_type::_null,
+                               shader_param_type_e T20=shader_param_type::_null,
+                               shader_param_type_e T21=shader_param_type::_null,
+                               shader_param_type_e T22=shader_param_type::_null,
+                               shader_param_type_e T23=shader_param_type::_null,
+                               shader_param_type_e T24=shader_param_type::_null,
+                               shader_param_type_e T25=shader_param_type::_null,
+                               shader_param_type_e T26=shader_param_type::_null,
+                               shader_param_type_e T27=shader_param_type::_null,
+                               shader_param_type_e T28=shader_param_type::_null,
+                               shader_param_type_e T29=shader_param_type::_null,
+                               shader_param_type_e T30=shader_param_type::_null,
+                               shader_param_type_e T31=shader_param_type::_null,
+                               shader_param_type_e T32=shader_param_type::_null>
+                       struct shader_param_ : public _internal::tuple<
+                               typename shader_param_type::to_type<T1>::type,
+                               typename shader_param_type::to_type<T2>::type
+                       > {
+                               //typename to_type<T1>::type v1;
+                       };
                        
                        //////////////////////////////////////////////////////
                }
index 9714f7e..7ec6f6d 100644 (file)
@@ -524,6 +524,22 @@ namespace roast
                        
                        
                                /////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+                               /*
+                               template <typename T>
+                               struct initial_value_type{ typedef T type; };
+                               template <typename T, int N>
+                               struct initial_value_type<T[N]>{ typedef T type[N]; T value[N]; };
+
+                               template <typename T>
+                               T _initial_value(const T &n){ return T(); }
+
+                               template <typename T, int N>
+                               T[N] /typename initial_value_type<T[N]>::type/ _initial_value(const T n[N]){
+                                       initial_value_type<T[N]> t;
+                                       return t.value;
+                               }
+                               */
                        
                                //      tuple
                                template <
@@ -543,25 +559,31 @@ namespace roast
                                        //typedef _tuple_ll_to_ul_t<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> _Base, _Ll, _LlType;
                                        typedef typename _tuple_ll_to_ul_t<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>::_Type _Base, _Ll, _LlType;
                                public:
+                                       //      0 paramater Constructer
+                                       tuple(){}
+                                       //      1 paramater Constructer
+                                       tuple(T1        t1) : _Base(t1){}
+                                       //      2 paramater Constructer
                                        tuple(
                                                T1      t1,
-                                               T2      t2,
-                                               T3      t3 = null_type(),
-                                               T4      t4 = null_type(),
-                                               T5      t5 = null_type(),
-                                               T6      t6 = null_type(),
-                                               T7      t7 = null_type(),
-                                               T8      t8 = null_type(),
-                                               T9      t9 = null_type(),
-                                               T10     t10 = null_type())
+                                               T2      t2)
                                                :
-                                               _Base(t1, _tuple_ll_to_ul_t<T2,T3,T4,T5,T6,T7,T8,T9,T10>::make(t2, t3, t4, t5, t6, t7, t8, t9, t10) )
+                                               _Base(t1, _tuple_ll_to_ul_t<T2>::make(t2) )
                                        {}
-                       
+
                                        tuple(
-                                               T1      t1 = null_type())
+                                               T1      t1,
+                                               T2      t2,
+                                               T3      t3,
+                                               T4      t4,
+                                               T5      t5,
+                                               T6      t6,
+                                               T7      t7,
+                                               T8      t8,
+                                               T9      t9,
+                                               T10     t10)
                                                :
-                                               _Base(t1)
+                                               _Base(t1, _tuple_ll_to_ul_t<T2,T3,T4,T5,T6,T7,T8,T9,T10>::make(t2, t3, t4, t5, t6, t7, t8, t9, t10) )
                                        {}
                        
                                        tuple operator = ( _tuple_ll_to_ul_t<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> &from )
index 49823fc..00d5c84 100644 (file)
@@ -8,6 +8,11 @@
 using namespace ::roast::directx::graphics;
 using namespace ::roast::directx::dx10;
 
+/*typedef int A[4];
+A hoge(){
+       A a;
+       return a; 
+}*/
 void main( void )
 {
        try
@@ -64,6 +69,7 @@ void main( void )
                d2.present();*/
 
                shader_param_<shader_param_type::float2> ss;
+               printf("size=%d\n", sizeof(shader_param_<shader_param_type::float1, shader_param_type::float4>) );
 
 struct MyVertex {
         D3DXVECTOR3 Pos;
index c522abe..94c1da6 100644 (file)
                                                        RelativePath="..\..\include\roast\graphics\directx\dx9.hpp"
                                                        >
                                                </File>
+                                               <File
+                                                       RelativePath="..\..\include\roast\graphics\directx\shader_param.hpp"
+                                                       >
+                                               </File>
                                                <Filter
                                                        Name="dx9"
                                                        >