Esempio n. 1
0
void TextureEditor::draw() {
  if (surface == NULL) return;
    
    // Reset default color to white
    ofSetColor(255, 255, 255, 255);
    drawJoints();
}
Esempio n. 2
0
void TextureEditorWidget::draw(){
	if(surface == 0){
		return;
	}

	// Reset default color to white
	ofSetColor(255, 255, 255, 255);
	drawJoints();
}
Esempio n. 3
0
 void ProjectionEditor::draw() {
     if (surfaceManager == NULL) return;
     if (surfaceManager->getSelectedSurface() == NULL) return;
     if (joints.size() <= 0) createJoints();
     drawJoints();
 }
Esempio n. 4
0
void TextureEditor::draw() {
  if (surface == NULL) return;

  drawJoints();
}
// Draw an individual bone
void Skeleton::drawBoneSegment(bone* root, GLUquadric* q) {
	if (root == NULL) {
		return;
	}

	GLfloat a = 0.0;

	// Find rotation vector normal.
	G308_Point v1 = { 0, 0, 1 };
	G308_Point v2 = { root->dirx, root->diry, root->dirz };
	G308_Point normal = { 0, 0, 0 };

	calculateCrossProduct(v1, v2, &normal);

	// Calculate rotation angle from bone's direction vector (degrees).
	a = calculateAngleFromDotProduct(v1, v2);

	// Draw spheres to represent joints
	if (jointsOn == true) {
		drawJoints(root);
	}

	// Rotate local coordinates
	glRotatef(root->rotz, 0, 0, 1);
	glRotatef(root->roty, 0, 1, 0);
	glRotatef(root->rotx, 1, 0, 0);

	// Rotate current frame/pose
	doCurrentMove(root);

	// Rotate local coordinates
	glRotatef(-root->rotx, 1, 0, 0);
	glRotatef(-root->roty, 0, 1, 0);
	glRotatef(-root->rotz, 0, 0, 1);

	// Draw axis of each individual joint
	if (jointAxisOn == true) {
		glPushMatrix();
		glRotatef(a, normal.x, normal.y, normal.z);
		drawJointAxis(q);
		glPopMatrix();
	}

	glPushMatrix();

	glColor3f(1, 1, 1);
	// Rotate bone.
	glRotatef(a, normal.x, normal.y, normal.z);
	// Draw face on the 'head' bone
	if (headOn == true && strcmp(root->name, "head") == 0) {
		displayFace(root);
	}
	// Draw the actual bone
	gluCylinder(q, 0.3, 0.3, root->length, 3, 3);
	// If using second character
	// Draw cuboid limbs
	if (currentCharacter == 1) {
		glScalef(0.2, 0.2, 1);
		glTranslatef(0,-2,0);

		glTranslatef(0, 0, root->length /2);
		// Draw chest
		if (strcmp(root->name,"lowerback") == 0 || strcmp(root->name,"upperback") == 0 || strcmp(root->name,"thorax") == 0) {
			glPushMatrix();
			glScalef(12, 2, 1);
			glutSolidCube(root->length);
			glPopMatrix();
		}
		else
			glutSolidCube(root->length);

		// Draw lower(root) chest
		if (strcmp(root->name,"lowerback") == 0) {
			glPushMatrix();
			glTranslatef(0,0,-root->length);
			glScalef(12, 3, 1);
			glutSolidCube(root->length);
			glPopMatrix();
		}
	}
	glPopMatrix();

	// Move bone to correct location
	glTranslatef(root->length * root->dirx, root->length * root->diry,
			root->length * root->dirz);

}