Tina Manoharan Valappil wrote:
>
> Hi,
>
> I have loaded an object (*.wrl file) using the VRMLloader.
> I got its geometry like this
>
> GeometryArray childGeom = (GeometryArray) childShape.getGeometry();
> // where childShape is its Shape3D
>
> Now in the VRML file I can see that the color of the object is
> set for all its vertices.
>
> So, I want to access that array of colors for all its vertices.
>
> I tried to do this ...
>
> int vertexCount = childGeom.getVertexCount();
> int initialColorIndex = childGeom.getInitialColorIndex();
>
The getInitialColorIndex() call is only valid for geometry created by
reference. The current loader does not load by reference as it was
written before by-ref existed.
Check the value of initialColorIndex. You may find its not what ya want
which is 0 if you want all the color values.
> Color3f[] colors = new Color3f[vertexCount];
>
> childGeom.getColors(initialColorIndex, colors);
>
> // but then I get an error here saying that there r no colors
> // so then what happened to the colors that were in the VRML
> // file. How can I get those colors ??
> // in case the VRML file does not have any vertex color data
> // then how can I do an initial check for that, ie whether
> // there is Color3f[] data or not ??
>
We will be releasing an update to the loader in the near future(Shooting
for April 20th). It will be available here when ready:
www.web3d.org/TaskGroups/source/xj3d.html
--
Alan Hudson
President: Yumetech, Inc. http://www.yumetech.com/
Web3D Open Source Chair http://www.web3d.org/TaskGroups/source/
===========================================================================
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".