Пример #1
0
bool Shader::Initialize(ID3D11Device * device, HWND hwnd, LPCSTR shaderFileName, LPCSTR vertexFuncName, LPCSTR pixelFuncName)
{

	bool result;
	int lenghFileName = strlen(shaderFileName) + 1;

	mp_name = new char[lenghFileName];

	memcpy(mp_name, shaderFileName, lenghFileName);

	char * psFileName = new char[lenghFileName + 5];

	strcpy_s(psFileName, lenghFileName + 5, shaderFileName);
	strcat_s(psFileName, lenghFileName + 5, ".ps\0");


	char * vsFileName = new char[lenghFileName + 5];

	strcpy_s(vsFileName, lenghFileName + 5, shaderFileName);
	strcat_s(vsFileName, lenghFileName + 5, ".vs\0");

	result = initializeShader(device, hwnd, vsFileName, psFileName, vertexFuncName, pixelFuncName);

	delete[] psFileName;
	delete[] vsFileName;

	return result;
}
Пример #2
0
bool ColorShaderClass::initialize( ID3D11Device *aD3DDevice, HWND aHwnd )
{
	bool result;

	result = initializeShader(aD3DDevice, aHwnd,
		L"color.vs", L"color.ps");

	return result;
}
Пример #3
0
void SpriteBatch::initialize()
{
	initializeShader();
	initializeBuffers();
	//initializeProjectionTransform();
	initializeSprites();


}
Пример #4
0
Ball::Ball(const int& width_, const int& height_, const float& lastXPos_) {
	width = width_;
	height = height_;
	xSize = 2.0f / width;
	ySize = 2.0f / height;
	lastXPos = lastXPos_;
	initialize();
	initializeShader();
}
Пример #5
0
bool vprLightShader::initialize(ID3D11Device* device, HWND hwnd)
{
	// Initialize the vertex and pixel shaders.
	if (!initializeShader(device, hwnd, "./lightVS.hlsl", "./lightPS.hlsl"))
	{
		return false;
	}

	return true;
}
Пример #6
0
		bool FontShader::initialize()
		{
			bool result;

			result = initializeShader("../Engine/Graphics/Shaders/fontVS.hlsl", "../Engine/Graphics/Shaders/fontPS.hlsl");
			if (!result)
			{
				return false;
			}

			return true;
		}
	bool LightShader::initialize(ID3D11Device* device, HWND hwnd)
	{
		bool result;
		
			// Initialize the vertex and pixel shaders.
		result = initializeShader(device, hwnd, L"Light.vs", L"Light.ps");
		if (!result)
		{
			return false;
		}

		return true;
	}
Пример #8
0
bool LightShaderClass::initialize(ID3D11Device* aD3DDevice, HWND aHwnd)
{
    bool result;

    result = initializeShader(
                 aD3DDevice, aHwnd, L"./shader/light.vs", L"./shader/light.ps");
    if(!result)
    {
        return false;
    }

    return true;
}
Пример #9
0
bool TextureShaderClass::initialize(ID3D11Device* device, HWND hwnd)
{
	bool result;

	result = initializeShader(
		device, hwnd, L"texture.vs", L"texture.ps");
	if(!result)
	{
		return false;
	}


	return true;
}
Пример #10
0
UITextBox::UITextBox(TEXTBOX_TYPES type){
	if (!visible) return;

	switch (type)
	{
	case UITextBox::HUD:
		boxType = type;
		if (!UITextBox::HUDTextShader.initialized)
			initializeShader(type);
		scale = 0.05f;
		direction = vector3(1.0f, 0.0f, 0.0f);
		down = vector3(0.0f, -1.0f, 0.0f);
		break;
	case UITextBox::WORLD:
		boxType = type;
		if (!UITextBox::pvTextShader.initialized)
			initializeShader(type);
		break;
	case UITextBox::BILLBOARD:
		break;
	default:
		break;
	}
}
Пример #11
0
bool ColorShaderClass::initialize(ID3D11Device* device, HWND hwnd)
{
	bool result;

	// Initialize the vertex and pixel shaders.
	result = initializeShader(device, hwnd,
		L"color_vs.hlsl",
		L"color_ps.hlsl");
	if (!result)
	{
		return false;
	}

	return true;
}
void MusikQuadRender::initializeGL()
{
    initializeOpenGLFunctions();

    //glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

    initializeShader();
    initializeTexShader();
    initializeGeometry();
    initializeTexGeometry();
    initializeFrameBuffer();
    glEnable(GL_DEPTH_TEST);


  //  timer->start(25,this);
}
Пример #13
0
	void TextureDisplayer::initialize(int sceneWidth, int sceneHeight, float nearPlane, float farPlane)
	{
		#ifdef _DEBUG
			if(isInitialized)
			{
				throw std::runtime_error("Display texture is already initialized.");
			}
		#endif

		initializeShader(nearPlane, farPlane);

		float minX, maxX, minY, maxY;
		if(fullScreen)
		{
			minX = 0.0;
			maxX = sceneWidth;
			minY = 0.0;
			maxY = sceneHeight;
		}else
		{
			switch(coordinateX)
			{
				case TextureDisplayer::LEFT:
					minX = sceneWidth*0.025;
					maxX = sceneWidth*0.325;
					break;
				case TextureDisplayer::CENTER_X:
					minX = sceneWidth*0.35;
					maxX = sceneWidth*0.65;
					break;
				case TextureDisplayer::RIGHT:
					minX = sceneWidth*0.675;
					maxX = sceneWidth*0.975;
					break;
				case TextureDisplayer::USER_DEFINED_X:
					minX = userMinX;
					maxX = userMaxX;
					break;
				default:
					throw std::domain_error("Unsupported coordinate X");
					break;
			}

			switch(coordinateY)
			{
				case TextureDisplayer::BOTTOM:
					minY = sceneHeight*0.675;
					maxY = sceneHeight*0.975;
					break;
				case TextureDisplayer::CENTER_Y:
					minY = sceneHeight*0.35;
					maxY = sceneHeight*0.65;
					break;
				case TextureDisplayer::TOP:
					minY = sceneHeight*0.025;
					maxY = sceneHeight*0.325;
					break;
				case TextureDisplayer::USER_DEFINED_Y:
					minY = userMinY;
					maxY = userMaxY;
					break;
				default:
					throw std::domain_error("Unsupported coordinate Y");
					break;
			}
		}

		//orthogonal matrix with origin at top left screen
		ShaderManager::instance()->bind(displayTextureShader);
		mProjection.setValues(2.0f/(float)sceneWidth, 0.0, -1.0,
				0.0, -2.0f/(float)sceneHeight, 1.0,
				0.0, 0.0, 1.0);
		glUniformMatrix3fv(mProjectionLoc, 1, false, (const float*)mProjection);

		//update the display
		quadDisplayer = std::make_unique<QuadDisplayerBuilder>()
				->vertexData(GL_FLOAT, new float[8]{minX, minY, maxX, minY, maxX, maxY, minX, maxY})
				->build();

		isInitialized = true;
	}