-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFusto.java
27 lines (24 loc) · 1.04 KB
/
Fusto.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package Esercizio_3_8;
import com.sun.j3d.utils.geometry.Cylinder;
import com.sun.j3d.utils.geometry.Primitive;
import javax.media.j3d.Appearance;
import javax.media.j3d.ColoringAttributes;
import javax.media.j3d.Material;
public class Fusto extends Cylinder {
public Fusto(float radius, float height) {
// Cylinder(float radius, float height, int primflags, int xdivision, int ydivision, Appearance ap)
super(radius / 9, height, Primitive.GENERATE_NORMALS, 20, 1, createAppearance());
}
public static Appearance createAppearance() {
Appearance app = new Appearance();
Material material = new Material();
material.setCapability(Material.AMBIENT_AND_DIFFUSE);
ColoringAttributes color = new ColoringAttributes();
color.setColor(1.0f, 0.6f, 0.2f);
app.setColoringAttributes(color);
material.setAmbientColor(210 / 255f, 180 / 255f, 140 / 255f);
material.setDiffuseColor(210 / 255f, 180 / 255f, 140 / 255f);
app.setMaterial(material);
return app;
}
}