int prFileOpen(struct VMGlobals *g, int numArgsPushed) { PyrSlot *a, *b, *c; char filename[PATH_MAX]; char mode[12]; PyrFile *pfile; FILE *file; a = g->sp - 2; b = g->sp - 1; c = g->sp; if (NotObj(c) || !isKindOf(slotRawObject(c), class_string) || NotObj(b) || !isKindOf(slotRawObject(b), class_string)) return errWrongType; if (slotRawObject(b)->size > PATH_MAX - 1) return errFailed; if (slotRawObject(c)->size > 11) return errFailed; pfile = (PyrFile*)slotRawObject(a); memcpy(filename, slotRawString(b)->s, slotRawObject(b)->size); filename[slotRawString(b)->size] = 0; memcpy(mode, slotRawString(c)->s, slotRawObject(c)->size); mode[slotRawString(c)->size] = 0; #ifdef SC_WIN32 win32_ReplaceCharInString(filename,PATH_MAX,'/','\\'); if(strcmp(mode,"w") == 0) strcpy(mode,"wb"); if(strcmp(mode,"r") == 0) strcpy(mode,"rb"); #endif //SC_WIN32 file = fopen(filename, mode); if (file) { SetPtr(&pfile->fileptr, file); SetTrue(a); } else { #ifdef SC_WIN32 // check if directory exisits // create a temporary file (somewhere) for a handle // the file is deleted automatically when closed if (sc_DirectoryExists(filename)) { int err; #ifdef _MSC_VER err = tmpfile_s(&file); if (!err) { SetPtr(&pfile->fileptr, file); SetTrue(a); return errNone; } #elif defined(__MINGW32__) file = tmpfile(); if (file) { SetPtr(&pfile->fileptr, file); SetTrue(a); return errNone; } #else #error compiler unsupported #endif } #endif SetNil(a); SetFalse(a); } return errNone; }
int prFileWrite(struct VMGlobals *g, int numArgsPushed) { PyrSlot *a, *b, *ptr; PyrFile *pfile; FILE *file; PyrObject *obj; char chr; a = g->sp - 1; b = g->sp; pfile = (PyrFile*)slotRawObject(a); file = (FILE*)slotRawPtr(&pfile->fileptr); if (file == NULL) return errFailed; switch (GetTag(b)) { case tagInt : { SC_IOStream<FILE*> scio(file); scio.writeInt32_be(slotRawInt(b)); break; } case tagSym : fwrite(slotRawSymbol(b)->name, sizeof(char), slotRawSymbol(b)->length, file); break; case tagChar : chr = slotRawChar(b); fwrite(&chr, sizeof(char), 1, file); break; case tagNil : case tagFalse : case tagTrue : case tagPtr : return errWrongType; case tagObj : { // writes the indexable part of any non obj_slot format object obj = slotRawObject(b); if (!isKindOf(obj, class_rawarray) || isKindOf(obj, class_symbolarray)) return errWrongType; if (obj->size) { ptr = obj->slots; int elemSize = gFormatElemSize[obj->obj_format]; int numElems = obj->size; #if BYTE_ORDER != BIG_ENDIAN switch (elemSize) { case 1: fwrite(ptr, elemSize, numElems, file); break; case 2: { char *ptr = slotRawString(b)->s; char *ptrend = ptr + numElems*2; for (; ptr < ptrend; ptr+=2) { fputc(ptr[1], file); fputc(ptr[0], file); } break; } case 4: { char *ptr = slotRawString(b)->s; char *ptrend = ptr + numElems*4; for (; ptr < ptrend; ptr+=4) { fputc(ptr[3], file); fputc(ptr[2], file); fputc(ptr[1], file); fputc(ptr[0], file); } break; } case 8: { char *ptr = slotRawString(b)->s; char *ptrend = ptr + numElems*8; for (; ptr < ptrend; ptr+=8) { fputc(ptr[7], file); fputc(ptr[6], file); fputc(ptr[5], file); fputc(ptr[4], file); fputc(ptr[3], file); fputc(ptr[2], file); fputc(ptr[1], file); fputc(ptr[0], file); } break; } } #else fwrite(ptr, elemSize, numElems, file); #endif } break; } default : // double { SC_IOStream<FILE*> scio(file); scio.writeDouble_be(slotRawFloat(b)); break; } } return errNone; }
void ccHObject::draw(CC_DRAW_CONTEXT& context) { if (!isEnabled()) return; bool draw3D = MACRO_Draw3D(context); bool drawInThisContext = (!m_visible && !m_selected ? false : m_currentDisplay == context._win); //no need to display anything but clouds and meshes in "point picking mode" bool DrawMesh = false; if (MACRO_DrawTriangleNames(context) && isKindOf(CC_MESH)) { ccGenericMesh *mesh = static_cast<ccGenericMesh*>(this); ccGenericPointCloud *cloud = mesh->getAssociatedCloud(); DrawMesh = (cloud == NULL || !cloud->isEnabled()); } drawInThisContext &= ( (!MACRO_DrawPointNames(context) || isKindOf(CC_POINT_CLOUD)) || (!MACRO_DrawTriangleNames(context) || DrawMesh) ); //apply 3D 'temporary' transformation (for display only) if (draw3D && m_glTransEnabled) { glMatrixMode(GL_MODELVIEW); glPushMatrix(); glMultMatrixf(m_glTrans.data()); } //draw entity if (m_visible && drawInThisContext) { if ((!m_selected || !MACRO_SkipSelected(context)) && (m_selected || !MACRO_SkipUnselected(context))) { glColor3ubv(context.pointsDefaultCol); drawMeOnly(context); //draw name in 3D (we display it in the 2D foreground layer in fact!) if (m_showNameIn3D && MACRO_Draw2D(context) && MACRO_Foreground(context) && !MACRO_DrawNames(context)) drawNameIn3D(context); } } //draw entity's children for (Container::iterator it = m_children.begin(); it!=m_children.end(); ++it) (*it)->draw(context); //if the entity is currently selected if (m_selected && draw3D && drawInThisContext) { switch (m_selectionBehavior) { case SELECTION_AA_BBOX: drawBB(context.bbDefaultCol); break; case SELECTION_FIT_BBOX: { ccGLMatrix trans; ccBBox box = getFitBB(trans); if (box.isValid()) { glMatrixMode(GL_MODELVIEW); glPushMatrix(); glMultMatrixf(trans.data()); box.draw(context.bbDefaultCol); glPopMatrix(); } } break; case SELECTION_IGNORED: break; default: assert(false); } } if (draw3D && m_glTransEnabled) glPopMatrix(); }
static int addMsgSlotWithTags(big_scpacket *packet, PyrSlot *slot) { switch (GetTag(slot)) { case tagInt : packet->addtag('i'); packet->addi(slotRawInt(slot)); break; case tagSym : packet->addtag('s'); packet->adds(slotRawSymbol(slot)->name); break; case tagObj : if (isKindOf(slotRawObject(slot), class_string)) { PyrString *stringObj = slotRawString(slot); packet->addtag('s'); packet->adds(stringObj->s, stringObj->size); } else if (isKindOf(slotRawObject(slot), class_int8array)) { PyrInt8Array *arrayObj = slotRawInt8Array(slot); packet->addtag('b'); packet->addb(arrayObj->b, arrayObj->size); } else if (isKindOf(slotRawObject(slot), class_array)) { PyrObject *arrayObj = slotRawObject(slot); if (arrayObj->size) { packet->addtag('b'); big_scpacket packet2; if (arrayObj->size > 1 && isKindOfSlot(arrayObj->slots+1, class_array)) { makeSynthBundle(&packet2, arrayObj->slots, arrayObj->size, true); } else { int error = makeSynthMsgWithTags(&packet2, arrayObj->slots, arrayObj->size); if (error != errNone) return error; } packet->addb((uint8*)packet2.data(), packet2.size()); } else { packet->addtag('i'); packet->addi(0); } } break; case tagTrue : packet->addtag('i'); packet->addi(1); break; case tagChar : packet->addtag(slotRawChar(slot)); break; case tagFalse : case tagNil : case tagPtr : packet->addtag('i'); packet->addi(0); break; default : if (gUseDoubles) { packet->addtag('d'); packet->addd(slotRawFloat(slot)); } else { packet->addtag('f'); packet->addf(slotRawFloat(slot)); } break; } return errNone; }
//================================================draw====================================================// void ccHObject::draw(CC_DRAW_CONTEXT& context) { if (!isEnabled())return; //是否开启 //are we currently drawing objects in 2D or 3D? bool draw3D = MACRO_Draw3D(context); //判断是在三维上绘制还是在二维上绘制? //the entity must be either visible and selected, and of course it should be displayed in this context //是否可视,是否被选择,是否在当前窗口下显示 bool drawInThisContext = ((m_visible || m_selected) && m_currentDisplay == context._win); //no need to display anything but clouds and meshes in "element picking mode" drawInThisContext &= ( ( !MACRO_DrawPointNames(context) || isKindOf(CC_TYPES::POINT_CLOUD) ) || ( !MACRO_DrawTriangleNames(context) || isKindOf(CC_TYPES::MESH) )); if (draw3D){ //apply 3D 'temporary' transformation (for display only) if (m_glTransEnabled){ //可以进行变换 glMatrixMode(GL_MODELVIEW); glPushMatrix(); glMultMatrixf(m_glTrans.data()); } if ( context.decimateCloudOnMove //LOD for clouds is enabled? && context.currentLODLevel >= context.minLODLevel //and we are currently rendering higher levels? ){ //only for real clouds drawInThisContext &= isA(CC_TYPES::POINT_CLOUD); //LOD只对点云有效?????????? } } //draw entity if (m_visible && drawInThisContext){ if (( !m_selected || !MACRO_SkipSelected(context) ) && ( m_selected || !MACRO_SkipUnselected(context) )) { //apply default color (in case of) ccGL::Color3v(context.pointsDefaultCol.rgb); //不同的物体绘制方式不同 drawMeOnly(context); //draw name in 3D (we display it in the 2D foreground layer in fact!) if (m_showNameIn3D && MACRO_Draw2D(context) && MACRO_Foreground(context) && !MACRO_DrawNames(context)) drawNameIn3D(context); } } //draw entity's children //绘制物体的子物体 for (Container::iterator it = m_children.begin(); it != m_children.end(); ++it) (*it)->draw(context); //绘制BB //if the entity is currently selected, we draw its bounding-box if (m_selected && draw3D && drawInThisContext && !MACRO_DrawNames(context) && context.currentLODLevel == 0){ drawBB(context.bbDefaultCol); } if (draw3D && m_glTransEnabled) glPopMatrix(); }
_Unwind_Reason_Code PERSONALITY_FUNCTION (int version, _Unwind_Action actions, _Unwind_Exception_Class exception_class, struct _Unwind_Exception *ue_header, struct _Unwind_Context *context) #endif { struct ObjcException *xh = (struct ObjcException *) ue_header; struct lsda_header_info info; const unsigned char *language_specific_data; const unsigned char *action_record; const unsigned char *p; _Unwind_Ptr landing_pad, ip; int handler_switch_value; int saw_cleanup = 0, saw_handler, foreign_exception; void *return_object; int ip_before_insn = 0; #ifdef __ARM_EABI_UNWINDER__ _Unwind_Action actions; switch (state & _US_ACTION_MASK) { case _US_VIRTUAL_UNWIND_FRAME: actions = _UA_SEARCH_PHASE; break; case _US_UNWIND_FRAME_STARTING: actions = _UA_CLEANUP_PHASE; if (!(state & _US_FORCE_UNWIND) && ue_header->barrier_cache.sp == _Unwind_GetGR (context, 13)) actions |= _UA_HANDLER_FRAME; break; case _US_UNWIND_FRAME_RESUME: CONTINUE_UNWINDING; break; default: abort(); } actions |= state & _US_FORCE_UNWIND; /* TODO: Foreign exceptions need some attention (e.g. rethrowing doesn't work). */ foreign_exception = 0; /* The dwarf unwinder assumes the context structure holds things like the function and LSDA pointers. The ARM implementation caches these in the exception header (UCB). To avoid rewriting everything we make the virtual IP register point at the UCB. */ ip = (_Unwind_Ptr) ue_header; _Unwind_SetGR (context, 12, ip); #else /* !__ARM_EABI_UNWINDER. */ /* Interface version check. */ if (version != 1) return _URC_FATAL_PHASE1_ERROR; foreign_exception = (exception_class != __objc_exception_class); #endif /* Shortcut for phase 2 found handler for domestic exception. */ if (actions == (_UA_CLEANUP_PHASE | _UA_HANDLER_FRAME) && !foreign_exception) { #ifdef __ARM_EABI_UNWINDER__ handler_switch_value = (int) ue_header->barrier_cache.bitpattern[1]; landing_pad = (_Unwind_Ptr) ue_header->barrier_cache.bitpattern[3]; #else handler_switch_value = xh->handlerSwitchValue; landing_pad = xh->landingPad; #endif goto install_context; } language_specific_data = (const unsigned char *) _Unwind_GetLanguageSpecificData (context); /* If no LSDA, then there are no handlers or cleanups. */ if (! language_specific_data) CONTINUE_UNWINDING; /* Parse the LSDA header. */ p = parse_lsda_header (context, language_specific_data, &info); info.ttype_base = base_of_encoded_value (info.ttype_encoding, context); #ifdef HAVE_GETIPINFO ip = _Unwind_GetIPInfo (context, &ip_before_insn); #else ip = _Unwind_GetIP (context); #endif if (!ip_before_insn) --ip; landing_pad = 0; action_record = 0; handler_switch_value = 0; #ifdef SJLJ_EXCEPTIONS /* The given "IP" is an index into the call-site table, with two exceptions -- -1 means no-action, and 0 means terminate. But since we're using uleb128 values, we've not got random access to the array. */ if ((int) ip < 0) return _URC_CONTINUE_UNWIND; else { _uleb128_t cs_lp, cs_action; do { p = read_uleb128 (p, &cs_lp); p = read_uleb128 (p, &cs_action); } while (--ip); /* Can never have null landing pad for sjlj -- that would have been indicated by a -1 call site index. */ landing_pad = cs_lp + 1; if (cs_action) action_record = info.action_table + cs_action - 1; goto found_something; } #else /* Search the call-site table for the action associated with this IP. */ while (p < info.action_table) { _Unwind_Ptr cs_start, cs_len, cs_lp; _uleb128_t cs_action; /* Note that all call-site encodings are "absolute" displacements. */ p = read_encoded_value (0, info.call_site_encoding, p, &cs_start); p = read_encoded_value (0, info.call_site_encoding, p, &cs_len); p = read_encoded_value (0, info.call_site_encoding, p, &cs_lp); p = read_uleb128 (p, &cs_action); /* The table is sorted, so if we've passed the ip, stop. */ if (ip < info.Start + cs_start) p = info.action_table; else if (ip < info.Start + cs_start + cs_len) { if (cs_lp) landing_pad = info.LPStart + cs_lp; if (cs_action) action_record = info.action_table + cs_action - 1; goto found_something; } } #endif /* SJLJ_EXCEPTIONS */ /* If ip is not present in the table, C++ would call terminate. */ /* ??? As with Java, it's perhaps better to tweek the LSDA to that no-action is mapped to no-entry. */ CONTINUE_UNWINDING; found_something: saw_cleanup = 0; saw_handler = 0; if (landing_pad == 0) { /* If ip is present, and has a null landing pad, there are no cleanups or handlers to be run. */ } else if (action_record == 0) { /* If ip is present, has a non-null landing pad, and a null action table offset, then there are only cleanups present. Cleanups use a zero switch value, as set above. */ saw_cleanup = 1; } else { /* Otherwise we have a catch handler. */ _sleb128_t ar_filter, ar_disp; while (1) { p = action_record; p = read_sleb128 (p, &ar_filter); read_sleb128 (p, &ar_disp); if (ar_filter == 0) { /* Zero filter values are cleanups. */ saw_cleanup = 1; } /* During forced unwinding, we only run cleanups. With a foreign exception class, we have no class info to match. */ else if ((actions & _UA_FORCE_UNWIND) || foreign_exception) ; else if (ar_filter > 0) { /* Positive filter values are handlers. */ Class catch_type = get_ttype_entry (&info, ar_filter); if (isKindOf (xh->value, catch_type)) { handler_switch_value = ar_filter; saw_handler = 1; break; } } else { /* Negative filter values are exception specifications, which Objective-C does not use. */ abort (); } if (ar_disp == 0) break; action_record = p + ar_disp; } } if (! saw_handler && ! saw_cleanup) CONTINUE_UNWINDING; if (actions & _UA_SEARCH_PHASE) { if (!saw_handler) CONTINUE_UNWINDING; /* For domestic exceptions, we cache data from phase 1 for phase 2. */ if (!foreign_exception) { #ifdef __ARM_EABI_UNWINDER__ ue_header->barrier_cache.sp = _Unwind_GetGR (context, 13); ue_header->barrier_cache.bitpattern[1] = (_uw) handler_switch_value; ue_header->barrier_cache.bitpattern[3] = (_uw) landing_pad; #else xh->handlerSwitchValue = handler_switch_value; xh->landingPad = landing_pad; #endif } return _URC_HANDLER_FOUND; } install_context: if (saw_cleanup == 0) { return_object = xh->value; if (!(actions & _UA_SEARCH_PHASE)) _Unwind_DeleteException(&xh->base); } _Unwind_SetGR (context, __builtin_eh_return_data_regno (0), __builtin_extend_pointer (saw_cleanup ? xh : return_object)); _Unwind_SetGR (context, __builtin_eh_return_data_regno (1), handler_switch_value); _Unwind_SetIP (context, landing_pad); return _URC_INSTALL_CONTEXT; }
void ccHObject::draw(CC_DRAW_CONTEXT& context) { if (!isEnabled()) return; //are we currently drawing objects in 2D or 3D? bool draw3D = MACRO_Draw3D(context); //the entity must be either visible and selected, and of course it should be displayed in this context bool drawInThisContext = ((m_visible || m_selected) && m_currentDisplay == context._win); //no need to display anything but clouds and meshes in "element picking mode" drawInThisContext &= (( !MACRO_DrawPointNames(context) || isKindOf(CC_POINT_CLOUD) ) || ( !MACRO_DrawTriangleNames(context) || isKindOf(CC_MESH) )); //apply 3D 'temporary' transformation (for display only) if (draw3D && m_glTransEnabled) { glMatrixMode(GL_MODELVIEW); glPushMatrix(); glMultMatrixf(m_glTrans.data()); } //draw entity if (m_visible && drawInThisContext) { if (( !m_selected || !MACRO_SkipSelected(context) ) && ( m_selected || !MACRO_SkipUnselected(context) )) { //apply default color (in case of) glColor3ubv(context.pointsDefaultCol); drawMeOnly(context); //draw name in 3D (we display it in the 2D foreground layer in fact!) if (m_showNameIn3D && MACRO_Draw2D(context) && MACRO_Foreground(context) && !MACRO_DrawNames(context)) drawNameIn3D(context); } } //draw entity's children for (Container::iterator it = m_children.begin(); it!=m_children.end(); ++it) (*it)->draw(context); //if the entity is currently selected, we draw its bounding-box if (m_selected && draw3D && drawInThisContext && !MACRO_DrawNames(context)) { switch (m_selectionBehavior) { case SELECTION_AA_BBOX: drawBB(context.bbDefaultCol); break; case SELECTION_FIT_BBOX: { ccGLMatrix trans; ccBBox box = getFitBB(trans); if (box.isValid()) { glMatrixMode(GL_MODELVIEW); glPushMatrix(); glMultMatrixf(trans.data()); box.draw(context.bbDefaultCol); glPopMatrix(); } } break; case SELECTION_IGNORED: break; default: assert(false); } } if (draw3D && m_glTransEnabled) glPopMatrix(); }
_Unwind_Reason_Code PERSONALITY_FUNCTION (int version, _Unwind_Action actions, _Unwind_Exception_Class exception_class, struct _Unwind_Exception *ue_header, struct _Unwind_Context *context) { struct ObjcException *xh = (struct ObjcException *) ue_header; struct lsda_header_info info; const unsigned char *language_specific_data; const unsigned char *action_record; const unsigned char *p; _Unwind_Ptr landing_pad, ip; int handler_switch_value; int saw_cleanup = 0, saw_handler; void *return_object; /* Interface version check. */ if (version != 1) return _URC_FATAL_PHASE1_ERROR; /* Shortcut for phase 2 found handler for domestic exception. */ if (actions == (_UA_CLEANUP_PHASE | _UA_HANDLER_FRAME) && exception_class == __objc_exception_class) { handler_switch_value = xh->handlerSwitchValue; landing_pad = xh->landingPad; goto install_context; } language_specific_data = (const unsigned char *) _Unwind_GetLanguageSpecificData (context); /* If no LSDA, then there are no handlers or cleanups. */ if (! language_specific_data) return _URC_CONTINUE_UNWIND; /* Parse the LSDA header. */ p = parse_lsda_header (context, language_specific_data, &info); info.ttype_base = base_of_encoded_value (info.ttype_encoding, context); ip = _Unwind_GetIP (context) - 1; landing_pad = 0; action_record = 0; handler_switch_value = 0; #ifdef SJLJ_EXCEPTIONS /* The given "IP" is an index into the call-site table, with two exceptions -- -1 means no-action, and 0 means terminate. But since we're using uleb128 values, we've not got random access to the array. */ if ((int) ip < 0) return _URC_CONTINUE_UNWIND; else { _uleb128_t cs_lp, cs_action; do { p = read_uleb128 (p, &cs_lp); p = read_uleb128 (p, &cs_action); } while (--ip); /* Can never have null landing pad for sjlj -- that would have been indicated by a -1 call site index. */ landing_pad = cs_lp + 1; if (cs_action) action_record = info.action_table + cs_action - 1; goto found_something; } #else /* Search the call-site table for the action associated with this IP. */ while (p < info.action_table) { _Unwind_Ptr cs_start, cs_len, cs_lp; _uleb128_t cs_action; /* Note that all call-site encodings are "absolute" displacements. */ p = read_encoded_value (0, info.call_site_encoding, p, &cs_start); p = read_encoded_value (0, info.call_site_encoding, p, &cs_len); p = read_encoded_value (0, info.call_site_encoding, p, &cs_lp); p = read_uleb128 (p, &cs_action); /* The table is sorted, so if we've passed the ip, stop. */ if (ip < info.Start + cs_start) p = info.action_table; else if (ip < info.Start + cs_start + cs_len) { if (cs_lp) landing_pad = info.LPStart + cs_lp; if (cs_action) action_record = info.action_table + cs_action - 1; goto found_something; } } #endif /* SJLJ_EXCEPTIONS */ /* If ip is not present in the table, C++ would call terminate. */ /* ??? As with Java, it's perhaps better to tweek the LSDA to that no-action is mapped to no-entry. */ return _URC_CONTINUE_UNWIND; found_something: saw_cleanup = 0; saw_handler = 0; if (landing_pad == 0) { /* If ip is present, and has a null landing pad, there are no cleanups or handlers to be run. */ } else if (action_record == 0) { /* If ip is present, has a non-null landing pad, and a null action table offset, then there are only cleanups present. Cleanups use a zero switch value, as set above. */ saw_cleanup = 1; } else { /* Otherwise we have a catch handler. */ _sleb128_t ar_filter, ar_disp; while (1) { p = action_record; p = read_sleb128 (p, &ar_filter); read_sleb128 (p, &ar_disp); if (ar_filter == 0) { /* Zero filter values are cleanups. */ saw_cleanup = 1; } /* During forced unwinding, we only run cleanups. With a foreign exception class, we have no class info to match. */ else if ((actions & _UA_FORCE_UNWIND) || exception_class != __objc_exception_class) ; else if (ar_filter > 0) { /* Positive filter values are handlers. */ Class catch_type = get_ttype_entry (&info, ar_filter); if (isKindOf (xh->value, catch_type)) { handler_switch_value = ar_filter; saw_handler = 1; break; } } else { /* Negative filter values are exception specifications, which Objective-C does not use. */ abort (); } if (ar_disp == 0) break; action_record = p + ar_disp; } } if (! saw_handler && ! saw_cleanup) return _URC_CONTINUE_UNWIND; if (actions & _UA_SEARCH_PHASE) { if (!saw_handler) return _URC_CONTINUE_UNWIND; /* For domestic exceptions, we cache data from phase 1 for phase 2. */ if (exception_class == __objc_exception_class) { xh->handlerSwitchValue = handler_switch_value; xh->landingPad = landing_pad; } return _URC_HANDLER_FOUND; } install_context: if (saw_cleanup == 0) { return_object = xh->value; if (!(actions & _UA_SEARCH_PHASE)) _Unwind_DeleteException(&xh->base); } _Unwind_SetGR (context, __builtin_eh_return_data_regno (0), __builtin_extend_pointer (saw_cleanup ? xh : return_object)); _Unwind_SetGR (context, __builtin_eh_return_data_regno (1), handler_switch_value); _Unwind_SetIP (context, landing_pad); return _URC_INSTALL_CONTEXT; }
void ccHObject::draw(CC_DRAW_CONTEXT& context) { if (!isEnabled()) return; bool draw3D = MACRO_Draw3D(context); bool drawInThisContext = (!visible && !selected ? false : currentDisplay == context._win); //no need to display anything but clouds in "point picking mode" drawInThisContext &= (!MACRO_DrawPointNames(context) || isKindOf(CC_POINT_CLOUD)); //apply 3D 'temporary' transformation (for display only) if (draw3D && glTransEnabled) { glMatrixMode(GL_MODELVIEW); glPushMatrix(); glMultMatrixf(glTrans.data()); } //draw entity if (visible && drawInThisContext) { if ((!selected || !MACRO_SkipSelected(context)) && (selected || !MACRO_SkipUnselected(context))) { glColor3ubv(context.pointsDefaultCol); drawMeOnly(context); } } //draw entity's children for (Container::iterator it = m_children.begin(); it!=m_children.end(); ++it) (*it)->draw(context); //if the entity is currently selected if (selected && draw3D && drawInThisContext) { switch (m_selectionBehavior) { case SELECTION_AA_BBOX: drawBB(context.bbDefaultCol); break; case SELECTION_FIT_BBOX: { ccGLMatrix trans; ccBBox box = getFitBB(trans); if (box.isValid()) { glMatrixMode(GL_MODELVIEW); glPushMatrix(); glMultMatrixf(trans.data()); box.draw(context.bbDefaultCol); glPopMatrix(); } } break; case SELECTION_IGNORED: break; default: assert(false); } } if (draw3D && glTransEnabled) glPopMatrix(); }