Package javax.vecmath

Examples of javax.vecmath.Color4f


/*  711 */       this.colors4 = null;
/*      */     } else {
/*  713 */       this.colors3 = null;
/*  714 */       this.colors4 = new Color4f[colors.length / 4];
/*  715 */       for (int i = 0; i < colors.length / 4; i++)
/*  716 */         this.colors4[i] = new Color4f(colors[(i * 4)], colors[(i * 4 + 1)], colors[(i * 4 + 2)], colors[(i * 4 + 3)]);
/*      */     }
/*      */   }
View Full Code Here


/*  759 */       this.colors4 = null;
/*      */     } else {
/*  761 */       this.colors3 = null;
/*  762 */       this.colors4 = new Color4f[colors.length / 4];
/*  763 */       for (int i = 0; i < colors.length / 4; i++)
/*  764 */         this.colors4[i] = new Color4f((colors[(i * 4)] & 0xFF) / 255.0F, (colors[(i * 4 + 1)] & 0xFF) / 255.0F, (colors[(i * 4 + 2)] & 0xFF) / 255.0F, (colors[(i * 4 + 3)] & 0xFF) / 255.0F);
/*      */     }
/*      */   }
View Full Code Here

/*  867 */       int vformat = this.geom.getVertexFormat();
/*  868 */       if ((vformat & 0x80) == 0) {
/*  869 */         if ((vformat & 0xC) == 12)
/*      */         {
/*  871 */           for (int i = 0; i < indices.length; i++) {
/*  872 */             this.primitiveColors[i] = new Color4f();
/*  873 */             this.geom.getColor(indices[i], this.primitiveColors[i]);
/*      */           }
/*      */         } else {
/*  876 */           Color3f color = new Color3f();
/*  877 */           for (int i = 0; i < indices.length; i++) {
/*  878 */             this.primitiveColors[i] = new Color4f();
/*  879 */             this.geom.getColor(indices[i], color);
/*  880 */             this.primitiveColors[i].x = color.x;
/*  881 */             this.primitiveColors[i].y = color.y;
/*  882 */             this.primitiveColors[i].z = color.z;
/*  883 */             this.primitiveColors[i].w = 1.0F;
/*      */           }
/*      */         }
/*      */
/*      */       }
/*  888 */       else if ((vformat & 0x100) == 0) {
/*  889 */         float[] floatData = this.geom.getColorRefFloat();
/*      */
/*  891 */         if (floatData == null) {
/*  892 */           byte[] byteData = this.geom.getColorRefByte();
/*  893 */           if (byteData == null) {
/*  894 */             Color3f[] c3fData = this.geom.getColorRef3f();
/*  895 */             if (c3fData == null) {
/*  896 */               Color4f[] c4fData = this.geom.getColorRef4f();
/*  897 */               if (c4fData == null) {
/*  898 */                 Color3b[] c3bData = this.geom.getColorRef3b();
/*  899 */                 if (c3bData == null) {
/*  900 */                   Color4b[] c4bData = this.geom.getColorRef4b();
/*  901 */                   for (int i = 0; i < indices.length; i++) {
/*  902 */                     this.primitiveColors[i] = new Color4f(c4bData[indices[i]].x, c4bData[indices[i]].y, c4bData[indices[i]].z, c4bData[indices[i]].w);
/*      */                   }
/*      */                 }
/*      */                 else
/*      */                 {
/*  907 */                   for (int i = 0; i < indices.length; i++) {
/*  908 */                     this.primitiveColors[i] = new Color4f(c3bData[indices[i]].x, c3bData[indices[i]].y, c3bData[indices[i]].z, 1.0F);
/*      */                   }
/*      */                 }
/*      */               }
/*      */               else
/*      */               {
/*  914 */                 for (int i = 0; i < indices.length; i++)
/*  915 */                   this.primitiveColors[i] = new Color4f(c4fData[indices[i]].x, c4fData[indices[i]].y, c4fData[indices[i]].z, c4fData[indices[i]].w);
/*      */               }
/*      */             }
/*      */             else
/*      */             {
/*  920 */               for (int i = 0; i < indices.length; i++) {
/*  921 */                 this.primitiveColors[i] = new Color4f(c3fData[indices[i]].x, c3fData[indices[i]].y, c3fData[indices[i]].z, 1.0F);
/*      */               }
/*      */
/*      */             }
/*      */
/*      */           }
/*  929 */           else if ((vformat & 0xC) == 12)
/*      */           {
/*  931 */             for (int i = 0; i < indices.length; i++) {
/*  932 */               int val = indices[i] << 2;
/*  933 */               this.primitiveColors[i] = new Color4f(byteData[val], byteData[(val + 1)], byteData[(val + 2)], byteData[(val + 3)]);
/*      */             }
/*      */           }
/*      */           else
/*      */           {
/*  938 */             for (int i = 0; i < indices.length; i++) {
/*  939 */               int val = indices[i] * 3;
/*  940 */               this.primitiveColors[i] = new Color4f(byteData[val], byteData[(val + 1)], byteData[(val + 2)], 1.0F);
/*      */             }
/*      */
/*      */           }
/*      */
/*      */         }
/*  949 */         else if ((vformat & 0xC) == 12)
/*      */         {
/*  951 */           for (int i = 0; i < indices.length; i++) {
/*  952 */             int val = indices[i] << 2;
/*  953 */             this.primitiveColors[i] = new Color4f(floatData[val], floatData[(val + 1)], floatData[(val + 2)], floatData[(val + 3)]);
/*      */           }
/*      */         }
/*      */         else {
/*  957 */           for (int i = 0; i < indices.length; i++) {
/*  958 */             int val = indices[i] * 3;
/*  959 */             this.primitiveColors[i] = new Color4f(floatData[val], floatData[(val + 1)], floatData[(val + 2)], 1.0F);
/*      */           }
/*      */
/*      */         }
/*      */
/*      */       }
/*      */       else
/*      */       {
/*  967 */         float[] floatData = this.geom.getInterleavedVertices();
/*  968 */         int offset = getInterleavedColorOffset(this.geom);
/*  969 */         int stride = getInterleavedStride(this.geom);
/*  970 */         for (int i = 0; i < indices.length; i++) {
/*  971 */           int val = stride * indices[i] + offset;
/*  972 */           if ((vformat & 0xC) == 12)
/*      */           {
/*  974 */             this.primitiveColors[i] = new Color4f(floatData[val], floatData[(val + 1)], floatData[(val + 2)], floatData[(val + 3)]);
/*      */           }
/*      */           else {
/*  977 */             this.primitiveColors[i] = new Color4f(floatData[val], floatData[(val + 1)], floatData[(val + 2)], 1.0F);
/*      */           }
/*      */         }
/*      */       }
/*      */     }
/*      */
View Full Code Here

/*      */   public Color4f getPointColor()
/*      */   {
/* 1154 */     if ((this.hasColors) && (this.pointColor == null)) {
/* 1155 */       double[] weights = getInterpWeights();
/* 1156 */       Color4f[] colors = getPrimitiveColors();
/* 1157 */       this.pointColor = new Color4f();
/* 1158 */       for (int i = 0; i < weights.length; i++) {
/* 1159 */         this.pointColor.x += (float)weights[i] * colors[i].x;
/* 1160 */         this.pointColor.y += (float)weights[i] * colors[i].y;
/* 1161 */         this.pointColor.z += (float)weights[i] * colors[i].z;
/* 1162 */         this.pointColor.w += (float)weights[i] * colors[i].w;
 
View Full Code Here

/*     */       }
/*     */
/* 225 */       if ((vertexFormat & 0xC) == 12) {
/* 226 */         Color4f[] color = new Color4f[valid];
/* 227 */         for (int i = 0; i < valid; i++) {
/* 228 */           color[i] = new Color4f(d[(wpv * (i + initial) + offset)], d[(wpv * (i + initial) + offset + 1)], d[(wpv * (i + initial) + offset + 2)], d[(wpv * (i + initial) + offset + 3)]);
/*     */         }
/*     */
/* 233 */         geomInfo.setColors(color);
/* 234 */         offset += 4;
/* 235 */       } else if ((vertexFormat & 0x4) != 0) {
/* 236 */         Color3f[] color = new Color3f[valid];
/* 237 */         for (int i = 0; i < valid; i++) {
/* 238 */           color[i] = new Color3f(d[(wpv * (i + initial) + offset)], d[(wpv * (i + initial) + offset + 1)], d[(wpv * (i + initial) + offset + 2)]);
/*     */         }
/*     */
/* 242 */         geomInfo.setColors(color);
/* 243 */         offset += 3;
/*     */       }
/*     */
/* 246 */       if ((vertexFormat & 0x2) != 0) {
/* 247 */         Vector3f[] normals = new Vector3f[valid];
/* 248 */         for (int i = 0; i < valid; i++) {
/* 249 */           normals[i] = new Vector3f(d[(wpv * (i + initial) + offset)], d[(wpv * (i + initial) + offset + 1)], d[(wpv * (i + initial) + offset + 2)]);
/*     */         }
/*     */
/* 253 */         geomInfo.setNormals(normals);
/* 254 */         offset += 3;
/*     */       }
/*     */
/* 257 */       Point3f[] coords = new Point3f[valid];
/* 258 */       for (int i = 0; i < valid; i++) {
/* 259 */         coords[i] = new Point3f(d[(wpv * (i + initial) + offset)], d[(wpv * (i + initial) + offset + 1)], d[(wpv * (i + initial) + offset + 2)]);
/*     */       }
/*     */
/* 263 */       geomInfo.setCoordinates(coords);
/*     */     }
/*     */     else {
/* 266 */       boolean byRef = (vertexFormat & 0x80) != 0;
/* 267 */       boolean nio = (vertexFormat & 0x800) != 0;
/*     */
/* 269 */       Point3f[] coords = null;
/* 270 */       if (byRef)
/*     */       {
/*     */         int initial;
/*     */         int initial;
/* 273 */         if (!(geomArray instanceof IndexedGeometryArray))
/* 274 */           initial = geomArray.getInitialCoordIndex();
/* 275 */         else initial = 0;
/*     */         int i;
/* 277 */         if (nio) {
/* 278 */           J3DBuffer buf = geomArray.getCoordRefBuffer();
/*     */
/* 280 */           switch (BufferWrapper.getBufferType(buf))
/*     */           {
/*     */           case 3:
/* 283 */             FloatBufferWrapper bb = new FloatBufferWrapper(buf);
/* 284 */             float[] c = new float[valid * 3];
/* 285 */             bb.position(initial * 3);
/* 286 */             bb.get(c, 0, valid * 3);
/* 287 */             coords = new Point3f[valid];
/* 288 */             for (i = 0; i < valid; i++) {
/* 289 */               coords[i] = new Point3f(c[(i * 3 + 0)], c[(i * 3 + 1)], c[(i * 3 + 2)]);
/*     */             }
/*     */
/* 294 */             break;
/*     */           case 4:
/* 297 */             DoubleBufferWrapper bb = new DoubleBufferWrapper(buf);
/* 298 */             double[] c = new double[valid * 3];
/* 299 */             bb.position(initial * 3);
/* 300 */             bb.get(c, 0, valid * 3);
/* 301 */             coords = new Point3f[valid];
/* 302 */             for (i = 0; i < valid; i++) {
/* 303 */               coords[i] = new Point3f((float)c[(i * 3 + 0)], (float)c[(i * 3 + 1)], (float)c[(i * 3 + 2)]);
/*     */             }
/*     */
/*     */           }
/*     */
/*     */         }
/* 310 */         else if (geomArray.getCoordRef3f() != null) {
/* 311 */           if (initial != 0) {
/* 312 */             Point3f[] c = geomArray.getCoordRef3f();
/* 313 */             coords = new Point3f[valid];
/* 314 */             for (i = 0; i < valid; i++)
/* 315 */               coords[i] = new Point3f(c[(i + initial)]);
/*     */           } else {
/* 317 */             coords = geomArray.getCoordRef3f();
/*     */           } } else if (geomArray.getCoordRef3d() != null) {
/* 319 */           Point3d[] c = geomArray.getCoordRef3d();
/* 320 */           coords = new Point3f[valid];
/* 321 */           for (int i = 0; i < valid; i++)
/* 322 */             coords[i] = new Point3f(c[(i + initial)]);
/*     */         }
/* 324 */         else if (geomArray.getCoordRefFloat() != null) {
/* 325 */           float[] c = geomArray.getCoordRefFloat();
/* 326 */           coords = new Point3f[valid];
/* 327 */           for (int i = 0; i < valid; i++) {
/* 328 */             coords[i] = new Point3f(c[((i + initial) * 3)], c[((i + initial) * 3 + 1)], c[((i + initial) * 3 + 2)]);
/*     */           }
/*     */
/*     */         }
/* 332 */         else if (geomArray.getCoordRefDouble() != null) {
/* 333 */           double[] c = geomArray.getCoordRefDouble();
/* 334 */           coords = new Point3f[valid];
/* 335 */           for (int i = 0; i < valid; i++)
/* 336 */             coords[i] = new Point3f((float)c[((i + initial) * 3)], (float)c[((i + initial) * 3 + 1)], (float)c[((i + initial) * 3 + 2)]);
/*     */         }
/*     */       }
/*     */       else
/*     */       {
/*     */         int initial;
/*     */         int initial;
/* 345 */         if (!(geomArray instanceof IndexedGeometryArray))
/* 346 */           initial = geomArray.getInitialVertexIndex();
/* 347 */         else initial = 0;
/* 348 */         coords = new Point3f[valid];
/* 349 */         for (int i = 0; i < valid; i++) coords[i] = new Point3f();
/* 350 */         geomArray.getCoordinates(initial, coords);
/*     */       }
/* 352 */       geomInfo.setCoordinates(coords);
/*     */
/* 354 */       if ((vertexFormat & 0x2) != 0) {
/* 355 */         Vector3f[] normals = null;
/* 356 */         if (byRef)
/*     */         {
/*     */           int initial;
/*     */           int initial;
/* 359 */           if (!(geomArray instanceof IndexedGeometryArray))
/* 360 */             initial = geomArray.getInitialNormalIndex();
/* 361 */           else initial = 0;
/*     */
/* 363 */           if (nio) {
/* 364 */             J3DBuffer buf = geomArray.getNormalRefBuffer();
/*     */
/* 366 */             if (BufferWrapper.getBufferType(buf) == 3) {
/* 367 */               FloatBufferWrapper bb = new FloatBufferWrapper(buf);
/* 368 */               float[] c = new float[valid * 3];
/* 369 */               bb.position(initial * 3);
/* 370 */               bb.get(c, 0, valid * 3);
/* 371 */               normals = new Vector3f[valid];
/* 372 */               for (int i = 0; i < valid; i++) {
/* 373 */                 normals[i] = new Vector3f(c[(i * 3 + 0)], c[(i * 3 + 1)], c[(i * 3 + 2)]);
/*     */               }
/*     */
/*     */             }
/*     */
/*     */           }
/* 379 */           else if (geomArray.getNormalRef3f() != null) {
/* 380 */             if (initial != 0) {
/* 381 */               Vector3f[] n = geomArray.getNormalRef3f();
/* 382 */               normals = new Vector3f[valid];
/* 383 */               for (int i = 0; i < valid; i++)
/* 384 */                 normals[i] = new Vector3f(n[(i + initial)]);
/*     */             } else {
/* 386 */               normals = geomArray.getNormalRef3f();
/*     */             } } else if (geomArray.getNormalRefFloat() != null) {
/* 388 */             float[] n = geomArray.getNormalRefFloat();
/* 389 */             normals = new Vector3f[valid];
/* 390 */             for (int i = 0; i < valid; i++)
/* 391 */               normals[i] = new Vector3f(n[((i + initial) * 3)], n[((i + initial) * 3 + 1)], n[((i + initial) * 3 + 2)]);
/*     */           }
/*     */         }
/*     */         else
/*     */         {
/*     */           int initial;
/*     */           int initial;
/* 400 */           if (!(geomArray instanceof IndexedGeometryArray))
/* 401 */             initial = geomArray.getInitialVertexIndex();
/* 402 */           else initial = 0;
/* 403 */           normals = new Vector3f[valid];
/* 404 */           for (int i = 0; i < valid; i++) normals[i] = new Vector3f();
/* 405 */           geomArray.getNormals(initial, normals);
/*     */         }
/* 407 */         geomInfo.setNormals(normals);
/*     */       }
/*     */
/* 410 */       if ((vertexFormat & 0xC) == 12) {
/* 411 */         Color4f[] colors = null;
/* 412 */         if (byRef)
/*     */         {
/*     */           int initial;
/*     */           int initial;
/* 415 */           if (!(geomArray instanceof IndexedGeometryArray))
/* 416 */             initial = geomArray.getInitialColorIndex();
/* 417 */           else initial = 0;
/*     */           int i;
/* 419 */           if (nio) {
/* 420 */             J3DBuffer buf = geomArray.getColorRefBuffer();
/*     */
/* 422 */             switch (BufferWrapper.getBufferType(buf))
/*     */             {
/*     */             case 3:
/* 425 */               FloatBufferWrapper bb = new FloatBufferWrapper(buf);
/* 426 */               float[] c = new float[valid * 4];
/* 427 */               bb.position(initial * 4);
/* 428 */               bb.get(c, 0, valid * 4);
/* 429 */               colors = new Color4f[valid];
/* 430 */               for (i = 0; i < valid; i++) {
/* 431 */                 colors[i] = new Color4f(c[(i * 4 + 0)], c[(i * 4 + 1)], c[(i * 4 + 2)], c[(i * 4 + 3)]);
/*     */               }
/*     */
/* 437 */               break;
/*     */             case 2:
/* 440 */               ByteBufferWrapper bb = new ByteBufferWrapper(buf);
/* 441 */               byte[] c = new byte[valid * 4];
/* 442 */               bb.position(initial * 4);
/* 443 */               bb.get(c, 0, valid * 4);
/* 444 */               colors = new Color4f[valid];
/* 445 */               for (i = 0; i < valid; i++) {
/* 446 */                 colors[i] = new Color4f((c[(i * 4 + 0)] & 0xFF) / 255.0F, (c[(i * 4 + 1)] & 0xFF) / 255.0F, (c[(i * 4 + 2)] & 0xFF) / 255.0F, (c[(i * 4 + 3)] & 0xFF) / 255.0F);
/*     */               }
/*     */
/*     */             }
/*     */
/*     */           }
/* 454 */           else if (geomArray.getColorRef4f() != null) {
/* 455 */             if (initial != 0) {
/* 456 */               Color4f[] c = geomArray.getColorRef4f();
/* 457 */               colors = new Color4f[valid];
/* 458 */               for (i = 0; i < valid; i++)
/* 459 */                 colors[i] = new Color4f(c[(i + initial)]);
/*     */             } else {
/* 461 */               colors = geomArray.getColorRef4f();
/*     */             } } else if (geomArray.getColorRefFloat() != null) {
/* 463 */             float[] c = geomArray.getColorRefFloat();
/* 464 */             colors = new Color4f[valid];
/* 465 */             for (int i = 0; i < valid; i++) {
/* 466 */               colors[i] = new Color4f(c[((i + initial) * 4 + 0)], c[((i + initial) * 4 + 1)], c[((i + initial) * 4 + 2)], c[((i + initial) * 4 + 3)]);
/*     */             }
/*     */
/*     */           }
/* 471 */           else if (geomArray.getColorRefByte() != null) {
/* 472 */             byte[] c = geomArray.getColorRefByte();
/* 473 */             colors = new Color4f[valid];
/* 474 */             for (int i = 0; i < valid; i++) {
/* 475 */               colors[i] = new Color4f((c[((i + initial) * 4 + 0)] & 0xFF) / 255.0F, (c[((i + initial) * 4 + 1)] & 0xFF) / 255.0F, (c[((i + initial) * 4 + 2)] & 0xFF) / 255.0F, (c[((i + initial) * 4 + 3)] & 0xFF) / 255.0F);
/*     */             }
/*     */
/*     */           }
/* 480 */           else if (geomArray.getColorRef4b() != null) {
/* 481 */             Color4b[] c = geomArray.getColorRef4b();
/* 482 */             colors = new Color4f[valid];
/* 483 */             for (int i = 0; i < valid; i++)
/* 484 */               colors[i] = new Color4f((c[(i + initial)].x & 0xFF) / 255.0F, (c[(i + initial)].y & 0xFF) / 255.0F, (c[(i + initial)].z & 0xFF) / 255.0F, (c[(i + initial)].w & 0xFF) / 255.0F);
/*     */           }
/*     */         }
/*     */         else
/*     */         {
/*     */           int initial;
/*     */           int initial;
/* 494 */           if (!(geomArray instanceof IndexedGeometryArray))
/* 495 */             initial = geomArray.getInitialVertexIndex();
/* 496 */           else initial = 0;
/* 497 */           colors = new Color4f[valid];
/* 498 */           for (int i = 0; i < valid; i++) colors[i] = new Color4f();
/* 499 */           geomArray.getColors(initial, colors);
/*     */         }
/* 501 */         geomInfo.setColors(colors);
/* 502 */       } else if ((vertexFormat & 0x4) != 0) {
/* 503 */         Color3f[] colors = null;
View Full Code Here

/* 219 */       addShape3D();
/*     */
/* 222 */       this.vlist = new GeneralizedVertexList(this.vlist.vertexFormat, 1);
/*     */     }
/*     */
/* 225 */     if (this.curColor == null) this.curColor = new Color4f();
/* 226 */     this.curColor.set(color);
/*     */   }
View Full Code Here

/*      */
/* 1707 */     Point3f offset = new Point3f();
/* 1708 */     tex.getLodOffset(offset);
/* 1709 */     rt.initLodOffset(offset.x, offset.y, offset.z);
/*      */
/* 1711 */     Color4f c = new Color4f();
/* 1712 */     tex.getBoundaryColor(c);
/* 1713 */     rt.initBoundaryColor(c);
/*      */
/* 1716 */     for (int i = tex.maxLevels - 1; i >= 0; i--) {
/* 1717 */       ImageComponent image = (ImageComponent)getNodeComponent(tex.getImage(i), forceDuplicate, hashtable);
View Full Code Here

/* 137 */       if (pcount > 0) {
/* 138 */         float[] weights = new float[pcount];
/* 139 */         tex.getFilter4Func(weights);
/* 140 */         newTex.setFilter4Func(weights);
/*     */       }
/* 142 */       Color4f c = new Color4f();
/* 143 */       tex.getBoundaryColor(c);
/* 144 */       newTex.setBoundaryColor(c);
/* 145 */       newTex.setUserData(tex.getUserData());
/* 146 */       getAppearance().setTexture(newTex);
/*     */     }
View Full Code Here

/* 1762 */         vc.c = vc.c3;
/*      */       }
/* 1764 */       else if (CompressionStream.this.vertexColor4) {
/* 1765 */         ci *= 4;
/* 1766 */         if (this.colorsB != null) {
/* 1767 */           vc.c4 = new Color4f((this.colorsB.get(ci + 0) & 0xFF) * 0.003921569F, (this.colorsB.get(ci + 1) & 0xFF) * 0.003921569F, (this.colorsB.get(ci + 2) & 0xFF) * 0.003921569F, (this.colorsB.get(ci + 3) & 0xFF) * 0.003921569F);
/*      */         }
/*      */         else
/*      */         {
/* 1774 */           vc.c4 = new Color4f(this.colorsF.get(ci + 0), this.colorsF.get(ci + 1), this.colorsF.get(ci + 2), this.colorsF.get(ci + 3));
/*      */         }
/*      */
/* 1779 */         vc.c = vc.c4;
/*      */       }
/*      */     }
View Full Code Here

/* 1608 */         vc.c = vc.c3;
/*      */       }
/* 1610 */       else if (CompressionStream.this.vertexColor4) {
/* 1611 */         ci *= 4;
/* 1612 */         if (this.colorsB != null) {
/* 1613 */           vc.c4 = new Color4f((this.colorsB[(ci + 0)] & 0xFF) * 0.003921569F, (this.colorsB[(ci + 1)] & 0xFF) * 0.003921569F, (this.colorsB[(ci + 2)] & 0xFF) * 0.003921569F, (this.colorsB[(ci + 3)] & 0xFF) * 0.003921569F);
/*      */         }
/*      */         else
/*      */         {
/* 1620 */           vc.c4 = new Color4f(this.colorsF[(ci + 0)], this.colorsF[(ci + 1)], this.colorsF[(ci + 2)], this.colorsF[(ci + 3)]);
/*      */         }
/*      */
/* 1625 */         vc.c = vc.c4;
/*      */       }
/*      */     }
View Full Code Here

TOP

Related Classes of javax.vecmath.Color4f

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.