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


C++ InitializeBuffers函数代码示例

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


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

示例1: InitializeBuffers

bool Rectangle2DClass::Initialize(ID3D11Device * device, ID3D11DeviceContext* context, int screenWidth, int screenHeight, int bitmapWidth, int bitmapHeight)
{
	HRESULT hr = S_OK;
	m_screenWidth = screenWidth;
	m_screenHeight = screenHeight;
	m_bitmapWidth = bitmapWidth;
	m_bitmapHeight = bitmapHeight;
	m_previousPosX = -1;
	m_previousPosY = -1;
	m_previousWidth = bitmapWidth;
	m_previousHeight = bitmapHeight;

	hr = InitializeBuffers(device);
	if (FAILED(hr))
		return hr;

	scaling[0] = 1.0f;
	scaling[1] = 1.0f;
	scaling[2] = 1.0f;

	D3D11_BUFFER_DESC bd;
	hr = InitializeBuffers(device);
	if (FAILED(hr))
		return hr;
	ZeroMemory(&bd, sizeof(bd));
	bd.ByteWidth = sizeof(Propertys);
	bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
	bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
	bd.Usage = D3D11_USAGE_DYNAMIC;
	hr = device->CreateBuffer(&bd, NULL, &m_BlockProperty);
	if (FAILED(hr))
	{
		MessageBox(NULL, L"ErrorCreate Translation Buffer", L"Error_BlockClass", MB_OK);
		return false;
	}
	ZeroMemory(&bd, sizeof(bd));
	bd.ByteWidth = sizeof(Factors);
	bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
	bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
	bd.Usage = D3D11_USAGE_DYNAMIC;
	hr = device->CreateBuffer(&bd, NULL, &m_RenderFactors);
	if (FAILED(hr))
	{
		MessageBox(NULL, L"ErrorCreate RenderFactors Buffer", L"Error_BlockClass", MB_OK);
		return false;
	}
	rotation[0] = 0.0f;
	rotation[1] = 0.0f;
	rotation[2] = 0.0f;
	D3DXMatrixIdentity(&propertys.RotationMatrix);
	return true;
}
开发者ID:zzxchavo,项目名称:Minecraft_Direct11,代码行数:52,代码来源:Rectangle2DClass.cpp

示例2: InitializeBuffers

bool CloudClass::Initialize(ID3D11Device* device, int width, int height, float SCREEN_DEPTH, float SCREEN_NEAR){
	bool result;
	// Create the up sample render to texture object.
	front_texture_ = new RenderTextureClass;
	if(!front_texture_){
		return false;
	}
	// Initialize the up sample render to texture object.
	result = front_texture_->Initialize(device, width, height, SCREEN_DEPTH, SCREEN_NEAR);
	if(!result){
		return false;
	}
	back_texture_ = new RenderTextureClass;
	if(!back_texture_){
		return false;
	}
	// Initialize the up sample render to texture object.
	result = back_texture_->Initialize(device, width, height, SCREEN_DEPTH, SCREEN_NEAR);
	if(!result){
		return false;
	}
	// Initialize the vertex and index buffer that hold the geometry for the terrain.
	result = InitializeBuffers(device);
	if(!result){
		return false;
	}
	return true;
}
开发者ID:jcrm,项目名称:Honours,代码行数:28,代码来源:cloud_box.cpp

示例3: LoadModel

bool ModelClass::Initialize(ID3D10Device* device, char* modelFilename, WCHAR* textureFilename)
{
	bool result;


	// Load in the model data.
	result = LoadModel(modelFilename);
	if(!result)
	{
		return false;
	}

	// Initialize the vertex and index buffer that hold the geometry for the model.
	result = InitializeBuffers(device);
	if(!result)
	{
		return false;
	}

	// Load the texture for this model.
	result = LoadTexture(device, textureFilename);
	if(!result)
	{
		return false;
	}

	return true;
}
开发者ID:JonathanSimonJones,项目名称:Year3Sem2,代码行数:28,代码来源:modelclass.cpp

示例4: LoadModel

bool BumpModelClass::Initialize(ID3D10Device* device, char* modelFilename, WCHAR* textureFilename1, WCHAR* textureFilename2)
{
    bool result;


    // Load in the model data.
    result = LoadModel(modelFilename);
    if(!result)
    {
        return false;
    }

    // Calculate the normal, tangent, and binormal vectors for the model.
    CalculateModelVectors();

    // Initialize the vertex and index buffer that hold the geometry for the model.
    result = InitializeBuffers(device);
    if(!result)
    {
        return false;
    }

    // Load the textures for this model.
    result = LoadTextures(device, textureFilename1, textureFilename2);
    if(!result)
    {
        return false;
    }

    return true;
}
开发者ID:jiangguang5201314,项目名称:ZNginx,代码行数:31,代码来源:bumpmodelclass.cpp

示例5: LoadTexture

// |----------------------------------------------------------------------------|
// |						      Initialize									|
// |----------------------------------------------------------------------------|
bool ParticleSystemClass::Initialize(ID3D11Device* device, WCHAR* textureFilename)
{
	bool result;


	// Load the texture that is used for the particles.
	result = LoadTexture(device, textureFilename);
	if(!result)
	{
		return false;
	}

	// Initialize the particle system.
	result = InitializeParticleSystem();
	if(!result)
	{
		return false;
	}

	// Create the buffers that will be used to render the particles with.
	result = InitializeBuffers(device);
	if(!result)
	{
		return false;
	}

	return true;
}
开发者ID:Jiyambi,项目名称:DirectX-Coursework,代码行数:31,代码来源:ParticleSystemClass.cpp

示例6: DecompressFile

static BROTLI_BOOL DecompressFile(Context* context, BrotliDecoderState* s) {
  BrotliDecoderResult result = BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT;
  InitializeBuffers(context);
  for (;;) {
    if (result == BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT) {
      if (!HasMoreInput(context)) {
        fprintf(stderr, "corrupt input [%s]\n",
                PrintablePath(context->current_input_path));
        return BROTLI_FALSE;
      }
      if (!ProvideInput(context)) return BROTLI_FALSE;
    } else if (result == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) {
      if (!ProvideOutput(context)) return BROTLI_FALSE;
    } else if (result == BROTLI_DECODER_RESULT_SUCCESS) {
      if (!FlushOutput(context)) return BROTLI_FALSE;
      if (context->available_in != 0 || HasMoreInput(context)) {
        fprintf(stderr, "corrupt input [%s]\n",
                PrintablePath(context->current_input_path));
        return BROTLI_FALSE;
      }
      return BROTLI_TRUE;
    } else {
      fprintf(stderr, "corrupt input [%s]\n",
              PrintablePath(context->current_input_path));
      return BROTLI_FALSE;
    }

    result = BrotliDecoderDecompressStream(s, &context->available_in,
        &context->next_in, &context->available_out, &context->next_out, 0);
  }
}
开发者ID:chipsec,项目名称:chipsec,代码行数:31,代码来源:brotli.c

示例7: LoadSkyBoxModel

bool SkyBox::Init(ID3D11Device* device)
{
	bool result;


	// Load in sky box model.
	result = LoadSkyBoxModel("../SkyBox.txt");
	if(!result)
	{
		return false;
	}

	// Load sky box into a vertex and index buffer for rendering.
	result = InitializeBuffers(device);
	if(!result)
	{
		return false;
	}

	// Set color at top of sky box.
	_apexColor = D3DXVECTOR4(0.0f, 0.15f, 0.66f, 1.0f);
	_apexColor = D3DXVECTOR4(0.0f, 0.145f, 0.667f, 1.0f);

	// Set color at center of sky box.
	_centerColor =  D3DXVECTOR4(0.81f, 0.38f, 0.66f, 1.0f);
	_centerColor =  D3DXVECTOR4(0.02f, 0.365f, 0.886f, 1.0f);

	return true;
}
开发者ID:makehimanoffer,项目名称:3rdYearProjectStorage,代码行数:29,代码来源:SkyBox.cpp

示例8: LoadHeightMap

bool TerrainClass::Initialize(ID3D11Device* device, char* heightMapFilename)
{
	bool result;


	// Load in the height map for the terrain.
	result = LoadHeightMap(heightMapFilename);
	if(!result)
	{
		return false;
	}

	// Normalize the height of the height map.
	NormalizeHeightMap();

	// Calculate the normals for the terrain data.
	result = CalculateNormals();
	if(!result)
	{
		return false;
	}

	// Initialize the vertex and index buffer that hold the geometry for the terrain.
	result = InitializeBuffers(device);
	if(!result)
	{
		return false;
	}

	return true;
}
开发者ID:jcrm,项目名称:Engine,代码行数:31,代码来源:terrainclass.cpp

示例9: LoadModel

bool ModelClass::Initialize(ID3D11Device* device, char* model_filename, WCHAR* texture_filename)
{
	bool result;

	result = LoadModel(model_filename);
	if(!result)
	{
		return false;
	}

	result = InitializeBuffers(device);
	if(!result)
	{
		return false;
	}

	

	//initialize texture
	result = LoadTexture(device, texture_filename);
	if(!result)
	{
		return false;
	}
	return true;
}
开发者ID:kvlar,项目名称:Haeigan,代码行数:26,代码来源:ModelClass.cpp

示例10: InitializeShaders

bool BitmapFontClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* textureFilename, const char* basisShaderFileName)
{
	bool initResult = InitializeShaders(device, basisShaderFileName);
	if (!initResult)
	{
		return false;
	}

	initResult = InitializeTextureView(device, deviceContext, textureFilename);
	if (!initResult)
	{
		return false;
	}

	initResult = InitializeBuffers(device);
	if (!initResult)
	{
		return false;
	}

	initResult = InitializeBlending(device, deviceContext);
	if (!initResult)
	{
		return false;
	}

	return true;
}
开发者ID:rgpieters,项目名称:Game-Engine,代码行数:28,代码来源:BitmapFontClass.cpp

示例11: InitializeBuffers

bool CBitmap::Initialize(ID3D11Device* device, int width, int height, std::string filename, int bmpWidth, int bmpHeight)
{
	bool result;
	screenWidth = width;
	screenHeight = height;

	bitmapHeight = bmpHeight;
	bitmapWidth = bmpWidth;

	previousPosX = -1;
	previousPosY = -1;

	result = InitializeBuffers(device);
	if (!result)
	{
		CLog::Write("CBitmap::Initialize : Could not initialize the buffers");
		return false;
	}

	result = LoadTexture(device, filename);
	if (!result)
	{
		CLog::Write("CBitmap::Initialize : could not load the texture " + filename);
		return false;
	}

	return true;
}
开发者ID:pikzen,项目名称:Crescent,代码行数:28,代码来源:CBitmap.cpp

示例12: result

void PreviewObject::Initialize()
{
	bool result(true);

	//m_pInstancedObject = ContentManager::Load<ModelComponent>(_T("./Resources/Lemmings3D/models/LemmingsCube.ovm"));
	//m_pInstancedObject->Initialize();

	// Load the texture for this model.
	result = LoadTexture(GraphicsDevice::GetInstance()->GetDevice(), m_TextureFile);
	ASSERT(result, _T("Couldn't Load the Texture of the instancedObject!"));
	if(!result)
	{
		Release();
		return;
	}

	// Initialize the vertex and instance buffer that hold the geometry for the triangles.
	result = InitializeBuffers(GraphicsDevice::GetInstance()->GetDevice());
	ASSERT(result, _T("Couldn't initialize buffers of the instancedObject!"));
	if(!result)
	{
		ReleaseBuffers();
		return;
	}
}
开发者ID:GlenDC,项目名称:Lemmings3D,代码行数:25,代码来源:PreviewObject.cpp

示例13: InitializeBuffers

bool BitmapClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, HWND hwnd, int screenWidth, int screenHeight, char* textureFilename, int bitmapWidth, int bitmapHeight){
	bool result;

	m_screenWidth = screenWidth;
	m_screenHeight = screenHeight;

	m_previousPosX = -1;
	m_previousPosY = -1;
	m_previousAngle = -1000.0f;

	result = InitializeBuffers(device);
	if (!result){
		return false;
	}
	result = LoadTexture(device, deviceContext, textureFilename, hwnd);
	if (!result){
		return false;
	}

	if (bitmapHeight == 0){
		m_bitmapHeight = m_Texture->GetHeight();
	}
	else{
		m_bitmapHeight = bitmapHeight;
	}

	if (bitmapWidth == 0){
		m_bitmapWidth = m_Texture->GetWidth();
	}
	else{
		m_bitmapWidth = bitmapWidth;
	}

	return true;
}
开发者ID:UnlikeSuika,项目名称:General_Direct3D,代码行数:35,代码来源:BitmapClass.cpp

示例14: InitializeBuffers

////////////////////////////////////////
//		PUBLIC UTILITY FUNCTIONS
////////////////////////////////////////
bool DiffuseContext::Initialize(HWND hWnd)
{
	bool result;

	result = InitializeBuffers();
	if(!result)
	{
		MessageBox(hWnd, L"Could not initialize a sprite context.", L"Error", MB_OK);
		return false;
	}

	// Create the color shader object.
	m_diffuseShade = new DiffuseShader("diffuse","diffuse");
	if(!m_diffuseShade)
	{
		return false;
	}

	// Initialize the color shader object.
	result = m_diffuseShade->Initialize(GraphicsGlobals::g_Device, hWnd);
	if(!result)
	{
		MessageBox(hWnd, L"Could not initialize the diffuse shader object.", L"Error", MB_OK);
		return false;
	}

	return true;
}
开发者ID:CSPshala,项目名称:dangerzone,代码行数:31,代码来源:DiffuseContext.cpp

示例15: InitializeBuffers

////////////////////////////////////////
//		PUBLIC UTILITY FUNCTIONS
////////////////////////////////////////
bool ParticleContext::Initialize()
{
	bool result;

	result = InitializeBuffers();

	if(!result)
	{
		MessageBox(WindowGlobals::g_hWnd, L"Could not initialize the particle context.", L"Error", MB_OK);
		return false;
	}

	// Create the color shader object.
	m_particleShader = new ParticleShader(L"billboard",L"colors",L"billboard");
	if(!m_particleShader)
	{
		return false;
	}

	// Initialize the color shader object.
	result = m_particleShader->Initialize(ApplicationSettings::g_Device, WindowGlobals::g_hWnd);
	if(!result)
	{
		MessageBox(WindowGlobals::g_hWnd, L"Could not initialize the particle shader object.", L"Error", MB_OK);
		return false;
	}

	return true;
}
开发者ID:CSPshala,项目名称:3Ddangerzone,代码行数:32,代码来源:ParticleContext.cpp


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