Esempio n. 1
0
void Microphone::setHeadDepth (float d) {
	float shift = d - hD;
	hD = d;

	Hole			head	 (hD,  hR,	 cR, hR, cR, 24),
					headFront(hD / 10.f, hR * 1.075f, cR * 0.9f, hR * 1.075f, cR * 0.9f, 24),
					headBack (hD / 10.f, hR * 1.075f, cR * 0.9f, hR * 1.075f, cR * 0.9f, 24);
	Cone			core	 (hD * 1.43333f,  cR, cR, 24);

	head.Fly(micParts[MIC_HEAD]->getPosition().z);
	head.Strafe(-hD/2);
	head.Pitch((FLOAT)M_PI_2);
	head.Roll((FLOAT)M_PI_2);

	headFront.Fly(head.getPosition().z);
	headFront.Strafe(-head.getPosition().y);
	headFront.Pitch((FLOAT)M_PI_2);
	headFront.Roll((FLOAT)M_PI_2);

	headBack.Translate(head.getPosition());
	headBack.Pitch((FLOAT)M_PI_2);
	headBack.Roll((FLOAT)M_PI_2);

	core.Fly(head.getPosition().z);
	core.Strafe(-core.getHeight() / 2.1f);
	core.Pitch((FLOAT)M_PI_2);
	core.Roll((FLOAT)M_PI_2);

	replaceMesh(MIC_HEAD,		head);
	replaceMesh(MIC_HEAD_FRONT, headFront);
	replaceMesh(MIC_HEAD_BACK,	headBack);
	replaceMesh(MIC_CORE,		core);
}
Esempio n. 2
0
void Microphone::setUprightHeight (float h) {
	float shift = h - uH;
	tH += shift; uH = tH * 0.58436f;

	Cone			upright	 (uH * 0.21127f + 2 * uG, uR * 0.66667f, uR * 0.66667f, 24),
					shroudLow(uH * 0.21127f, uR, uR, 24),
					shroudHi (uH - upright.getHeight() - uH * 0.084537f, uR, uR, 24),
					bridge   (uH * 0.084537f,uR * 0.66667f, uR * 0.41667f, 24);

	Pyramid			handleBridgeUp	(uH * 0.09155f, uR * 0.653f, hI, uR * 0.653f, hI),
					handleBridgeDown(uH * 0.077f,   uR * 0.653f, hI, uR * 0.653f, hI),
					handle			(uH * 0.7598f,  uR * 0.792f, uR * 0.5418f, uR * 0.5418f, uR * 0.5418f, uR * 0.125f),
					handleTop		(uH * 0.05647f, uR * 0.792f, uR * 0.5418f, uR * 0.792f,  uR * 0.5418f,-uR * 0.3542f);

	upright.Fly(bH);
	shroudLow.Fly(tH * 0.0823f);
	shroudHi.Fly(shroudLow.getPosition().z + shroudLow.getHeight() + uG);
	bridge.Fly(shroudHi.getPosition().z + shroudHi.getHeight());

	handleBridgeUp.Fly(tH * 0.46f);
	handleBridgeUp.Follow(bR * 0.2f);
	handleBridgeDown.Fly(tH * 0.15f);
	handleBridgeDown.Follow(handleBridgeUp.getPosition().x);
	handle.Translate(bR * 0.306f, bR * 0.0059f, tH * 0.547f);
	handle.Pitch((FLOAT)M_PI);
	handle.Yaw((FLOAT)M_PI_2);
	handleTop.Translate(handle.getPosition().x, handle.getPosition().y, handle.getPosition().z);
	handleTop.Yaw((FLOAT)M_PI_2);

	replaceMesh(MIC_UPRIGHT, upright);
	replaceMesh(MIC_SHROUD_LOW, shroudLow);
	replaceMesh(MIC_SHROUD_HI, shroudHi);
	replaceMesh(MIC_BRIDGE, bridge);
	replaceMesh(MIC_HANDLE_BU, handleBridgeUp);
	replaceMesh(MIC_HANDLE_BD, handleBridgeDown);
	replaceMesh(MIC_HANDLE, handle);
	replaceMesh(MIC_HANDLE_TOP, handleTop);

	for (int i = MIC_HEAD; i < PARTS_NUM; i++){
		micParts[i]->Translate(	micParts[i]->getPosition().x,
								micParts[i]->getPosition().y,
								bridge.getPosition().z + bridge.getHeight() + hR);
		recalcMeshVertices((MIC_PART)i, *micParts[i]);
	}
}
Esempio n. 3
0
void Microphone::Triangulate() {
	vertices.clear();
	edges.clear();
	polygons.clear();

	ExCone			base(bH, bR, bR, bR * 0.824f, precision);
	Pyramid			buttonL(bH * 0.6f, bW * 0.575f, bW, bW * 0.3f, bW, -bW * 0.1375f),
					buttonR(bH * 0.6f, bW * 0.575f, bW, bW * 0.3f, bW, -bW * 0.1375f);
	
	Cone			shroudLow(uH * 0.21127f, uR, uR, precision),
					bridge   (uH * 0.084537f, uR * 0.66667f, uR * 0.41667f, precision),
					shroudHi (uH - uG - shroudLow.getHeight() - uH * .04f - bridge.getHeight(), uR, uR, precision),
					upright	 (uH - bridge.getHeight(), uR * 0.66667f, uR * 0.66667f, precision);

	Pyramid			handleBridgeUp	(uH * 0.09155f, uR * 0.653f, hI, uR * 0.653f, hI),
					handleBridgeDown(uH * 0.077f,   uR * 0.653f, hI, uR * 0.653f, hI),
					handle			(uH * 0.7598f,  uR * 0.792f, uR * 0.5418f, uR * 0.5418f, uR * 0.5418f, uR * 0.125f),
					handleTop		(uH * 0.05647f, uR * 0.792f, uR * 0.5418f, uR * 0.792f,  uR * 0.5418f,-uR * 0.3542f);

	Hole			head	 (hD,  hR,	 cR, hR, cR, precision),
					headFront(hD / 10.f, hR * 1.075f, cR * 0.9f, hR * 1.075f, cR * 0.9f, precision),
					headBack (hD / 10.f, hR * 1.075f, cR * 0.9f, hR * 1.075f, cR * 0.9f, precision);
	Cone			core	 (hD * 1.43333f,  cR, cR, precision);

	base.Yaw(-(FLOAT)M_PI_2);
	base.Transform();

	buttonL.Translate(-bR * 0.2588f, bR * 0.824f, bH * 1.1f);
	buttonL.Pitch((FLOAT)M_PI);
	buttonL.Transform();

	buttonR.Translate(bR * 0.2588f, bR * 0.824f, bH * 1.1f);
	buttonR.Pitch((FLOAT)M_PI);
	buttonR.Transform();

	upright.Fly(bH);
	upright.Transform();

	shroudLow.Fly(base.getHeight() + uH * .04f);
	shroudLow.Transform();

	shroudHi.Fly(shroudLow.getPosition().z + shroudLow.getHeight() + uG);
	shroudHi.Transform();

	bridge.Fly(shroudHi.getPosition().z + shroudHi.getHeight());
	bridge.Transform();

	handleBridgeUp.Fly(uH * 0.8f);
	handleBridgeUp.Follow(uR + hI / 2);
	handleBridgeUp.Transform();

	handleBridgeDown.Fly(bH + uH * 0.15f);
	handleBridgeDown.Follow(handleBridgeUp.getPosition().x);
	handleBridgeDown.Transform();

	handle.Translate(uR * 1.5f + hI, bR * 0.0059f, uH * .95f);
	handle.Pitch((FLOAT)M_PI);
	handle.Yaw((FLOAT)M_PI_2);
	handle.Transform();

	handleTop.Translate(handle.getPosition().x, handle.getPosition().y, handle.getPosition().z);
	handleTop.Yaw((FLOAT)M_PI_2);
	handleTop.Transform();

	head.Fly(bridge.getPosition().z + bridge.getHeight() + hR);
	head.Strafe(-hD/2);
	head.Pitch((FLOAT)M_PI_2);
	head.Roll((FLOAT)M_PI_2);
	head.Transform();

	headFront.Fly(head.getPosition().z);
	headFront.Strafe(-head.getPosition().y);
	headFront.Pitch((FLOAT)M_PI_2);
	headFront.Roll((FLOAT)M_PI_2);
	headFront.Transform();

	headBack.Translate(head.getPosition());
	headBack.Pitch((FLOAT)M_PI_2);
	headBack.Roll((FLOAT)M_PI_2);
	headBack.Transform();

	core.Fly(head.getPosition().z);
	core.Strafe(-core.getHeight() / 2.1f);
	core.Pitch((FLOAT)M_PI_2);
	core.Roll((FLOAT)M_PI_2);
	core.Transform();

	addMesh(MIC_BASE,		base);
	addMesh(MIC_BUTTON_L,	buttonL);
	addMesh(MIC_BUTTON_R,	buttonR);
	addMesh(MIC_UPRIGHT,	upright);
	addMesh(MIC_SHROUD_LOW,	shroudLow);
	addMesh(MIC_SHROUD_HI,	shroudHi);
	addMesh(MIC_BRIDGE,		bridge);
	addMesh(MIC_HANDLE_BU,	handleBridgeUp);
	addMesh(MIC_HANDLE_BD,	handleBridgeDown);
	addMesh(MIC_HANDLE,		handle);
	addMesh(MIC_HANDLE_TOP,	handleTop);
	addMesh(MIC_HEAD,		head);
	addMesh(MIC_HEAD_FRONT,	headFront);
	addMesh(MIC_HEAD_BACK,	headBack);
	addMesh(MIC_CORE,		core);

	Transform();
	vertices.shrink_to_fit();
	edges.shrink_to_fit();
	polygons.shrink_to_fit();

//	flipNormals(0, polygons.size());
}