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


C++ GraphicsWindow类代码示例

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


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

示例1: GetDevice

static LPDIRECT3DDEVICE9 GetDevice()
{
	GraphicsWindow		*GW;
	ViewExp				*View;
	LPDIRECT3DDEVICE9	Device;

	View = GetCOREInterface()->GetActiveViewport();

	if(View)
	{
		GW = View->getGW();

		if(GW)
		{
			ID3D9GraphicsWindow *D3DGW = (ID3D9GraphicsWindow *)GW->GetInterface(D3D9_GRAPHICS_WINDOW_INTERFACE_ID);

			if(D3DGW)
			{
				Device = D3DGW->GetDevice();

				return(Device);
			}
		}
	}
	return NULL;
}
开发者ID:whztt07,项目名称:OgreGameProject,代码行数:26,代码来源:DxStdMtl2.cpp

示例2: DbgAssert

int mrGeomShaderObject::HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt) {

	if (MaxSDK::Graphics::IsHardwareHitTesting(vpt))
	{
		return 0;
	}

    if ( ! vpt || ! vpt->IsAlive() )
		{
			// why are we here
			DbgAssert(!_T("Doing Display() on invalid viewport!"));
			return FALSE;
		}
	
		GraphicsWindow* gw = vpt->getGW();
    DWORD rlim = gw->getRndLimits();

    if(DisplayAsWireframe()) {
        gw->setRndLimits(GW_WIREFRAME|GW_EDGES_ONLY|GW_BACKCULL);
    }

    HitRegion hitRegion;
    MakeHitRegion(hitRegion, type, crossing, 4, p);
    Matrix3 tm = inode->GetObjectTM(t);

    gw->setTransform(tm);
    UpdateMesh(t);

    int res = m_mesh.select(gw, inode->Mtls(), &hitRegion, (flags & HIT_ABORTONHIT), inode->NumMtls());

    gw->setRndLimits(rlim);

    return res;
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:34,代码来源:mrGeomShaderObject.cpp

示例3: AxisViewportRect

void AxisViewportRect(ViewExp *vpt, const Matrix3 &tm, float length, Rect *rect)
	{
	Matrix3 tmn = tm;
	float zoom;
	IPoint3 wpt;
	Point3 pt;
	GraphicsWindow *gw = vpt->getGW();

	// Get width of viewport in world units:  --DS
	zoom = vpt->GetScreenScaleFactor(tmn.GetTrans())*ZFACT;
	
	tmn.Scale( Point3(zoom,zoom,zoom) );
	gw->setTransform( tmn );	
	pt = Point3(0.0f, 0.0f, 0.0f);
	gw->wTransPoint( &pt, &wpt );
	rect->left = rect->right  = wpt.x;
	rect->top  = rect->bottom = wpt.y;

	AxisRect( gw, Point3(length,0.0f,0.0f),rect );	
	AxisRect( gw, Point3(0.0f,length,0.0f),rect );	
	AxisRect( gw, Point3(0.0f,0.0f,length),rect );	

	rect->right  += 2;
	rect->bottom += 2;
	rect->left   -= 2;
	rect->top    -= 2;
	}
开发者ID:mathieumg,项目名称:inf4715,代码行数:27,代码来源:pthelp.cpp

示例4: DbgAssert

// 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

示例5: DbgAssert

int TriPatchObject::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) {

	if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Invalid viewport!"));
		return FALSE;
	}

	Matrix3 tm;
	GraphicsWindow *gw = vpt->getGW();
	gw->setTransform(inode->GetObjectTM(t));
	UpdatePatchMesh(t);

	if(!MaxSDK::Graphics::IsRetainedModeEnabled())
	{
		if(!(gw->getRndMode() & GW_BOX_MODE)) {
			PrepareMesh(t);
			Mesh& mesh = patch.GetMesh();
			if(mesh.getNumVerts()) {
				mesh.render( gw, inode->Mtls(),
					(flags&USE_DAMAGE_RECT) ? &vpt->GetDammageRect() : NULL, 
					COMP_ALL | (inode->Selected()?COMP_OBJSELECTED:0), inode->NumMtls());	
			}
		}
	}

	patch.render( gw, inode->Mtls(),
		(flags&USE_DAMAGE_RECT) ? &vpt->GetDammageRect() : NULL, 
		COMP_ALL | (inode->Selected()?COMP_OBJSELECTED:0), inode->NumMtls());	
	return(0);
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:32,代码来源:tripatch.cpp

示例6: debugPass

void Framebuffer::debugPass(GraphicsWindow& graphicsWindow, std::vector<unsigned int> attachmentIndices)
{
	glBindFramebuffer(GL_FRAMEBUFFER, 0);

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	bindForReading();

	unsigned int windowWidth = graphicsWindow.getWindowWidth();
	unsigned int windowHeight = graphicsWindow.getWindowHeight();

	GLsizei oneThirdWidth = (GLsizei)(windowWidth / 3.0f);
	GLsizei oneThirdHeight = (GLsizei)(windowHeight / 3.0f);

	if (attachmentIndices.size() > 8)
	{
		Logger::GetInstance().Log("Color attachment count out of bounds!");
		return;
	}

	for (unsigned int i = 0; i < attachmentIndices.size(); i++)
	{
		glReadBuffer(GL_COLOR_ATTACHMENT0 + attachmentIndices[i]);

		glBlitFramebuffer(0, 0, windowWidth, windowHeight,
			oneThirdWidth*((i)%3), oneThirdHeight*((i)/3), oneThirdWidth*(((i)%3)+1), oneThirdHeight*(((i+3))/3), GL_COLOR_BUFFER_BIT, GL_LINEAR);
	}

	check_gl_error();
}
开发者ID:GregJo,项目名称:BA-Framework,代码行数:30,代码来源:Framebuffer.cpp

示例7: triangle_cf

Value*
triangle_cf(Value** arg_list, int count)
{
	check_arg_count(triangle, 2, count);
	for (int i=0; i < count; i++)
		type_check(arg_list[i], Array, _T("triangle"));

	Array			*pts_val = (Array*)arg_list[0], 
	*col_val = (Array*)arg_list[1];
	GraphicsWindow	*gw		 = MAXScript_interface->GetActiveViewExp().getGW();	
	
	if (MaxSDK::Graphics::IsRetainedModeEnabled() && gw->querySupport(GW_SPT_NUM_LIGHTS) == 0)
	{
		return &undefined;
	}

	if (col_val->size != 3)
		throw RuntimeError(MaxSDK::GetResourceStringAsMSTR(IDS_RK_RGB_ARRAY_SIZE_NOT_3));
	if (pts_val->size != 3)
		throw RuntimeError(MaxSDK::GetResourceStringAsMSTR(IDS_RK_VERT_ARRAY_SIZE_NOT_3));

	Point3* pts = new Point3[3]; 
	Point3*	 col = new Point3[3]; 
	for (int i=0; i < 3; i++) {
		pts[i] = pts_val->data[i]->to_point3();
		col[i] = col_val->data[i]->to_point3()/255.f;
	}	

	//	virtual void	triangle(Point3 *xyz, Point3 *rgb) = 0;
	gw->triangle(pts, col);

	delete [] pts;
	delete [] col;
	return &ok;
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:35,代码来源:GraphicsWindow.cpp

示例8: wRect_cf

Value*
wRect_cf(Value** arg_list, int count)
{
	check_arg_count(wRect, 2, count);
	Box2 &rect = arg_list[0]->to_box2();
	Point3 color = arg_list[1]->to_point3()/255.f;

	GraphicsWindow	*gw		= MAXScript_interface->GetActiveViewExp().getGW();		
	
	if (MaxSDK::Graphics::IsRetainedModeEnabled() && gw->querySupport(GW_SPT_NUM_LIGHTS) == 0)
	{
		return &undefined;
	}

	Point3*	 col = NULL; // new Point3[2];
	IPoint3* pts = new IPoint3[2]; 

//	col[0]=col[1]=color;
	pts[0]=IPoint3((int)(rect.left),0.f,0.f);
	pts[1]=IPoint3((int)(rect.right),0.f,0.f);

	gw->setColor(LINE_COLOR, color);
	for (int j = rect.top; j <= rect.bottom; j++)
	{
		pts[0].y=pts[1].y=j;
		gw->wPolyline(2, pts, col, FALSE, NULL);	
	}

	delete [] pts;
//	delete [] col;
	return &ok;
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:32,代码来源:GraphicsWindow.cpp

示例9: DbgAssert

void GeometryButton::ResetLocation(ViewExp *vpt)
{
	if ( ! vpt || ! vpt->IsAlive() )
	{	
		// why are we here?
		DbgAssert(!_T("Doing ResetLocation() on invalid viewport!"));
		return;
	}

	if(GetEnabled()==true&&mLabel.Length()>0)
	{
		SIZE sp;
		GraphicsWindow *gw = vpt->getGW();
		gw->getTextExtents(mLabel.data(),&sp);
		RECT rect;
		HWND hWnd = vpt->GetHWnd();
		GetWindowRect (hWnd, &rect);
		int width = rect.right - rect.left;
		mLocation.x = width/2 - sp.cx/2;

		//need to reset the y here also...
		IGeometryCheckerManager *man = GetIGeometryCheckerManager();
		if(man->GetDisplayTextUpTop()==false)
		{
			int mult = 1; // at least for top
			if(man->DoesGeometryCheckerHavePropDlg(man->GetActivatedGeometryCheckerIndex()))
				++mult;
			if(man->GetAutoUpdate()==false)
				++mult;
			mLocation.y = (rect.bottom-rect.top) - mult*(4+OFFSET) + OFFSET;
		}
	}
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:33,代码来源:GeometryButton.cpp

示例10: p

void CrossSectionMouseProc::DrawCrossing(HWND hWnd)
	{
	if (mShapeData == NULL) return;

	BezierShape *shape = mShapeData->TempData(es)->GetShape(ip->GetTime());
	if (shape == NULL) return;

	int polys = mSelectedSplines.Count();
	if (polys <= 0) return;

	Spline3D *spline = shape->GetSpline(mSelectedSplines[polys-1]);
	int knots = spline->KnotCount();
	Point3 p(0.0f, 0.0f, 0.0f);
	IPoint3 sp;

	ViewExp *vpt = ip->GetViewport(hWnd);
	GraphicsWindow *gw = vpt->getGW();
	ip->ReleaseViewport(vpt);
	gw->setTransform(mObjToWorldTM);

	HDC hdc = GetDC(hWnd);
	SetROP2(hdc, R2_XORPEN);
	SetBkMode(hdc, TRANSPARENT);
	SelectObject(hdc,CreatePen(PS_DOT, 0, ComputeViewportXORDrawColor()));
	for (int i = 0, j = 0; i < 2 && i <= j; i++, j += (knots-1)) {
		if (knots > i) p = spline->GetKnotPoint(j);
		gw->wTransPoint(&p, &sp);
		MoveToEx(hdc,sp.x,sp.y,NULL);
		LineTo(hdc,mMouse.x,mMouse.y);
		}
	DeleteObject(SelectObject(hdc,GetStockObject(BLACK_PEN)));
	ReleaseDC(hWnd, hdc);
	}
开发者ID:2asoft,项目名称:xray,代码行数:33,代码来源:editsops.cpp

示例11: DbgAssert

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;
	}
开发者ID:artemeliy,项目名称:inf4715,代码行数:34,代码来源:fextrude.cpp

示例12: main

int main()
{
    GraphicsWindow gWindow;
    gWindow.createWindow();
    gWindow.mainLoop();
    return 0;
}
开发者ID:Barbacamanitu,项目名称:DatBoi,代码行数:7,代码来源:main.cpp

示例13: GetDevice

static LPDIRECT3DDEVICE9 GetDevice()
{
#ifndef NO_ASHLI
	GraphicsWindow		*lpGW = NULL;
	static LPDIRECT3DDEVICE9 lpDevice = NULL;

	if(lpDevice)
		return lpDevice;

	ViewExp& lpView = GetCOREInterface()->GetActiveViewExp();
	if(lpView.IsAlive())
	{
		lpGW = lpView.getGW();
		if(lpGW)
		{
			ID3D9GraphicsWindow *lpD3DGW = (ID3D9GraphicsWindow *)lpGW->GetInterface(D3D9_GRAPHICS_WINDOW_INTERFACE_ID);
			if(lpD3DGW)
			{
				lpDevice = lpD3DGW->GetDevice();
			}
		}
		
	}
	
	return lpDevice;
#else
	return NULL;
#endif
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:29,代码来源:ViewportLoader.cpp

示例14: CheckForDX

BOOL CheckForDX()
{
	static bool firstcheck	= true;		// ~Wenle: this function get called for the first time?
	static bool checkresult = false;	// ~Wenle: the check result is cached here

	if (firstcheck)
	{
		firstcheck = false;

		ViewExp &vpt = GetCOREInterface()->GetActiveViewExp();  

		if (vpt.IsAlive())
		{
			GraphicsWindow *gw = vpt.getGW();

			if (gw && gw->querySupport(GW_SPT_GEOM_ACCEL))
			{
				IHardwareShader * phs = (IHardwareShader*)gw->GetInterface(HARDWARE_SHADER_INTERFACE_ID);
				if (phs)
					checkresult = true;
			}
		}
	}

	return checkresult;
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:26,代码来源:DllEntry.cpp

示例15: FindModContext

int BendManip::Display(TimeValue t, INode* pNode, ViewExp *pVpt, int flags)
{

	ModContext* mc = FindModContext( pNode, modifier );
	if( mc==NULL ) return 0;


	Interval valid;
	GraphicsWindow *gw = pVpt->getGW();
	Matrix3 modmat, ntm = pNode->GetObjTMBeforeWSM(t), off, invoff;

	if (mc->box->IsEmpty()) return 0;

	//Lets get the Modifier do all the work here
	modmat = modifier->CompMatrix(t,*mc,ntm,valid,FALSE);
	modifier->CompOffset(t,off,invoff);
	gw->setTransform(modmat);
	if(mouseWithin)
		gw->setColor( LINE_COLOR, (float)1.0, (float)0.0, (float)0.0);
	else
		gw->setColor( LINE_COLOR, (float)0.0, (float)1.0, (float)0.0);

	DoModifiedBox(*mc->box,modifier->GetDeformer(t,*mc,invoff,off),DrawLineProc(gw));

	
	return 1;
	
}
开发者ID:2asoft,项目名称:xray,代码行数:28,代码来源:bendmanip.cpp


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