52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include "dvc_config.h"
|
|
#include "shader/dvc_shader_interface.h"
|
|
|
|
|
|
class StandardVertexShader : public davinci::VertexShaderInterface
|
|
{
|
|
public:
|
|
virtual const char* getName(void) const {
|
|
return m_name.c_str();
|
|
}
|
|
|
|
virtual const davinci::VertexDesc& getOutputVertexDesc() const {
|
|
return m_outputVertexDesc;
|
|
}
|
|
|
|
virtual size_t getOutputVertexByteSize(void) const {
|
|
return m_outputVertexDesc.vertexByteSize();
|
|
}
|
|
|
|
virtual void begin(const davinci::RenderPipe* pipe, SetInputAttributeFunc setInputAttributeFunc);
|
|
virtual void process(size_t index, float32_t* outputVertex);
|
|
virtual void end();
|
|
|
|
protected:
|
|
davinci::DeviceBufferAccessorConstPtr getInputAccessor(davinci::VertexElementType elementType) const {
|
|
auto it = m_inputAccessors.find(elementType);
|
|
if (it != m_inputAccessors.end()) {
|
|
return it->second;
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
private:
|
|
const davinci::RenderPipe* m_pipe = nullptr;
|
|
std::string m_name;
|
|
|
|
bool m_withWorldPos = false;
|
|
bool m_withNormal = false;
|
|
bool m_withTexCoord0 = false;
|
|
|
|
typedef std::map<davinci::VertexElementType, davinci::DeviceBufferAccessorConstPtr> InputAccessorMap;
|
|
InputAccessorMap m_inputAccessors;
|
|
|
|
davinci::VertexDesc m_outputVertexDesc;
|
|
|
|
public:
|
|
StandardVertexShader(bool withWorldPos, bool withNormal, bool withTexCoord0);
|
|
virtual ~StandardVertexShader();
|
|
};
|