コード例 #1
0
	Renderer::Renderer()
	{  
		this->factory = nullptr;
		this->adapter = nullptr;
		this->swapChain = nullptr;
		this->device = nullptr;
		this->context = nullptr;
		this->RTView = nullptr;
		this->SBatch = nullptr;
		this->SFont = nullptr;
		this->textureInputLayout = nullptr;
		this->textureVShader = nullptr;
		this->texturePShader = nullptr;
		this->boundShader = SHADER_TYPE_NONE;
		this->colorVShader = nullptr;
		this->colorPShader = nullptr;
		this->colorInputLayout = nullptr;
		this->colorCBuffer = nullptr;
		this->worldCBuffer = nullptr;
		this->viewCBuffer = nullptr;
		this->projectionCBuffer = nullptr;
		this->rsDisableCull = nullptr;
		this->rsCullFront = nullptr;
		this->rsDefault = nullptr;
		this->defaultSampler = nullptr;
		this->camera = Camera3D();
	}
コード例 #2
0
RenderTechnique::PassElm RenderTechnique::addPassDome( NameID& name, unsigned int texCount, Effect* effect, int width, int height, bool renderToCanvas )
{
	for( PassElm p = m_passes.FirstPointer(); !p.IsEmpty(); p.Next() )
		if( p() && name == p()->name )
			return( PassElm() );
	if( static_cast<int>(texCount) > Global::use().engine->getTextureUnitsCount() )
		return( PassElm() );
	Engine::WindowRect wr;
	Global::use().engine->getWindowRect( wr );
	if( width <= 0 )
		width = wr.width;
	if( height <= 0 )
		height = wr.height;
	Pass* p = new Pass( name );
	PassElm pass = m_passes.AddPointer( p );
	if( pass.IsEmpty() )
	{
		DELETE_OBJECT( p );
		return( PassElm() );
	}
	p->inputTextures.Reserve( texCount );
	p->inputTexturesMine.Reserve( texCount );
	for( unsigned int i = 0; i < p->inputTextures.Size(); i++ )
	{
		p->inputTextures[ i ] = 0;
		p->inputTexturesMine[ i ] = false;
	}
	p->outputMaterial = xnew Material();
	p->outputMaterial->setEffect( effect );
	p->outputScene = xnew SpriteBatch( 6 );
	float asp = (float)width / (float)height;
	float d = sqrt( 1.0f + ( asp * asp ) );
	float D = sqrt( 2.0f * ( d * d ) );
	p->outputScene->setCamera( xnew Camera3D( 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, false, 45.0f, asp, d * 0.5f, D * 2.0f) );
	p->isDome = true;
	p->outputQuad = xnew SpriteBatch::Sprite();
	p->outputQuad->setMaterial( p->outputMaterial );
	p->outputQuad->reserve( 24 );
	// +x
	p->outputQuad->access( 0 )->vertex.position = XeCore::XeHalfVector( d, d, d );
	p->outputQuad->access( 1 )->vertex.position = XeCore::XeHalfVector( d, -d, d );
	p->outputQuad->access( 2 )->vertex.position = XeCore::XeHalfVector( d, -d, -d );
	p->outputQuad->access( 3 )->vertex.position = XeCore::XeHalfVector( d, d, -d );
	// +y
	p->outputQuad->access( 4 )->vertex.position = XeCore::XeHalfVector( d, d, d );
	p->outputQuad->access( 5 )->vertex.position = XeCore::XeHalfVector( -d, d, d );
	p->outputQuad->access( 6 )->vertex.position = XeCore::XeHalfVector( -d, d, -d );
	p->outputQuad->access( 7 )->vertex.position = XeCore::XeHalfVector( d, d, -d );
	// +z
	p->outputQuad->access( 8 )->vertex.position = XeCore::XeHalfVector( -d, d, d );
	p->outputQuad->access( 9 )->vertex.position = XeCore::XeHalfVector( -d, -d, d );
	p->outputQuad->access( 10 )->vertex.position = XeCore::XeHalfVector( d, -d, d );
	p->outputQuad->access( 11 )->vertex.position = XeCore::XeHalfVector( d, d, d );
	// -x
	p->outputQuad->access( 12 )->vertex.position = XeCore::XeHalfVector( -d, d, d );
	p->outputQuad->access( 13 )->vertex.position = XeCore::XeHalfVector( -d, -d, d );
	p->outputQuad->access( 14 )->vertex.position = XeCore::XeHalfVector( -d, -d, -d );
	p->outputQuad->access( 15 )->vertex.position = XeCore::XeHalfVector( -d, d, -d );
	// -y
	p->outputQuad->access( 16 )->vertex.position = XeCore::XeHalfVector( d, -d, d );
	p->outputQuad->access( 17 )->vertex.position = XeCore::XeHalfVector( -d, -d, d );
	p->outputQuad->access( 18 )->vertex.position = XeCore::XeHalfVector( -d, -d, -d );
	p->outputQuad->access( 19 )->vertex.position = XeCore::XeHalfVector( d, -d, -d );
	// -z
	p->outputQuad->access( 20 )->vertex.position = XeCore::XeHalfVector( -d, d, -d );
	p->outputQuad->access( 21 )->vertex.position = XeCore::XeHalfVector( -d, -d, -d );
	p->outputQuad->access( 22 )->vertex.position = XeCore::XeHalfVector( d, -d, -d );
	p->outputQuad->access( 23 )->vertex.position = XeCore::XeHalfVector( d, d, -d );
	for( unsigned int i = 0; i < 24; i++ )
	{
		p->outputQuad->access( i )->vertex.color = XeCore::XeHalfVector( 1.0f, 1.0f, 1.0f );
		p->outputQuad->access( i )->vertex.coords = p->outputQuad->access( i )->vertex.position.Normalize();
	}
	p->outputScene->attach( p->outputQuad );
	if( renderToCanvas )
	{
		p->outputCanvas = xnew Canvas( width, height );
		p->outputScene->setCanvas( p->outputCanvas );
		p->outputCanvas->setClearOnActivate( true );
	}
	return( pass );
}