本文整理汇总了C++中SetTransform函数的典型用法代码示例。如果您正苦于以下问题:C++ SetTransform函数的具体用法?C++ SetTransform怎么用?C++ SetTransform使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetTransform函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NPP_SetWindow
//----------------------------------------------------------------------------
// NPP_SetWindow:
//----------------------------------------------------------------------------
NPError NP_LOADDS
NPP_SetWindow(NPP instance, NPWindow* window) {
pprintf( szPPR, "NPP_SetWindow\n\r" );
if ( instance == 0 ) return NPERR_INVALID_INSTANCE_ERROR;
PluginInstance* This = (PluginInstance*) instance->pdata;
//
// *Developers*: Before setting fWindow to point to the
// new window, you may wish to compare the new window
// info to the previous window (if any) to note window
// size changes, etc.
//
// if window handle changed
if ( This->hWnd != (HWND)window->window ) {
pprintf( szPPR, "HWND (hmf %x) changed, %x --> %x\n\r", This->hmf, (int)This->hWnd, (int)window->window );
// remember the new window
This->fWindow = window;
if ( This->hWnd ) {
// Remove the subclass for the old client window
WinSubclassWindow(This->hWnd, This->lpfnOldWndProc);
}
// remember the new window handle
This->hWnd = (HWND)This->fWindow->window;
// subclass the window
This->lpfnOldWndProc = WinSubclassWindow(This->hWnd, SubClassFunc);
AssociateInstance( This->hWnd, This );
/* paint a background for the drawing */
WinQueryWindowRect( This->hWnd, &This->rclWnd );
// WinFillRect( This->hps, &This->rclWnd, CLR_PALEGRAY );
// destroy old PS and create new PS
if ( This->hps ) GpiDestroyPS( This->hps );
HDC hdc = WinQueryWindowDC( This->hWnd );
if ( !hdc ) hdc = WinOpenWindowDC( This->hWnd );
SIZEL siz={ 0, 0 };
HAB hab=WinQueryAnchorBlock( This->hWnd );
This->hps = GpiCreatePS( hab, hdc, &siz,
PU_PELS | GPIT_NORMAL | GPIA_ASSOC );
pprintf( szPPR, "GpiCreatePS, hdc=%x, hps=%x\n\r", (int)hdc, (int)This->hps );
if ( !This->hps ) {
pprintf( szPPR, "GpiCreatePS failed, Err=%x\n\r",
WinGetLastError( hab ) );
}
SetTransform( This, This->hps, &This->rclWnd );
} else { // check if window coordinates changed.
//It may happens for full-screan
RECTL rcl;
WinQueryWindowRect( This->hWnd, &rcl );
if ( memcmp( &This->rclWnd, &rcl, sizeof( rcl ) ) ) {
pprintf( szPPR, "Rect (hmf %x) changed, ( %d, %d ) - ( %d, %d ) --> ( %d, %d ) - ( %d, %d )\n\r",
This->hmf,
This->rclWnd.xLeft, This->rclWnd.yBottom, This->rclWnd.xRight, This->rclWnd.yTop,
rcl.xLeft, rcl.yBottom, rcl.xRight, rcl.yTop );
memcpy( &This->rclWnd, &rcl, sizeof( rcl ) );
SetTransform( This, This->hps, &This->rclWnd );
}
}
return NPERR_NO_ERROR;
}
示例2: D3DXMatrixLookAtRH
//------------------------------------------------------------------------------------------
HRESULT CGraphicDevice::SetCameraInfo( const SCameraInfo& i_cameraInfo )
{
HRESULT hr;
// 新しいカメラ情報を保持
m_cameraInfo = i_cameraInfo;
/// 新しいカメラ情報でビュー,射影行列を計算 ///
D3DXMATRIX mView, mProj;
// ビュー行列を計算
D3DXMatrixLookAtRH( &mView
, &m_cameraInfo.vEyePos
, &m_cameraInfo.vInterestPos
, &m_cameraInfo.vUpDir );
// 射影行列を計算
D3DXMatrixPerspectiveFovRH( &mProj
, m_cameraInfo.fFov
, ((float)m_nWidth) / m_nHeight
, m_cameraInfo.fNear
, m_cameraInfo.fFar
);
// 各行列を設定
V_RETURN( SetTransform(TransformType_View, mView) );
V_RETURN( SetTransform(TransformType_Projection, mProj) );
return S_OK;
}
示例3: SetTransform
void FlyCamera::CalculateRotation(double dt, double xOffset, double yOffset)
{
if (xOffset != 0.0)
{
glm::mat4 rot = glm::rotate((float)(m_fRotationSpeed * dt * -xOffset), glm::vec3(0, 1, 0));
SetTransform(GetTransform() * rot);
}
if (yOffset != 0.0)
{
glm::mat4 rot = glm::rotate((float)(m_fRotationSpeed * dt * -yOffset), glm::vec3(1, 0, 0));
SetTransform(GetTransform() * rot);
}
//Clean up rotation
glm::mat4 oldTrans = GetTransform();
glm::mat4 trans;
glm::vec3 worldUp = glm::vec3(0, 1, 0);
//Right
trans[0] = glm::normalize(glm::vec4(glm::cross(worldUp, oldTrans[2].xyz()), 0));
//Up
trans[1] = glm::normalize(glm::vec4(glm::cross(oldTrans[2].xyz(), trans[0].xyz()), 0));
//Forward
trans[2] = glm::normalize(oldTrans[2]);
//Position
trans[3] = oldTrans[3];
SetTransform(trans);
}
示例4: SpatialParent
void SpatialNode::SetWorldTransform(const Vector3& newPosition, const Quaternion& newRotation)
{
SpatialNode* parentNode = SpatialParent();
if (parentNode)
{
Vector3 localPosition = parentNode->WorldTransform().Inverse() * newPosition;
Quaternion localRotation = parentNode->WorldRotation().Inverse() * newRotation;
SetTransform(localPosition, localRotation);
}
else
SetTransform(newPosition, newRotation);
}
示例5: GetTransform
void
DrawTarget::PushDeviceSpaceClipRects(const IntRect* aRects, uint32_t aCount)
{
Matrix oldTransform = GetTransform();
SetTransform(Matrix());
RefPtr<PathBuilder> pathBuilder = CreatePathBuilder();
for (uint32_t i = 0; i < aCount; i++) {
AppendRectToPath(pathBuilder, Rect(aRects[i]));
}
RefPtr<Path> path = pathBuilder->Finish();
PushClip(path);
SetTransform(oldTransform);
}
示例6: SetTransform
void CMeshShape::Init(Data::PParams Desc)
{
InitialTfm.ident(); //??? (was in mangalore, see XML CompositeLoader)
SetTransform(InitialTfm);
SetMaterialType(CMaterialTable::StringToMaterialType(Desc->Get<nString>(CStrID("Mtl"), "Metal")));
SetFileName(Desc->Get<nString>(CStrID("File")));
}
示例7: UpdateAnimation
void UpdateAnimation(HWND hwnd)
{
if (!IsAnimating())
return;
// Compute the elapsed time since the start of the animation in seconds.
DWORD const tickCount = GetTickCount();
float elapsed = (tickCount - g_animationStartCount) * (1.0f / 1000);
if (elapsed < g_animationDuration)
{
// We're still animating. Compuate the current x by interpolating between
// the start x and end x.
float r = elapsed / g_animationDuration;
g_animationCurrentX = (g_animationStartX * (1 - r)) + (g_animationEndX * r);
}
else
{
// We're done with this animation. Let both the current and start x equal the end x.
g_animationCurrentX = g_animationEndX;
g_animationStartX = g_animationEndX;
// If we're not at zero, we'll start a new animation ending at zero. The duration of
// this animation depends on the distance.
g_animationEndX = 0;
g_animationStartCount = tickCount;
g_animationDuration = fabs(g_animationStartX) / 10;
}
SetTransform(hwnd);
}
示例8: SetTransform
void PointRenderer::GetExtent(CachedExtent &ioCache)
{
SetTransform(ioCache.mTransform);
for(int i=0; i<mTransformed.size(); i++)
ioCache.mExtent.Add(mTransformed[i]);
}
示例9: Direct3DRender
//------------------------------------
//NAME : Direct3DRender()
//DESC : 绘制3D场景
//------------------------------------
void Direct3DRender()
{
/*
Direct3D的绘制过程就是:绘制→显示→绘制→显示。
但是,每当开始绘制图形之前,都需要通过IDirect3DDevice9接口的Clear方法将后台缓存中的内容进行清空,并设置表面的填充颜色等
HRESULT IDirect3DDevice9::Clear(
DWORD Count,
const D3DRECT *pRects, //指定对表面指定的矩形区域进行清除操作,数组中包含的矩形的数量由Count参数指定
DWORD Flags, //指定了需要清除的表面,该参数可以取值于D3DCLEAR_TARGET、D3DCLEAR_ZBUFFER和D3DCLEAR_STENCIL,分别表示对后台缓存、深度缓存和模板缓存进行清除
D3DCOLOR Color, //用于指定在清除缓存内容后设置的背景色,可以通过D3DCOLOR_XRGB宏将RGB值转换给该参数
float Z, //指定当清除缓存内容后设置深度缓存的值
DWORD Stencil
);
*/
g_pd3dDevice->Clear(0,NULL,D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,D3DCOLOR_XRGB(0,0,0),1.0f,0);//黑色背景
//开始绘制
g_pd3dDevice->BeginScene();
//在绘制立方体之前,分别取得绕x,y,z轴旋转变换的矩阵,然后将他们组合并让立方体同时绕这3个轴旋转
SetTransform();
/*图形绘制的实际过程*/
DrawPrimitive();
//结束绘制
g_pd3dDevice->EndScene();
//翻转
g_pd3dDevice->Present(NULL,NULL,NULL,NULL);
}
示例10: Clear
void ODERigidObject::Create(dWorldID worldID,dSpaceID space,bool useBoundaryLayer)
{
Clear();
spaceID = space;
bodyID = dBodyCreate(worldID);
dMass mass;
mass.mass = obj.mass;
//NOTE: in ODE, COM must be zero vector! -- we take care of this by shifting geometry
//CopyVector3(mass.c,obj.com);
mass.c[0] = mass.c[1] = mass.c[2] = 0; mass.c[3] = 1.0;
CopyMatrix(mass.I,obj.inertia);
int res=dMassCheck(&mass);
if(res != 1) {
fprintf(stderr,"Uh... mass is not considered to be valid by ODE?\n");
std::cerr<<"Inertia: "<<obj.inertia<<std::endl;
}
dBodySetMass(bodyID,&mass);
geometry = new ODEGeometry;
geometry->Create(&obj.geometry,spaceID,-obj.com,useBoundaryLayer);
dGeomSetBody(geometry->geom(),bodyID);
dGeomSetData(geometry->geom(),(void*)-1);
geometry->SetPadding(defaultPadding);
geometry->surf().kRestitution = obj.kRestitution;
geometry->surf().kFriction = obj.kFriction;
geometry->surf().kStiffness = obj.kStiffness;
geometry->surf().kDamping = obj.kDamping;
SetTransform(obj.T);
}
示例11: SelectMetaFile
void SelectMetaFile( PluginInstance *This, HMF hmf ) {
if ( This->hmf ) GpiDeleteMetaFile( This->hmf );
This->hmf=hmf;
HAB hab=WinQueryAnchorBlock( This->hWnd );
HPS hps=This->hps;
if ( !hps ) {
pprintf( szPPR, "No hps ???\n\r" );
return;
}
//calculate bounds
HDC hdc = WinQueryWindowDC( This->hWnd );
if ( !hdc ) hdc = WinOpenWindowDC( This->hWnd );
GpiResetBoundaryData( hps );
if ( GpiAssociate( hps, NULL ) ) {
GpiSetDrawControl( hps, DCTL_BOUNDARY, DCTL_ON );
Draw( This, hps, FALSE, FALSE );
if ( GpiQueryBoundaryData( hps, &This->rclMeta ) && (This->rclMeta.xLeft<This->rclMeta.xRight) ) {
if ( !GpiAssociate( hps, hdc ) ) pprintf( szPPR, "GpfAssociate( hps, hdc ) failed\n\r" );
GpiSetDrawControl( hps, DCTL_BOUNDARY, DCTL_OFF );
GpiResetPS( hps, GRES_ALL);
SetTransform( This, hps, &This->rclWnd );
} else {
pprintf( szPPR, "GpiQueryBoundaryData failed, Err=%x\n\r",
WinGetLastError( hab ) );
}
} else pprintf( szPPR, "GpfAssociate( hps, NULL ) failed\n\r" );
// invalidate window to ensure a redraw
WinInvalidateRect( This->hWnd, 0, TRUE );
}
示例12: XMStoreFloat4x4
void SceneNode::SetTransform(CXMMATRIX transform)
{
XMFLOAT4X4 t;
XMStoreFloat4x4(&t, transform);
SetTransform(t);
}
示例13: GetPosition
void mtsOSGBody::Body::UpdateTransform(){
if( GetPosition.IsValid() ){
// Get the position of the camera
prmPositionCartesianGet prmRt;
GetPosition( prmRt );
bool valid = false;
prmRt.GetValid( valid );
// Set the transformation
if( valid )
{ SetTransform( prmRt.Position() ); }
}
// Update the transformation
osaOSGBody::UpdateTransform();
{
prmPositionCartesianSet prmRt;
prmRt.SetGoal( GetTransform() );
bool valid = true;
prmRt.SetValid( valid );
SetPosition( prmRt );
}
}
示例14: GetTransform
void MineActor::TickLocal(const dtGame::Message& msg)
{
ProjectileActor::TickLocal(msg);
dtCore::Transform currentTransform;
GetTransform(currentTransform);
currentTransform.SetRotation(currentTransform.GetRotation() + osg::Vec3(1.0, 0.0, 0.0));
SetTransform(currentTransform);
}
示例15: MOZ_ASSERT
void
GL::PushTransform(const Matrix& aTransform)
{
MOZ_ASSERT(IsCurrent());
MatrixPushEXT(GL_MODELVIEW);
mTransformIdStack.push(mTransformIdStack.top());
SetTransform(aTransform, GetUniqueId());
}