本文整理汇总了C++中ViewExp::getGW方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewExp::getGW方法的具体用法?C++ ViewExp::getGW怎么用?C++ ViewExp::getGW使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewExp
的用法示例。
在下文中一共展示了ViewExp::getGW方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: DrawCrossing
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);
}
示例3: Normalize
void
TrackMouseCallBack::draw_marker(ViewExp& vpt, Point3 p, Point3 norm)
{
return; // sorry, this doesn't work yet - I'll post it later
// set GW tm to orientation specified by norm and draw a circle
Matrix3 tm;
Point3 zdir, ydir, xdir;
// compute the direction of the z axis to be.
// the positive z axis points AWAY from the target.
zdir = Normalize(norm);
// compute direction of the X axis before roll.
xdir = Normalize(CrossProd(zdir.x > 0 ? Point3(0, 0, 1) : Point3(0, 0, -1), zdir));
// compute direction of the Y axis before roll.
ydir = Normalize(CrossProd(zdir, xdir));
tm.SetRow(0, xdir);
tm.SetRow(1, ydir);
tm.SetRow(2, zdir);
vpt.getGW()->setTransform(tm);
vpt.getGW()->setColor(LINE_COLOR, MARKER_COLOR);
vpt.getGW()->marker(&p, CIRCLE_MRKR);
}
示例4: filename
//.........这里部分代码省略.........
static TCHAR szBuffer[256];
wsprintf(szBuffer,TEXT("Error writing file %s:\n%s"),
TEXT(filename.c_str()),res.message());
MessageBox (GetActiveWindow(), szBuffer, TEXT("Warning"),
MB_OK | MB_ICONWARNING) ;
}
if(!_options->getIncludeImageDataInIveFile()){
// Turn readerwriter options off again.
osgDB::ReaderWriter::Options* opt = new osgDB::ReaderWriter::Options();
osgDB::Registry::instance()->setOptions(opt);
}
}
else{
if(_options->getShowErrMsg()){
std::string error("Can not find plugin to save file: ");
error.append(name);
MessageBox (GetActiveWindow(), error.c_str() , TEXT("Warning"), MB_OK | MB_ICONWARNING) ;
}
}
_ip->ProgressEnd();
}
// Show quick preview
if(_options->getQuickView()){
float fNear = 1.0f;
float fFar = 1000.0f;
// Get the active viewport and the win32 window within it.
// The position and size will be retreive from this.
ViewExp* viewExp = _ip->GetActiveViewport();
float fov = viewExp->GetFOV();
HWND hWnd = viewExp->getGW()->getHWnd();
RECT sRect;
BOOL ok = GetWindowRect(hWnd, &sRect);
int width = 100;
int height = 100;
int x =100;
int y =100;
if(ok){
x = sRect.left;
y = sRect.top;
width = sRect.right - sRect.left;
height = sRect.bottom - sRect.top;
}
// Create previewer window and set size.
Previewer previewer;
previewer.setWindowSize(x, y, width, height);
// The affine TM transforms from world coords to view coords
// so we need the inverse of this matrix
Matrix3 aTM, camTM, coordSysTM;
Point3 viewDir, viewPos, lookAtPos, upVector;
INode* camera;
float dist = 100;
Point3 upperLeft = viewExp->MapScreenToView(IPoint2(0, 0), fFar);
Point3 lowerRight = viewExp->MapScreenToView(IPoint2(width, height), fFar);
viewExp->GetAffineTM(aTM);
coordSysTM = Inverse(aTM);
viewDir = coordSysTM.VectorTransform(Point3(0.0f, 0.0f, -1.0f));
示例5: proc
int CreateLineMouseProc::proc(
HWND hwnd,
int msg,
int point,
int flags,
IPoint2 m )
{
ViewExp *vpt = ip->GetViewport(hwnd);
int res = TRUE;
static int poly, seg, vert;
static BezierShape *shape;
static Spline3D *spline;
static BOOL creating = FALSE;
static BOOL inserting = FALSE;
static Matrix3 mat;
static EditSplineMod *mod;
static int originalInsert;
if(creating) {
// Ignore the messages the spline code doesn't care about... TH 3/12/99
switch(msg) {
#ifdef DESIGN_VER
case MOUSE_DBLCLICK:
#endif
case MOUSE_POINT:
case MOUSE_MOVE:
case MOUSE_ABORT:
break;
default:
return TRUE;
}
vpt->getGW()->setTransform(mat);
int res = shape->splines[poly]->Create(vpt,msg,point,flags,m,&mat,ip);
// Must update the shape's selection set for this spline
shape->UpdateSels(TRUE);
switch(res) {
case CREATE_STOP:
es->EndCreateLine();
creating = FALSE;
backspaceRouter.UnRegister(&pBack);
break;
case CREATE_ABORT:
shape->DeleteSpline(poly);
es->EndCreateLine(FALSE);
creating = FALSE;
backspaceRouter.UnRegister(&pBack);
break;
}
mod->createShapeData->Invalidate(PART_GEOM);
mod->NotifyDependents(FOREVER, PART_GEOM, REFMSG_CHANGE);
ip->RedrawViews(ip->GetTime(), REDRAW_NORMAL);
}
else
if(inserting) {
// Ignore the messages the spline code doesn't care about... TH 3/12/99
switch(msg) {
#ifdef DESIGN_VER
case MOUSE_DBLCLICK:
#endif
case MOUSE_POINT:
{
for (int i = 0; i < shape->bindList.Count();i++)
{
if (poly == shape->bindList[i].segSplineIndex)
{
if ((seg!=-1)&&(originalInsert <= shape->bindList[i].seg))
{
if (originalInsert == shape->bindList[i].seg)
{
{
shape->bindList[i].seg++;
}
}
else
{
shape->bindList[i].seg++;
}
}
}
}
}
case MOUSE_MOVE:
case MOUSE_ABORT:
break;
default:
return TRUE;
}
int res = shape->splines[poly]->Create(vpt,msg,point,flags,m,&mat,ip);
// Must update the shape's selection set for this spline
BitArray& vsel = shape->vertSel[poly];
BitArray& ssel = shape->segSel[poly];
while(vsel.GetSize() < shape->splines[poly]->Verts()) {
vsel.SetSize(vsel.GetSize() + 3,1);
vsel.Shift(RIGHT_BITSHIFT,3,vert+3);
vsel.Clear(vert+2);
vsel.Clear(vert+3);
//.........这里部分代码省略.........