00001 00002 // Copyright 1986, 2015 NVIDIA ARC GmbH. All rights reserved. 00004 // Created: 9.10.08 00005 // Module: api 00006 // Purpose: mental ray C++ shader interface extensions 00008 00018 00019 00020 #ifndef SHADER_SDS34_H 00021 #define SHADER_SDS34_H 00022 00023 namespace mi { 00024 namespace shader_v3 { 00025 00035 00036 class Subdivision34 { 00037 public: 00038 00041 enum Space_type {POS, TEXTURE, MOTION}; 00042 00044 virtual miUint get_no_spaces() const = 0; 00045 00048 virtual miUint get_dimension(miUint space) const = 0; 00049 00052 virtual Space_type get_space_type(miUint space) const = 0; 00053 00056 virtual miUint get_no_vectors(miUint space) const = 0; 00057 00064 virtual const miScalar * get_vector( 00065 miUint space, 00066 miUint which) const = 0; // vector 00067 00069 virtual miUint get_no_triangles() const = 0; 00070 00072 virtual miUint get_no_quads() const = 0; 00073 00079 struct Face { 00080 const miUint * m_vertices; // ret 3 or 4 indices 00081 miTag m_material; // face material 00082 }; 00083 00088 virtual const Face get_triangle( 00089 miUint space, 00090 miUint which) const = 0; // triangle 00091 00096 virtual const Face get_quad( 00097 miUint space, 00098 miUint which) const = 0; // quad 00099 00105 virtual bool get_triangle_derivatives( 00106 miUint face, // triangle 00107 miUint which, // vertex 0-2 00108 miVector derivs[2]) = 0; // result du dv vectors 00109 00115 virtual bool get_quad_derivatives( 00116 miUint face, // quad 00117 miUint which, // vertex 0-3 00118 miVector derivs[2]) = 0; // result du dv vectors 00119 }; 00120 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, 2015 NVIDIA ARC GmbH. All rights reserved.