Project

General

Profile

« Previous | Next » 

Revision 8a99c681

Added by Leszek Koltunski about 7 years ago

Make a MeshCubes object rendered with no effects have its front wall at the screen's surface (so that when we just replace MeshFlat with MeshCubes, it looks more similar)

View differences:

src/main/java/org/distorted/examples/cubes/CubesRenderer.java
52 52
    private MeshObject mMesh;
53 53
    private DistortedScreen mScreen;
54 54
    private DynamicQuat mQuatInt1, mQuatInt2;
55
    private int mObjWidth, mObjHeight;
55
    private int mObjWidth, mObjHeight, mObjDepth;
56 56

  
57 57
    Static4D mQuat1, mQuat2;
58 58
    int mScreenMin;
......
71 71

  
72 72
      mObjWidth = mTexture.getWidth();
73 73
      mObjHeight= mTexture.getHeight();
74
      mObjDepth = mTexture.getDepth(mMesh);
74 75

  
75 76
      mQuat1 = new Static4D(0,0,0,1);  // unity
76 77
      mQuat2 = new Static4D(0,0,0,1);  // quaternions
......
111 112

  
112 113
      mEffects.move( new Static3D( (width-factor*mObjWidth)/2 , (height-factor*mObjHeight)/2 , 0) );
113 114
      mEffects.scale(factor);
114
      Static3D center = new Static3D( (float)mObjWidth/2, (float)mObjHeight/2, 0.0f );
115
      Static3D center = new Static3D( (float)mObjWidth/2, (float)mObjHeight/2, -(float)mObjDepth/2 );
115 116

  
116 117
      mEffects.quaternion(mQuatInt1, center);
117 118
      mEffects.quaternion(mQuatInt2, center);

Also available in: Unified diff