Is it possible to create CubeImage arrays?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
bombquake
Prole
Posts: 5
Joined: Sat Sep 02, 2023 2:00 am
Contact:

Is it possible to create CubeImage arrays?

Post by bombquake »

If I run

Code: Select all

local cubemap_array = love.graphics.newCanvas(1024,1024,10,{type="cube",format="depth16",readable=true})
print(cubemap_array:getTextureType())
print(cubemap_array:getLayerCount())
I get

Code: Select all

cube
1
there's only one layer, are cubeimage arrays supported?
User avatar
pgimeno
Party member
Posts: 3637
Joined: Sun Oct 18, 2015 2:58 pm

Re: Is it possible to create CubeImage arrays?

Post by pgimeno »

TextureType only lets you specify one of array or cube or the others, so no, you can't have a Cube Array as you can't specify both at the same time.

Also, Texture:getLayerCount returns 1 for anything that isn't an array, so the result you're getting is expected.
User avatar
bombquake
Prole
Posts: 5
Joined: Sat Sep 02, 2023 2:00 am
Contact:

Re: Is it possible to create CubeImage arrays?

Post by bombquake »

I see thank you. I wanted to use them because I have several cubemaps I'm using inside my shader for omnidirectional shadow mapping and the compiler doesn't support sampler variable indexing. My current solution is to hard-code going through an array of them (below they're in in point_light_shadow_maps[]) so only constants are used for indexing

Code: Select all

// .\shader\vertex.glsl
#define DO_POINT_LIGHT(i)\\
  if (u_point_light_count > i){\\
  	if (point_light_has_shadow_map[i])\\
  		{light += calc_point_light_col_shadow(i, frag_normal, i, point_bias, point_light_shadow_maps[i]);}\\
  			else\\
  		{light += calc_point_light_col(i, frag_normal);}}
float point_bias = 1.35;
DO_POINT_LIGHT(0);
DO_POINT_LIGHT(1);
DO_POINT_LIGHT(2);
DO_POINT_LIGHT(3);
DO_POINT_LIGHT(4);
DO_POINT_LIGHT(5);
DO_POINT_LIGHT(6);
DO_POINT_LIGHT(7);
DO_POINT_LIGHT(8);
It feels more like a hack than a solution; after doing some profiling the bottlenecks are elsewhere in the program but still, if anyone has any ideas for better ways this could be done I'd love to hear it
Attachments
prov.love
(1.91 MiB) Downloaded 43 times
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests