Hi, > The player discovers the map through the game. Getting the terrain > coordinates where the user clicked is for already discovered parts not a > problem, as I can use default Java 3D picking methods. But how do I > discover > where the user clicked, if this part is undiscovered?
If your landscape is not too large you could simply turn the invisible parts invisible by setVisible(false) in RenderingAttributes. The objects are still pickable. But therefore all tiles have to be in the scenegraph. Another more elegant way should be to use one large invisible Quad around the visible parts of the map. If the Pickresult is that Quad you have to get the clicked point on that Quad by getClosestIntersection(Point3d pt) in Pickresult. From that point it's easy to compute the not yet existing tile at that position of your map. > To get a nicer landscape I want blend the textures so the terrain > overlaps. My > original idea was to create a BufferdImage for each grid and add this as a > texture to the geometry. But this would result into an OutOfMemory > Exception. Try to use multitexturing. Use and reuse small textures for the tiles and a second maybe larger texture for the whole map or a cluster of tiles. Try to increase the memory limits with start parameters like -ms128m -mx256m. > Currently I am adding the complete known map to the scene-graph. Would it > work if I only add the currently visible area and remove the invisible? > Yes. You should do that for larger terrains. If all fits into memory you can simply turn the invisible parts off with a switch node above every tile in the scene graph to increase rendering performance. This is similar to frustum culling (what Java3d does) but it should be more efficient if you do it, 'cause you can do it with more simple operations with your knowledge of the scene. If there's not enough memory you have to detach the invisible parts and delete all references to them, to get them garbage collected. You have to use a BranchGroup and set the appropriate capabilities. Regards. Thomas > Thanks, > > -- > Andreas Bauer > [EMAIL PROTECTED] > > ======================================================================== == > = > To unsubscribe, send email to [EMAIL PROTECTED] and include in the > body > of the message "signoff JAVA3D-INTEREST". For general help, send email to > [EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
