规范模型输入以及测试shader
This commit is contained in:
@@ -8,8 +8,8 @@ DV_CORE_BEGIN_NAMESPACE
|
||||
class MathUtil
|
||||
{
|
||||
public:
|
||||
static size_t ComponentSize(ComponentType ct);
|
||||
static size_t DataTypeSize(DataType dt);
|
||||
static DV_CORE_API size_t ComponentSize(ComponentType ct);
|
||||
static DV_CORE_API size_t DataTypeSize(DataType dt);
|
||||
|
||||
//count the number of bits set in v
|
||||
static DV_CORE_API uint32_t popcount(uint8_t v);
|
||||
|
||||
@@ -8,7 +8,7 @@ DV_CORE_BEGIN_NAMESPACE
|
||||
void VertexShaderStep::process(UniformBuffer& uniformBuffer, const InputAssemberStep::NodeArray& assembedNodeArray)
|
||||
{
|
||||
ShaderFileInterface* shaderInterface = davinci::LoadShaderFile("TestShader.dll");
|
||||
VertexShaderInterface* standardVS = shaderInterface->getVertexShader("xxxx");
|
||||
VertexShaderInterface* standardVS = shaderInterface->getVertexShader("test");
|
||||
|
||||
const fVector3* eyePos = (const fVector3*)(uniformBuffer.getAttribute("camera:eye_pos"));
|
||||
const fMatrix4* cameraView = (const fMatrix4*)(uniformBuffer.getAttribute("camera:view_mat"));
|
||||
@@ -24,6 +24,9 @@ void VertexShaderStep::process(UniformBuffer& uniformBuffer, const InputAssember
|
||||
//update self uniform value
|
||||
uniformBuffer.setAttribute("self:world_transform", inputNode.transform);
|
||||
|
||||
fMatrix4 worldInverseTrans = inputNode.transform.inverse().transpose();
|
||||
uniformBuffer.setAttribute("self:world_transform_inverse_trans", worldInverseTrans);
|
||||
|
||||
standardVS->prepare(&uniformBuffer,
|
||||
[inputNode](VertexElementType type) -> DeviceBufferAccessorConstPtr
|
||||
{
|
||||
@@ -47,19 +50,7 @@ void VertexShaderStep::process(UniformBuffer& uniformBuffer, const InputAssember
|
||||
|
||||
for (size_t i = 0; i < vertexCounts; i++)
|
||||
{
|
||||
size_t index = 0;
|
||||
if (inputNode.indices->getComponentType() == CT_Uint16)
|
||||
{
|
||||
index = (size_t)(*(uint16_t*)(inputNode.indices->getElement(i)));
|
||||
}
|
||||
else if(inputNode.indices->getComponentType() == CT_Uint32)
|
||||
{
|
||||
index = (size_t)(*(uint32_t*)(inputNode.indices->getElement(i)));
|
||||
}
|
||||
else
|
||||
{
|
||||
//error
|
||||
}
|
||||
uint16_t index = *((const uint16_t*)(inputNode.indices->getElement(i)));
|
||||
|
||||
fVector3 vertexWorldPos;
|
||||
void* outputVertexMemory = outputNode.vertexBuf->ptr(i* outputNode.vertexDesc.vertexByteSize());
|
||||
|
||||
@@ -9,7 +9,7 @@ DV_CORE_BEGIN_NAMESPACE
|
||||
void RasterizerStep::process(const VertexShaderStep::NodeArray& vsNodeArray, AntiAliasingTech aaTech, int32_t canvasWidth, int32_t canvasHeight)
|
||||
{
|
||||
ShaderFileInterface* shaderInterface = davinci::LoadShaderFile("TestShader.dll");
|
||||
PixelShaderInterface* pixelShader = shaderInterface->getPixelShader("xxx");
|
||||
PixelShaderInterface* pixelShader = shaderInterface->getPixelShader("test");
|
||||
|
||||
fMatrix4 view_trans =
|
||||
fMatrix4::makeTrans(canvasWidth / 2.f, canvasHeight / 2.f, 0.f) *
|
||||
@@ -75,7 +75,7 @@ void RasterizerStep::process(const VertexShaderStep::NodeArray& vsNodeArray, Ant
|
||||
newFragment.mask = mask;
|
||||
newFragment.next = currentOffset;
|
||||
this->m_fragementArray.push_back(newFragment);
|
||||
}
|
||||
},true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user