/*
The Joy of Java 3D
by Greg Hopkins
Copyright Copyright 2001
*/
/*
There are many ways to change the way that objects in your scene look. You can change
their color, how much light they reflect. You can paint them with two-dimensional images,
or add rough textures to their surfaces. The Appearance class contains the functions for
making these changes. This section shows you how to use these functions.
The simplest way of setting the appearance is by specifying only the color and the shading
method. This works for setting an object to being a simple color, but to make an object
look realistic, you need to specify how an object appears under lights. You do this by
creating a Material.
Step Example
1. Create an object Sphere sphere = new Sphere();
----------------------------------------------------------------------------------
2. Create an appearance Appearance ap = new Appearance();
----------------------------------------------------------------------------------
3. Create a color Color3f col = new Color3f(0.0f, 0.0f, 1.0f);
----------------------------------------------------------------------------------
4. Create the coloring attributes ColoringAttributes ca = new ColoringAttributes
(col, ColoringAttributes.NICEST);
----------------------------------------------------------------------------------
5. Add the attributes to the appearance ap.setColoringAttributes(ca);
----------------------------------------------------------------------------------
6. Set the appearance for the object sphere.setAppearance(ap);
*/
|