void GenCOptions( // PROCESS ALL OPTIONS char **argv ) // - command line vector { auto OPT_STORAGE data; char* env_var; // - environment var for compiler indirectionLevel = 0; InitModInfo(); CmdLnCtxInit(); CmdSysInit(); OPT_INIT( &data ); if( ! CompFlags.ignore_environment ) { CtxSetCurrContext( CTX_CMDLN_ENV ); env_var = CmdSysEnvVar(); CmdLnCtxPushEnv( env_var ); procOptions( &data, CppGetEnv( env_var ) ); CmdLnCtxPop(); } CtxSetCurrContext( CTX_CMDLN_PGM ); CmdLnCtxPush( CTX_CLTYPE_PGM ); while( *argv != NULL ) { procOptions( &data, *argv ); ++argv; } CmdLnCtxPop(); CmdLnCtxFini(); CtxSetCurrContext( CTX_CMDLN_VALID ); analyseAnyTargetOptions( &data ); CmdSysAnalyse( &data ); postOptions(); OPT_FINI( &data ); MiscMacroDefs(); DbgAssert( GblPackAmount == PackAmount ); DbgAssert( GblPackAmount != 0 ); }
HRESULT CMethodInfo::InitPropertyGet( ITypeInfo* pTypeInfo, const VARDESC* pVarDesc ) { HRESULT hResult; CComBSTR bstrName; UINT nNames; DbgAssert( pTypeInfo != NULL ); DbgAssert( pVarDesc != NULL ); m_pIntTypeInfo = pTypeInfo; m_dispid = pVarDesc->memid; m_invkind = INVOKE_PROPERTYGET; m_readOnly = pVarDesc->wVarFlags&VARFLAG_FREADONLY; m_isHidden = pVarDesc->wVarFlags&(VARFLAG_FHIDDEN); m_tBindable = pVarDesc->wVarFlags&VARFLAG_FBINDABLE; m_tRequestEdit = pVarDesc->wVarFlags&FUNCFLAG_FREQUESTEDIT; hResult = pTypeInfo->GetNames( m_dispid, &bstrName, 1, &nNames ); if( FAILED( hResult ) ) { return( hResult ); } DbgAssert( nNames == 1 ); m_strName = TSTR::FromBSTR(bstrName); // get the return string const TYPEDESC* tdesc = &(pVarDesc->elemdescVar.tdesc); while (tdesc->vt == VT_PTR) tdesc = tdesc->lptdesc; GetTypeString(tdesc, m_strReturn, true, &m_spTypeInfo); return( S_OK ); }
void TileCallback::post_render_tile( const asr::Frame* frame, const size_t tile_x, const size_t tile_y) { const asf::Image& image = frame->image(); const asf::CanvasProperties& props = image.properties(); DbgAssert(props.m_canvas_width == m_bitmap->Width()); DbgAssert(props.m_canvas_height == m_bitmap->Height()); DbgAssert(props.m_channel_count == 4); // Blit the tile to the destination bitmap. blit_tile(*frame, tile_x, tile_y); // Partially refresh the display window. const asf::Tile& tile = image.tile(tile_x, tile_y); const size_t x = tile_x * props.m_tile_width; const size_t y = tile_y * props.m_tile_height; RECT rect = make_rect(x, y, tile.get_width(), tile.get_height()); m_bitmap->RefreshWindow(&rect); // Keep track of the number of rendered tiles. asf::atomic_inc(m_rendered_tile_count); }
bool ParticleChannelMap::Append(IObject* channel) { IParticleChannelMapW* iMap = GetParticleChannelMapWInterface(channel); DbgAssert(iMap); if (iMap == NULL) return false; IObject* iUVVert = iMap->GetUVVertChannel(); IObject* iTVFace = iMap->GetTVFaceChannel(); bool res1=true, res2=true; if (iUVVert != NULL) { if (chanUVVert() == NULL) _chanUVVert() = new ParticleChannelTabUVVert(); DbgAssert(chanUVVert()); if (chanUVVert() == NULL) return false; res1 = _chanUVVert()->Append(iUVVert); } if (iTVFace != NULL) { if (chanTVFace() == NULL) _chanTVFace() = new ParticleChannelTabTVFace(); DbgAssert(chanTVFace()); if (chanTVFace() == NULL) return false; res2 = _chanTVFace()->Append(iTVFace); } return (res1 && res2); }
void SplineData::PasteToSelected(int splineIndex, int crossSectionIndex) { if ((splineIndex < 0) || (splineIndex >= mSplineElementData.Count())) { DbgAssert(0); return; } int numCross = NumberOfCrossSections(splineIndex); if ((crossSectionIndex < 0) || (crossSectionIndex > numCross)) { DbgAssert(0); return; } SplineCrossSection section = mSplineElementData[splineIndex]->GetCrossSection(crossSectionIndex); for (int i = 0; i < NumberOfSplines(); i++ ) { if (IsSplineSelected(i)) { for (int j = 0; j < NumberOfCrossSections(i); j++) { if (CrossSectionIsSelected(i,j)) { SplineCrossSection *crossSection = GetCrossSection(i,j); crossSection->mScale = section.mScale; crossSection->mQuat = section.mQuat; } } } } RecomputeCrossSections(); }
void SMBrushSculpt::StartStroke(int mode,BOOL cont, int subobj, const SMHit &hit) { SM_ASSERT(m_stroking==FALSE); SM_ASSERT(subobj==SM_SO_VERTEX || subobj==SM_SO_EDGE || subobj==SM_SO_FACE); // undo/redo // create restore object DbgAssert(!m_actrestore); m_actrestore = new MeshVertRestore(m_SM->m_polyobj); // and make it active DbgAssert(!theHold.Holding()); if (0 && theHold.Holding()) { theHold.Cancel(); } theHold.Begin(); if (theHold.Holding()){ theHold.Put (m_actrestore); } // start the stroke m_stroking = TRUE; m_subobj = subobj; }
WResFileOffset res_seek( WResFileID fid, WResFileOffset amount, int where ) { if( fid == hInstance.fid ) { if( where == SEEK_SET ) { return( lseek( WRES_FID2PH( fid ), amount + WResFileShift, where ) - WResFileShift ); } else { return( lseek( WRES_FID2PH( fid ), amount, where ) ); } } DbgAssert( where != SEEK_END ); DbgAssert( !(where == SEEK_CUR && amount < 0) ); if( WRES_FID2PH( fid ) == Root->outfile->handle ) { if( where == SEEK_CUR ) { unsigned long old_pos; unsigned long new_pos; old_pos = PosLoad(); new_pos = old_pos + amount; if( new_pos > old_pos ) { PadLoad( (size_t)amount ); } else { SeekLoad( new_pos ); } return( new_pos ); } else { SeekLoad( amount ); return( amount ); } } else { return( QLSeek( WRES_FID2PH( fid ), amount, where, "resource file" ) ); } }
void SlaveControl::SetReference(int i, RefTargetHandle rtarg) { DbgAssert( i >= 0); DbgAssert( i < NumRefs()); if (i==0) sub = (Control*) rtarg; else if (i==1) { if ((rtarg == NULL) && (master)) { //tell the master that I am being removed int ct = blockID.Count(); for (int i = 0; i < ct; i++) RemoveControl(0); } master = (MasterBlockControl*) rtarg; if (master == NULL) masterPresent = FALSE; else masterPresent = TRUE; } else DebugPrint(_T("set reference error occurred\n")); }
void mrShaderButtonHandler::OnCommand() { DbgAssert(m_dialogHWnd != NULL); // Add the filter IMtlBrowserFilter_Manager* filterManager = Get_IMtlBrowserFilter_Manager(); if(filterManager != NULL) { filterManager->AddFilter(m_shaderFilter); } // Browse for a texmap BOOL newMat; BOOL cancel; MtlBase* mtlBase = GetCOREInterface()->DoMaterialBrowseDlg(m_dialogHWnd, (BROWSE_MAPSONLY | BROWSE_INCNONE), newMat, cancel); if(!cancel) { DbgAssert((mtlBase == NULL) || ((mtlBase->SuperClassID() == TEXMAP_CLASS_ID))); Texmap* texmap = static_cast<Texmap*>(mtlBase); SetShader(texmap); Update(); } if(filterManager != NULL) { filterManager->RemoveFilter(m_shaderFilter); } }
void mrTwoSidedShader::TranslateParameters(imrTranslation& translationInterface, imrShader* shader, TimeValue t, Interval& valid) { // The "map" parameters are translated using the shader connections. // The color parameters have already been translated by the automatic system if((shader != NULL) && (m_mainPB != NULL)) { BOOL frontMapOn; BOOL backMapOn; Texmap* frontMap; Texmap* backMap; AColor frontColor; AColor backColor; // Get the map values m_mainPB->GetValue(kMainPID_FrontColor, t, frontColor, valid); m_mainPB->GetValue(kMainPID_BackColor, t, backColor, valid); m_mainPB->GetValue(kMainPID_FrontMapOn, t, frontMapOn, valid); m_mainPB->GetValue(kMainPID_BackMapOn, t, backMapOn, valid); m_mainPB->GetValue(kMainPID_FrontMap, t, frontMap, valid); m_mainPB->GetValue(kMainPID_BackMap, t, backMap, valid); // Get the parameter blocks used to store the parameters IParamBlock2* parametersPB = shader->GetParametersParamBlock(); IParamBlock2* connectionsPB = shader->GetConnectionsParamBlock(); if((parametersPB != NULL) && (connectionsPB != NULL)) { ParamID paramID; // Translate the colors if(GetParamIDByName(paramID, _T("front"), parametersPB)) { parametersPB->SetValue(paramID, 0, frontColor); // Value must be set at time 0, this is a restriction of the system. } if(GetParamIDByName(paramID, _T("back"), parametersPB)) { parametersPB->SetValue(paramID, 0, backColor); // Value must be set at time 0, this is a restriction of the system. } // Set the shader connections. The shaders must be set before the "shader ON" flags // since setting a shader automatically turns the "ON" flag ON. if(GetParamIDByName(paramID, _T("front.shader"), connectionsPB)) { connectionsPB->SetValue(paramID, 0, frontMap); // Value must be set at time 0, this is a restriction of the system. } if(GetParamIDByName(paramID, _T("back.shader"), connectionsPB)) { connectionsPB->SetValue(paramID, 0, backMap); // Value must be set at time 0, this is a restriction of the system. } if(GetParamIDByName(paramID, _T("front.connected"), connectionsPB)) { connectionsPB->SetValue(paramID, 0, frontMapOn); // Value must be set at time 0, this is a restriction of the system. } if(GetParamIDByName(paramID, _T("back.connected"), connectionsPB)) { connectionsPB->SetValue(paramID, 0, backMapOn); // Value must be set at time 0, this is a restriction of the system. } } else { DbgAssert(false); } } else { DbgAssert(false); } }
void EditPolyData::ShrinkSelection (IMeshSelect *imod, int level) { DbgAssert (mpMesh); if( !mpMesh ) return; BitArray newSel; int mnSelLevel = meshSelLevel[level]; DbgAssert (mpMesh->GetFlag (MN_MESH_FILLED_IN)); if (!mpMesh->GetFlag (MN_MESH_FILLED_IN)) return; SynchBitArrays(); switch (mnSelLevel) { case MNM_SL_VERTEX: // Find the edges between two selected vertices. mpMesh->ClearEFlags (MN_USER); mpMesh->PropegateComponentFlags (MNM_SL_EDGE, MN_USER, mnSelLevel, MN_SEL, true); newSel = mVertSel; // De-select all the vertices touching edges to unselected vertices: for (int i=0; i<mpMesh->nume; i++) { if (!mpMesh->e[i].GetFlag (MN_USER)) { newSel.Clear (mpMesh->e[i].v1); newSel.Clear (mpMesh->e[i].v2); } } SetVertSel (newSel, imod, TimeValue(0)); break; case MNM_SL_EDGE: // Find all vertices used by only selected edges: mpMesh->ClearVFlags (MN_USER); mpMesh->PropegateComponentFlags (MNM_SL_VERTEX, MN_USER, mnSelLevel, MN_SEL, true); newSel = mEdgeSel; for (int i=0; i<mpMesh->nume; i++) { // Deselect edges with at least one vertex touching a nonselected edge: if (!mpMesh->v[mpMesh->e[i].v1].GetFlag (MN_USER) || !mpMesh->v[mpMesh->e[i].v2].GetFlag (MN_USER)) newSel.Clear (i); } SetEdgeSel (newSel, imod, TimeValue(0)); break; case MNM_SL_FACE: // Find all vertices used by only selected faces: mpMesh->ClearVFlags (MN_USER); mpMesh->PropegateComponentFlags (MNM_SL_VERTEX, MN_USER, mnSelLevel, MN_SEL, true); newSel = mFaceSel; for (int i=0; i<mpMesh->numf; i++) { for (int j=0; j<mpMesh->f[i].deg; j++) { if (!mpMesh->v[mpMesh->f[i].vtx[j]].GetFlag (MN_USER)) { // Deselect faces with at least one vertex touching a nonselected face: newSel.Clear (i); break; } } } SetFaceSel (newSel, imod, TimeValue(0)); break; } }
void EditPolyData::GrowSelection (IMeshSelect *imod, int level) { DbgAssert (mpMesh); if( !mpMesh ) return; BitArray newSel; int mnSelLevel = meshSelLevel[level]; DbgAssert (mpMesh->GetFlag (MN_MESH_FILLED_IN)); if (!mpMesh->GetFlag (MN_MESH_FILLED_IN)) return; SynchBitArrays(); int i; switch (mnSelLevel) { case MNM_SL_VERTEX: for (i=0; i<mpMesh->numv; i++) mpMesh->v[i].SetFlag (MN_USER, mVertSel[i]!=0); mpMesh->ClearEFlags (MN_USER); mpMesh->PropegateComponentFlags (MNM_SL_EDGE, MN_USER, MNM_SL_VERTEX, MN_USER); newSel.SetSize (mpMesh->numv); for (i=0; i<mpMesh->nume; i++) { if (mpMesh->e[i].GetFlag (MN_USER)) { newSel.Set (mpMesh->e[i].v1); newSel.Set (mpMesh->e[i].v2); } } SetVertSel (newSel, imod, TimeValue(0)); break; case MNM_SL_EDGE: for (i=0; i<mpMesh->nume; i++) mpMesh->e[i].SetFlag (MN_USER, mEdgeSel[i]!=0); mpMesh->ClearVFlags (MN_USER); mpMesh->PropegateComponentFlags (MNM_SL_VERTEX, MN_USER, MNM_SL_EDGE, MN_USER); newSel.SetSize (mpMesh->nume); for (i=0; i<mpMesh->nume; i++) { if (mpMesh->v[mpMesh->e[i].v1].GetFlag (MN_USER) || mpMesh->v[mpMesh->e[i].v2].GetFlag (MN_USER)) newSel.Set (i); } SetEdgeSel (newSel, imod, TimeValue(0)); break; case MNM_SL_FACE: for (i=0; i<mpMesh->numf; i++) mpMesh->f[i].SetFlag (MN_USER, mFaceSel[i]!=0); mpMesh->ClearVFlags (MN_USER); mpMesh->PropegateComponentFlags (MNM_SL_VERTEX, MN_USER, MNM_SL_FACE, MN_USER); newSel.SetSize (mpMesh->numf); for (i=0; i<mpMesh->numf; i++) { int j; for (j=0; j<mpMesh->f[i].deg; j++) { if (mpMesh->v[mpMesh->f[i].vtx[j]].GetFlag (MN_USER)) break; } if (j<mpMesh->f[i].deg) newSel.Set (i); } SetFaceSel (newSel, imod, TimeValue(0)); break; } }
RefTargetHandle BlockControl::GetReference(int i) { DbgAssert(i >= 0); DbgAssert(i < controls.Count()); if (i < controls.Count()) { // DebugPrint(_T("Getting block control ref %d\n"),i); return controls[i]; } return NULL; }
void CgFrontModInitInit( // INITIALIZE MODULE-INITIALIZATION void ) { ModuleInitInit(); codeCGFILE = NULL; emitDataCGFILE = &dataCGFILE; DbgAssert( ins_def_seg.opcode == IC_DEF_SEG ); DbgAssert( ins_init_beg.opcode == IC_INIT_BEG ); DbgAssert( ins_init_done.opcode == IC_INIT_DONE ); DbgAssert( ins_init_test.opcode == IC_INIT_TEST ); }
void AppDataTest_UpdateAppDataLoadProc(Animatable *anim, const Class_ID& cid, SClass_ID sid, ILoad* iload, Tab<DWORD> &subIDs) { DbgAssert( anim && iload ); if ( anim == NULL || iload == NULL ) return; DbgAssert (cid == APPDATA_TEST_CLASS_ID); DbgAssert (sid == UTILITY_CLASS_ID); Interface14 *iface = GetCOREInterface14(); iface->ConvertAppDataChunksContainingStringToUTF8(anim, cid, sid, subIDs, iload->CodePage()); }
int ParticleChannelMap::Count() const { int uvVertCount = chanUVVert() ? chanUVVert()->Count() : 0; int tvFaceCount = chanTVFace() ? chanTVFace()->Count() : 0; DbgAssert(uvVertCount >= 0); DbgAssert(tvFaceCount >= 0); if ((uvVertCount < 0) || (tvFaceCount < 0)) return 0; if (uvVertCount == 0) return 0; if (tvFaceCount == 0) return uvVertCount; if (uvVertCount != tvFaceCount) return 0; return uvVertCount; }
BOOL SetDlgItemHex( IN HWND hWnd, IN int ControlId, IN UINT Value ) /*++ Routine Description: Arguments: hWnd - Supplies the window (dialog box) handle that contains the control or the window handle where the font should be set. ControlId - Supplies the control id or xero if the hWnd is a window rather than a dialog handle. Return Value: BOOL - --*/ { BOOL Success; DWORD Count; if( IsDlgItemUnicode( hWnd, ControlId )) { WCHAR Buffer[ MAX_PATH ]; Count = wsprintfW( Buffer, L"0x%08.8X", Value ); DbgAssert(( Count != 0 ) && ( Count < MAX_PATH )); Success = SetDlgItemTextW( hWnd, ControlId, Buffer ); DbgAssert( Success ); } else { CHAR Buffer[ MAX_PATH ]; Count = wsprintfA( Buffer, "0x%08.8X", Value ); DbgAssert(( Count != 0 ) && ( Count < MAX_PATH )); Success = SetDlgItemTextA( hWnd, ControlId, Buffer ); DbgAssert( Success ); } return Success; }
BOOL PickControlNode::Pick(IObjParam *ip,ViewExp *vpt) { if ( ! vpt || ! vpt->IsAlive() ) { // why are we here DbgAssert(!_T("Invalid viewport!")); return FALSE; } INode *node = vpt->GetClosestHit(); if (node) { // RB 3/1/99: This should use the node tm not the object TM. See ModifyObject() imp. Matrix3 ourTM,ntm = node->GetNodeTM(GetCOREInterface()->GetTime()); //node->GetObjectTM(ip->GetTime()); ModContextList mcList; INodeTab nodes; ip->GetModContexts(mcList,nodes); if (nodes.Count()) { ourTM = nodes[0]->GetObjectTM(GetCOREInterface()->GetTime()); ourTM = Inverse(ourTM); Box3 bounds; bounds.Init(); ObjectState os = node->EvalWorldState(GetCOREInterface()->GetTime()); ViewExp& vp = GetCOREInterface()->GetActiveViewExp(); if ( ! vp.IsAlive() ) { // why are we here DbgAssert(!_T("Invalid viewport!")); return FALSE; } os.obj->GetWorldBoundBox(GetCOREInterface()->GetTime(), node, vp.ToPointer(), bounds ); Point3 min = bounds.pmin * ourTM; Point3 max = bounds.pmax * ourTM; theHold.Begin(); mod->pblock2->SetValue(particlemesher_customboundsa,0,min); mod->pblock2->SetValue(particlemesher_customboundsb,0,max); theHold.Accept(GetString(IDS_BOUNDS)); mod->NotifyDependents(FOREVER,0,REFMSG_CHANGE); mod->UpdateUI(); } nodes.DisposeTemporary(); } return TRUE; }
void mrShaderButtonHandler::Enable(bool enable) { DbgAssert(m_dialogHWnd != NULL); HWND ctrlHWnd = GetDlgItem(m_dialogHWnd, m_ctrlID); ICustButton* custButton = GetICustButton(ctrlHWnd); if(custButton != NULL) { custButton->Enable(enable); ReleaseICustButton(custButton); } else { DbgAssert(false); } }
RefTargetHandle SlaveControl::GetReference(int i) { DbgAssert( i >= 0); DbgAssert( i < NumRefs()); if (i==0) return (RefTargetHandle) sub; else if (i==1) return (RefTargetHandle) master; else { // DebugPrint(_T("get reference error occurred\n")); return NULL; } }
void BlockControl::SetReference(int i, RefTargetHandle rtarg) { DbgAssert(i >= 0); DbgAssert(i <= controls.Count()); // DebugPrint(_T("Setting block control ref %d\n"),i); if (i==controls.Count() && rtarg) { controls.Resize(controls.Count()+1); } if (i==controls.Count() && !rtarg) { return; } controls[i] = (Control*)rtarg; }
BOOL PickProtTarget::Pick (IObjParam *ip, ViewExp *vpt) { if ( ! vpt || ! vpt->IsAlive() ) { // why are we here DbgAssert(!_T("Invalid viewport!")); return FALSE; } INode *node = vpt->GetClosestHit(); assert(node); int res = TRUE; ph->ReplaceReference(which,node); ph->NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE); ph->Invalidate(); SetDlgItemText(hDlg, which ? IDC_PROT_TARGET2_NAME : IDC_PROT_TARGET1_NAME, ph->refNode[which] ? node->GetName() : _T("")); if(creating) { ph->BeginEditParams(ip, BEGIN_EDIT_CREATE, NULL); ip->SetCommandMode(cm); ip->RedrawViews(ip->GetTime()); return FALSE; } return TRUE; }
int FogObject::HitTest(TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt) { if ( ! vpt || ! vpt->IsAlive() ) { // why are we here? DbgAssert(!"Doing HitTest() on invalid view port!"); return FALSE; } HitRegion hitRegion; DWORD savedLimits; int res = FALSE; Matrix3 m; GraphicsWindow *gw = vpt->getGW(); Material *mtl = gw->getMaterial(); MakeHitRegion(hitRegion,type,crossing,4,p); gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM); GetMat(t,inode,*vpt,m); gw->setTransform(m); gw->clearHitCode(); if (mesh.select( gw, mtl, &hitRegion, flags & HIT_ABORTONHIT )) return TRUE; gw->setRndLimits(savedLimits); return res; }
int FogObject::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) { if ( ! vpt || ! vpt->IsAlive() ) { // why are we here? DbgAssert(!"Doing Display() on invalid view port!"); return FALSE; } float radius; pblock->GetValue(PB_FOG_SIZE, t, radius, FOREVER); if (radius <= 0.0) return 0; BuildMesh(t); Matrix3 m; GraphicsWindow *gw = vpt->getGW(); Material *mtl = gw->getMaterial(); DWORD rlim = gw->getRndLimits(); gw->setRndLimits(GW_WIREFRAME|GW_EDGES_ONLY|GW_BACKCULL| (rlim&GW_Z_BUFFER) ); GetMat(t,inode,*vpt,m); gw->setTransform(m); if (inode->Selected()) gw->setColor( LINE_COLOR, 1.0f, 1.0f, 1.0f); else if(!inode->IsFrozen()) gw->setColor( LINE_COLOR, 1.0f, 0.0f, 0.0f); mesh.render( gw, mtl, NULL, COMP_ALL); gw->setRndLimits(rlim); return(0); }
int ProtHelpObjCreateCallBack::proc(ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat ) { if ( ! vpt || ! vpt->IsAlive() ) { // why are we here DbgAssert(!_T("Invalid viewport!")); return FALSE; } if (msg==MOUSE_POINT||msg==MOUSE_MOVE) { switch(point) { case 0: ph->suspendSnap = TRUE; mat.SetTrans(vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE)); break; case 1: mat.SetTrans(vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE)); if (msg==MOUSE_POINT) { ph->suspendSnap = FALSE; return 0; } break; } } else if (msg == MOUSE_ABORT) { return CREATE_ABORT; } return 1; }
int XTCSample::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags, Object *pObj) { if ( ! vpt || ! vpt->IsAlive() ) { // why are we here DbgAssert(!_T("Doing Display() on invalid viewport!")); return FALSE; } if(pObj->ClassID() == XGSPHERE_CLASS_ID || pObj->IsSubClassOf(triObjectClassID)) { return DisplayMesh(t, inode, vpt, flags, GetMesh(pObj)); } #ifndef NO_PATCHES else if( pObj->IsSubClassOf(patchObjectClassID) ) { return DisplayPatch(t, inode, vpt, flags, (PatchObject *) pObj); } #endif else if(pObj->CanConvertToType(triObjectClassID)) { TriObject *pTri = (TriObject *) pObj->ConvertToType(t,triObjectClassID); DisplayMesh(t, inode, vpt, flags, &pTri->mesh); if(pTri != pObj) pTri->DeleteThis(); } return 0; }
int FExtrudeMod::HitTest( TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc) { if ( ! vpt || ! vpt->IsAlive() ) { // why are we here DbgAssert(!_T("Invalid viewport!")); return FALSE; } GraphicsWindow *gw = vpt->getGW(); Point3 pt; HitRegion hr; int savedLimits, res = 0; Matrix3 tm = CompMatrix(t,inode,mc); MakeHitRegion(hr,type, crossing,4,p); gw->setHitRegion(&hr); gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM); gw->setTransform(tm); gw->clearHitCode(); base->GetValue(t,&pt,FOREVER,CTRL_ABSOLUTE); gw->marker(&pt,HOLLOW_BOX_MRKR); if (gw->checkHitCode()) { vpt->LogHit(inode, mc, gw->getHitDistance(), 0, NULL); res = 1; } gw->setRndLimits(savedLimits); return res; }
int FExtrudeMod::Display( TimeValue t, INode* inode, ViewExp *vpt, int flagst, ModContext *mc) { if ( ! vpt || ! vpt->IsAlive() ) { // why are we here DbgAssert(!_T("Invalid viewport!")); return FALSE; } GraphicsWindow *gw = vpt->getGW(); Point3 pt; Matrix3 tm = CompMatrix(t,inode,mc); int savedLimits; gw->setRndLimits((savedLimits = gw->getRndLimits()) & ~GW_ILLUM); gw->setTransform(tm); // Draw start point if (ip && ip->GetSubObjectLevel() == 1) { //gw->setColor(LINE_COLOR, (float)1.0, (float)1.0, (float)0.0); gw->setColor(LINE_COLOR,GetUIColor(COLOR_SEL_GIZMOS)); } else { //gw->setColor(LINE_COLOR, (float).85, (float).5, (float)0.0); gw->setColor(LINE_COLOR,GetUIColor(COLOR_GIZMOS)); } base->GetValue(t,&pt,FOREVER,CTRL_ABSOLUTE); gw->marker(&pt,HOLLOW_BOX_MRKR); gw->setRndLimits(savedLimits); return 0; }
int ProtHelpObject::HitTest(TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt) { if ( ! vpt || ! vpt->IsAlive() ) { // why are we here DbgAssert(!_T("Invalid viewport!")); return FALSE; } HitRegion hitRegion; DWORD savedLimits; int res; Matrix3 m; GraphicsWindow *gw = vpt->getGW(); Material *mtl = gw->getMaterial(); MakeHitRegion(hitRegion,type,crossing,4,p); gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM); GetMat(t,inode,*vpt,m); gw->setTransform(m); // if we get a hit on the mesh, we're done gw->clearHitCode(); if (mesh.select( gw, mtl, &hitRegion, flags & HIT_ABORTONHIT )) return TRUE; // if not, check the target line, and set the pair flag if it's hit gw->clearHitCode(); res = DrawLines(t, inode, gw, 1); gw->setRndLimits(savedLimits); return res; }
int SimpleWSMObject::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) { if ( ! vpt || ! vpt->IsAlive() ) { // why are we here DbgAssert(!_T("Invalid viewport!")); return FALSE; } if (!OKtoDisplay(t)) return 0; GraphicsWindow *gw = vpt->getGW(); Matrix3 mat = inode->GetObjectTM(t); UpdateMesh(t); gw->setTransform(mat); //mesh.render(gw, inode->Mtls(), DWORD rlim = gw->getRndLimits(); gw->setRndLimits(GW_WIREFRAME|GW_EDGES_ONLY|/*GW_BACKCULL|*/(rlim&GW_Z_BUFFER?GW_Z_BUFFER:0)); if (inode->Selected()) gw->setColor( LINE_COLOR, GetSelColor()); else if(!inode->IsFrozen()) //gw->setColor( LINE_COLOR, wsmMtl.Kd[0], wsmMtl.Kd[1], wsmMtl.Kd[2]); gw->setColor(LINE_COLOR,GetUIColor(COLOR_SPACE_WARPS)); mesh.render(gw, &wsmMtl, (flags&USE_DAMAGE_RECT) ? &vpt->GetDammageRect() : NULL, COMP_ALL); gw->setRndLimits(rlim); return(0); }