Merge pull request #60 from h4570/feature/pipeline
Small refactoring of viewproj matrix calcs
This commit is contained in:
@@ -41,7 +41,6 @@ private:
|
||||
packet2_t *currPacket;
|
||||
u8 context;
|
||||
packet2_t *matricesPacket __attribute__((aligned(64)));
|
||||
MATRIX localWorld, localScreen;
|
||||
VECTOR position, rotation;
|
||||
u32 vertCount;
|
||||
};
|
||||
|
||||
@@ -203,19 +203,19 @@ void Renderer::allocateBuffers(float t_screenW, float t_screenH)
|
||||
frameBuffers[0].width = (u16)t_screenW;
|
||||
frameBuffers[0].height = (u16)t_screenH;
|
||||
frameBuffers[0].mask = 0;
|
||||
frameBuffers[0].psm = GS_PSM_32;
|
||||
frameBuffers[0].psm = GS_PSM_24;
|
||||
frameBuffers[0].address = graph_vram_allocate((u16)t_screenW, (u16)t_screenH, frameBuffers[0].psm, GRAPH_ALIGN_PAGE);
|
||||
|
||||
frameBuffers[1].width = (u16)t_screenW;
|
||||
frameBuffers[1].height = (u16)t_screenH;
|
||||
frameBuffers[1].mask = 0;
|
||||
frameBuffers[1].psm = GS_PSM_32;
|
||||
frameBuffers[1].psm = GS_PSM_24;
|
||||
frameBuffers[1].address = graph_vram_allocate((u16)t_screenW, (u16)t_screenH, frameBuffers[1].psm, GRAPH_ALIGN_PAGE);
|
||||
|
||||
zBuffer.enable = DRAW_ENABLE;
|
||||
zBuffer.mask = 0;
|
||||
zBuffer.method = ZTEST_METHOD_GREATER_EQUAL;
|
||||
zBuffer.zsm = GS_ZBUF_32;
|
||||
zBuffer.zsm = GS_ZBUF_24;
|
||||
zBuffer.address = graph_vram_allocate((u16)t_screenW, (u16)t_screenH, zBuffer.zsm, GRAPH_ALIGN_PAGE);
|
||||
PRINT_LOG("Framebuffers, zBuffer set and allocated!");
|
||||
|
||||
|
||||
@@ -71,12 +71,12 @@ void VifSender::uploadMicroProgram()
|
||||
|
||||
void VifSender::sendMatrices(const RenderData &t_renderData, const Vector3 &t_position, const Vector3 &t_rotation)
|
||||
{
|
||||
vec3ToNative(position, t_position, 1.0F);
|
||||
vec3ToNative(rotation, t_rotation, 1.0F);
|
||||
create_local_world(localWorld, position, rotation);
|
||||
create_local_screen(localScreen, localWorld, t_renderData.worldView->data, t_renderData.perspective->data);
|
||||
Matrix viewProj = Matrix();
|
||||
viewProj.rotation(t_rotation); // model matrix
|
||||
viewProj.translate(t_position); // model matrix
|
||||
viewProj *= *t_renderData.worldView * *t_renderData.perspective; // viewproj = model * (view * projection)
|
||||
packet2_reset(matricesPacket, false);
|
||||
packet2_utils_vu_add_unpack_data(matricesPacket, 0, &localScreen, 8, 0);
|
||||
packet2_utils_vu_add_unpack_data(matricesPacket, 0, &viewProj.data, 8, 0);
|
||||
packet2_utils_vu_add_end_tag(matricesPacket);
|
||||
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
|
||||
dma_channel_send_packet2(matricesPacket, DMA_CHANNEL_VIF1, 1);
|
||||
|
||||
Reference in New Issue
Block a user