|
|
Christopher James Huff wrote:
> I don't know if you meant this, but that last paragraph implies that a
> mesh box would be unuseable in CSG. If he uses inside_vector, it will be
> useable for CSG operations.
Works quite well actually :)
-----------------------------------------------------------
// Macro for creating a basic box object using triangles
#macro Box_Mesh(Vec1,Vec2)
#if (Vec1.x=Vec2.x | Vec1.y=Vec2.y | Vec1.z=Vec2.z)
#debug "\n MeshBox detected identical vector values.\n" #end
#local P1=<Vec1.x, Vec1.y, Vec1.z>;
#local P2=<Vec2.x, Vec1.y, Vec1.z>;
#local P3=<Vec2.x, Vec1.y, Vec2.z>;
#local P4=<Vec1.x, Vec1.y, Vec2.z>;
#local P5=<Vec1.x, Vec2.y, Vec1.z>;
#local P6=<Vec2.x, Vec2.y, Vec1.z>;
#local P7=<Vec2.x, Vec2.y, Vec2.z>;
#local P8=<Vec1.x, Vec2.y, Vec2.z>;
mesh {
triangle { P5, P1, P2 texture {T1} }
triangle { P5, P6, P2 texture {T1} }
triangle { P6, P2, P3 texture {T2} }
triangle { P6, P7, P3 texture {T2} }
triangle { P7, P3, P4 texture {T3} }
triangle { P7, P8, P4 texture {T3} }
triangle { P8, P4, P1 texture {T4} }
triangle { P8, P5, P1 texture {T4} }
triangle { P8, P5, P6 texture {T5} }
triangle { P8, P7, P6 texture {T5} }
triangle { P4, P1, P2 texture {T6} }
triangle { P4, P3, P2 texture {T6} }
inside_vector <0, 0, 1>
}
#end
default { finish { ambient .4 diffuse .6 } }
#declare T1 = texture { pigment { rgb<1,0,0> }}
#declare T2 = texture { pigment { rgb<0,1,0> }}
#declare T3 = texture { pigment { rgb<0,0,1> }}
#declare T4 = texture { pigment { rgb<1,1,0> }}
#declare T5 = texture { pigment { rgb<1,0,1> }}
#declare T6 = texture { pigment { rgb<0,1,1> }}
// Usage
camera{location<-4,4,-4> look_at 0}
light_source{<-5,5,-5>rgb 1}
difference
{
Box_Mesh ( <-1,-1,-1>, <1,1,1> )
cylinder { z*-1.1, z*1.1, .75 pigment { rgb 1 }}
}
--
Ken Tyler
Post a reply to this message
|
|