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); }
void Microphone::setUprightRadius (float r) { float shift = r - uR; uR = r; Cone upright (uH * 0.35211f, uR * 0.66667f, uR * 0.66667f, 24), shroudLow(uH * 0.21127f, uR, uR, 24), shroudHi (uH * 0.63317f, uR, uR, 24), bridge (uH * 0.084537f,uR * 0.66667f, uR * 0.41667f, 24); upright.Fly(bH); shroudLow.Fly(tH * 0.0823f); shroudHi.Fly(shroudLow.getPosition().z + shroudLow.getHeight() + uG); bridge.Fly(shroudHi.getPosition().z + shroudHi.getHeight()); replaceMesh(MIC_UPRIGHT, upright); replaceMesh(MIC_SHROUD_LOW, shroudLow); replaceMesh(MIC_SHROUD_HI, shroudHi); replaceMesh(MIC_BRIDGE, bridge); for (int i = MIC_HANDLE_BU; i < MIC_HEAD; i++){ micParts[i]->Translate( micParts[i]->getPosition().x + shift, micParts[i]->getPosition().y, micParts[i]->getPosition().z); recalcMeshVertices((MIC_PART)i, *micParts[i]); } }
void Microphone::setHeadRadius (float r) { float shift = r - hR; hR = r; tH += shift; 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); head.Fly(micParts[MIC_HEAD]->getPosition().z + shift); 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); replaceMesh(MIC_HEAD, head); replaceMesh(MIC_HEAD_FRONT, headFront); replaceMesh(MIC_HEAD_BACK, headBack); micParts[MIC_CORE]->Translate( micParts[MIC_CORE]->getPosition().x, micParts[MIC_CORE]->getPosition().y, micParts[MIC_CORE]->getPosition().z + shift); recalcMeshVertices(MIC_CORE, *micParts[MIC_CORE]); }
void Microphone::setButtonWidth (float w) { bW = w; 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); buttonL.Translate( -bR * 0.2588f, bR * 0.824f, bH * 1.1f); buttonL.Pitch((FLOAT)M_PI); buttonR.Translate(bR * 0.2588f, bR * 0.824f, bH * 1.1f); buttonR.Pitch((FLOAT)M_PI); replaceMesh(MIC_BUTTON_L, buttonL); replaceMesh(MIC_BUTTON_R, buttonR); }
void MapBlock::updateMesh(u32 daynight_ratio) { #if 0 /* DEBUG: If mesh has been generated, don't generate it again */ { JMutexAutoLock meshlock(mesh_mutex); if(mesh != NULL) return; } #endif MeshMakeData data; data.fill(daynight_ratio, this); scene::SMesh *mesh_new = makeMapBlockMesh(&data, m_gamedef); /* Replace the mesh */ replaceMesh(mesh_new); }
void Microphone::setUprightGap (float g) { float shift = g - uG; Cone upright (uH * 0.21127f + 2 * g, uR * 0.66667f, uR * 0.66667f, 24), shroudLow(uH * 0.21127f, uR, uR, 24), shroudHi ( uH * 0.7042f - 2*uG - shift, uR, uR, 24); upright.Fly(bH); shroudLow.Fly(tH * 0.0823f); shroudHi.Fly(shroudLow.getPosition().z + shroudLow.getHeight() + g); replaceMesh(MIC_UPRIGHT, upright); replaceMesh(MIC_SHROUD_LOW, shroudLow); replaceMesh(MIC_SHROUD_HI, shroudHi); }
void Microphone::setHandleIndent (float i) { float shift = i - hI; hI = i; Pyramid handleBridgeUp (uH * 0.09155f, uR * 0.653f, hI * 1.5f, uR * 0.653f, hI * 1.5f), handleBridgeDown(uH * 0.077f, uR * 0.653f, hI * 1.5f, uR * 0.653f, hI * 1.5f); handleBridgeUp.Fly(tH * 0.46f); handleBridgeUp.Follow(uR + hI / 2.f); handleBridgeDown.Fly(tH * 0.15f); handleBridgeDown.Follow(handleBridgeUp.getPosition().x); replaceMesh(MIC_HANDLE_BU, handleBridgeUp); replaceMesh(MIC_HANDLE_BD, handleBridgeDown); for (int i = MIC_HANDLE; i < MIC_HEAD; i++){ micParts[i]->Translate( micParts[i]->getPosition().x + shift, micParts[i]->getPosition().y, micParts[i]->getPosition().z); recalcMeshVertices((MIC_PART)i, *micParts[i]); } }
void Microphone::setBaseHeight (float h) { float shift = h - bH; bH = h; tH += shift; ExCone base(bH, bR, bR, bR * 0.824f, 24); base.Yaw(-(FLOAT)M_PI_2); replaceMesh(MIC_BASE, base); for (int i = MIC_BUTTON_L; i < PARTS_NUM; i++){ micParts[i]->Translate(micParts[i]->getPosition().x, micParts[i]->getPosition().y, micParts[i]->getPosition().z + shift); recalcMeshVertices((MIC_PART)i, *micParts[i]); } }
void Microphone::setBaseRadius (float r) { bR = r; ExCone base(bH, bR, bR, bR * 0.824f, 24); base.Yaw(-(FLOAT)M_PI_2); replaceMesh(MIC_BASE, base); micParts[MIC_BUTTON_L]->Translate(-bR * 0.2588f, bR * 0.824f, bH * 1.1f); micParts[MIC_BUTTON_R]->Translate(bR * 0.2588f, bR * 0.824f, bH * 1.1f); recalcMeshVertices(MIC_BUTTON_L, *micParts[MIC_BUTTON_L]); recalcMeshVertices(MIC_BUTTON_R, *micParts[MIC_BUTTON_R]); }
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]); } }