for(int i=0;i<24;i++)normals[i]=new Vector3f(); Point3f [] pts=new Point3f[24]; for(int i=0;i<24;i++)pts[i]=new Point3f(); Color3f [] clrs=new Color3f[24]; for(int i=0;i<24;i++)clrs[i]=new Color3f(0.5f,0.5f,0.5f); pa.setCullFace(PolygonAttributes.CULL_NONE); Material mat=new Material(); mat.setEmissiveColor(new Color3f(0.5f,0.5f,0.5f)); mat.setAmbientColor(new Color3f(0.1f,0.1f,0.1f)); mat.setDiffuseColor(new Color3f(0.2f,0.3f,0.4f)); mat.setSpecularColor(new Color3f(0.6f,0.3f,0.2f)); mat.setLightingEnable(true); RenderingAttributes ra=new RenderingAttributes(); ColoringAttributes ca=new ColoringAttributes(); ca.setShadeModel(ColoringAttributes.SHADE_GOURAUD); ca.setColor(new Color3f(0.2f,0.5f,0.9f)); app.setColoringAttributes(ca); app.setRenderingAttributes(ra); light1.setColor(new Color3f(1f,1f,1f)); light1.setDirection(new Vector3f(0,1,0)); objRotate.addChild(light1); DirectionalLight light2=new DirectionalLight(); light2.setInfluencingBounds(new BoundingSphere(new Point3d(5.0,0,0),10.0)); light2.setColor(new Color3f(0.5f,1f,0.5f)); light2.setDirection(new Vector3f(0,-1,0)); objRotate.addChild(light2);
public static void decompose(final Matrix4f mat, final Vector3f origin, final AxisAngle4f rotation, final Vector3f translation) { final Matrix3f rot = new Matrix3f(); mat.get(rot); rotation.set(rot); final Point3f tmp = new Point3f(origin); rot.transform(tmp); tmp.sub(origin); mat.get(translation); translation.add(tmp); }
/** * Constructs an infinite cone pick shape from the specified * parameters. * @param origin the origin of the cone * @param direction the direction of the cone * @param spreadAngle the spread angle of the cone in radians */ public PickConeRay(Point3d origin, Vector3d direction, double spreadAngle) { this.origin = new Point3d(origin); this.direction = new Vector3d(direction); this.spreadAngle = spreadAngle; }
private void setPathArrays(Quat4f[] quats, Point3f[] positions) { this.quats = new Quat4f[quats.length]; for(int i = 0; i < quats.length; i++) { this.quats[i] = new Quat4f(); this.quats[i].set(quats[i]); } this.positions = new Point3f[positions.length]; for(int i = 0; i < positions.length; i++) { this.positions[i] = new Point3f(); this.positions[i].set(positions[i]); } }
/** * Sets the parameters of this PickCone to the specified values. * @param origin the origin of the cone * @param direction the direction of the cone * @param spreadAngle the spread angle of the cone in radians */ public void set(Point3d origin, Vector3d direction, double spreadAngle) { this.origin.set(origin); this.direction.set(direction); this.spreadAngle = spreadAngle; }
BranchGroup lineGroup = new BranchGroup(); Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(new Color3f(204.0f, 204.0f, 204.0f), ColoringAttributes.SHADE_FLAT); app.setColoringAttributes(ca); for (int i = 0; i < 2; i++) { for (int j = 0; j <2; j++) { plaPts[count] = new Point3f(i/10.0f,j/10.0f,0); colPts[count]=new Color3f(i/3.0f,j/3.0f,(float) ((i+j)/3.0));//my arbitrary color set :) count++;
Appearance app = new Appearance(); Vector3f [] normals=new Vector3f[24]; for(int i=0;i<24;i++)normals[i]=new Vector3f(); Point3f [] pts=new Point3f[24]; for(int i=0;i<24;i++)pts[i]=new Point3f(); Color3f [] clrs=new Color3f[24]; for(int i=0;i<24;i++)clrs[i]=new Color3f(0.5f,0.5f,0.5f); pa.setCullFace(PolygonAttributes.CULL_NONE); Material mat=new Material(); mat.setEmissiveColor(new Color3f(0.5f,0.5f,0.5f)); mat.setAmbientColor(new Color3f(0.1f,0.1f,0.1f)); mat.setDiffuseColor(new Color3f(0.2f,0.3f,0.4f)); mat.setSpecularColor(new Color3f(0.6f,0.3f,0.2f)); mat.setLightingEnable(true); RenderingAttributes ra=new RenderingAttributes(); ColoringAttributes ca=new ColoringAttributes(); ca.setShadeModel(ColoringAttributes.SHADE_GOURAUD); ca.setColor(new Color3f(0.2f,0.5f,0.9f)); app.setColoringAttributes(ca); app.setRenderingAttributes(ra); DirectionalLight light1=new DirectionalLight(); light1.setInfluencingBounds(new BoundingSphere(new Point3d(-5.0,0,0),10.0)); light1.setColor(new Color3f(1f,1f,1f)); light1.setDirection(new Vector3f(0,1,0)); objRotate.addChild(light1); DirectionalLight light2=new DirectionalLight();
/** * Sets the parameters of this PickCylinderRay to the specified values. * @param origin the origin of the cylindrical ray. * @param direction the direction of the cylindrical ray. * @param radius the radius of the cylindrical ray. */ public void set(Point3d origin, Vector3d direction, double radius) { this.origin.set(origin); this.direction.set(direction); this.radius = radius; }
BranchGroup lineGroup = new BranchGroup(); Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(new Color3f(204.0f, 204.0f,204.0f), ColoringAttributes.SHADE_FLAT); app.setColoringAttributes(ca); Point3f[] plaPts = new Point3f[5]; for (int i = 0; i < 2; i++) { for (int j = 0; j <2; j++) { plaPts[count] = new Point3f(i/10.0f,j/10.0f,0); count++; plaPts[count] = new Point3f(3.0f/10.0f,2.0f/10.0f,0); int[]intArr=new int[5]; intArr[0]=3;intArr[1]=4;intArr[2]=4;intArr[3]=3;intArr[4]=3; app.setPolygonAttributes(la); Material matt=new Material(); matt.setAmbientColor(new Color3f(1,1,1)); matt.setDiffuseColor(new Color3f(0.5f,0.5f,0.7f)); matt.setEmissiveColor(new Color3f(0.2f,0.2f,0.3f)); matt.setShininess(0.5f); matt.setSpecularColor(new Color3f(0.4f,0.6f,0.9f)); matt.setLightingEnable(true); al.setColor(new Color3f(1,1,1));
/** * Constructs an infinite cylindrical ray pick shape from the specified * parameters. * @param origin the origin of the cylindrical ray. * @param direction the direction of the cylindrical ray. * @param radius the radius of the cylindrical ray. */ public PickCylinderRay(Point3d origin, Vector3d direction, double radius) { this.origin = new Point3d(origin); this.direction = new Vector3d(direction); this.radius = radius; }