当前位置: 首页>>代码示例>>C++>>正文


C++ GraphicsWindow::getMaterial方法代码示例

本文整理汇总了C++中GraphicsWindow::getMaterial方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsWindow::getMaterial方法的具体用法?C++ GraphicsWindow::getMaterial怎么用?C++ GraphicsWindow::getMaterial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GraphicsWindow的用法示例。


在下文中一共展示了GraphicsWindow::getMaterial方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HitTest

int EditFaceDataMod::HitTest (TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc) {
	Interval valid;
	int savedLimits, res = 0;
	GraphicsWindow *gw = vpt->getGW();
	HitRegion hr;
	
	// Setup GW
	MakeHitRegion(hr,type, crossing,4,p);
	gw->setHitRegion(&hr);
	Matrix3 mat = inode->GetObjectTM(t);
	gw->setTransform(mat);	
	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
	gw->clearHitCode();

	if (!mc->localData) return 0;
	EditFaceDataModData *md = (EditFaceDataModData*)mc->localData;
	Mesh *mesh = md->GetCacheMesh ();
	MNMesh *mnmesh = md->GetCacheMNMesh ();

	SubObjHitList hitList;
	if (mesh) {
		res = mesh->SubObjectHitTest(gw, gw->getMaterial(), &hr, flags|hitLevel[selLevel], hitList);
	} else if (mnmesh) {
		res = mnmesh->SubObjectHitTest (gw, gw->getMaterial(), &hr, flags|mnhitLevel[selLevel], hitList);
	}

	MeshSubHitRec *rec = hitList.First();
	while (rec) {
		vpt->LogHit(inode,mc,rec->dist,rec->index,NULL);
		rec = rec->Next();
	}

	gw->setRndLimits(savedLimits);	
	return res;	
}
开发者ID:2asoft,项目名称:xray,代码行数:35,代码来源:EditFaceData.cpp

示例2: HitTest

// From BaseObject
int SimpleWSMObject::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;
	}

	Point2 pt( (float)p[0].x, (float)p[0].y );
	HitRegion hitRegion;
	GraphicsWindow *gw = vpt->getGW();	
	Material *mtl = gw->getMaterial();
		
	UpdateMesh(t);
	gw->setTransform(inode->GetObjectTM(t));
	MakeHitRegion(hitRegion, type, crossing, 4, p);
	DWORD rlim  = gw->getRndLimits();	
	int res;

	gw->setRndLimits((rlim|GW_PICK|GW_WIREFRAME) 
		& ~(GW_ILLUM|GW_BACKCULL|GW_FLAT|GW_SPECULAR));

	res = mesh.select(gw, mtl, &hitRegion, flags & HIT_ABORTONHIT);
	
	gw->setRndLimits(rlim);
	return res;
	}
开发者ID:artemeliy,项目名称:inf4715,代码行数:30,代码来源:simpobj.cpp

示例3: HitTest

// From BaseObject
int TargetObject::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;
	Matrix3 m;
	GraphicsWindow *gw = vpt->getGW();	
	MakeHitRegion(hitRegion,type,crossing,4,p);	
	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
	GetMat(t,inode,*vpt,m);
	gw->setTransform(m);
	if(mesh.select( gw, gw->getMaterial(), &hitRegion, flags & HIT_ABORTONHIT ))
		return TRUE;
	gw->setRndLimits( savedLimits );
	return FALSE;

#if 0
	gw->setHitRegion(&hitRegion);
	gw->clearHitCode();
	gw->fWinMarker(&pt, HOLLOW_BOX_MRKR);
	return gw->checkHitCode();
#endif

	}
开发者ID:artemeliy,项目名称:inf4715,代码行数:30,代码来源:target.cpp

示例4: Display

int bhkCapsuleObject::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) 
{
   Matrix3 m;
   Color color = Color(inode->GetWireColor());
   GraphicsWindow *gw = vpt->getGW();
   Material *mtl = gw->getMaterial();
   m = inode->GetObjectTM(t);
   gw->setTransform(m);
   DWORD rlim = gw->getRndLimits();

   DWORD newrlim = GW_WIREFRAME/*|GW_Z_BUFFER*/;
#if VERSION_3DSMAX >= ((5000<<16)+(15<<8)+0) // Version 5+
   newrlim |= GW_EDGES_ONLY;
#endif
   gw->setRndLimits(newrlim);

   if (inode->Selected()) 
      gw->setColor( LINE_COLOR, GetSelColor());
   else if(!inode->IsFrozen() && !inode->Dependent())
      gw->setColor( LINE_COLOR, color);

   UpdateMesh(t);
   mesh.render( gw, mtl, NULL, COMP_ALL);	
   gw->setRndLimits(rlim);
   return 0;
}
开发者ID:Anchoys1,项目名称:max_nif_plugin,代码行数:26,代码来源:bhkCapsuleObj.cpp

示例5: if

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);
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:33,代码来源:fog.cpp

示例6: Display

int LuminaireObject::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) 
{
	if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Invalid viewport!"));
		return FALSE;
	}

	Matrix3 m;
	if (dumFlags&DISABLE_DISPLAY)
		return 0;
	GraphicsWindow *gw = vpt->getGW();
	Material *mtl = gw->getMaterial();
	m = inode->GetObjectTM(t);
	gw->setTransform(m);
	DWORD rlim = gw->getRndLimits();
	gw->setRndLimits(GW_WIREFRAME|GW_EDGES_ONLY|GW_BACKCULL| (rlim&GW_Z_BUFFER) );
	if (inode->Selected()) 
		gw->setColor( LINE_COLOR, GetSelColor());
	else if(!inode->IsFrozen() && !inode->Dependent())
		gw->setColor( LINE_COLOR, color.x, color.y, color.z);

	UpdateMesh();
	mesh.render( gw, mtl, NULL, COMP_ALL);	
	gw->setRndLimits(rlim);
	return 0;
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:28,代码来源:Luminaire.cpp

示例7: Display

int RainParticle::Display( TimeValue t, INode* inode, ViewExp *vpt, int flags )
{
	if (!OKtoDisplay(t)) 
		return 0;

	GraphicsWindow *gw = vpt->getGW();
	DWORD rlim  = gw->getRndLimits();

	// Draw emitter
	gw->setRndLimits(GW_WIREFRAME | GW_EDGES_ONLY | (rlim & GW_Z_BUFFER) );

	if (inode->Selected())
	{
		gw->setColor( LINE_COLOR, GetSelColor());
	}
	else if(!inode->IsFrozen())
	{
		gw->setColor(LINE_COLOR,GetUIColor(COLOR_PARTICLE_EM));
	}

	Material *mtl = gw->getMaterial();   
	if (mtl && !inode->Selected() && !inode->IsFrozen())
	{
		gw->setColor(LINE_COLOR, mtl->Kd[0], mtl->Kd[1], mtl->Kd[2]);
	}

	gw->setTransform(inode->GetObjTMBeforeWSM(t));  
	mesh.render(gw, mtl, (flags & USE_DAMAGE_RECT) ? &vpt->GetDammageRect() : NULL, COMP_ALL);
	
	return 0;
}
开发者ID:cpzhang,项目名称:zen,代码行数:31,代码来源:RainParticle.cpp

示例8: HitTest

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;
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:27,代码来源:fog.cpp

示例9: HitTest

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;
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:29,代码来源:prothelp.cpp

示例10: if

int
BackgroundObject::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags)
{
    float radius;
    pblock->GetValue(PB_BG_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);
    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, 1.0f, 0.0f);
    mesh.render( gw, mtl, NULL, COMP_ALL);

    gw->setRndLimits(rlim);
    return(0);
}
开发者ID:2asoft,项目名称:xray,代码行数:25,代码来源:backgrnd.cpp

示例11: Display

int SimpleParticle::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) 
	{
	if (!OKtoDisplay(t)) return 0;
	Update(t,inode);
	GraphicsWindow *gw = vpt->getGW();
	DWORD rlim  = gw->getRndLimits();	
	
	// Draw emitter
	gw->setRndLimits(GW_WIREFRAME|GW_EDGES_ONLY|GW_BACKCULL| (rlim&GW_Z_BUFFER) );
	if (inode->Selected()) 
		gw->setColor( LINE_COLOR, GetSelColor());
	else if(!inode->IsFrozen())
		//gw->setColor( LINE_COLOR, particleMtl.Kd[0], particleMtl.Kd[1], particleMtl.Kd[2]);
		gw->setColor(LINE_COLOR,GetUIColor(COLOR_PARTICLE_EM));

	if (EmitterVisible()) {
		gw->setTransform(inode->GetObjTMBeforeWSM(t));	
		mesh.render(gw, &particleMtl, 
			(flags&USE_DAMAGE_RECT) ? &vpt->GetDammageRect() : NULL, COMP_ALL);
		}
			
	// Draw particles
	gw->setRndLimits(GW_WIREFRAME|GW_EDGES_ONLY|GW_BACKCULL| (rlim&(GW_Z_BUFFER|GW_BOX_MODE)) );
	Material *mtl = gw->getMaterial();	
	if (!inode->Selected() && !inode->IsFrozen())
		gw->setColor( LINE_COLOR, mtl->Kd[0], mtl->Kd[1], mtl->Kd[2]);

	gw->setTransform(ident);
	parts.Render(gw,GetMarkerType());

	gw->setRndLimits(rlim);
	return(0);
	}
开发者ID:2asoft,项目名称:xray,代码行数:33,代码来源:simpobj.cpp

示例12: Display

int bhkProxyObject::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) 
{
	if (forceRedraw)
	{
		Interface *gi = GetCOREInterface();
		gi->ForceCompleteRedraw();
	}

	Matrix3 m;
	Color color = Color(inode->GetWireColor());
	GraphicsWindow *gw = vpt->getGW();
	Material *mtl = gw->getMaterial();
	m = inode->GetObjectTM(t);
	gw->setTransform(m);
	DWORD rlim = gw->getRndLimits();

	DWORD newrlim = GW_WIREFRAME|GW_Z_BUFFER;
#if VERSION_3DSMAX >= ((5000<<16)+(15<<8)+0) // Version 5+
	newrlim |= GW_EDGES_ONLY;
#endif
	gw->setRndLimits(newrlim);

	if (inode->Selected()) 
		gw->setColor( LINE_COLOR, GetSelColor());
	else if(!inode->IsFrozen() && !inode->Dependent())
		gw->setColor( LINE_COLOR, color);

	Matrix3 m3(true);

	float size = 20.0f;
	Point3 pts[5];
	// X
	pts[0] = Point3(-size, 0.0f, 0.0f); pts[1] = Point3(size, 0.0f, 0.0f);
	vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);

	// Y
	pts[0] = Point3(0.0f, -size, 0.0f); pts[1] = Point3(0.0f, size, 0.0f);
	vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);

	// Z
	pts[0] = Point3(0.0f, 0.0f, -size); pts[1] = Point3(0.0f, 0.0f, size);
	vpt->getGW()->polyline(2, pts, NULL, NULL, FALSE, NULL);

	//UpdateMesh(t);

	int bvType = 0;
	pblock2->GetValue(PB_BOUND_TYPE, 0, bvType, FOREVER, 0);
	if (bvType != 0)
	{
		Matrix3 tm = gw->getTransform();
		Matrix3 proxyTM(true);
		proxyTM.SetTranslate(proxyPos);
		gw->setTransform(proxyTM);
		proxyMesh.render( gw, mtl, NULL, COMP_ALL);	
		gw->setTransform(tm);
	}
	gw->setRndLimits(rlim);
	return 0;
}
开发者ID:Doommarine23,项目名称:max_nif_plugin,代码行数:59,代码来源:bhkProxyObj.cpp

示例13: HitTest

// From BaseObject
int TriPatchObject::HitTest(TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt) {	
	HitRegion hitRegion;
	GraphicsWindow *gw = vpt->getGW();	
	Material *mtl = gw->getMaterial();
   	
	UpdatePatchMesh(t);
	gw->setTransform(inode->GetObjectTM(t));

	MakeHitRegion(hitRegion, type, crossing, 4, p);
	return patch.select( gw, mtl, &hitRegion, flags & HIT_ABORTONHIT );
	}
开发者ID:DimondTheCat,项目名称:xray,代码行数:12,代码来源:tripatch.cpp

示例14: Display

int ProtHelpObject::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) 
{
   if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Invalid viewport!"));
		return FALSE;
	}
	 
	 Matrix3 m;
   GraphicsWindow *gw = vpt->getGW();
   Material *mtl = gw->getMaterial();

   created = TRUE;
   GetMat(t,inode,*vpt,m);
   gw->setTransform(m);
   DWORD rlim = gw->getRndLimits();
   gw->setRndLimits(GW_WIREFRAME|GW_EDGES_ONLY|GW_BACKCULL| (rlim&GW_Z_BUFFER) );
   if (inode->Selected()) 
      gw->setColor( LINE_COLOR, GetSelColor());
   else if(!inode->IsFrozen() && !inode->Dependent())
      gw->setColor( LINE_COLOR, GetUIColor(COLOR_TAPE_OBJ));
   mesh.render( gw, mtl, NULL, COMP_ALL);
   
   // calc angle
   lastAngle = 0.0;
   #define RadToDegDbl  (180.0 / 3.141592653589793)
   if(refNode[0] && refNode[1]) {
      Point3 origin = m.GetTrans();
      Point3 vec1 = refNode[0]->GetObjectTM(t).GetTrans() - origin;
      Point3 vec2 = refNode[1]->GetObjectTM(t).GetTrans() - origin;
      float len1 = Length(vec1);
      float len2 = Length(vec2);
      if(len1 > 0.00001f && len2 > 0.00001f) {
         double cosAng = (double)DotProd(vec1, vec2) / (double)(len1 * len2);
         if(fabs(cosAng) <= 0.999999)  // beyond float accuracy!
            lastAngle = acos(cosAng) * RadToDegDbl;
         else
            lastAngle = 180.0;
      }
   }
#if 0
   Point3 pt(0,0,0);
   TCHAR buf[32];
   _stprintf(buf, "%g", lastAngle);
   gw->setColor(TEXT_COLOR, GetUIColor(COLOR_TAPE_OBJ));
   gw->text(&pt, buf);
#endif
   DrawLines(t, inode, gw, 1);
   UpdateUI(t);
   gw->setRndLimits(rlim);
   return(0);
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:53,代码来源:prothelp.cpp

示例15: Display

int TargetObject::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) {
	if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Invalid viewport!"));
		return FALSE;
	}
	
	if (MaxSDK::Graphics::IsRetainedModeEnabled())
	{
		// 11/15/2010 
		// In Nitrous view port, do not draw the target when seeing from the target's camera
		if (NULL != vpt && NULL != vpt->GetViewCamera() && vpt->GetViewCamera()->GetTarget() == inode)
		{
			return 0;
		}
	}

	Matrix3 m;
	GraphicsWindow *gw = vpt->getGW();
	GetMat(t,inode,*vpt,m);
	gw->setTransform(m);
	DWORD rlim = gw->getRndLimits();
	gw->setRndLimits(GW_WIREFRAME|GW_EDGES_ONLY|GW_BACKCULL| (rlim&GW_Z_BUFFER) );
	if (inode->Selected()) 
		gw->setColor( LINE_COLOR, GetSelColor());
	else if(!inode->IsFrozen() && !inode->Dependent() && inode->GetLookatNode()) {
		const ObjectState& os = inode->GetLookatNode()->EvalWorldState(t);
		Object* ob = os.obj;

		// 6/25/01 3:32pm --MQM-- 
		// set color to wire-frame color, 
		// instead of COLOR_LIGHT_OBJ or COLOR_CAMERA_OBJ
		if ( (ob!=NULL) && ( (ob->SuperClassID()==LIGHT_CLASS_ID) ||
							 (ob->SuperClassID()==CAMERA_CLASS_ID) ) )
		{													
			Color color(inode->GetWireColor());
			gw->setColor( LINE_COLOR, color );
		}
		else
			gw->setColor( LINE_COLOR, GetUIColor(COLOR_CAMERA_OBJ)); // default target color, just use camera targ color
	}

	mesh.render( gw, gw->getMaterial(), NULL, COMP_ALL);	
    gw->setRndLimits(rlim);
//	gw->fWinMarker(&pt,HOLLOW_BOX_MRKR);
	return(0);
	}
开发者ID:artemeliy,项目名称:inf4715,代码行数:48,代码来源:target.cpp


注:本文中的GraphicsWindow::getMaterial方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。