The GeometryInfo object contains a method called reverse():
public void reverse()
Reverse the order of all lists. If your data is formatted with the wrong
winding rule (so you always see the back and never the front), this
method will (in effect) reverse the winding of your data by inverting
all of the index lists and the stripCounts and contourCounts lists.
The .obj loader can be sent a flag (REVERSE) to tell it to call
GeometryInfo.reverse(), in case the .obj file was written with
CW winding.
I just cleaned up the javadoc in both cases to make it clear that
Java 3D wants counter-clockwise winding.
There was something in your original post that puzzled me:
> From: Justin Couch <[EMAIL PROTECTED]>
> Subject: [JAVA3D] Lighting/Normals problem
> To: [EMAIL PROTECTED]
>
> G'day Folks,
>
> I'm really stuck here with this seemingly trivial problem. It's been
> annoying me for the past week and I really don't know what the answer
> is. As a backgrounder, I'm generating custom geometry for the j3d.org
> toolkit therefore I do not want to use the NormalGenerator. It's a
> common thing across all of the geometry, so there's some fundamental
> flaw in my technique. I'm hoping someone will find it much easier than I
> do.
Why not use the NormalGenerator on custom geometry?
-Paul
> Date: Wed, 18 Apr 2001 10:22:24 -0700
> From: Doug Twilleager <[EMAIL PROTECTED]>
> Subject: Re: [JAVA3D] Lighting/Normals problem
> To: [EMAIL PROTECTED]
>
> I agree that our documentation should be more explicit about this.
> It is a general computer graphics issue. OpenGL and Java 3D use a
> right-handed coordinate system, so front faces are defined by using
> a counter-clockwise winding. Direct3D uses a left-handed coordinate
> system, so front faces are defined by using a clockwise winding.
> All of these API's allow culling to be changed, so the system can
> adapt appropriately.
>
> In all of the above API's, vertex normals are used strictly for
> lighting. They have no bearing on culling or defining the front face.
> I just read the VRML spec on this issue, and it is a bit different.
> It seems to combine vertex normals with face normals, but states that
> if the normal does not match the winding order, results are undefined.
>
> As for loading models, this is an ongoing issue. Since no API or modeling
> package have standardized on default winding, models may exist as cw, ccw,
> or neither. Some old obj models have arbitrary winding. That is why all
> the API's have the ability to change culling behavior.
>
> Doug Twilleager
> Sun Microsystems
>
>
> >X-Accept-Language: en
> >MIME-Version: 1.0
> >Content-Transfer-Encoding: 7bit
> >Subject: Re: [JAVA3D] Lighting/Normals problem
> >To: [EMAIL PROTECTED]
> >
> >Alf Edgar Andresen wrote:
> >
> >> > anywhere. If so, it must be another one of these magic things that we
> >> > don't really need to know about and therefore is not worth documenting.
> >>
> >> OpenGL-standard, I think.
> >
> >Well, putting on my Newbie hat as these are the sorts of questions I get
> >asked:
> >
> >- I downloaded and installed the DirectX version. What has that got to
> >do with OpenGL?
> >
> >- The documentation does not say that I must declare my vertex lists in
> >ccw order so it's a bug in the API.
> >
> >- I provided normals and so the application must use those to calculate
> >which way a face is pointing. If not, what is the point of supplying
> >normals?
> >
> >Also, look at the other response about having to deal with unknown
> >content coming in and not knowing whether to unwind or not.
> >
> >--
> >Justin Couch http://www.vlc.com.au/~justin/
> >Freelance Java Consultant http://www.yumetech.com/
> >Author, Java 3D FAQ Maintainer http://www.j3d.org/
> >-------------------------------------------------------------------
> >"Humanism is dead. Animals think, feel; so do machines now.
> >Neither man nor woman is the measure of all things. Every organism
> >processes data according to its domain, its environment; you, with
> >all your brains, would be useless in a mouse's universe..."
> > - Greg Bear, Slant
> >-------------------------------------------------------------------
> >
> >===========================================================================
> >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".