Раньше он работал нормально, и эту функцию не игнорировали. Я внес некоторые изменения в шейдер HLSL и добавил две перегруженные функции (Render
и UpdateBuffers
) с дополнительным параметром XMFLOAT4 между тем, когда он работал, и когда он перестал работать, что, я думаю, не должно было повлиять на него.
У меня есть класс с именем TexturedRect
и производный класс TexturedSpritesheet
. Функция с именем Render
вызывает UpdateBuffers
, которая переопределяется в TexturedSpritesheet
.
Когда я звоню TexturedSpritesheet::Render
, он игнорирует переопределение и использует TexturedRect::UpdateBuffers
.
TexturedRect.h (включая только строки, имеющие отношение к вопросу):
public:
bool Render(ID3D11DeviceContext*, int, int);
bool Render(ID3D11DeviceContext*, int, int, DirectX::XMFLOAT4);
protected:
bool UpdateBuffers(ID3D11DeviceContext*, int, int);
bool UpdateBuffers(ID3D11DeviceContext*, int, int, DirectX::XMFLOAT4);
TexturedRect.cpp (включая только строки, имеющие отношение к вопросу):
bool TexturedRect::Render(ID3D11DeviceContext* deviceContext, int positionX, int positionY) {
bool result;
m_posX = positionX;
m_posY = positionY;
result = UpdateBuffers(deviceContext, positionX, positionY);
if (!result) return false;
RenderBuffers(deviceContext, false);
return true;
}
bool TexturedRect::Render(ID3D11DeviceContext* deviceContext, int positionX, int positionY, DirectX::XMFLOAT4 color) {
bool result;
m_posX = positionX;
m_posY = positionY;
result = UpdateBuffers(deviceContext, positionX, positionY, color);
if (!result) return false;
RenderBuffers(deviceContext, true);
return true;
}
TexturedSpritesheet.h (включая только строки, имеющие отношение к вопросу):
protected:
bool UpdateBuffers(ID3D11DeviceContext*, int, int);
bool UpdateBuffers(ID3D11DeviceContext*, int, int, DirectX::XMFLOAT4);