本文整理汇总了Java中com.sun.j3d.utils.geometry.Sphere.setCapability方法的典型用法代码示例。如果您正苦于以下问题:Java Sphere.setCapability方法的具体用法?Java Sphere.setCapability怎么用?Java Sphere.setCapability使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.j3d.utils.geometry.Sphere
的用法示例。
在下文中一共展示了Sphere.setCapability方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create3D
import com.sun.j3d.utils.geometry.Sphere; //导入方法依赖的package包/类
/** Create 3D geometry. */
@Override
protected void create3D() {
Appearance appear = new Appearance();
material.setCapability(Material.ALLOW_COMPONENT_WRITE);
material.setDiffuseColor(color);
material.setSpecularColor(black);
appear.setMaterial(material);
int flags = Primitive.GEOMETRY_NOT_SHARED | Primitive.ENABLE_GEOMETRY_PICKING | Primitive.GENERATE_NORMALS;
body = new Sphere(radius, flags, appear);
// we must be able to change the pick flag of the agent
body.setCapability(Node.ALLOW_PICKABLE_READ);
body.setCapability(Node.ALLOW_PICKABLE_WRITE);
body.setPickable(true);
body.setCollidable(true);
addChild(body);
// Add bounds for interactions
Bounds bounds = new BoundingSphere(new Point3d(0, 0, 0), radius);
setBounds(bounds);
}
示例2: create3D
import com.sun.j3d.utils.geometry.Sphere; //导入方法依赖的package包/类
/** Create 3D geometry. */
@Override
protected void create3D() {
Appearance appear = new Appearance();
material.setDiffuseColor(color);
material.setSpecularColor(black);
appear.setMaterial(material);
int flags = Primitive.GEOMETRY_NOT_SHARED | Primitive.ENABLE_GEOMETRY_PICKING | Primitive.GENERATE_NORMALS;
body = new Sphere(radius, flags, appear);
// we must be able to change the pick flag of the agent
body.setCapability(Node.ALLOW_PICKABLE_READ);
body.setCapability(Node.ALLOW_PICKABLE_WRITE);
body.setPickable(true);
body.setCollidable(true);
addChild(body);
// Add bounds for interactions
Bounds bounds = new BoundingSphere(new Point3d(0, 0, 0), radius);
setBounds(bounds);
}
示例3: create3D
import com.sun.j3d.utils.geometry.Sphere; //导入方法依赖的package包/类
/** Create 3D geometry. */
@Override
protected void create3D() {
Appearance appear = new Appearance();
material.setDiffuseColor(color);
material.setSpecularColor(black);
appear.setMaterial(material);
int flags = Primitive.GEOMETRY_NOT_SHARED | Primitive.ENABLE_GEOMETRY_PICKING | Primitive.GENERATE_NORMALS;
body = new Sphere(radius, flags, appear);
// we must be able to change the pick flag of the agent
body.setCapability(Node.ALLOW_PICKABLE_READ);
body.setCapability(Node.ALLOW_PICKABLE_WRITE);
body.setPickable(true);
body.setCollidable(true);
addChild(body);
// Add bounds for interactions
Bounds bounds = new BoundingSphere(new Point3d(0, 0, 0), radius);
setBounds(bounds);
}
示例4: create3D
import com.sun.j3d.utils.geometry.Sphere; //导入方法依赖的package包/类
/** Create 3D geometry. */
@Override
protected void create3D() {
Appearance appear = new Appearance();
material.setCapability(Material.ALLOW_COMPONENT_WRITE);
material.setDiffuseColor(color);
material.setSpecularColor(black);
appear.setMaterial(material);
int flags = Primitive.GEOMETRY_NOT_SHARED | Primitive.ENABLE_GEOMETRY_PICKING | Primitive.GENERATE_NORMALS;
body = new Sphere(radius, flags, appear);
// we must be able to change the pick flag of the agent
body.setCapability(Node.ALLOW_PICKABLE_READ);
body.setCapability(Node.ALLOW_PICKABLE_WRITE);
body.setPickable(true);
body.setCollidable(true);
addChild(body);
// Add bounds for interactions
Bounds bounds = new BoundingSphere(new Point3d(0, 0, 0), radius);
setBounds(bounds);
}
示例5: geometryWithColor
import com.sun.j3d.utils.geometry.Sphere; //导入方法依赖的package包/类
/**
*
* Permet de créer une géométrie Java3D à partir d'une apparence
*
* @param ap
* @return
*/
private ArrayList<TransformGroup> geometryWithColor(Appearance ap) {
// On récupère la géométrie sous forme de points
IGeometry geom = this.feat.getGeom();
if (geom instanceof GM_MultiPoint) {
// On peut àventuellement vouloir ajouter des traitements
} else if (geom instanceof GM_Point) {
// On peut àventuellement vouloir ajouter des traitements
} else {
Object0d.logger.warn(Messages.getString("Representation.GeomUnk"));
return null;
}
IDirectPositionList lDP = geom.coord();
int nbPoints = lDP.size();
PointArray pA = new PointArray(nbPoints, GeometryArray.COORDINATES
| GeometryArray.COLOR_3);
ArrayList<TransformGroup> lTG = new ArrayList<TransformGroup>(nbPoints);
Object0d.logger.debug(nbPoints);
pA.setCapability(GeometryArray.ALLOW_COLOR_READ);
pA.setCapability(GeometryArray.ALLOW_COLOR_WRITE);
for (int i = 0; i < nbPoints; i++) {
// On crée la sphère et on lui applique l'apparence choisie
Sphere s = new Sphere(Object0d.RADIUS, ap);
s.setCapability(Primitive.ENABLE_APPEARANCE_MODIFY);
s.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
s.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
s.getShape().setCapability(Shape3D.ALLOW_APPEARANCE_READ);
s.getShape().setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
IDirectPosition pTemp = lDP.get(i);
// On place le centre de la sphère aux bonnes coordonnées
Transform3D translate = new Transform3D();
translate.set(new Vector3f((float) pTemp.getX(), (float) pTemp.getY(),
(float) pTemp.getZ()));
TransformGroup TG1 = new TransformGroup(translate);
TG1.addChild(s);
lTG.add(TG1);
// On complète la liste des sphères
this.lShape.add(s);
}
return lTG;
}
示例6: geometryWithOutColor
import com.sun.j3d.utils.geometry.Sphere; //导入方法依赖的package包/类
/**
* Génère une représentation avec une couleur pour chaque sphère
*
* @param ap
* @return
*/
private ArrayList<TransformGroup> geometryWithOutColor(Appearance ap) {
// On décompose sous forme de points la géométrie
IGeometry geom = this.feat.getGeom();
if (geom instanceof GM_MultiPoint) {
// On peut àventuellement vouloir ajouter des traitements
} else if (geom instanceof GM_Point) {
// On peut àventuellement vouloir ajouter des traitements
} else {
Object0d.logger.warn(Messages.getString("Representation.GeomUnk"));
return null;
}
IDirectPositionList lDP = geom.coord();
int nbPoints = lDP.size();
PointArray pA = new PointArray(nbPoints, GeometryArray.COORDINATES
| GeometryArray.COLOR_3);
ArrayList<TransformGroup> lTG = new ArrayList<TransformGroup>(nbPoints);
pA.setCapability(GeometryArray.ALLOW_COLOR_READ);
pA.setCapability(GeometryArray.ALLOW_COLOR_WRITE);
for (int i = 0; i < nbPoints; i++) {
Sphere s = new Sphere(Object0d.RADIUS, ap);
// on ajoute une couleur aléatoire
ColoringAttributes CA = new ColoringAttributes(new Color3f(
(float) Math.random(), (float) Math.random(), (float) Math.random()),
ColoringAttributes.SHADE_GOURAUD);
ap.setColoringAttributes(CA);
s.setCapability(Primitive.ENABLE_APPEARANCE_MODIFY);
s.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
s.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
s.getShape().setCapability(Shape3D.ALLOW_APPEARANCE_READ);
s.getShape().setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
IDirectPosition pTemp = lDP.get(i);
// On place le sphère aux bonnes coordonnées
Transform3D translate = new Transform3D();
translate.set(new Vector3f((float) pTemp.getX(), (float) pTemp.getY(),
(float) pTemp.getZ()));
TransformGroup TG1 = new TransformGroup(translate);
TG1.addChild(s);
lTG.add(TG1);
this.lShape.add(s);
}
return lTG;
}