} else if( sgContainer instanceof edu.cmu.cs.stage3.alice.scenegraph.Transformable ) {
edu.cmu.cs.stage3.alice.scenegraph.Transformable sgTransformable = (edu.cmu.cs.stage3.alice.scenegraph.Transformable)sgContainer;
edu.cmu.cs.stage3.alice.scenegraph.Light sgLight = getFirstLightChild( sgTransformable );
edu.cmu.cs.stage3.alice.scenegraph.Camera sgCamera = getFirstCameraChild( sgTransformable );
edu.cmu.cs.stage3.alice.scenegraph.Visual sgVisual = getFirstVisualChild( sgTransformable );
Model model = null;
if( sgLight != null ) {
Light light = null;
if( sgLight instanceof edu.cmu.cs.stage3.alice.scenegraph.AmbientLight ) {
AmbientLight ambientLight = new AmbientLight();
light = ambientLight;
} else if( sgLight instanceof edu.cmu.cs.stage3.alice.scenegraph.DirectionalLight ) {
DirectionalLight directionalLight = new DirectionalLight();
light = directionalLight;
} else if( sgLight instanceof edu.cmu.cs.stage3.alice.scenegraph.PointLight ) {
PointLight pointLight = null;
if( sgLight instanceof edu.cmu.cs.stage3.alice.scenegraph.SpotLight ) {
SpotLight spotLight = new SpotLight();
pointLight = spotLight;
} else {
pointLight = new PointLight();
}
light = pointLight;
}
model = light;
sgLight.setBonus( model );
} else if( sgCamera != null ) {
Camera camera = null;
if( sgCamera instanceof edu.cmu.cs.stage3.alice.scenegraph.SymmetricPerspectiveCamera ) {
SymmetricPerspectiveCamera symmetricPerspectiveCamera = new SymmetricPerspectiveCamera();
camera = symmetricPerspectiveCamera;
} else if( sgCamera instanceof edu.cmu.cs.stage3.alice.scenegraph.PerspectiveCamera ) {
PerspectiveCamera perspectiveCamera = new PerspectiveCamera();
camera = perspectiveCamera;
} else if( sgCamera instanceof edu.cmu.cs.stage3.alice.scenegraph.OrthographicCamera ) {
OrthographicCamera orthographicCamera = new OrthographicCamera();
camera = orthographicCamera;
} else if( sgCamera instanceof edu.cmu.cs.stage3.alice.scenegraph.ProjectionCamera ) {
ProjectionCamera projectionCamera = new ProjectionCamera();
camera = projectionCamera;
}
model = camera;
sgCamera.setBonus( model );
} else {
model = new Model();
}
if( sgVisual != null ) {
sgVisual.setBonus( model );
edu.cmu.cs.stage3.alice.scenegraph.Appearance sgAppearance = sgVisual.getFrontFacingAppearance();
edu.cmu.cs.stage3.alice.scenegraph.Geometry sgGeometry = sgVisual.getGeometry();
if( sgAppearance != null ) {
edu.cmu.cs.stage3.alice.scenegraph.TextureMap sgTextureMap = sgAppearance.getDiffuseColorMap();
if( sgTextureMap != null ) {
TextureMap diffuseColorMap = new TextureMap();
diffuseColorMap.setParent( model );
diffuseColorMap.image.set( sgTextureMap.getImage() );
diffuseColorMap.format.set( new Integer( sgTextureMap.getFormat() ) );
model.diffuseColorMap.set( diffuseColorMap );
model.textureMaps.add( diffuseColorMap );
}
model.color.set( sgAppearance.getDiffuseColor() );
model.opacity.set( new Double( sgAppearance.getOpacity() ) );
}
if( sgGeometry instanceof edu.cmu.cs.stage3.alice.scenegraph.IndexedTriangleArray ) {
edu.cmu.cs.stage3.alice.scenegraph.IndexedTriangleArray sgITA = (edu.cmu.cs.stage3.alice.scenegraph.IndexedTriangleArray)sgGeometry;
IndexedTriangleArray ita = new IndexedTriangleArray();
ita.setParent( model );
ita.vertices.set( sgITA.getVertices() );
ita.indices.set( sgITA.getIndices() );
model.geometry.set( ita );
model.geometries.add( ita );
}
}
model.setLocalTransformationRightNow( sgTransformable.getLocalTransformation() );
element = model;
}
for( int i=0; i<sgContainer.getChildCount(); i++ ) {
edu.cmu.cs.stage3.alice.scenegraph.Component sgChild = sgContainer.getChildAt( i );
if( sgChild instanceof edu.cmu.cs.stage3.alice.scenegraph.Transformable ) {
Model child = (Model)internalConvert( (edu.cmu.cs.stage3.alice.scenegraph.Transformable)sgChild, i );
child.setParent( element );
child.vehicle.set( element );
if( child.name.getStringValue() == null ) {
child.name.set( "yet to be named part " + i );
}
if( element instanceof World ) {