// Token: 0x060041F1 RID: 16881 RVA: 0x0014F40C File Offset: 0x0014D80C public void GenerateGeometry(float radius0, float radius1, float thickness, float height, int sides, int heightSegments, NormalsType normalsType, PivotPosition pivotPosition) { MeshFilter component = base.GetComponent <MeshFilter>(); if (component.sharedMesh == null) { component.sharedMesh = new Mesh(); } Mesh sharedMesh = component.sharedMesh; if (thickness >= 0f) { base.GenerationTimeMS = HollowConePrimitive.GenerateGeometry(sharedMesh, radius0, radius1, thickness, height, sides, heightSegments, normalsType, pivotPosition); } else { base.GenerationTimeMS = ConePrimitive.GenerateGeometry(sharedMesh, radius0, radius1, height, sides, heightSegments, normalsType, pivotPosition); } this.radius0 = radius0; this.radius1 = radius1; this.height = height; this.thickness = thickness; this.sides = sides; this.heightSegments = heightSegments; this.normalsType = normalsType; this.flipNormals = false; this.pivotPosition = pivotPosition; }
public GeometricPrimitives(GraphicsDevice graphicsDevice) { Box = new BoxPrimitive(graphicsDevice); Capsule = new CapsulePrimitive(graphicsDevice); Cone = new ConePrimitive(graphicsDevice); Cylinder = new CylinderPrimitive(graphicsDevice); Sphere = new SpherePrimitive(graphicsDevice); }
// Token: 0x06004204 RID: 16900 RVA: 0x0014FAA4 File Offset: 0x0014DEA4 public override void GenerateColliderGeometry() { Mesh colliderMesh = base.GetColliderMesh(); if (colliderMesh) { colliderMesh.Clear(); ConePrimitive.GenerateGeometry(colliderMesh, this.radius, this.radius, this.height, this.sides, this.heightSegments, this.normalsType, this.pivotPosition); base.RefreshMeshCollider(); } base.GenerateColliderGeometry(); }
// Token: 0x06004202 RID: 16898 RVA: 0x0014F9F0 File Offset: 0x0014DDF0 public void GenerateGeometry(float radius, float height, int sides, int heightSegments, NormalsType normalsType, PivotPosition pivotPosition) { MeshFilter component = base.GetComponent <MeshFilter>(); if (component.sharedMesh == null) { component.sharedMesh = new Mesh(); } Mesh sharedMesh = component.sharedMesh; base.GenerationTimeMS = ConePrimitive.GenerateGeometry(sharedMesh, radius, radius, height, sides, heightSegments, normalsType, pivotPosition); this.radius = radius; this.height = height; this.sides = sides; this.heightSegments = heightSegments; this.normalsType = normalsType; this.flipNormals = false; this.pivotPosition = pivotPosition; }
/// <summary> /// Creates a StaticModel from a GeometricPrimitive and specified dimensions. /// </summary> /// <param name="primitiveType">Type of primitive to create</param> /// <param name="height">Height of primitive, used by cubes and cylinders.</param> /// <param name="width">Width of primitive, used by cubes.</param> /// <param name="depth">Depth of primitive, used by cubes.</param> /// <param name="diameter">Diameter of primitive, used by cylinders, spheres, toruses, and teapots.</param> private void LoadModelFromPrimitive(GeometricPrimitiveType primitiveType, float height, float width, float depth, float diameter) { GeometricPrimitive primitive; switch (primitiveType) { case GeometricPrimitiveType.Box: primitive = new CubePrimitive(this.parentEntity.Game.GraphicsDevice, height, width, depth); break; case GeometricPrimitiveType.Sphere: primitive = new SpherePrimitive(this.parentEntity.Game.GraphicsDevice, diameter, 16); break; case GeometricPrimitiveType.Cylinder: primitive = new CylinderPrimitive(this.parentEntity.Game.GraphicsDevice, height, diameter, 16); break; case GeometricPrimitiveType.Cone: primitive = new ConePrimitive(this.parentEntity.Game.GraphicsDevice, height, diameter, 16); break; case GeometricPrimitiveType.Torus: primitive = new TorusPrimitive(this.parentEntity.Game.GraphicsDevice, diameter, 0.3333f, 16); break; case GeometricPrimitiveType.Teapot: primitive = new TeapotPrimitive(this.parentEntity.Game.GraphicsDevice, diameter, 8); break; default: throw new Exception("LoadPrimitive does not handle this type of GeometricPrimitive. Was a new primitive type made and not handled here?"); } if (null != primitive) { model = new StaticModel(primitive, this.parentEntity.Game.GraphicsDevice); } }