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


C++ D3DXCOLOR函数代码示例

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


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

示例1: GetApp

void CommandSystem::Draw() {

	if (!mCommandMode)  return;

	int nHeight = GetApp()->getHeight() * 0.7f;
	GetApp()->text_->SetInsertionPos(50, nHeight);
	GetApp()->text_->SetForegroundColor(D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f));
	GetApp()->text_->DrawFormattedTextLine(mStatusLine.c_str());

	idStr displayString = "edit";
	GetApp()->text_->SetInsertionPos(50, nHeight+10);

	displayString += "> ";
	displayString += mCommand.c_str();	
	if (timeGetTime() & 0x200)
	{
		displayString += "_";
	}
	GetApp()->text_->DrawFormattedTextLine(displayString.c_str());

}
开发者ID:DanielNeander,项目名称:my-3d-engine,代码行数:21,代码来源:CommandSystem.cpp

示例2: tObject

	GameObject::GameObject(int textureIndex, float scale, float posX, float posY, float posZ, float dur, PositionType tPos) :
//	myMesh(NULL),
	//position(&v.Position),
	//color(&v.Color),
	tObject(SPRITE),
	tPosition(tPos),
	velocity(0,0,0),
	lookDirection(1,0,0),
	mMeshOirentation(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),
	duration(dur),
	parent(NULL)
{
	myVertex.TextureIndex = textureIndex;
	myVertex.AnimationSize = 0;
	myVertex.AnimationProgress = 0;
	myVertex.Opacity = 1.f;
	SetColor(D3DXCOLOR(0,0,0,0));
	ScaleTo(scale);
	TranslateTo(posX,posY,posZ);
	RotateTo(0,0,0);
}
开发者ID:3lim,项目名称:marlie,代码行数:21,代码来源:GameObject.cpp

示例3: createTex

Sprite::Sprite(ID3D10Device* p_d3dDevice, float p_x, float p_y, float p_width, float p_height, char* p_fileName, D3D10_VIEWPORT* p_viewPort)
	
{
	m_d3dDevice = p_d3dDevice;
	m_viewPort = p_viewPort;
	
	// Set the sprite's shader resource view
	m_imageSprite.pTexture = createTex(p_fileName);

	m_x = p_x;
	m_y = p_y;

	m_posX = m_x;
	m_posY = m_y;

	m_height = p_height;
	m_width = p_width;

	// top-left location in U,V coords
	m_imageSprite.TexCoord.x = 0;
	m_imageSprite.TexCoord.y = 0;

	// Determine the texture size in U,V coords
	m_imageSprite.TexSize.x = 1.0f;
	m_imageSprite.TexSize.y = 1.0f;

	// Set the texture index. Single textures will use 0
	m_imageSprite.TextureIndex = 0;

	m_imageSprite.ColorModulate = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);

	D3DXMatrixIdentity(&m_matTranslate);
	D3DXMatrixIdentity(&m_matScale);

	D3DXMatrixScaling(&m_matScale, m_width, m_height, 1.0f);
	
	m_anchorPoint = NORMAL;

	m_centerX = false;
}
开发者ID:Philldomd,项目名称:oopro,代码行数:40,代码来源:Sprite.cpp

示例4: ASSERT

KG3DSFXBillboard::KG3DSFXBillboard(KG3DSFX *pSFX)
{
    ASSERT(pSFX);

    m_pSFX = pSFX;

    m_pTexture = NULL;
    m_dwCuttingNum = 1;
    m_pTexture2 = NULL;
    m_dwCuttingNum2 = 1;

    m_fCurrentFrame = -1;

    //m_bLockAxis = FALSE;
    //m_bRotation = FALSE;

    m_bBindToBone = FALSE;
    m_strBoneName = "";

    m_vPositionLine.InsertKeyFrame(0, D3DXVECTOR3(0, 0, 0));
    m_fWidthTimeLine.InsertKeyFrame(0, 50);
    m_fHeightTimeLine.InsertKeyFrame(0, 50);
    m_DiffuseTimeLine.InsertKeyFrame(0, D3DXCOLOR(1, 1, 1, 1));
    m_nTextureFrameIndex.InsertKeyFrame(0, 0);
    m_nTexture2FrameIndex.InsertKeyFrame(0, 0);
    m_vUVTimeLine.InsertKeyFrame(0, D3DXVECTOR2(0, 0));
    m_fRotationTimeLine.InsertKeyFrame(0, 0.f);

    m_dwBindTrackIndex = SFX_NOT_BIND_TO_TRACK;
    m_Rotation = 0.f;
    m_Translation = D3DXVECTOR3(0, 0, 0);

    m_eBlendMode = SFX_BM_SRCALPHA_INVSRCALPHA;
    m_dwRenderTargetTexFlag = 0;
    m_dwBillBoradType = BILLBOARE_TYPE_NORMAL;
    m_pVB = NULL;

    m_fHeight = 0.f;
    m_fWidth  = 0.f;
}
开发者ID:1suming,项目名称:pap2,代码行数:40,代码来源:KG3DSFXBillboard.cpp

示例5: D3DXCOLOR

void MakeStackIcon::onRender(uint flags)
{
	if (!enabled)
		return;
#ifdef DXRENDER
	D3DMATERIAL9 stackIconMaterial = dxr->textureMaterial;
	stackIconMaterial.Diffuse = D3DXCOLOR(1, 1, 1, ease(alpha));
	dxr->device->SetMaterial(&stackIconMaterial);
	Mat33 orientation(NxQuat(90, Vec3(1,0,0)));
	dxr->renderSideLessBox(Vec3(position.x, 10, position.z), orientation, Vec3(size / 2.0f, -size / 2.0f, 1), texMgr->getGLTextureId("widget.vertStack"));
	dxr->device->SetMaterial(&dxr->textureMaterial);
#else
	glPushAttribToken token(GL_ENABLE_BIT);

	//glColor4f(72.0f/255., 149.0f/255., 234.0f/255., 1.0);
	if (alpha == 1.0)
		glColor4d(1, 1, 1, 1);
	else glColor4d(1, 1, 1, ease(alpha));

	glDisable(GL_DEPTH_TEST);
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, texMgr->getGLTextureId("widget.vertStack"));
	glEnable(GL_BLEND);

	glPushMatrix();
	glTranslated(position.x, 0, position.z);
	glScalef(size / 2.0f, 0.2f, size / 2.0f);
	glBegin(GL_TRIANGLE_FAN);
	{
		glNormal3f(0,1,0);
		glTexCoord2f(1,1); 	glVertex3f(-1,1,1);
		glTexCoord2f(0,1); 	glVertex3f(1,1,1);
		glTexCoord2f(0,0); 	glVertex3f(1,1,-1);
		glTexCoord2f(1,0); 	glVertex3f(-1,1,-1);
	}
	glEnd();
	glPopMatrix();
#endif
}
开发者ID:DX94,项目名称:BumpTop,代码行数:39,代码来源:BT_StackIcon.cpp

示例6: textTailAttachTitle

PyObject * textTailAttachTitle(PyObject * poSelf, PyObject * poArgs)
{
	int iVirtualID;
	if (!PyTuple_GetInteger(poArgs, 0, &iVirtualID))
		return Py_BuildException();
	char * szName;
	if (!PyTuple_GetString(poArgs, 1, &szName))
		return Py_BuildException();
	float fr;
	if (!PyTuple_GetFloat(poArgs, 2, &fr))
		return Py_BuildException();
	float fg;
	if (!PyTuple_GetFloat(poArgs, 3, &fg))
		return Py_BuildException();
	float fb;
	if (!PyTuple_GetFloat(poArgs, 4, &fb))
		return Py_BuildException();

	CPythonTextTail::Instance().AttachTitle(iVirtualID, szName, D3DXCOLOR(fr, fg, fb, 1.0f));

	return Py_BuildNone();
}
开发者ID:adi97ida,项目名称:Client,代码行数:22,代码来源:PythonTextTailModule.cpp

示例7: OnFrameRender

static void CALLBACK OnFrameRender(IDirect3DDevice9* pDev,
								   double time,
								   float elapsedTime,
								   void* userContext)
{
	pDev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
				D3DXCOLOR(0.1f, 0.3f, 0.6f, 0.0f), 1.0f, 0);

	if (SUCCEEDED(pDev->BeginScene())) {
#if 0
		pDev->SetTransform(D3DTS_WORLD, &g_matrixWorld);
		pDev->SetTransform(D3DTS_VIEW, &g_matrixView);
		pDev->SetTransform(D3DTS_PROJECTION, &g_matrixProjection);
		pDev->SetLight(0, &g_light);
		pDev->LightEnable(0, TRUE);
		pDev->SetMaterial(&g_material);
		//pDev->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
		pDev->SetRenderState(D3DRS_SPECULARENABLE,TRUE);
#else
		cgD3D9BindProgram(g_cgVertexProgram);
		checkForCgError("binding vertex program");
#endif

		cgSetParameterValuefc(g_cgWorldMatrix, 16, g_matrixWorld.m[0]);
		cgSetParameterValuefc(g_cgWorldViewProjMatrix, 16, g_matrixWorldViewProj.m[0]);
		cgSetParameterValuefc(g_cgAmbient, 3, (float*)&g_light.Ambient);
		cgSetParameterValuefc(g_cgLightColor, 3, (float*)&g_light.Diffuse);
		cgSetParameterValuefc(g_cgLightPos, 3, (float*)&g_light.Position);
		cgSetParameterValuefc(g_cgEyePos, 3, (float*)&g_eyePos);
		cgSetParameterValuefc(g_cgKe, 3, (float*)&g_material.Emissive);
		cgSetParameterValuefc(g_cgKa, 3, (float*)&g_material.Ambient);
		cgSetParameterValuefc(g_cgKd, 3, (float*)&g_material.Diffuse);
		cgSetParameterValuefc(g_cgKs, 3, (float*)&g_material.Specular);
		cgSetParameterValuefc(g_cgShininess, 3, &g_material.Power);

		g_pMeshSphere->DrawSubset(0);
		pDev->EndScene();
	}
}
开发者ID:daodaodaorenjiandao,项目名称:Graphics,代码行数:39,代码来源:main.cpp

示例8: OnD3D11FrameRender

//--------------------------------------------------------------------------------------
// Render the scene using the D3D11 device
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D11FrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext,
								  double fTime, float fElapsedTime, void* pUserContext )
{
	// Clear render target and the depth stencil 
	float ClearColor[4] = { 0.176f, 0.196f, 0.667f, 0.0f };
	ID3D11RenderTargetView* pRTV = DXUTGetD3D11RenderTargetView();
	ID3D11DepthStencilView* pDSV = DXUTGetD3D11DepthStencilView();
	pd3dImmediateContext->ClearRenderTargetView( pRTV, ClearColor );
	pd3dImmediateContext->ClearDepthStencilView( pDSV, D3D11_CLEAR_DEPTH, 1.0, 0 );

	vegetationRendering->draw(pd3dDevice, GameTime(fElapsedTime, fTime));

	std::wstringstream ws;

	ws << DXUTGetFPS();
	
	textHelper.Begin();
	textHelper.SetInsertionPos(5, 5);
	textHelper.SetForegroundColor(vegetationRendering->isInCaptureMode() ? D3DXCOLOR(1,0,0,1) : D3DXCOLOR(1, 1, 0, 1));
	textHelper.DrawTextLine(ws.str().c_str());
	textHelper.End();
}
开发者ID:steinbergerbernd,项目名称:Vegetationrendering,代码行数:25,代码来源:Main.cpp

示例9: EFFECT

EFFECT_LENSFLARE::EFFECT_LENSFLARE(IDirect3DDevice9 *Dev, int _type, D3DXVECTOR3 _position) : EFFECT(Dev)
{
	m_position = _position;
	m_type = _type;
	m_mainAlpha = 0.0f;
	m_inScreen = false;

	//Add Flares
	if(m_type == 0)	//Standard flare
	{
		m_flares.push_back(FLARE(D3DXCOLOR(1.0f, 1.0f, 0.5f, 1.0f), 0.5f, 0.7f, 0));
		m_flares.push_back(FLARE(D3DXCOLOR(0.0f, 1.0f, 0.5f, 1.0f), 1.0f, 1.0f, 1));
		m_flares.push_back(FLARE(D3DXCOLOR(1.0f, 0.5f, 0.5f, 1.0f), 1.5f, 1.3f, 2));
		m_flares.push_back(FLARE(D3DXCOLOR(1.0f, 1.0f, 0.5f, 1.0f), -0.5f, 0.8f, 3));
		m_flares.push_back(FLARE(D3DXCOLOR(0.0f, 1.0f, 0.5f, 1.0f), 0.4f, 1.0f, 4));
		m_flares.push_back(FLARE(D3DXCOLOR(1.0f, 1.0f, 0.5f, 1.0f), 0.75f, 1.0f, 5));
		m_flares.push_back(FLARE(D3DXCOLOR(0.0f, 0.0f, 1.0f, 1.0f), 1.8f, 1.2f, 6));
		m_flares.push_back(FLARE(D3DXCOLOR(1.0f, 1.0f, 0.5f, 1.0f), 2.1f, 0.5f, 4));
	}
	else if(m_type == 1)		//Some other flare etc...
	{
		//setup your own flare here...
	}
}
开发者ID:Alriightyman,项目名称:RTS,代码行数:24,代码来源:effect.cpp

示例10: D3DXMatrixIdentity

void HippoUI_RenderD3D9::DrawSprite(HippoUI_Rect& rect,HippoUI_TextureProxy* pTexProxy,HippoUi_Color& color)
{
	//return;
	IDirect3DTexture9* pTex=(IDirect3DTexture9*)(pTexProxy->GetHardwareTexturePtr());
	//calc scale
	D3DXMATRIXA16 matTransform;
	D3DXMatrixIdentity(&matTransform);

	float scale_x=( float )rect.GetWidth()/pTexProxy->GetRect().GetWidth();
	float scale_y=( float )rect.GetHeight()/pTexProxy->GetRect().GetHeight();
	D3DXMatrixScaling( &matTransform, scale_x, scale_y, 1.0f );
	m_pSprite->SetTransform(&matTransform);
	
	D3DXVECTOR3 vPos( ( float )rect.left, ( float )rect.top, 0.0f );
	vPos.x /= scale_x;
	vPos.y /= scale_y;

	HRESULT res=m_pSprite->Draw(pTex,pTexProxy->GetRect().GetRECT(),0,&vPos,D3DXCOLOR( color.r, color.g, color.b, color.a ));
	if(FAILED(res))
	{
		ReportErr("sprite draw failed");
	}
}
开发者ID:sssa2000,项目名称:AIGameDemo,代码行数:23,代码来源:HippoUI_RenderD3D9.cpp

示例11: render_frame

// render a single frame
void render_frame(void)
{
   // clear the render target (this should be the back buffer) to a deep blue
   g_dev_context_ptr->ClearRenderTargetView(g_render_target_ptr, D3DXCOLOR(0.0f, 0.2f, 0.4f, 1.0f));


   // do 3D render to the render target (this should be the back buffer)

   // select which vertex buffer to display (we only have one, so this is simple)
   UINT stride = sizeof(MY_VERTEX);
   UINT offset = 0;
   g_dev_context_ptr->IASetVertexBuffers(0, 1, &g_vertex_buffer_ptr, &stride, &offset);

   // select the drawing routine for the primitives that will be drawn
   g_dev_context_ptr->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

   // draw the vertex buffer to the render target
   g_dev_context_ptr->Draw(3, 0);


   // switch the back buffer and the front buffer
   g_swap_chain_ptr->Present(0, 0);
}
开发者ID:amdreallyfast,项目名称:directx_graphics_pad,代码行数:24,代码来源:main.cpp

示例12: D3DXVECTOR2

GameSprite::GameSprite(int width, int height)
{
	originalSize.x = (float)width;
	originalSize.y = (float)height;
	frameSize.x = (float)Stats::getTilesize();
	frameSize.y = (float)Stats::getTilesize();
	position.x = 0;
	position.y = 0;
	position.z = 0;
	scale.x = 1;
	scale.y = 1;
	velocity = D3DXVECTOR2(0,0);
	texCoord = D3DXVECTOR2(0,0);
	color = D3DXCOLOR(1, 1, 1, 1);

	hasAnimation = false;
	animationPos = 0;
	numFrames = width / Stats::getTilesize();
	timePerFrame = 200;
	animationRow = 0;

	sprite = new D3DX10_SPRITE();
}
开发者ID:mcmonkey,项目名称:cglory,代码行数:23,代码来源:GameSprite.cpp

示例13: WinMain

// the entry point for any Windows program
int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow)
{
	EngineConfig config;
	// TODO:
	// Load this from a file.
	ZeroMemory(&config, sizeof(EngineConfig));
	config.screen_width = 800;
	config.screen_height = 600;
	config.min_world_coords = D3DXVECTOR3(-5000.0f, -5000.0f, -5000.0f);
	config.max_world_coords = D3DXVECTOR3(5000.0f, 5000.0f, 5000.0f);
	config.num_octree_levels = 4;
	config.near_clip = 0.1f;
	config.far_clip = 5000.0f;
	config.fov = 45.0f;
	config.ambient_color = D3DXVECTOR3(0.1f, 0.1f, 0.1f);
	config.background_color = D3DXCOLOR(0.0f, 0.0f, 0.0f, 0.0f);
	config.camera_speed = 0.06f;
	config.mouse_sensitivity = 0.01f;

	config.hInstance = hInstance;
	config.hPrevInstance = hPrevInstance;
	config.lpCmdLine = lpCmdLine;
	config.nCmdShow = nCmdShow;
	config.draw_debug_objects = false;

	config.window_class_name = "GameWindow";
	config.window_caption = "Hi, this is 3D, coming to you in 2D(where available)";

	g_engine = new Engine(config);
	InitObjects();
	WPARAM main_loop_result = Engine::instance->MainLoop();

	return main_loop_result;
}
开发者ID:x1024,项目名称:D3D-Renderer,代码行数:38,代码来源:main.cpp

示例14: __ApplyDiffuseRenderState

void CGrannyMaterial::__ApplySpecularRenderState()
{
	if (TRUE == STATEMANAGER.GetRenderState(D3DRS_ALPHABLENDENABLE))
	{
		__ApplyDiffuseRenderState();
		return;
	}

	CGraphicTexture* pkTexture=ms_akSphereMapInstance[m_bSphereMapIndex].GetTexturePointer();

	STATEMANAGER.SetTexture(0, GetD3DTexture(0));

	if (pkTexture)
		STATEMANAGER.SetTexture(1, pkTexture->GetD3DTexture());
	else
		STATEMANAGER.SetTexture(1, NULL);

	STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, D3DXCOLOR(g_fSpecularColor.r, g_fSpecularColor.g, g_fSpecularColor.b, __GetSpecularPower()));
	STATEMANAGER.SaveTextureStageState(1, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR);
	STATEMANAGER.SaveTextureStageState(0, D3DTSS_COLORARG1,	D3DTA_TEXTURE);
	STATEMANAGER.SaveTextureStageState(0, D3DTSS_COLORARG2,	D3DTA_DIFFUSE);
	STATEMANAGER.SaveTextureStageState(0, D3DTSS_COLOROP,	D3DTOP_MODULATE);
	STATEMANAGER.SaveTextureStageState(0, D3DTSS_ALPHAARG1,	D3DTA_TEXTURE);
	STATEMANAGER.SaveTextureStageState(0, D3DTSS_ALPHAARG2,	D3DTA_TFACTOR);
	STATEMANAGER.SaveTextureStageState(0, D3DTSS_ALPHAOP,	D3DTOP_MODULATE);

	STATEMANAGER.SetTextureStageState(1, D3DTSS_COLORARG1,	D3DTA_CURRENT);
	STATEMANAGER.SetTextureStageState(1, D3DTSS_COLORARG2,	D3DTA_TEXTURE);
	STATEMANAGER.SetTextureStageState(1, D3DTSS_COLOROP,	D3DTOP_MODULATEALPHA_ADDCOLOR);
	STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAARG1,	D3DTA_CURRENT);
	STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAOP,	D3DTOP_SELECTARG1);

	STATEMANAGER.SetTransform(D3DTS_TEXTURE1, &ms_matSpecular);
	STATEMANAGER.SaveTextureStageState(1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2);
	STATEMANAGER.SaveTextureStageState(1, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP);
	STATEMANAGER.SaveTextureStageState(1, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP);
}
开发者ID:adi97ida,项目名称:Client,代码行数:37,代码来源:Material.cpp

示例15: D3DXLoadMeshFromX

bool XModel::load(std::string filename, std::string texturedir) {
	LPD3DXBUFFER materialBuffer;

	HRESULT res;
	res = D3DXLoadMeshFromX(filename.c_str(), D3DXMESH_SYSTEMMEM, mamain->d3ddev, NULL, &materialBuffer, NULL, &materialCount, &mesh);

	if (FAILED(res)) {
		ErrorHandleCritical(mamain->err, mamain->errCrit, ErrorD3D9, res, "D3DXLoadMeshFromX");
		return false;
	}

	D3DXMATERIAL* xMaterials = (D3DXMATERIAL* )materialBuffer->GetBufferPointer();

	materials = new D3DMATERIAL9[materialCount];
	textures  = new LPDIRECT3DTEXTURE9[materialCount];

	memset(materials, 0, materialCount * sizeof(D3DMATERIAL9));
	memset(textures, 0, materialCount * sizeof(LPDIRECT3DTEXTURE9));

	for (uint i = 0; i < materialCount; ++i) {
		materials[i] = xMaterials[i].MatD3D;
		materials[i].Ambient = D3DXCOLOR(0.0, 0.0, 0.0, 0.0);

		textures[i] = NULL;
		if (xMaterials[i].pTextureFilename != NULL && lstrlen(xMaterials[i].pTextureFilename) > 0) {
			std::string file = texturedir + '/' + xMaterials[i].pTextureFilename;

			res = D3DXCreateTextureFromFile(mamain->d3ddev, file.c_str(), &textures[i]);

			if (FAILED(res))
				ErrorHandleCritical(mamain->err, mamain->errCrit, ErrorCreateTexFromFile, res, file);
		}
	}

	materialBuffer->Release();
	return true;
}
开发者ID:gitter-badger,项目名称:MA-Engine,代码行数:37,代码来源:ModelX.cpp


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