@@ -38,6 +38,7 @@ struct Texture3D
3838 std::string m_textureName;
3939 std::string m_samplerName;
4040 unsigned m_edgelen;
41+ GpuShaderDesc::TextureType m_channel;
4142 Interpolation m_interpolation;
4243 GpuShaderDescRcPtr m_shaderDesc;
4344 int m_index;
@@ -129,6 +130,9 @@ void bindPyGpuShaderDesc(py::module & m)
129130 case GpuShaderDesc::TEXTURE_RGB_CHANNEL:
130131 numChannels = 3 ;
131132 break ;
133+ case GpuShaderDesc::TEXTURE_RGBA_CHANNEL:
134+ numChannels = 4 ;
135+ break ;
132136 default :
133137 throw Exception (" Error: Unsupported texture type" );
134138 }
@@ -160,6 +164,7 @@ void bindPyGpuShaderDesc(py::module & m)
160164 const std::string & textureName,
161165 const std::string & samplerName,
162166 unsigned edgelen,
167+ GpuShaderDesc::TextureType channel,
163168 Interpolation interpolation,
164169 const py::buffer & values)
165170 {
@@ -172,10 +177,11 @@ void bindPyGpuShaderDesc(py::module & m)
172177 self->add3DTexture (textureName.c_str (),
173178 samplerName.c_str (),
174179 edgelen,
180+ channel,
175181 interpolation,
176182 static_cast <float *>(info.ptr ));
177183 },
178- " textureName" _a, " samplerName" _a, " edgeLen" _a, " interpolation" _a, " values" _a,
184+ " textureName" _a, " samplerName" _a, " edgeLen" _a, " channel " _a, " interpolation" _a, " values" _a,
179185 DOC (GpuShaderCreator, add3DTexture))
180186 .def (" get3DTextures" , [](GpuShaderDescRcPtr & self)
181187 {
@@ -266,6 +272,9 @@ void bindPyGpuShaderDesc(py::module & m)
266272 case GpuShaderDesc::TEXTURE_RGB_CHANNEL:
267273 numChannels = 3 ;
268274 break ;
275+ case GpuShaderDesc::TEXTURE_RGBA_CHANNEL:
276+ numChannels = 4 ;
277+ break ;
269278 default :
270279 throw Exception (" Error: Unsupported texture type" );
271280 }
@@ -323,6 +332,7 @@ void bindPyGpuShaderDesc(py::module & m)
323332 .def_readonly (" textureName" , &Texture3D::m_textureName)
324333 .def_readonly (" samplerName" , &Texture3D::m_samplerName)
325334 .def_readonly (" edgeLen" , &Texture3D::m_edgelen)
335+ .def_readonly (" channel" , &Texture3D::m_channel)
326336 .def_readonly (" interpolation" , &Texture3D::m_interpolation)
327337 .def (" getValues" , [](Texture3D & self)
328338 {
@@ -350,10 +360,11 @@ void bindPyGpuShaderDesc(py::module & m)
350360 const char * textureName = nullptr ;
351361 const char * samplerName = nullptr ;
352362 unsigned edgelen;
363+ GpuShaderDesc::TextureType channel;
353364 Interpolation interpolation;
354- it.m_obj ->get3DTexture (i, textureName, samplerName, edgelen, interpolation);
365+ it.m_obj ->get3DTexture (i, textureName, samplerName, edgelen, channel, interpolation);
355366
356- return { textureName, samplerName, edgelen, interpolation, it.m_obj , i };
367+ return { textureName, samplerName, edgelen, channel, interpolation, it.m_obj , i };
357368 })
358369 .def (" __iter__" , [](Texture3DIterator & it) -> Texture3DIterator &
359370 {
@@ -366,10 +377,11 @@ void bindPyGpuShaderDesc(py::module & m)
366377 const char * textureName = nullptr ;
367378 const char * samplerName = nullptr ;
368379 unsigned edgelen;
380+ GpuShaderDesc::TextureType channel;
369381 Interpolation interpolation;
370- it.m_obj ->get3DTexture (i, textureName, samplerName, edgelen, interpolation);
382+ it.m_obj ->get3DTexture (i, textureName, samplerName, edgelen, channel, interpolation);
371383
372- return { textureName, samplerName, edgelen, interpolation, it.m_obj , i };
384+ return { textureName, samplerName, edgelen, channel, interpolation, it.m_obj , i };
373385 });
374386}
375387
0 commit comments