Project

General

Profile

« Previous | Next » 

Revision 51e08404

Added by Leszek Koltunski over 4 years ago

Progress with SingleMesh (texture maps)

View differences:

src/main/java/org/distorted/examples/singlemesh/SingleMeshRenderer.java
61 61
           0xffff0000, 0xffb5651d    // (front-RED   ) (back  -BROWN)
62 62
         };
63 63

  
64
    private static final int NUM_FACES = FACE_COLORS.length;
65

  
66
    private static final Static4D RIG_MAP = new Static4D(0.0f/(NUM_FACES+1),0.0f,1.0f/(NUM_FACES+1),1.0f);
67
    private static final Static4D LEF_MAP = new Static4D(1.0f/(NUM_FACES+1),0.0f,1.0f/(NUM_FACES+1),1.0f);
68
    private static final Static4D TOP_MAP = new Static4D(2.0f/(NUM_FACES+1),0.0f,1.0f/(NUM_FACES+1),1.0f);
69
    private static final Static4D BOT_MAP = new Static4D(3.0f/(NUM_FACES+1),0.0f,1.0f/(NUM_FACES+1),1.0f);
70
    private static final Static4D FRO_MAP = new Static4D(4.0f/(NUM_FACES+1),0.0f,1.0f/(NUM_FACES+1),1.0f);
71
    private static final Static4D BAC_MAP = new Static4D(5.0f/(NUM_FACES+1),0.0f,1.0f/(NUM_FACES+1),1.0f);
72
    private static final Static4D INT_MAP = new Static4D(6.0f/(NUM_FACES+1),0.0f,1.0f/(NUM_FACES+1),1.0f);
73

  
74
    private static final Static4D[][] TEXTURE_MAP = new Static4D[][]
75
         {
76
             {  INT_MAP, LEF_MAP, INT_MAP, BOT_MAP, INT_MAP, BAC_MAP },
77
             {  INT_MAP, LEF_MAP, INT_MAP, BOT_MAP, FRO_MAP, INT_MAP },
78
             {  INT_MAP, LEF_MAP, TOP_MAP, INT_MAP, INT_MAP, BAC_MAP },
79
             {  INT_MAP, LEF_MAP, TOP_MAP, INT_MAP, FRO_MAP, INT_MAP },
80
             {  RIG_MAP, INT_MAP, INT_MAP, BOT_MAP, INT_MAP, BAC_MAP },
81
             {  RIG_MAP, INT_MAP, INT_MAP, BOT_MAP, FRO_MAP, INT_MAP },
82
             {  RIG_MAP, INT_MAP, TOP_MAP, INT_MAP, INT_MAP, BAC_MAP },
83
             {  RIG_MAP, INT_MAP, TOP_MAP, INT_MAP, FRO_MAP, INT_MAP }
84
         };
85

  
64 86
    private static final Static3D[] CUBIT_MOVES = new Static3D[]
65 87
         {
66 88
           new Static3D(-DIST,-DIST,-DIST),
......
321 343
      for(int i=0; i<NUM_CUBITS; i++)
322 344
        {
323 345
        cubits[i].apply( new MatrixEffectMove(CUBIT_MOVES[i]), 1,0);
346
        cubits[i].setTextureMap(TEXTURE_MAP[i]);
324 347
        }
325 348

  
326 349
      MeshBase result = new MeshJoined(cubits);

Also available in: Unified diff