Project

General

Profile

« Previous | Next » 

Revision 4682c746

Added by Leszek Koltunski 7 months ago

fix rounding corners in TwistyCutSolid.

View differences:

src/main/java/org/distorted/objectlib/objects/TwistyCutFisher.java
60 60

  
61 61
  Static3D[] getOriginalRotationAxis() { return ROT_AXIS; }
62 62
  int getBasicAngle()                  { return 4; }
63
  float[] getCornerPressStrength()     { return new float[] {0.01f,0.10f}; };
63
  float[] getCornerPressStrength()     { return new float[] {0.015f,0.10f}; };
64 64
  Static4D getPlanesQuat()             { return makeQuat(new Static3D(0,1,0),45); }
65 65
  float[] getPlanesVector()            { return new float[] {0,0,0}; }
66 66

  
src/main/java/org/distorted/objectlib/objects/TwistyCutSolid.java
28 28
  private int[][] mBasicAngle;
29 29
  private float[] mDist3D, mDist;
30 30
  private ObjectShape[] mShapes;
31
  private ObjectVertexEffects[] mEffects;
31 32
  private int[][] mCubitToVariantQuatMap;
32 33
  private float[][] mCutPlanes;
33 34
  private Static3D[] mRotAxis;
......
106 107
    Static4D[] quats = getQuats();
107 108
    float[][] pos = getCubitPositions();
108 109
    Static3D[] faceAxis = getFaceAxis();
109
    float[] dist = distsToFace();
110
    float[] dist = getDist();
110 111

  
111 112
    float[][] potentialVertices = FactoryShape.computePotentialVertices(mCutPlanes);
112 113

  
......
328 329
    return centers;
329 330
    }
330 331

  
332
///////////////////////////////////////////////////////////////////////////////////////////////////
333

  
334
  private int getFirstCubitOfVariant(int variant)
335
    {
336
    if( mShapes==null ) prepareShapes();
337

  
338
    for(int c=0; c<mNumCubits; c++)
339
      if( mCubitToVariantQuatMap[c][0]==variant ) return c;
340

  
341
    return -1;
342
    }
343

  
331 344
///////////////////////////////////////////////////////////////////////////////////////////////////
332 345

  
333 346
  public ObjectVertexEffects getVertexEffects(int variant)
334 347
    {
335
    ObjectShape shape  = getObjectShape(variant);
336
    float[][] vertices = shape.getVertices();
337
    float[][] centers  = computeVertexEffectCenter(variant);
338
    float[][] pos      = getCubitPositions();
339
    int[] cornerIndices= FactoryShape.computeVertexEffectsIndices(vertices, pos[variant], getFaceAxis(), getDist() );
340
    float[] strength   = getCornerPressStrength();
341
    float[][] corners  = { strength };
342
    int[] centerIndices= new int[centers.length];
343
    for(int c=0; c<centers.length; c++) centerIndices[c] = c;
344

  
345
    return FactoryCubit.generateVertexEffect(vertices,corners,cornerIndices,centers,centerIndices);
348
    if( mEffects==null )
349
      {
350
      int numVariants = getNumCubitVariants();
351
      mEffects = new ObjectVertexEffects[numVariants];
352
      }
353

  
354
    if( mEffects[variant]==null )
355
      {
356
      ObjectShape shape  = getObjectShape(variant);
357
      float[][] vertices = shape.getVertices();
358
      float[][] centers  = computeVertexEffectCenter(variant);
359
      float[][] pos      = getCubitPositions();
360
      int firstCubit     = getFirstCubitOfVariant(variant);
361
      int[] cornerIndices= FactoryShape.computeVertexEffectsIndices(vertices, pos[firstCubit], getFaceAxis(), getDist() );
362
      float[] strength   = getCornerPressStrength();
363
      float[][] corners  = { strength };
364
      int[] centerIndices= new int[centers.length];
365
      for(int c=0; c<centers.length; c++) centerIndices[c] = c;
366

  
367
      mEffects[variant] = FactoryCubit.generateVertexEffect(vertices,corners,cornerIndices,centers,centerIndices);
368
      }
369

  
370
    return mEffects[variant];
346 371
    }
347 372

  
348 373
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff