Hrmm...
well, setting the Bounds for the BranchGroup node doesn't work. I've tried
setting the Bounds for the Shape3D node, but it keeps raising a
ClassCastException, not when I set the bounds, but later on in the
updateData function of GeometryUpdater. Curious...when I comment out the
code to set the Shape3D's bounds, the ClassCastException isn't raised.
I've listed code I used to set the bounds. I'm not asking you to debug my
code...just to verify that this _should_ work.
==============================
shape.setCapability(Shape3D.ALLOW_BOUNDS_READ);
shape.setCapability(Shape3D.ALLOW_BOUNDS_WRITE);
shape.setBoundsAutoCompute(false);
shape.setBounds(new BoundingSphere(new Point3d(),Double.MAX_VALUE));
==================================
The exception raised was...
===================
java.lang.ClassCastException: javax.media.j3d.BoundingSphere
at
javax.media.j3d.GeometryArrayRetained.sendDataChangedMessage(Geometr
ArrayRetained.java:1747)
at
javax.media.j3d.GeometryArrayRetained.updateData(GeometryArrayRetain
d.java:3917)
at
javax.media.j3d.GeometryArray.updateData(GeometryArray.java:573)
at
Graphics.GraphicWeaponParticles.updateAll(GraphicWeaponParticles.jav
:87)
at GameControl.GameManager.heartbeat(GameManager.java:52)
at GameControl.ClientGM.heartbeat(ClientGM.java:80)
at
GameControl.TimerListener.actionPerformed(TimerListener.java:16)
at javax.swing.Timer.fireActionPerformed(Unknown Source)
=========================
Shawn, you said you had troubles like this before? I remember your
explanations of how you used the TriArrays to render particles. If this
code or exception doesn't ring any bells, it's okay. I am actually
considering just using TransformGroups for each particle, because of my
time constraints. That'll really suck.
David Ko
On Mon, 18 Dec 2000, David wrote:
> Suggestion:
>
> View fulstrum culling is done at the shape level, the bounds are unioned to
> make BG bounds. So set the shape's bounds auto compute off, use a bounding
> sphere with a radius appropriate to your geometry, on each geom update, move
> your vertices, and move the bounds center (I suggest using one bounds per
> object and move the bounds rather than building and destroying per frame).
> Then set the shape bounds before leaving the updator.
>
> Do that if there is a time when you DO want it culled, otherwise just set
> the bounds to some extremely large size to be assured it will always be
> there.
>
> Dave
> ----- Original Message -----
> From: David <[EMAIL PROTECTED]>
> To: Discussion list for Java 3D API <[EMAIL PROTECTED]>
> Sent: Monday, December 18, 2000 10:15 AM
> Subject: Re: Re: [JAVA3D] Frustum Culling
>
>
> Node.SetBoundsAutoCompute(false).
>
> I think it is on be default. If not then nothing would work unless you set
> the bounds, or turned auto compute on. There for I assume it is on by
> default.
>
> You can check with Node.getBoundsAutoCompute().
>
> I bet thats the problem.
>
> Dave
> ----- Original Message -----
> From: David Ko <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, December 18, 2000 9:35 AM
> Subject: Re: [JAVA3D] Frustum Culling
>
>
> The TriangleArray I'm using is not being translated in any way. All
> triangles are modified throught a GeometryUpdater and passed back in by
> reference. During initialization, I fill the TriangleArray with 400 tris
> all at the origin. When one of the triangles is "fired", it's verticies
> are simply modified and passed into the TriangleArray. This works great,
> but only if you're within 1.0f radius of the origin, whereupon all tris
> currently being displayed on screen just disappears. I checked the bounds
> of the BranchGroup, and indeed it was centered at the origin with a radius
> of 1.0f. I tried setting the bounds to Double.MAX_VALUE, but nothing
> happens. I'm not sure how to disable auto_bounds_compute. It's not off by
> default?
>
> My basic set up is this:
>
> BranchGroup
> |
> |
> Shape3D
> |
> |
> TriangleArray (by_reference, allow_ref_data_write/read, allow_count_write)
>
>
> It's tempting to say that this is bug, but there were too many times I
> thought there were bugs in java3D when they were really bugs in my code.
>
> David Ko
>
> On Mon, 18 Dec 2000, David wrote:
>
> > I don't know. But off the top of my head:
> >
> > Have you tried disabling "auto bounds compute" and set your own bounds
> for
> > the shape? I don't understand why this is happening. Is your triangle
> > strip also being translated, or are you changing the actual vertices every
> > frame for movement? If so it could be that bounds are not re-computed for
> > each frame. I have never heard anyone else having issues with this
> before,
> > so maybe this is something very specific to what you are doing. More
> > information would be needed to help figure this out.
> >
> > But as far as just having a single triangle strip that spans from culled
> to
> > non-culled space, and having it disappear... that I have never seen. I do
> > water with a similar technique and I don't have any trouble seeing it
> > everywhere I go.
> >
> > Dave Yazel
> >
> >
> > ----- Original Message -----
> > From: David Ko <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, December 18, 2000 5:28 AM
> > Subject: [JAVA3D] Frustum Culling
> >
> >
> > Hello, I've asked this question before. I'll just rephrase it.
> >
> > How do you have prevent the view from culling out a BranchGroup from
> > rendering, even if the BranchGroup's "sphere of influence" is outside the
> > range of the view? I'm having trouble because my TriangleArray is being
> > culled out, even though the triangles should be still be rendered.
> > I've tried everything (i.e. setting bounds, specifying
> > VISIBILITY_DRAW_ALL in View). Nothing!
> >
> > Any help, leads, or messages of pity would be appreciated.
> >
> > David Ko
> >
> >
> ===========================================================================
> > 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".
> >
>
> ===========================================================================
> 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".
>
===========================================================================
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".