Appearance Is Everything : Object Model « 3D « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JavaFX
25.JDK 6
26.JDK 7
27.JNDI LDAP
28.JPA
29.JSP
30.JSTL
31.Language Basics
32.Network Protocol
33.PDF RTF
34.Reflection
35.Regular Expressions
36.Scripting
37.Security
38.Servlets
39.Spring
40.Swing Components
41.Swing JFC
42.SWT JFace Eclipse
43.Threads
44.Tiny Application
45.Velocity
46.Web Services SOA
47.XML
Java » 3D » Object Model 




Appearance Is Everything


/*
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);



*/



           
       














Related examples in the same category
1.Line TypesLine Types
2.Shape: Point outlineShape: Point outline
3.Color YoyoColor Yoyo
4.Yoyo LineYoyo Line
5.The use of the GeometryInfo class and related classesThe use of the GeometryInfo class and related classes
6.Example SwitchExample Switch
7.A Morph object to animate a shape between two key shapesA Morph object to animate a shape between two key shapes
8.ExHenge - create a stone-henge like (vaguely) mysterious temple thing
9.Geometry By ReferenceGeometry By Reference
10.Stereo Girl
11.Red Green GirlRed Green Girl
12.Red Green GriffinRed Green Griffin
13.cg viewer
14.A basic hierarchical model of the top part of a human torsoA basic hierarchical model of the top part of a human torso
15.A large hollow box
16.Java 3D Box and a custom Cuboid implementationJava 3D Box and a custom Cuboid implementation
17.A simple class using the an indexed quadrilateral arrayA simple class using the an indexed quadrilateral array
18.Simple Indexed Quad NormalsSimple Indexed Quad Normals
19.Simple Indexed QuadSimple Indexed Quad
20.Twist Strip visual objectTwist Strip visual object
21.Door AppDoor App
22.ShadowApp creates a single planeShadowApp creates a single plane
23.TeapotTeapot
24.MorphingMorphing
25.VolRend
26.GouraudGouraud
27.An Object An Object
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.