/* Name: Cone Primitive Plug-in Copyright: 2006 Author: Tyson Collins Date: 05/06/06 07:15 Description: Plugin for Anim8or v0.95 that adds a cone primitive */ #plugin("object", "mesh", "cone"); #parameter("divisions", int, 10, 4, 1000); #parameter("diameter", float, 16.0, 1.0, 1000.0); #parameter("height", float, 10.0, 3.0, 1000.0, scale); #return($cone); #button(20, 25, 2, 0x0000000000, 0x0000000000, 0x0000000000, 0x0000000c00, 0x0000000e00, 0x0000001e00, 0x0000003500, 0x0000003500, 0x0000005580, 0x0000005580, 0x0000005540, 0x000000a540, 0x000000a520, 0x00000124a0, 0x0000012490, 0x0000024490, 0x0000024488, 0x0000024448, 0x0000028448, 0x0000018450, 0x000000e4e0, 0x0000001f00, 0x0000000000, 0x0000000000, 0x0000000000); shape $cone; float $height,$diameter; int $divisions; int $vtxIndex[60]; $height = parameter("height"); $diameter = parameter("diameter"); $divisions = parameter("divisions"); float $angle,$x,$y,$z; int $i,$tot; point3 $p; $cone.Open(); $i = 0; $p.x = 0; $p.y = $height; $p.z = 0; $cone.AddPoint($p); for $i = 1 to $divisions do { $angle = $angle + (3.141592653589793/($divisions/2)); $x = $diameter*sin($angle); $y = 0; $z = $diameter*cos($angle); $p.x = $x; $p.y = $y; $p.z = $z; $vtxIndex[$i] = $cone.AddPoint($p); $tot = $i; } $vtxIndex[$tot+1] = 1; int $j; $j = 1; while($j <= $divisions) { $cone.OpenFace(0, 2); $cone.VertexN($vtxIndex[$j]); $cone.VertexN(0); $cone.VertexN($vtxIndex[$j+1]); $cone.CloseFace(); $j = $j + 1; } $cone.OpenFace(0, 0); for $i = 1 to $divisions do { $cone.VertexN($vtxIndex[$i]); } $cone.CloseFace(); $cone.Close();