entitytexture() framenumber

Blitz3D Forums/Blitz3D Programming/entitytexture() framenumber

RemiD(Posted 2016) [#1]
Hello, :)

I have a mesh made of many 3drectangles and each rectangle has the same uv coords than the others (use the same area on the texture).

If i use an "animated texture" (a texture with several frames), what happens when i use entitytexture(mesh,texture,framenumber) ? A new texture is applied to the surface (only 1 surface in this case) of the mesh or the uv coords of all vertices are modified to use another area of the texture ?

Because maybe it would be faster to use : copyrect(0,0,framepwidth,framepheight,0,0,texturebuffer(frame(n)),texturebuffer(texture))

Any idea ?

Thanks,


Matty(Posted 2016) [#2]
If you are asking what blitz does internally I do not know but I would imagine it simply shifts the position of the texture's uv coordinates such that 0...1 0...1 UV point to different locations within the actual texture...so rather than the uv coords of the mesh changing - the lookup on the texture itself changes.

Just my imagination however...

Re:your solution of copyrecting...perhaps it would be faster to use positiontexture and scaletexture commands?


RemiD(Posted 2016) [#3]
I ask this because depending on the mesh (low tris or high tris), if there are many uv coordinates to calculate/set it may take some time...


_PJ_(Posted 2016) [#4]
Might be even quicker then, to use a secondary UV coord set and TextureCoords


Stevie G(Posted 2016) [#5]
It would make more sense for entitytexture to simply apply a new texture and retain UV's as Matty says.

Copyrect is dog slow so I cannot see how that would be faster than what Blitz does internally with entitytexture. It should be easy enough to try both solutions.


RemiD(Posted 2016) [#6]
An update about this : entitytexture(mesh,texture,framen) is fast even if the mesh has many vertices/triangles (0.001ms for a 5000 triangles mesh).