예제 #1
0
파일: CubeMap.cpp 프로젝트: 2asoft/xray
// LAM - 4/21/03 - enumerate files for archiving
void CubeMap::EnumAuxFiles(NameEnumCallback& nameEnum, DWORD flags)
{
	if ((flags&FILE_ENUM_CHECK_AWORK1)&&TestAFlag(A_WORK1)) return;

	if (GetCubeMapFile())
	{
		TCHAR *cubeMapPath = FindMapFile(GetCubeMapFile());
		if (cubeMapPath)
		{
			if (!(flags&FILE_ENUM_MISSING_ONLY)) 
				nameEnum.RecordName(cubeMapPath);
		}
		else
		{	if (flags&FILE_ENUM_MISSING_ONLY)
				nameEnum.RecordName(GetCubeMapFile());
		}
	}
	
	if (GetVertexShaderFile())
	{
		TCHAR *vertexShaderPath = FindMapFile(GetVertexShaderFile());
		if (vertexShaderPath)
		{
			if (!(flags&FILE_ENUM_MISSING_ONLY)) 
				nameEnum.RecordName(vertexShaderPath);
		}
		else
		{	if (flags&FILE_ENUM_MISSING_ONLY)
				nameEnum.RecordName(GetVertexShaderFile());
		}
	}
	
	ReferenceTarget::EnumAuxFiles(nameEnum, flags);
}
예제 #2
0
파일: CubeMap.cpp 프로젝트: 2asoft/xray
HRESULT IDX8PixelShaderImp::Initialize(Material *mtl, INode *node)
{
	HRESULT hr = S_OK;

	if (map->GetInitPS()) {

		TCHAR *cubeMapPath = FindMapFile(map->GetCubeMapFile());
		
		if(!cubeMapPath)
			hr = E_FAIL;
		else
		{
			SAFE_RELEASE(pCubeTexture);
			hr = D3DXCreateCubeTextureFromFileEx(pd3dDevice,
				cubeMapPath,
				D3DX_DEFAULT,
				1,
				0,
				D3DFMT_UNKNOWN,
				D3DPOOL_MANAGED,
				D3DX_FILTER_LINEAR,
				D3DX_FILTER_LINEAR,
				0,
				NULL,
				NULL,
				&pCubeTexture);
		}
		
		map->SetInitPS(false);
	}

	return hr;
}
예제 #3
0
파일: Boot.cpp 프로젝트: Tinob/Ishiiruka
bool CBoot::LoadMapFromFilename()
{
  std::string strMapFilename;
  bool found = FindMapFile(&strMapFilename, nullptr);
  if (found && g_symbolDB.LoadMap(strMapFilename))
  {
    UpdateDebugger_MapLoaded();
    return true;
  }

  return false;
}
예제 #4
0
파일: CubeMap.cpp 프로젝트: 2asoft/xray
HRESULT IDX8PixelVertexShaderImp::LoadAndCompileShader()
{
		// VertexShader Instructions
		DWORD dwDecl[] =
		{
			D3DVSD_STREAM(0),
				D3DVSD_REG(0, D3DVSDT_FLOAT3),
				D3DVSD_REG(1, D3DVSDT_FLOAT3),
				D3DVSD_END()
		};

		HRESULT hr;
		TCHAR *vertexShaderPath = FindMapFile(map->GetVertexShaderFile());
		
		if(!vertexShaderPath)
		{
			return E_FAIL;
		}
		
		
		hr = D3DXAssembleShaderFromFile(vertexShaderPath , 0, NULL, &pCode, NULL);
		
		if (dwVertexShader) {
			pd3dDevice->DeleteVertexShader(dwVertexShader);
		}
		
		if(FAILED(hr))
		{
			return E_FAIL;
		}
		

		hr = pd3dDevice->CreateVertexShader(dwDecl,	(LPDWORD)pCode->GetBufferPointer(), &dwVertexShader, 0);

		return hr;

}
예제 #5
0
HRESULT SampleShaderPluginVertexShader::InitValid(Mesh *mesh, INode *node) 
{
	
	HRESULT hr = S_OK;
	m_pINode = node;
	
    // Create a vertex shader for doing the effect
	
	LPD3DXBUFFER *ppCode = &pCode;
	
    LPD3DXBUFFER pBuffer = NULL;
	
	//! VertexShader Declarations
	
	
	//! VertexShader Constants
	Constants.SetCount(20);
	
	//! set up the material vertex color ... 
    D3DMATERIAL8 mtrl;
	ZeroMemory( &mtrl, sizeof(D3DMATERIAL8) );
	
	mtrl.Diffuse.r = mtrl.Ambient.r = m_MtlColor.r;
	mtrl.Diffuse.g = mtrl.Ambient.g = m_MtlColor.g;
	mtrl.Diffuse.b = mtrl.Ambient.b = m_MtlColor.b;
	mtrl.Diffuse.a = mtrl.Ambient.a = 1.0f;
    pd3dDevice->SetMaterial( &mtrl );
    pd3dDevice->SetRenderState( D3DRS_LIGHTING, TRUE );
    pd3dDevice->SetRenderState( D3DRS_AMBIENT, 0xffffffff );	
	/*!
	* D3DXAssembleShader
	* Assembles an ASCII description of a shader into binary form, where the shader source is in memory.
	*
	* @param pSrcData : [in] Pointer to the source code. 
	* @param SrcDataLen : [in] Size of the source code, in bytes. 
	* @param Flags : [in] A combination of the following flags, specifying assembly options. 
	* D3DXASM_DEBUG Inserts debugging information as comments in the assembled shader. 
	* D3DXASM_SKIPVALIDATION Do not validate the generated code against known capabilities and constraints. This option is recommended only when assembling a shader you know will function (that is, the shader has been assembled before without this option.) 
	* @param ppConstants : [out] Returns a pointer to an ID3DXBuffer interface, representing the returned constant declarations. These constants are returned as a vertex shader declaration fragment. It is up to the application to insert the contents of this buffer into their declaration. For pixel shaders this parameter is meaningless because constant declarations are included in the assembled shader. This parameter is ignored if it is NULL. 
	* @param ppCompiledShader : [out] Returns a pointer to an ID3DXBuffer interface, representing the returned compiled object code. This parameter is ignored if it is NULL. 
	* @param ppCompilationErrors : [out] Returns a pointer to an ID3DXBuffer interface, representing the returned ASCII error messages. This parameter is ignored if it is NULL. 
	*
	* @return HRESULT  : 
	
	  HRESULT D3DXAssembleShader(
	  LPCVOID pSrcData,
	  UINT SrcDataLen,
	  DWORD Flags,
	  LPD3DXBUFFER* ppConstants,
	  LPD3DXBUFFER* ppCompiledShader,
	  LPD3DXBUFFER* ppCompilationErrors
	  );
	  
	*/
    //! Specify the vertex format that the vertex shader will be using for doing the effect
    DWORD dwVertexFormatDefinition[] =
    {
        D3DVSD_STREAM( 0 ),	D3DVSD_REG( 0, D3DVSDT_FLOAT3 ),     // v0 = Position
		D3DVSD_REG( 1, D3DVSDT_FLOAT3 ),     // v1 = Normal
		D3DVSD_END()
    };	
	
#if 0
	TCHAR *vertexShaderPath = FindMapFile("ambient.njv");	
	hr = D3DXAssembleShaderFromFile(vertexShaderPath , 0, NULL, &pCode, NULL);
#else
	hr = D3DXAssembleShader( SurfaceShader , sizeof(SurfaceShader)-1 , 0 , NULL , &pCode , NULL ); 
#endif
	
	hr = pd3dDevice->CreateVertexShader(dwVertexFormatDefinition,(LPDWORD)pCode->GetBufferPointer(), &dwVertexShader, 0);
	
	initDone = true;
	
	return hr;
	
}