Skip to content

Commit

Permalink
Refactoring CircleMesh#3
Browse files Browse the repository at this point in the history
  • Loading branch information
Zelaux committed Feb 15, 2025
1 parent c2a28d6 commit 177bb33
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/omaloon/graphics/g3d/CircleMesh.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
import mindustry.graphics.g3d.*;
import mindustry.type.*;
import omaloon.graphics.*;

/**
* @author Zelaux
* */
*/
public class CircleMesh extends PlanetMesh{
public final Mesh mesh;
public TextureRegion region;
Expand Down Expand Up @@ -44,11 +45,14 @@ public MeshPoint(Vec3 position, Vec2 textureCords){

int[] order = {0, 1, 2, 2, 3, 0};
Vec3 plane = new Vec3();
if(axis.y==0){
plane.set(0,1,0);
}else {
float val=axis.dot(1,0,1);
plane.set(1,-val/axis.y,1).nor();
if(axis.y == 0){
plane.set(0, 1, 0);
}else{
float val = axis.dot(1, 0, 1);
float calcY = -val / axis.y;
float len = Mathf.sqrt(2 + calcY * calcY);
float invLen = 1 / len;
plane.set(invLen, calcY / len, invLen);
}

Vec3 inv = axis.cpy().unaryMinus();
Expand Down

0 comments on commit 177bb33

Please sign in to comment.