mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
pgraphnodes: Support missing texture types in shader generator:
- Cube arrays - 1D texture arrays - Buffer textures Not to say that they are displayed meaningfully, but better than a cryptic error message.
This commit is contained in:
parent
d69d393e4c
commit
a20996d2aa
@ -1293,15 +1293,20 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||||||
text << "\t float4 tex" << i << " = tex" << texture_type_as_string(tex._type);
|
text << "\t float4 tex" << i << " = tex" << texture_type_as_string(tex._type);
|
||||||
text << "(tex_" << i << ", texcoord" << i << ".";
|
text << "(tex_" << i << ", texcoord" << i << ".";
|
||||||
switch (tex._type) {
|
switch (tex._type) {
|
||||||
|
case Texture::TT_cube_map_array:
|
||||||
|
text << "xyzw";
|
||||||
|
break;
|
||||||
case Texture::TT_cube_map:
|
case Texture::TT_cube_map:
|
||||||
case Texture::TT_3d_texture:
|
case Texture::TT_3d_texture:
|
||||||
case Texture::TT_2d_texture_array:
|
case Texture::TT_2d_texture_array:
|
||||||
text << "xyz";
|
text << "xyz";
|
||||||
break;
|
break;
|
||||||
case Texture::TT_2d_texture:
|
case Texture::TT_2d_texture:
|
||||||
|
case Texture::TT_1d_texture_array:
|
||||||
text << "xy";
|
text << "xy";
|
||||||
break;
|
break;
|
||||||
case Texture::TT_1d_texture:
|
case Texture::TT_1d_texture:
|
||||||
|
case Texture::TT_buffer_texture:
|
||||||
text << "x";
|
text << "x";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1342,15 +1347,20 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
|
|||||||
text << "\t float4 tex" << i << " = tex" << texture_type_as_string(tex._type);
|
text << "\t float4 tex" << i << " = tex" << texture_type_as_string(tex._type);
|
||||||
text << "(tex_" << i << ", texcoord" << i << ".";
|
text << "(tex_" << i << ", texcoord" << i << ".";
|
||||||
switch (tex._type) {
|
switch (tex._type) {
|
||||||
|
case Texture::TT_cube_map_array:
|
||||||
|
text << "xyzw";
|
||||||
|
break;
|
||||||
case Texture::TT_cube_map:
|
case Texture::TT_cube_map:
|
||||||
case Texture::TT_3d_texture:
|
case Texture::TT_3d_texture:
|
||||||
case Texture::TT_2d_texture_array:
|
case Texture::TT_2d_texture_array:
|
||||||
text << "xyz";
|
text << "xyz";
|
||||||
break;
|
break;
|
||||||
case Texture::TT_2d_texture:
|
case Texture::TT_2d_texture:
|
||||||
|
case Texture::TT_1d_texture_array:
|
||||||
text << "xy";
|
text << "xy";
|
||||||
break;
|
break;
|
||||||
case Texture::TT_1d_texture:
|
case Texture::TT_1d_texture:
|
||||||
|
case Texture::TT_buffer_texture:
|
||||||
text << "x";
|
text << "x";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1970,24 +1980,33 @@ combine_source_as_string(const ShaderKey::TextureInfo &info, short num, bool alp
|
|||||||
const char *ShaderGenerator::
|
const char *ShaderGenerator::
|
||||||
texture_type_as_string(Texture::TextureType ttype) {
|
texture_type_as_string(Texture::TextureType ttype) {
|
||||||
switch (ttype) {
|
switch (ttype) {
|
||||||
case Texture::TT_1d_texture:
|
case Texture::TT_1d_texture:
|
||||||
return "1D";
|
return "1D";
|
||||||
break;
|
|
||||||
case Texture::TT_2d_texture:
|
case Texture::TT_2d_texture:
|
||||||
return "2D";
|
return "2D";
|
||||||
break;
|
|
||||||
case Texture::TT_3d_texture:
|
case Texture::TT_3d_texture:
|
||||||
return "3D";
|
return "3D";
|
||||||
break;
|
|
||||||
case Texture::TT_cube_map:
|
case Texture::TT_2d_texture_array:
|
||||||
return "CUBE";
|
return "2DARRAY";
|
||||||
break;
|
|
||||||
case Texture::TT_2d_texture_array:
|
case Texture::TT_cube_map:
|
||||||
return "2DARRAY";
|
return "CUBE";
|
||||||
break;
|
|
||||||
default:
|
case Texture::TT_buffer_texture:
|
||||||
pgraphnodes_cat.error() << "Unsupported texture type!\n";
|
return "BUF";
|
||||||
return "2D";
|
|
||||||
|
case Texture::TT_cube_map_array:
|
||||||
|
return "CUBEARRAY";
|
||||||
|
|
||||||
|
case Texture::TT_1d_texture_array:
|
||||||
|
return "1DARRAY";
|
||||||
|
|
||||||
|
default:
|
||||||
|
pgraphnodes_cat.error() << "Unsupported texture type!\n";
|
||||||
|
return "2D";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user