Finding specific nodes in a loaded model is a common problem. I use this utility class (NodeFinder.java attached) to find the node I want. For your purpose something simliar to the example below should suffice.
-Ewan
// Load the model
ObjectFile myLoader = new ObjectFile();
Scene myScene = myLoader.load("your filename/url here");
// Get the root of the scene
Node myRootNode = myScene.getSceneGroup();
// Temp enumerations for shapes and geometries
Enumeration shapes = null;
Enumeration geometries = null;
// Find all of the Shape3D nodes that comprise this model
try { shapes = NodeFinder.findNodes(myRootNode,
"javax.media.j3d.Shape3D"); }
catch(ClassNotFoundException e) { e.printStackTrace(); }
// Handle each shape in turn
while (shapes.hasMoreElements())
{
// Retrieve all of the geometry node components from the shape
geometries = ((Shape3D)shapes.nextElement()).getAllGeometries();
// Handle each piece of geometry in turn
while (geometries.hasMoreElements())
{
// Recover the next geometry component
GeometryArray ga = (GeometryArray)geometries.nextElement();
... now do whatever you like with the GeometryArray object
}
}
----- Original Message -----
From: "Madeti, Henu S. (UMR-Student)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, October 05, 2003 1:51 AM
Subject: [JAVA3D] getting polygon array for object file
>
>
> Hi all,
>
> We have the objload.java loading a obj file. I wish to set different
appearances for different polygons of the obj file. So can someone tell me
how to get the polygon(geometry array) from the object file.
>
> thanks
> Henu
>
>
===========================================================================
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".
NodeFinder.java
Description: Binary data
