00001 00002 // Copyright 1986-2009 by mental images GmbH, Fasanenstr. 81, D-10623 Berlin, 00003 // Germany. All rights reserved. 00005 // Created: 9.10.08 00006 // Module: api 00007 // Purpose: mental ray C++ shader interface extensions 00009 00019 00020 00021 #ifndef SHADER_SDS34_H 00022 #define SHADER_SDS34_H 00023 00024 namespace mi { 00025 namespace shader_v3 { 00026 00036 00037 class Subdivision34 { 00038 public: 00039 00042 enum Space_type {POS, TEXTURE, MOTION}; 00043 00045 virtual miUint get_no_spaces() const = 0; 00046 00049 virtual miUint get_dimension(miUint space) const = 0; 00050 00053 virtual Space_type get_space_type(miUint space) const = 0; 00054 00057 virtual miUint get_no_vectors(miUint space) const = 0; 00058 00065 virtual const miScalar * get_vector( 00066 miUint space, 00067 miUint which) const = 0; // vector 00068 00070 virtual miUint get_no_triangles() const = 0; 00071 00073 virtual miUint get_no_quads() const = 0; 00074 00080 struct Face { 00081 const miUint * m_vertices; // ret 3 or 4 indices 00082 miTag m_material; // face material 00083 }; 00084 00089 virtual const Face get_triangle( 00090 miUint space, 00091 miUint which) const = 0; // triangle 00092 00097 virtual const Face get_quad( 00098 miUint space, 00099 miUint which) const = 0; // quad 00100 00106 virtual bool get_triangle_derivatives( 00107 miUint face, // triangle 00108 miUint which, // vertex 0-2 00109 miVector derivs[2]) = 0; // result du dv vectors 00110 00116 virtual bool get_quad_derivatives( 00117 miUint face, // quad 00118 miUint which, // vertex 0-3 00119 miVector derivs[2]) = 0; // result du dv vectors 00120 }; 00121 00124 class Access_subdivision34 { 00125 public: 00126 Access_subdivision34( 00127 miTag tag); 00128 00129 ~Access_subdivision34(); 00130 00131 Subdivision34 * operator->() const; 00132 00133 private: 00134 Access_subdivision34(const Access_subdivision34&); 00135 Access_subdivision34 & operator=(const Access_subdivision34&); 00136 mi::shader_v3::Interface * m_iface; 00137 Subdivision34 * m_sds34; 00138 const miTag m_tag; 00139 }; 00140 00144 typedef Access_subdivision34 Subdivision34_access; 00145 00147 inline Access_subdivision34::Access_subdivision34( 00148 miTag tag) 00149 : m_iface(mi_get_shader_interface()), 00150 m_sds34(m_iface->accessSubdivision34(tag)), 00151 m_tag(tag) 00152 { 00153 } 00154 00156 inline Access_subdivision34::~Access_subdivision34() 00157 { 00158 if (m_sds34 != 0) 00159 m_iface->releaseSubdivision34(m_sds34); 00160 m_iface->release(); 00161 } 00162 00164 inline Subdivision34 * Access_subdivision34::operator->() const 00165 { 00166 return m_sds34; 00167 } 00168 00169 }} 00170 00171 #endif //SHADER_SDS34_H
Copyright © 1986-2010 by
mental images GmbH