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


C++ GetWorldTransform函数代码示例

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


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

示例1: GetWorldTransform

void DAVA::ShadowVolumeNode::DrawShadow()
{
	Matrix4 prevMatrix = RenderManager::Instance()->GetMatrix(RenderManager::MATRIX_MODELVIEW); 
	Matrix4 meshFinalMatrix = GetWorldTransform() * prevMatrix;
	RenderManager::Instance()->SetMatrix(RenderManager::MATRIX_MODELVIEW, meshFinalMatrix);

	Matrix4 projMatrix = RenderManager::Instance()->GetMatrix(RenderManager::MATRIX_PROJECTION);

	RenderManager::Instance()->SetShader(shader);
	RenderManager::Instance()->SetRenderData(shadowPolygonGroup->renderDataObject);
	RenderManager::Instance()->FlushState();
	RenderManager::Instance()->AttachRenderData();

	Vector3 position = Vector3() * GetWorldTransform();
	Light * light = scene->GetNearestDynamicLight(Light::TYPE_COUNT, position);
	if (light && uniformLightPosition0 != -1)
	{
		Vector3 lightPosition0 = light->GetPosition();
		const Matrix4 & matrix = scene->GetCurrentCamera()->GetMatrix();
		lightPosition0 = lightPosition0 * matrix;

		shader->SetUniformValueByIndex(uniformLightPosition0, lightPosition0);
	}

	if (shadowPolygonGroup->renderDataObject->GetIndexBufferID() != 0)
	{
		RenderManager::Instance()->HWDrawElements(PRIMITIVETYPE_TRIANGLELIST, shadowPolygonGroup->indexCount, EIF_16, 0);
	}
	else
	{
		RenderManager::Instance()->HWDrawElements(PRIMITIVETYPE_TRIANGLELIST, shadowPolygonGroup->indexCount, EIF_16, shadowPolygonGroup->indexArray);
	}

	RenderManager::Instance()->SetMatrix(RenderManager::MATRIX_MODELVIEW, prevMatrix);
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:35,代码来源:ShadowVolumeNode.cpp

示例2: SetRotation

void CannonTower::Fire(){
	//Get closest enemy
	Enemy * enemy = mGame.GetWorld().GetClosestEnemy(GetWorldTransform().GetTranslation());
	if (enemy == nullptr)
		return;

	//Turn to enemy direction
	SetRotation(0);
	Vector3 enemyDir = enemy->GetPosition() - GetWorldTransform().GetTranslation();
	enemyDir.Normalize();
	Vector3 towerPos = GetWorldTransform().GetTranslation();
	float angle = Math::Acos(Dot(enemyDir, Vector3::UnitX));
	float crossZ = Cross(Vector3::UnitX, enemyDir).z;
	if (crossZ < 0.0f){
		angle *= -1.0f;
	}
	SetRotation(angle);

	//Fire the ball
	auto ball = CannonBall::Spawn(mGame);
	ball->SetPosition(GetWorldTransform().GetTranslation());
	ball->SetRotation(angle);

	//Trigger the sound
	mAudio->PlaySound(mShottingSound);
}
开发者ID:caioteixeira,项目名称:TowerDefense,代码行数:26,代码来源:CannonTower.cpp

示例3: Compare

void KTraceEMF::CompareDC(HDC hDC)
{
	Compare(m_value[0],  GetMapMode(hDC),						"MapMode      : %d\r\n");
	Compare(m_value[1],  GetGraphicsMode(hDC),					"GraphicsMode : %d\r\n");
	
	XFORM xm;
	GetWorldTransform(hDC, & xm);
	Compare(m_float[0],  xm.eM11,								"WT.eM11      : %8.5f\r\n");
	Compare(m_float[1],  xm.eM12,								"WT.eM12      : %8.5f\r\n");
	Compare(m_float[2],  xm.eM21,								"WT.eM21      : %8.5f\r\n");
	Compare(m_float[3],  xm.eM22,								"WT.eM22      : %8.5f\r\n");
	Compare(m_float[4],  xm.eDx,								"WT.eDx       : %8.5f\r\n");
	Compare(m_float[5],  xm.eDy,								"WT.eDy       : %8.5f\r\n");

	Compare(m_value[2],  GetBkMode(hDC),						"BkMode       : %d\r\n");
	Compare(m_value[3],  GetROP2(hDC),							"ROP2         : %d\r\n");
	Compare(m_value[4],  ((int)GetTextAlign(hDC)),				"TextAlign    : 0x%x\r\n");

	Compare(m_object[0], GetCurrentObject(hDC, OBJ_PEN),		"Pen          : 0x%08x\r\n");
	Compare(m_object[1], GetCurrentObject(hDC, OBJ_BRUSH),		"Brush        : 0x%08x\r\n");
	Compare(m_object[2], GetCurrentObject(hDC, OBJ_FONT),		"Font         : 0x%08x\r\n");
	Compare(m_object[3], GetCurrentObject(hDC, OBJ_PAL),		"Palette      : 0x%08x\r\n");
	Compare(m_object[4], GetCurrentObject(hDC, OBJ_COLORSPACE),	"ColorSpace   : 0x%08x\r\n");
	Compare(m_object[5], GetCurrentObject(hDC, OBJ_BITMAP),		"Bitmap       : 0x%08x\r\n");
}
开发者ID:b2kguga,项目名称:CodesAndNotes,代码行数:25,代码来源:EMFView.cpp

示例4: GetWorldTransform

void LindenmayerTreeNode::Render(OGLRenderer& r, bool render_children) {
	if (r.GetCurrentShader() != shader) r.SetCurrentShader(shader);
	r.UpdateShaderMatrices();
	Matrix4 transform = GetWorldTransform() * Matrix4::Scale(GetModelScale());
	glUniformMatrix4fv(glGetUniformLocation(GetShader()->GetProgram(), "modelMatrix"), 1, false, (float*)&transform);
	glUniformMatrix4fv(glGetUniformLocation(GetShader()->GetProgram(), "textureMatrix"), 1, false, (float*)&GetTextureMatrix());
	glUniform4fv(glGetUniformLocation(GetShader()->GetProgram(), "nodeColour"), 1, (float*)&GetColour());

	/*Draw the branches first to reduce expensive BindTexture calls*/
	glActiveTexture(GL_TEXTURE0);
	glBindTexture(GL_TEXTURE_2D, textures[0].id);
	for (auto it = children.begin(); it != children.end(); ++it) {
		mem_usage += sizeof(LBranchNode);
		(*it)->Render(r, false);
	}
	/*Then draw the "leaves", turning off alpha blending to do so*/
	glBindTexture(GL_TEXTURE_2D, textures[1].id);
	glDisable(GL_BLEND);
	for (auto it = children.begin(); it != children.end(); ++it) {
		for (auto it2 = (*it)->GetChildIteratorStart(); it2 != (*it)->GetChildIteratorEnd(); ++it2) {
			mem_usage += sizeof(LLeafNode) + sizeof(ParticleEmitter);
			(*it2)->Render(r, false);
		}
	}
	glEnable(GL_BLEND);
}
开发者ID:callanwhite,项目名称:GraphicsForGames,代码行数:26,代码来源:LindenmayerTreeNode.cpp

示例5: sizeof

void MacPrinterCanvas::start(float scale) {
	static char szMsg[] = "NEURON";
	scale_ = scale;
	if (!get()) {
		return;
	}
	//if (!Escape(hdc, STARTDOC, sizeof szMsg-1, szMsg, NULL)) {
		//DebugMessage("STARTDOC failed\n");
	//	abort();
	//}
	DOCINFO di;
  di.cbSize      = sizeof(DOCINFO);
  di.lpszDocName = "NEURON";
  di.lpszOutput  = NULL;
	
	StartDoc(hdc, &di);
	StartPage(hdc);
//	SetMapMode(hdc, MM_TWIPS);
	int a = GetMapMode(hdc);
	SIZE b; GetViewportExtEx(hdc, &b);
	POINT c; GetViewportOrgEx(hdc, &c);
	XFORM d; GetWorldTransform(hdc, &d);
	if (a < -10) { return; }
	damage_all();
	RECT r;
	//SetRectRgn(&r, 0, 0, hres_/2, vres_/2);
	r.left = 0; r.top=0; r.right = hres_; r.bottom=vres_;
	beginPaint(hdc, r);
	//SelectClipRgn(hdc, NULL);

	//d.eM11 = d.eM22 *= 2.;	
	//SetWorldTransform(hdc, &d);
}
开发者ID:neurodebian,项目名称:iv-hines,代码行数:33,代码来源:mprinter.cpp

示例6: return

bool SG_Spatial::inside(const MT_Point3 &point) const
{
	MT_Scalar radius = m_worldScaling[m_worldScaling.closestAxis()]*m_radius;
	return (m_worldPosition.distance2(point) <= radius*radius) ?
		m_bbox.transform(GetWorldTransform()).inside(point) :
		false;
}
开发者ID:244xiao,项目名称:blender,代码行数:7,代码来源:SG_Spatial.cpp

示例7: pixelData

void DIBPixelData::setRGBABitmapAlpha(HDC hdc, const IntRect& dstRect, unsigned char level)
{
    HBITMAP bitmap = static_cast<HBITMAP>(GetCurrentObject(hdc, OBJ_BITMAP));
    DIBPixelData pixelData(bitmap);
    ASSERT(pixelData.bitsPerPixel() == 32);

    IntRect drawRect(dstRect);
    XFORM trans;
    GetWorldTransform(hdc, &trans);
    IntSize transformedPosition(trans.eDx, trans.eDy);
    drawRect.move(transformedPosition);

    int pixelDataWidth = pixelData.size().width();
    int pixelDataHeight = pixelData.size().height();
    IntRect bitmapRect(0, 0, pixelDataWidth, pixelDataHeight);
    drawRect.intersect(bitmapRect);
    if (drawRect.isEmpty())
        return;

    RGBQUAD* bytes = reinterpret_cast<RGBQUAD*>(pixelData.buffer());
    bytes += drawRect.y() * pixelDataWidth;

    size_t width = drawRect.width();
    size_t height = drawRect.height();
    int x = drawRect.x();
    for (size_t i = 0; i < height; i++) {
        RGBQUAD* p = bytes + x;
        for (size_t j = 0; j < width; j++) {
            p->rgbReserved = level;
            p++;
        }
        bytes += pixelDataWidth;
    }
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:34,代码来源:DIBPixelData.cpp

示例8: _cairo_win32_display_surface_unset_clip

void
_cairo_win32_display_surface_unset_clip (cairo_win32_display_surface_t *surface)
{
    XFORM saved_xform;
    int gm = GetGraphicsMode (surface->win32.dc);
    if (gm == GM_ADVANCED) {
	GetWorldTransform (surface->win32.dc, &saved_xform);
	ModifyWorldTransform (surface->win32.dc, NULL, MWT_IDENTITY);
    }

    /* initial_clip_rgn will either be a real region or NULL (which means reset to no clip region) */
    SelectClipRgn (surface->win32.dc, surface->initial_clip_rgn);

    if (surface->had_simple_clip) {
	/* then if we had a simple clip, intersect */
	IntersectClipRect (surface->win32.dc,
			   surface->win32.extents.x,
			   surface->win32.extents.y,
			   surface->win32.extents.x + surface->win32.extents.width,
			   surface->win32.extents.y + surface->win32.extents.height);
    }

    if (gm == GM_ADVANCED)
	SetWorldTransform (surface->win32.dc, &saved_xform);
}
开发者ID:AlexShiLucky,项目名称:luapower-all,代码行数:25,代码来源:cairo-win32-display-surface.c

示例9: glBindTexture

	void	cScreenCapture::Render(Vector3 e_vPos,int e_iWidth,int e_iHeight)
	{
		if( m_uiWidth == -1 )
			return;
		glBindTexture( GL_TEXTURE_2D, m_uiTextureID);
		e_iWidth /= 2;
		e_iHeight /= 2;

		float	l_fTexPointer[] = {  0,1,
									 1,1,
									 0,0,
									 1,0};
		
		float	l_Vertices[] = { (float)-e_iWidth,(float)-e_iHeight,0,
								 (float)e_iWidth, (float)-e_iHeight,0,
								 (float)-e_iWidth, (float)e_iHeight,0,
								 (float)e_iWidth,(float)e_iHeight,0};

		cMatrix44	l_mat = cMatrix44::TranslationMatrix(Vector3((float)(e_vPos.x+e_iWidth),(float)(e_vPos.y+e_iHeight), e_vPos.z));
		SetupShaderWorldMatrix(l_mat*GetWorldTransform());
		myGlVertexPointer(3,l_Vertices);
		myGlUVPointer(2,l_fTexPointer);
		ASSIGN_2D_COLOR(Vector4::One);
		MY_GLDRAW_ARRAYS(GL_TRIANGLE_STRIP, 0, 4);

	}
开发者ID:fatmingwang,项目名称:FM79979,代码行数:26,代码来源:FrameBuffer.cpp

示例10: RenderPlayfieldEffect

void StencilEffects::RenderPlayfieldEffect()
{
    if (!GAMECONTEXT)
        return;

    auto playfield = PLAYFIELD.Get();
    if (!playfield)
        return;

    if (!m_bPlayfieldEffectVisible)
        return;

    GraphicsDriver::Instance()->SetTransform(GraphicsDriver::TS_World, playfield->GetWorldTransform());
    if (m_TilesVB.IsValid())
    {
        // Fill stencil with 1s
        GraphicsDriver::Instance()->SetStencilFunc(GraphicsDriver::CF_Always, 1, 0xff);
        GraphicsDriver::Instance()->SetStencilOps(GraphicsDriver::SO_Keep, GraphicsDriver::SO_Keep, GraphicsDriver::SO_Replace);

        m_TilesMaterial->Begin();
        m_TilesMaterial->GetShader()->GetConstant("uAmbientColor")->Set(&Color::White, 1);
        m_TilesMaterial->GetShader()->Begin();
        m_TilesVB->Begin(m_TilesMaterial->GetShader());
        m_TilesVB->Draw();
    }

    GraphicsDriver::Instance()->SetRenderState(GraphicsDriver::RS_StencilWriting, 0); // no more writing into the stencil buffer
    GraphicsDriver::Instance()->SetStencilFunc(GraphicsDriver::CF_NotEqual, 1, 0xff); // Render only where stencil is not 1

    m_DefaultMaterial->Begin();
    m_DefaultMaterial->GetShader()->GetConstant("uAmbientColor")->Set(&m_PlayfieldHighlight, 1);
    m_DefaultMaterial->GetShader()->Begin();
    m_PlayfieldVB->Begin(m_DefaultMaterial->GetShader());
    m_PlayfieldVB->Draw();
}
开发者ID:aminere,项目名称:StarportsPublic,代码行数:35,代码来源:StencilEffects.cpp

示例11: GetWorld

void DynamicEntityNode::DynamicMove(sf::Vector2f Disp, bool SweepBothDirections)
{
	unsigned int CollisionMask = eCollisionGroup::Monster | eCollisionGroup::Static | eCollisionGroup::Player | eCollisionGroup::Pickup;
	float SweepTmax = 1.5f;

	if (SweepBothDirections)
	{
		if (Disp.x != 0.0f)
		{
			HitInfo Hit;
			GetWorld()->GetQuadTree()->SweepShapeClosest(*GetCollisionShape(), GetWorldTransform(), sf::Vector2f(Disp.x, 0.0f), SweepTmax, CollisionMask, this, Hit);

			if (Hit.m_pObject)
			{
				Disp.x = 0.0f;
				OnTouch(Hit.m_pObject);
			}
		}

		if (Disp.y != 0.0f)
		{
			HitInfo Hit;
			GetWorld()->GetQuadTree()->SweepShapeClosest(*GetCollisionShape(), GetWorldTransform(), sf::Vector2f(0.0f, Disp.y), SweepTmax, CollisionMask, this, Hit);

			if (Hit.m_pObject)
			{
				Disp.y = 0.0f;
				OnTouch(Hit.m_pObject);
			}
		}
	}
	else
	{
		HitInfo Hit;
		GetWorld()->GetQuadTree()->SweepShapeClosest(*GetCollisionShape(), GetWorldTransform(), Disp, SweepTmax, CollisionMask, this, Hit);

		if (Hit.m_pObject)
		{
			Disp.x = 0.0f;
			Disp.y = 0.0f;
			OnTouch(Hit.m_pObject);
		}
	}

	Move(Disp);
}
开发者ID:Soth1985,项目名称:Survive,代码行数:46,代码来源:dynamic_entity_node.cpp

示例12: FrostEnemies

void FrostTower::FrostEnemies(){
	//Get the near enemies vector
	std::vector<Enemy *> enemies = mGame.GetWorld().GetEnemiesInRange(GetWorldTransform().GetTranslation(), 100.0f);

	for (Enemy * enemy : enemies){
		enemy->Slow();
	}
}
开发者ID:caioteixeira,项目名称:TowerDefense,代码行数:8,代码来源:FrostTower.cpp

示例13: _cairo_win32_save_initial_clip

static cairo_int_status_t
_cairo_win32_save_initial_clip (HDC hdc, cairo_win32_display_surface_t *surface)
{
    RECT rect;
    int clipBoxType;
    int gm;
    XFORM saved_xform;

    /* GetClipBox/GetClipRgn and friends interact badly with a world transform
     * set.  GetClipBox returns values in logical (transformed) coordinates;
     * it's unclear what GetClipRgn returns, because the region is empty in the
     * case of a SIMPLEREGION clip, but I assume device (untransformed) coordinates.
     * Similarly, IntersectClipRect works in logical units, whereas SelectClipRgn
     * works in device units.
     *
     * So, avoid the whole mess and get rid of the world transform
     * while we store our initial data and when we restore initial coordinates.
     *
     * XXX we may need to modify x/y by the ViewportOrg or WindowOrg
     * here in GM_COMPATIBLE; unclear.
     */
    gm = GetGraphicsMode (hdc);
    if (gm == GM_ADVANCED) {
	GetWorldTransform (hdc, &saved_xform);
	ModifyWorldTransform (hdc, NULL, MWT_IDENTITY);
    }

    clipBoxType = GetClipBox (hdc, &rect);
    if (clipBoxType == ERROR) {
	_cairo_win32_print_gdi_error (__FUNCTION__);
	SetGraphicsMode (hdc, gm);
	/* XXX: Can we make a more reasonable guess at the error cause here? */
	return _cairo_error (CAIRO_STATUS_DEVICE_ERROR);
    }

    surface->win32.extents.x = rect.left;
    surface->win32.extents.y = rect.top;
    surface->win32.extents.width = rect.right - rect.left;
    surface->win32.extents.height = rect.bottom - rect.top;

    surface->initial_clip_rgn = NULL;
    surface->had_simple_clip = FALSE;

    if (clipBoxType == COMPLEXREGION) {
	surface->initial_clip_rgn = CreateRectRgn (0, 0, 0, 0);
	if (GetClipRgn (hdc, surface->initial_clip_rgn) <= 0) {
	    DeleteObject(surface->initial_clip_rgn);
	    surface->initial_clip_rgn = NULL;
	}
    } else if (clipBoxType == SIMPLEREGION) {
	surface->had_simple_clip = TRUE;
    }

    if (gm == GM_ADVANCED)
	SetWorldTransform (hdc, &saved_xform);

    return CAIRO_STATUS_SUCCESS;
}
开发者ID:AlexShiLucky,项目名称:luapower-all,代码行数:58,代码来源:cairo-win32-display-surface.c

示例14: GetWorldTransform

        KFbxXMatrix FilmboxNode::GetLocalTransform( int frame ) const
        {
            KFbxXMatrix world_transform  = GetWorldTransform( frame );
            KFbxXMatrix parent_transform = GetParentWorldTransform( frame );
            KFbxXMatrix world_to_local   = parent_transform.Inverse();
            KFbxXMatrix local_transform  = world_to_local * world_transform;

            return local_transform;
        }
开发者ID:sunzhiyuan,项目名称:opencl,代码行数:9,代码来源:FilmboxNode.cpp

示例15:

        //----------------------------------------------------------------
		/// Get World Orientation
		///
		/// @return Orientation quaternion relative to parent
		//----------------------------------------------------------------
		const Quaternion& Transform::GetWorldOrientation() const
		{
            if(mpParentTransform)
            {
                mqWorldOrientation = Core::Quaternion(GetWorldTransform());
                return mqWorldOrientation;
            }
            
            return mqOrientation;
		}
开发者ID:mclaughlinhugh4,项目名称:ChilliSource,代码行数:15,代码来源:Transform.cpp


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