mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
Add support for 2D texture arrays to ShaderGenerator and BufferViewer (actual render-to-texture-array functionality to come)
This commit is contained in:
parent
a1c70ce95e
commit
d489f68115
@ -290,6 +290,17 @@ class BufferViewer(DirectObject):
|
|||||||
card = NodePath(self.cardmaker.generate())
|
card = NodePath(self.cardmaker.generate())
|
||||||
card.setTexture(tex)
|
card.setTexture(tex)
|
||||||
cards.append(card)
|
cards.append(card)
|
||||||
|
elif (tex.getTextureType() == Texture.TT2dTextureArray):
|
||||||
|
for layer in range(tex.getZSize()):
|
||||||
|
self.cardmaker.setUvRange((0, 1, 1, 0), (0, 0, 1, 1),\
|
||||||
|
(layer, layer, layer, layer))
|
||||||
|
card = NodePath(self.cardmaker.generate())
|
||||||
|
# 2D texture arrays are not supported by
|
||||||
|
# the fixed-function pipeline, so we need to
|
||||||
|
# enable the shader generator to view them.
|
||||||
|
card.setShaderAuto()
|
||||||
|
card.setTexture(tex)
|
||||||
|
cards.append(card)
|
||||||
else:
|
else:
|
||||||
card = win.getTextureCard()
|
card = win.getTextureCard()
|
||||||
card.setTexture(tex)
|
card.setTexture(tex)
|
||||||
|
@ -962,8 +962,10 @@ sort_on_stages() {
|
|||||||
for (si = _on_stages.begin(); si != _on_stages.end(); ++si) {
|
for (si = _on_stages.begin(); si != _on_stages.end(); ++si) {
|
||||||
StageNode &sn = (*si);
|
StageNode &sn = (*si);
|
||||||
TextureStage *stage = sn._stage;
|
TextureStage *stage = sn._stage;
|
||||||
|
Texture *texture = sn._texture;
|
||||||
nassertv(stage != NULL);
|
nassertv(stage != NULL);
|
||||||
if (stage->is_fixed_function()) {
|
nassertv(texture != NULL);
|
||||||
|
if (stage->is_fixed_function() && texture->get_texture_type() != Texture::TT_2d_texture_array) {
|
||||||
const InternalName *name = stage->get_texcoord_name();
|
const InternalName *name = stage->get_texcoord_name();
|
||||||
|
|
||||||
// This pair of lines will get the next consecutive texcoord index
|
// This pair of lines will get the next consecutive texcoord index
|
||||||
|
@ -612,7 +612,7 @@ update_shadow_buffer(NodePath light_np) {
|
|||||||
// - shadow mapping
|
// - shadow mapping
|
||||||
// - most texgen modes
|
// - most texgen modes
|
||||||
// - texmatrix
|
// - texmatrix
|
||||||
// - 1D/2D/3D textures, cube textures
|
// - 1D/2D/3D textures, cube textures, 2D tex arrays
|
||||||
// - linear/exp/exp2 fog
|
// - linear/exp/exp2 fog
|
||||||
//
|
//
|
||||||
// Not yet supported:
|
// Not yet supported:
|
||||||
@ -956,6 +956,7 @@ synthesize_shader(const RenderState *rs) {
|
|||||||
switch (tex->get_texture_type()) {
|
switch (tex->get_texture_type()) {
|
||||||
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:
|
||||||
text << "xyz";
|
text << "xyz";
|
||||||
break;
|
break;
|
||||||
case Texture::TT_2d_texture:
|
case Texture::TT_2d_texture:
|
||||||
@ -998,6 +999,7 @@ synthesize_shader(const RenderState *rs) {
|
|||||||
switch(tex->get_texture_type()) {
|
switch(tex->get_texture_type()) {
|
||||||
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:
|
||||||
text << "xyz";
|
text << "xyz";
|
||||||
break;
|
break;
|
||||||
case Texture::TT_2d_texture:
|
case Texture::TT_2d_texture:
|
||||||
@ -1625,6 +1627,9 @@ texture_type_as_string(Texture::TextureType ttype) {
|
|||||||
case Texture::TT_cube_map:
|
case Texture::TT_cube_map:
|
||||||
return "CUBE";
|
return "CUBE";
|
||||||
break;
|
break;
|
||||||
|
case Texture::TT_2d_texture_array:
|
||||||
|
return "2DARRAY";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
pgraph_cat.error() << "Unsupported texture type!\n";
|
pgraph_cat.error() << "Unsupported texture type!\n";
|
||||||
return "2D";
|
return "2D";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user