static Vector3 getConeVertex(float u, float v, GizmoCoords coords) //Vector3 pos, Vector3 xVec, Vector3 yVec, Vector3 zVec){ { var tmp = getUnitConeVertex(u, v); return(coords.transformPoint(tmp)); //return pos + tmp.x * xVec + tmp.y*yVec + tmp.z*zVec; }
public static void processWireCone(GizmoCoords coords, int uSegments, int vSegments, float vPivot, LineCallback lineCallback) { if (lineCallback == null) { throw new System.ArgumentNullException(); } var southPole = coords.pos - coords.yVec * vPivot; var northPole = southPole + coords.yVec; if (uSegments < 3) { uSegments = 3; } if (vSegments < 1) { vSegments = 1; } coords.pos = southPole; processUvSurface <GizmoCoords>(uSegments, vSegments, 0, uSegments, 0, vSegments, northPole, southPole, true, true, (u, v, data) => getConeVertex(u, v, data), lineCallback, coords); }
static Vector3 getUnitCylinderVertex(float u, float v, GizmoCoords coords) { var sinCos = getSinCos(u * Mathf.PI * 2.0f); var result = coords.transformPoint(new Vector3(-sinCos.y, v, sinCos.x)); return(result); }
public static void drawVectorText(string text, Transform transform, float localLetterScale, TextAnchor anchor, TextAnchor alignment) { var coords = new GizmoCoords(transform); coords.xVec *= localLetterScale; coords.yVec *= localLetterScale; coords.zVec *= localLetterScale; drawVectorText(text, coords, anchor, alignment); }
public static void drawVectorTextLine(string text, Transform transform, float localLetterScale) { var coords = new GizmoCoords(transform); coords.xVec *= localLetterScale; coords.yVec *= localLetterScale; coords.zVec *= localLetterScale; drawVectorTextLine(text, coords); }
public static void processWireCube(GizmoCoords coords, bool makePivotAxes, Vector3 pivotOffset, LineCallback lineCallback) { if (lineCallback == null) { throw new System.ArgumentNullException(); } var a = coords.pos - coords.xVec * pivotOffset.x - coords.yVec * pivotOffset.y - coords.zVec * pivotOffset.z; var b = a + coords.xVec; var c = a + coords.yVec; var d = b + coords.yVec; var a1 = a + coords.zVec; var b1 = b + coords.zVec; var c1 = c + coords.zVec; var d1 = d + coords.zVec; lineCallback(a, b); lineCallback(a, c); lineCallback(b, d); lineCallback(c, d); lineCallback(a1, b1); lineCallback(a1, c1); lineCallback(b1, d1); lineCallback(c1, d1); lineCallback(a, a1); lineCallback(b, b1); lineCallback(c, c1); lineCallback(d, d1); if (!makePivotAxes) { return; } var pivotX = coords.pos - pivotOffset.x * coords.xVec; var pivotY = coords.pos - pivotOffset.y * coords.yVec; var pivotZ = coords.pos - pivotOffset.z * coords.zVec; lineCallback(pivotX, pivotX + coords.xVec); lineCallback(pivotY, pivotY + coords.yVec); lineCallback(pivotZ, pivotZ + coords.zVec); }
public static void processUvSphere(GizmoCoords coords, int uSegments, int vSegments, LineCallback lineCallback) { if (lineCallback == null) { throw new System.ArgumentNullException(); } if (uSegments < 3) { uSegments = 3; } if (vSegments < 2) { vSegments = 12; } Vector3 northPole = getSphereVertex(0.0f, 1.0f, coords); Vector3 southPole = getSphereVertex(0.0f, 0.0f, coords); processUvSurface <GizmoCoords>(uSegments, vSegments, 0, uSegments, 1, vSegments - 1, northPole, southPole, true, true, (u, v, data) => getSphereVertex(u, v, data), lineCallback, coords); }
public static void processWireCube(GizmoCoords coords, bool makePivotAxes = false) { processWireCube(coords, makePivotAxes, new Vector3(0.5f, 0.5f, 0.5f), gizmoLine); }
public static void drawVectorTextLine(string text, GizmoCoords coords) { VectorText.processTextLine(text, (a, b, crd) => gizmoLine(crd.transformPoint(new Vector3(-a.x, a.y, 0.0f)), crd.transformPoint(new Vector3(-b.x, b.y, 0.0f))), coords); }
public static void drawVectorTextLine(string text, Vector3 pos, Quaternion rotation, float letterScale) { var coords = new GizmoCoords(pos, rotation, new Vector3(letterScale, letterScale, letterScale)); drawVectorTextLine(text, coords); }
static Vector3 getSphereVertex(float u, float v, GizmoCoords coords) { var unitVert = getUnitSphereVertex(u, v); return(coords.transformPoint(unitVert)); }
public static void drawVectorText(string text, GizmoCoords coords, TextAnchor anchor, TextAnchor alignment) { VectorText.processText(text, anchor, alignment, (a, b, crd) => { gizmoLine(crd.transformPoint(new Vector3(-a.x, a.y, 0.0f)), crd.transformPoint(new Vector3(-b.x, b.y, 0.0f))); }, coords); }
public static void drawVectorText(string text, Vector3 pos, Quaternion rotation, float letterScale, TextAnchor anchor, TextAnchor alignment) { var coords = new GizmoCoords(pos, rotation, new Vector3(letterScale, letterScale, letterScale)); drawVectorText(text, coords, anchor, alignment); }
public static void drawWireCone(Vector3 position, float radius, float height, Quaternion rotation, float vPivot = 0.0f, int uSegments = 8, int vSegments = 1) { GizmoCoords coords = new GizmoCoords(position, rotation, new Vector3(radius, height, radius)); processWireCone(coords, uSegments, vSegments, vPivot, gizmoLine); }
public static void drawWireCube(Transform transform, Vector3 size, Vector3 pivot, bool pivotAxes = false) { var coords = new GizmoCoords(transform, size); processWireCube(coords, pivotAxes, pivot); }
public static void processWireCube(GizmoCoords coords, bool makePivotAxes, Vector3 pivotOffset) { processWireCube(coords, makePivotAxes, pivotOffset, gizmoLine); }
public static void drawWireSphere(Transform transform, float localRadius, int uSegments = 8, int vSegments = 4) { var coords = new GizmoCoords(transform, new Vector3(localRadius, localRadius, localRadius)); drawWireSphere(coords, uSegments, vSegments); }
public static void drawWireSphere(GizmoCoords coords, int uSegments, int vSegments) { processUvSphere(coords, uSegments, vSegments, gizmoLine); }
public static void drawWireSphere(Vector3 position, float radius, int uSegments, int vSegments, Quaternion rotation) { var coords = new GizmoCoords(position, rotation, new Vector3(radius, radius, radius)); drawWireSphere(coords, uSegments, vSegments); }
public static void drawWireCone(Transform transform, float localRadius, float localHeight, float vPivot = 0.0f, int uSegments = 8, int vSegments = 1) { GizmoCoords coords = new GizmoCoords(transform, new Vector3(localRadius, localHeight, localRadius)); processWireCone(coords, uSegments, vSegments, vPivot, gizmoLine); }
public static void drawWireCube(Vector3 position, Vector3 size, Quaternion rotation, Vector3 pivot, bool pivotAxes = false) { var coords = new GizmoCoords(position, rotation, size); processWireCube(coords, pivotAxes, pivot); }