TQuad


Croquet-Teapot

Comment:

TQuad is a TPrimitive used to render four sided objects.

Hierarchy:

ProtoObject
Object
TObject
TFrame
TPrimitive
TQuad

Summary:

instance variables:

normal vertices

methods:

instance class
accessing initialize render no messages

Detail:

instance variables:

normal
vertices

instance methods:

accessing
v1: v1 v2: v2 v3: v3 v4: v4


	vertices at: 1 put: v1.
	vertices at: 2 put: v2.
	vertices at: 3 put: v3.
	vertices at: 4 put: v4.
	normal _ nil.
	self boundsChanged.

initialize
initBounds


	boundSphere _ TBoundSphere mtfBall: vertices.
	boundSphere frame: self.
	normal _ (((vertices at: 2)-(vertices at: 1)) cross: ((vertices at: 3)- (vertices at: 2))) normalized.
initialize

	super initialize.
	vertices _ B3DVector3Array ofSize: 4.
	vertices at: 1 put:(B3DVector3 x: -0.5 y:0.5 z: 0.0).
	vertices at: 2 put:(B3DVector3 x: -0.5 y:-0.5 z: 0.0).
	vertices at: 3 put:(B3DVector3 x: 0.5 y:-0.5 z:0.0).
	vertices at: 4 put:(B3DVector3 x: 0.5 y:0.5 z:0.0).
	self initBounds.
	^self

render
pick: pointer


	^ pointer pickQuad: normal
		q1: (vertices at: 1)
		q2: (vertices at: 2)
		q3: (vertices at: 3)
		q4: (vertices at: 4).
renderPrimitive: ogl

	ogl
		glBegin: GLQuads;
			glNormal3fv: normal;
			glTexCoord2f:0.0 with: 0.0;	glVertex3fv: (vertices at: 1);
			glTexCoord2f:1.0 with:0.0;	glVertex3fv: (vertices at: 2);
			glTexCoord2f:1.0 with:1.0;	glVertex3fv: (vertices at: 3);
			glTexCoord2f:0.0 with:1.0;	glVertex3fv: (vertices at: 4);
		glEnd.

class methods:

^top


- made by Dandelion -