Infinite Planes

BlitzMax Forums/MiniB3D Module/Infinite Planes

SLotman(Posted 2010) [#1]
Since CreatePlane isn't implemented on miniB3D, I tried to do my own:



It is working (altough I couldn't figure out how to set the mesh to fill the screen width, I just set a value really high) - but now comes my doubt: how can I integrate it into miniB3D?



The idea is to take this code, and implement it as CreatePlane, with collisions and everything - but I'm not sure where to start, not even how I can access (inside miniB3D) the 'active' camera to place the plane correctly.

Edit: improved the code a little bit :)

Last edited 2010


ima747(Posted 2010) [#2]
Look into making your plane an extension of TMesh, and look into overriding the render method for positioning relative to the currently rendering camera... Either that or it's one of the update functions that adds the mesh to the render list... Check the update and render functions of tcamera, there should be a comment about what adds entities to the render list.

Good luck, would love to have so e easy to use planes!


SLotman(Posted 2010) [#3]
I implemented it on miniB3D (yay!), and while I still have to implement segments into the plane, something just hit me:

I am using the "PositionTexture" to simulate the texture movement, and it is working perfectly. There's only one problem with this - the texture is altered, and if applied to other objects, it will be moving too.

No clue yet how to figure that one out :(


ima747(Posted 2010) [#4]
Maybe alter the U/V of your mesh's vertices rather than the texture's U/V?

VertexTexCoords


ima747(Posted 2010) [#5]
another note on the width, you should be able to calculate the max width at a given distance (say the far clip plane...) as a factor of the screen's aspect ratio and then modify that by the camera's zoom if you want to be really thorough... don't recall the actual math but if you need assistance I can try to dig it out of some of my code.

Might be another way with some variant of camerapick or maybe direct opengl with an unproject...


SLotman(Posted 2010) [#6]
Hah, I just figure it out:



I store the texture UV before rendering, and restore it afterwards :)

Now just left to make the plane segmented :)

Edit: I also tought about changing the mesh UVW: would be pretty easy for a simple 2 triangles plane - but on segmented plane, have a plane very segmented (don't know what's the limit on Blitz3D) it could be much slower than just changing the texture UV...

Last edited 2010