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


C++ Sky::init方法代码示例

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


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

示例1: initApp

void CubeMapApp::initApp()
{
	D3DApp::initApp();

	fx::InitAll(md3dDevice);
	InputLayout::InitAll(md3dDevice);
	GetTextureMgr().init(md3dDevice);


	mTech                = fx::CubeMapFX->GetTechniqueByName("CubeMapTech");
	mfxLightVar          = fx::CubeMapFX->GetVariableByName("gLight");
	mfxEyePosVar         = fx::CubeMapFX->GetVariableByName("gEyePosW");
	mfxWVPVar            = fx::CubeMapFX->GetVariableByName("gWVP")->AsMatrix();
	mfxWorldVar          = fx::CubeMapFX->GetVariableByName("gWorld")->AsMatrix();
	mfxTexMtxVar         = fx::CubeMapFX->GetVariableByName("gTexMtx")->AsMatrix();
	mfxReflectMtrlVar    = fx::CubeMapFX->GetVariableByName("gReflectMtrl")->AsVector();
	mfxCubeMapEnabledVar = fx::CubeMapFX->GetVariableByName("gCubeMapEnabled")->AsScalar();
	mfxDiffuseMapVar     = fx::CubeMapFX->GetVariableByName("gDiffuseMap")->AsShaderResource();
	mfxSpecMapVar        = fx::CubeMapFX->GetVariableByName("gSpecMap")->AsShaderResource();
	mfxCubeMapVar        = fx::CubeMapFX->GetVariableByName("gCubeMap")->AsShaderResource();

 
	//mClearColor = D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f);

	GetCamera().position() = D3DXVECTOR3(0.0f, 1.8f, -10.0f);

	mBallMapRV        = GetTextureMgr().createTex(L"blackdiffuse.dds");
	//mSpecMapRV        = GetTextureMgr().createTex(L"spec.dds");
	mDefaultSpecMapRV = GetTextureMgr().createTex(L"defaultspec.dds");
	mEnvMapRV         = GetTextureMgr().createCubeTex(L"grassenvmap1024.dds");

	mFloor.init(md3dDevice, 41, 21, 1.0f);
	mBase.init(md3dDevice, 2.0f);
	mBall.init(md3dDevice, 0.5f, 30, 30);
	mColumn.init(md3dDevice, 0.25f, 1.0f, 3.0f, 30, 30);
	mSky.init(md3dDevice, mEnvMapRV, 5000.0f);

 
	mParallelLight.dir      = D3DXVECTOR3(0.57735f, -0.57735f, 0.57735f);
	mParallelLight.ambient  = D3DXCOLOR(0.3f, 0.3f, 0.3f, 1.0f);
	mParallelLight.diffuse  = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
	mParallelLight.specular = D3DXCOLOR(0.5f, 0.5f, 0.5f, 1.0f);
}
开发者ID:Team306,项目名称:BigProject,代码行数:43,代码来源:main.cpp

示例2: initApp

void TerrainApp::initApp()
{
	D3DApp::initApp();

	fx::InitAll(md3dDevice);
	InputLayout::InitAll(md3dDevice);
	GetTextureMgr().init(md3dDevice);

	mClearColor = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);

	GetCamera().position() = D3DXVECTOR3(0.0f, 10.0f, -10.0f);

	mEnvMapRV = GetTextureMgr().createCubeTex(L"grassenvmap1024.dds");
	mSky.init(md3dDevice, mEnvMapRV, 5000.0f);

	Terrain::InitInfo tii;
	tii.HeightmapFilename = L"coastMountain513.raw";
	tii.LayerMapFilename0 = L"grass.dds";
	tii.LayerMapFilename1 = L"lightdirt.dds";
	tii.LayerMapFilename2 = L"darkdirt.dds";
	tii.LayerMapFilename3 = L"stone.dds";
	tii.LayerMapFilename4 = L"snow.dds";
	tii.BlendMapFilename  = L"blend.dds";
	tii.HeightScale  = 0.35f;
	tii.HeightOffset = -20.0f;
	tii.NumRows      = 513;
	tii.NumCols      = 513;
	tii.CellSpacing  = 1.0f;

	mLand.init(md3dDevice, tii);
 
	mParallelLight.dir      = D3DXVECTOR3(0.707f, -0.707f, 0.0f);
	mParallelLight.ambient  = D3DXCOLOR(0.3f, 0.3f, 0.3f, 1.0f);
	mParallelLight.diffuse  = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
	mParallelLight.specular = D3DXCOLOR(0.5f, 0.4843f, 0.3f, 1.0f);

	mLand.setDirectionToSun(-mParallelLight.dir);
}
开发者ID:derekqian,项目名称:d3dcoder,代码行数:38,代码来源:Terrain+Demo.cpp

示例3: initApp

void ColoredCubeApp::initApp()
{
	D3DApp::initApp();
	
	myOutFile.open("debug.txt");

	fx::InitAll(md3dDevice);
	
	mBox.init(md3dDevice, 1.0f);
	mPlane.init(md3dDevice, 1.0f); //we send scale of 1.0f what does that mean??

	
	mTree.initObject(md3dDevice);
	std::string treeFileName = "MediumPolyTree.3ds";
	mTree.load(md3dDevice, treeFileName);
	mTree.createTexturesAll(L"LeafCol.jpg", L"LeafAlpha.jpg", L"mySpec.jpg", L"LeafnormalX_normals.PNG");
	mTree.setCubeMap(Object::createCubeTex(md3dDevice, L"grassenvmap1024.dds"));
	mTree.rotate(-1.5f,0.0f,0.0f);
	mTree.translate(3.0f,-3.0f,-2.6f);

	mObjBox.initObject(md3dDevice);
	std::string boxFileName = "man2.fbx";
	mObjBox.load(md3dDevice, boxFileName);
	mObjBox.createTexturesAll( L"manD.jpg", L"defaultAlpha.jpg", L"defaultspec.dds", L"manN.jpg");
	mObjBox.createTexturesAt(0, L"bricks.dds", L"defaultAlpha.jpg", L"spec.dds", L"womanHairN.jpg");
	mObjBox.setCubeMap(Object::createCubeTex(md3dDevice, L"grassenvmap1024.dds"));
	mObjBox.rotate(0.0f,0.0f,3.14f);
	mObjBox.translate(-3.0f,0.0f,2.5f);
	mObjBox.scale(2.0f,2.0f,2.0f);
	
	
	buildFX();
	buildVertexLayouts();

	//mLights[0].dir      = D3DXVECTOR3(0.57735f, -0.57735f, 0.57735f);
	mLights[0].dir      = D3DXVECTOR3(0.576f, -0.576f, -0.576f);
	mLights[0].ambient  = D3DXCOLOR(0.8f, 0.8f, 0.8f, 1.0f);
	mLights[0].diffuse  = D3DXCOLOR(0.8f, 0.8f, 0.8f, 1.0f);
	mLights[0].specular = D3DXCOLOR(0.5f, 0.5f, 0.5f, 1.0f);

	// Pointlight--position is changed every frame to animate.
	mLights[1].pos      = D3DXVECTOR3(2.0f,2.0f,2.0f);
	mLights[1].ambient  = D3DXCOLOR(0.8f, 0.8f, 0.0f, 1.0f);
	mLights[1].diffuse  = D3DXCOLOR(0.5f, 0.5f, 0.5f, 1.0f);
	mLights[1].specular = D3DXCOLOR(0.5f, 0.5f, 0.5f, 1.0f);
	mLights[1].att.x    = 0.0f;
	mLights[1].att.y    = 1.0f;
	mLights[1].att.z    = 0.0f;
	mLights[1].range    = 120.0f;

	animationTimeElapsed = 0.0f;
	animationTimePrev = mTimer.getGameTime();

	for(int i = 0; i < fireFrameCount; i++)
	{
		std::wostringstream fileName;

		fileName << L"FireAnim\\Fire";

		if(i+1 < 10)
			fileName << L"00";
		else if(i+1 < 100)
			fileName << L"0";

		fileName << i+1 << L".bmp";

		std::wstring wbuffer = fileName.str();
		LPCWSTR usableName = wbuffer.c_str();
		
		HR(D3DX10CreateShaderResourceViewFromFile(md3dDevice,
			usableName, 0, 0, &mFireAnimationMapRVs[i], 0));
	}

	HR(D3DX10CreateShaderResourceViewFromFile(md3dDevice,
		L"bricks.dds", 0, 0, &mCrateMapRV, 0 ));
	
	HR(D3DX10CreateShaderResourceViewFromFile(md3dDevice,
		L"bricks_normal.dds", 0, 0, &mDefaultNormalMapRV, 0 ));

	HR(D3DX10CreateShaderResourceViewFromFile(md3dDevice,
		L"stone_diffuse.dds", 0, 0, &mGrassMapRV, 0 ));
	
	HR(D3DX10CreateShaderResourceViewFromFile(md3dDevice,
		L"stone_normal.dds", 0, 0, &mBrickNormalMapRV, 0 ));

	HR(D3DX10CreateShaderResourceViewFromFile(md3dDevice,
		L"spec.dds", 0, 0, &mSpecularMapRV, 0 ));

	

	

	// If not, create it.
	D3DX10_IMAGE_LOAD_INFO loadInfo;
    loadInfo.MiscFlags = D3D10_RESOURCE_MISC_TEXTURECUBE;

	ID3D10Texture2D* tex = 0;
	HR(D3DX10CreateTextureFromFile(md3dDevice, L"grassenvmap1024.dds", 
		&loadInfo, 0, (ID3D10Resource**)&tex, 0) );

//.........这里部分代码省略.........
开发者ID:ashkanhoss29,项目名称:Resume,代码行数:101,代码来源:Colored+Cube+App.cpp

示例4: InitWindowsApp


//.........这里部分代码省略.........
	descDepth.MipLevels = 1;
	descDepth.ArraySize = 1;
	descDepth.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
	descDepth.SampleDesc.Count = 1;
	descDepth.SampleDesc.Quality = 0;
	descDepth.Usage = D3D10_USAGE_DEFAULT;
	descDepth.BindFlags = D3D10_BIND_DEPTH_STENCIL;
	descDepth.CPUAccessFlags = 0;
	descDepth.MiscFlags = 0;
	md3dDevice->CreateTexture2D( &descDepth, NULL, &mDepthStencil );

	// Create the depth stencil view
	D3D10_DEPTH_STENCIL_VIEW_DESC descDSV;
	ZeroMemory( &descDSV, sizeof(descDSV) );
	descDSV.Format = descDepth.Format;
	descDSV.ViewDimension = D3D10_DSV_DIMENSION_TEXTURE2D;
	descDSV.Texture2D.MipSlice = 0;

	// Bind the render target view and depth/stencil view to the pipeline.
	md3dDevice->CreateDepthStencilView( mDepthStencil, &descDSV, &mDepthStencilView );
	md3dDevice->OMSetRenderTargets( 1, &mRenderTargetView, mDepthStencilView );

	// Set the viewport transform.
	vp.TopLeftX = 0;
	vp.TopLeftY = 0;
	vp.Width    = SCREEN_WIDTH;
	vp.Height   = SCREEN_HEIGHT;
	vp.MinDepth = 0.0f;
	vp.MaxDepth = 1.0f;
	md3dDevice->RSSetViewports(1, &vp);
	//________________________________

	Effects::InitAll(md3dDevice);
	fxU.init(md3dDevice, Effects::MeshFX);

	Terrain::InitInfo tii;
	tii.CellSpacing = 1.0f;
	tii.HeightmapFilename = L"flat513.raw";
	tii.HeightOffset = -30.0f;
	tii.HeightScale = 0.2f;
	tii.NumCols = 513;
	tii.NumRows = 513;
	land.init(md3dDevice, tii);
	//mTerrain.init(md3dDevice, (std::string)"Textures/Terrain/HeightMap.raw", 0.35f, -50.0f, 0.1f, 512, 512);

	//Cube c;
	//c.init(md3dDevice, D3DXVECTOR3(2.0f, 2.0f, 2.0f), D3DXVECTOR3(-16.0f, land.getHeight(-16.0f, -16.0f)+1.0f, -16.0f));
	//mCubes.push_back(c);
	//nr.push_back(0);

	nrOfTowers.push_back(0);
	
	mCubes.resize(10);
	for(int i = 0; i < mCubes.size();i++)
	{
		mCubes[i].init(i, md3dDevice, D3DXVECTOR3(5.0f,5.0f,5.0f), D3DXVECTOR3(0.0f, land.getHeight(0.0f,0.0f), 0.0f), (i*0.50f+0.50f));
		nr.push_back(0);
	}
	pWave = new wave(1, 20, md3dDevice, &land);
	pWave->initMonsters();
	
	mPyramid.init(md3dDevice, D3DXVECTOR3(2.0f, 2.0f, 2.0f), D3DXVECTOR3(-16.0f, land.getHeight(-16.0f, -16.0f)+5.0f, -16.0f));
	mCylinder.init(md3dDevice, 1.0f, D3DXVECTOR3(-2.0f, land.getHeight(-2.0f, -8.0f)+1.0f, -8.0f));

	//GetCamera().setPosY(land.getHeight(GetCamera().getPos().x, GetCamera().getPos().z));
	GetCamera().setLens(0.30f*pi, (float)SCREEN_WIDTH/SCREEN_HEIGHT, 1.0f, 1000.0f);
开发者ID:GameProject,项目名称:Tower,代码行数:67,代码来源:Winmain.cpp


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