void LLCylinder::renderface(F32 pixel_area, S32 face) { if (face < 0 || face > 2) { llerror("LLCylinder::renderface() invalid face number", face); return; } glMatrixMode(GL_MODELVIEW); glPushMatrix(); S32 level_of_detail; if (pixel_area > 20000.f) { level_of_detail = 0; } else if (pixel_area > 1600.f) { level_of_detail = 1; } else if (pixel_area > 200.f) { level_of_detail = 2; } else { level_of_detail = 3; } if (level_of_detail < 0 || CYLINDER_LEVELS_OF_DETAIL <= level_of_detail) { llerror("LLCylinder::renderface() invalid level of detail", level_of_detail); return; } LLVertexBuffer::unbind(); switch(face) { case 0: glTranslatef(0.f, 0.f, -0.5f); drawSide(level_of_detail); break; case 1: glTranslatef(0.0f, 0.f, 0.5f); drawTop(level_of_detail); break; case 2: glTranslatef(0.0f, 0.f, -0.5f); drawBottom(level_of_detail); break; default: llerror("LLCylinder::renderface() fell out of switch", 0); break; } glMatrixMode(GL_MODELVIEW); glPopMatrix(); }
U32 draw_cylinder_cap(GLint slices, GLfloat base_radius, BOOL is_top) { U32 triangles = 0; if (!gQuadObj) { gQuadObj = gluNewQuadric(); if (!gQuadObj) llerror("draw_cylinder_base couldn't allocated quadric", 0); } gluQuadricDrawStyle(gQuadObj, GLU_FILL); gluQuadricNormals(gQuadObj, GLU_SMOOTH); gluQuadricOrientation(gQuadObj, GLU_OUTSIDE); gluQuadricTexture(gQuadObj, GL_TRUE); // no hole in the middle of the disk, and just one ring GLdouble inner_radius = 0.0; GLint rings = 1; // normals point in +z for top, -z for base if (is_top) { gluQuadricOrientation(gQuadObj, GLU_OUTSIDE); } else { gluQuadricOrientation(gQuadObj, GLU_INSIDE); } gluDisk(gQuadObj, inner_radius, base_radius, slices, rings); triangles += slices; return triangles; }
// ----------------------------------------------------------------------- int str_append(char c) { if (str_len >= STR_MAX) { llerror("string too long"); return 0; } *(str_buf+str_len++) = c; return 1; }
bool LLAvatarItemComparator::compare(const LLPanel* item1, const LLPanel* item2) const { const LLAvatarListItem* avatar_item1 = dynamic_cast<const LLAvatarListItem*>(item1); const LLAvatarListItem* avatar_item2 = dynamic_cast<const LLAvatarListItem*>(item2); if (!avatar_item1 || !avatar_item2) { llerror("item1 and item2 cannot be null", 0); return true; } return doCompare(avatar_item1, avatar_item2); }
void LLCone::renderface(S32 level_of_detail, S32 face) { if (face < 0 || face > 1) { llerror("LLCone::renderface() invalid face number", face); return; } if (level_of_detail < 0 || CONE_LEVELS_OF_DETAIL <= level_of_detail) { llerror("LLCone::renderface() invalid level of detail", level_of_detail); return; } glMatrixMode(GL_MODELVIEW); glPushMatrix(); LLVertexBuffer::unbind(); switch(face) { case 0: glTranslatef(0.f, 0.f, -0.5f); drawSide(level_of_detail); break; case 1: glTranslatef(0.f, 0.f, -0.5f); drawBottom(level_of_detail); break; default: llerror("LLCylinder::renderface() fell out of switch", 0); break; } glMatrixMode(GL_MODELVIEW); glPopMatrix(); }
// draws a cylinder or cone // returns approximate number of triangles required U32 draw_cylinder_side(GLint slices, GLint stacks, GLfloat base_radius, GLfloat top_radius) { U32 triangles = 0; GLfloat height = 1.0f; if (!gQuadObj) { gQuadObj = gluNewQuadric(); if (!gQuadObj) llerror("draw_cylindrical_body couldn't allocated quadric", 0); } gluQuadricDrawStyle(gQuadObj, GLU_FILL); gluQuadricNormals(gQuadObj, GLU_SMOOTH); gluQuadricOrientation(gQuadObj, GLU_OUTSIDE); gluQuadricTexture(gQuadObj, GL_TRUE); gluCylinder(gQuadObj, base_radius, top_radius, height, slices, stacks); triangles += stacks * (slices * 2); return triangles; }
void LLCone::render(S32 level_of_detail) { GLfloat height = 1.0f; if (level_of_detail < 0 || CONE_LEVELS_OF_DETAIL <= level_of_detail) { llerror("LLCone::render() invalid level of detail", level_of_detail); return; } glMatrixMode(GL_MODELVIEW); glPushMatrix(); // center object at 0 glTranslatef(0.f, 0.f, - height / 2.0f); drawSide(level_of_detail); drawBottom(level_of_detail); glMatrixMode(GL_MODELVIEW); glPopMatrix(); }
//static LLIMFloater* LLIMFloater::show(const LLUUID& session_id) { closeHiddenIMToasts(); if (!gIMMgr->hasSession(session_id)) return NULL; if(!isChatMultiTab()) { //hide all LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel"); for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter) { LLIMFloater* floater = dynamic_cast<LLIMFloater*>(*iter); if (floater && floater->isDocked()) { floater->setVisible(false); } } } bool exist = findInstance(session_id); LLIMFloater* floater = getInstance(session_id); if (!floater) return NULL; if(isChatMultiTab()) { LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); // do not add existed floaters to avoid adding torn off instances if (!exist) { // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END; if (floater_container) { floater_container->addFloater(floater, TRUE, i_pt); } } floater->openFloater(floater->getKey()); } else { // Docking may move chat window, hide it before moving, or user will see how window "jumps" floater->setVisible(false); if (floater->getDockControl() == NULL) { LLChiclet* chiclet = LLChicletBar::getInstance()->getChicletPanel()->findChiclet<LLChiclet>( session_id); if (chiclet == NULL) { llerror("Dock chiclet for LLIMFloater doesn't exists", 0); } else { LLChicletBar::getInstance()->getChicletPanel()->scrollToChiclet(chiclet); } floater->setDockControl(new LLDockControl(chiclet, floater, floater->getDockTongue(), LLDockControl::BOTTOM)); } // window is positioned, now we can show it. } floater->setVisible(TRUE); return floater; }
LLFloaterIMPanel::LLFloaterIMPanel(const std::string& session_label, const LLUUID& session_id, const LLUUID& other_participant_id, const std::vector<LLUUID>& ids, EInstantMessage dialog) : LLFloater(session_id), mInputEditor(NULL), mHistoryEditor(NULL), mSessionUUID(session_id), mSessionLabel(session_label), mSessionInitialized(FALSE), mSessionStartMsgPos(0), mOtherParticipantUUID(other_participant_id), mDialog(dialog), mSessionInitialTargetIDs(ids), mTyping(FALSE), mOtherTyping(FALSE), mTypingLineStartIndex(0), mSentTypingState(TRUE), mNumUnreadMessages(0), mShowSpeakersOnConnect(TRUE), mTextIMPossible(TRUE), mProfileButtonEnabled(TRUE), mCallBackEnabled(TRUE), mSpeakerPanel(NULL), mFirstKeystrokeTimer(), mLastKeystrokeTimer() { std::string xml_filename; switch(mDialog) { case IM_SESSION_GROUP_START: mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this); xml_filename = "floater_instant_message_group.xml"; break; case IM_SESSION_INVITE: mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this); if (gAgent.isInGroup(mSessionUUID)) { xml_filename = "floater_instant_message_group.xml"; } else // must be invite to ad hoc IM { xml_filename = "floater_instant_message_ad_hoc.xml"; } break; case IM_SESSION_P2P_INVITE: xml_filename = "floater_instant_message.xml"; break; case IM_SESSION_CONFERENCE_START: mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this); xml_filename = "floater_instant_message_ad_hoc.xml"; break; // just received text from another user case IM_NOTHING_SPECIAL: xml_filename = "floater_instant_message.xml"; mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionUUID); mProfileButtonEnabled = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionUUID); mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionUUID); break; default: llwarns << "Unknown session type" << llendl; xml_filename = "floater_instant_message.xml"; break; } LLUICtrlFactory::getInstance()->buildFloater(this, xml_filename, NULL); setTitle(mSessionLabel); mInputEditor->setMaxTextLength(1023); // enable line history support for instant message bar mInputEditor->setEnableLineHistory(TRUE); //*TODO we probably need the same "awaiting message" thing in LLIMFloater LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionUUID); if (!im_session) { llerror("im session with id " + mSessionUUID.asString() + " does not exist!", 0); return; } mSessionInitialized = im_session->mSessionInitialized; if (!mSessionInitialized) { //locally echo a little "starting session" message LLUIString session_start = sSessionStartString; session_start.setArg("[NAME]", getTitle()); mSessionStartMsgPos = mHistoryEditor->getWText().length(); addHistoryLine( session_start, LLUIColorTable::instance().getColor("SystemChatColor"), false); } }