finished tutorial 03

This commit is contained in:
h4570
2022-08-21 16:40:26 +02:00
parent 4303cc2c97
commit 409ee294eb
27 changed files with 349 additions and 25 deletions
@@ -83,8 +83,8 @@ void MinecraftPipeline::initBBox() {
bbox = new RenderBBox(block.vertices, block.count);
}
void MinecraftPipeline::render(std::vector<McpipBlock*> blocks, Texture* t_tex,
const bool& isMulti,
void MinecraftPipeline::render(std::vector<McpipBlock*> blocks,
const Texture* t_tex, const bool& isMulti,
const bool& fullClipChecks) {
auto texBuffers = rendererCore->texture.useTexture(t_tex);
+4
View File
@@ -19,6 +19,10 @@ Renderer3D::~Renderer3D() {}
void Renderer3D::init(RendererCore* core) { utility.init(core); }
void Renderer3D::usePipeline(Renderer3DPipeline& pipeline) {
usePipeline(&pipeline);
}
void Renderer3D::usePipeline(Renderer3DPipeline* pipeline) {
if (currentPipeline != pipeline) {
if (currentPipeline) currentPipeline->onUseEnd();
@@ -14,8 +14,9 @@ namespace Tyra {
Vec4 CameraInfo3D::defaultCameraUp = Vec4(0.0F, 1.0F, 0.0F);
CameraInfo3D::CameraInfo3D(Vec4* t_cameraPosition, Vec4* t_cameraLooksAt,
Vec4* t_cameraUp) {
CameraInfo3D::CameraInfo3D(const Vec4* t_cameraPosition,
const Vec4* t_cameraLooksAt,
const Vec4* t_cameraUp) {
position = t_cameraPosition;
looksAt = t_cameraLooksAt;
@@ -25,6 +26,7 @@ CameraInfo3D::CameraInfo3D(Vec4* t_cameraPosition, Vec4* t_cameraLooksAt,
up = t_cameraUp;
}
}
CameraInfo3D::~CameraInfo3D() {}
} // namespace Tyra
@@ -61,7 +61,7 @@ void Path3::clearScreen(zbuffer_t* z, const Color& color) {
dma_channel_send_packet2(clearScreenPacket, DMA_CHANNEL_GIF, true);
}
void Path3::sendTexture(Texture* texture,
void Path3::sendTexture(const Texture* texture,
const RendererCoreTextureBuffers& texBuffers) {
packet2_reset(texturePacket, false);
@@ -83,8 +83,9 @@ void Path3::sendTexture(Texture* texture,
packet2_chain_open_cnt(texturePacket, 0, 0, 0);
packet2_update(texturePacket,
draw_texture_wrapping(texturePacket->next, 0,
texture->getWrapSettings()));
draw_texture_wrapping(
texturePacket->next, 0,
const_cast<texwrap_t*>(texture->getWrapSettings())));
packet2_chain_close_tag(texturePacket);
packet2_update(texturePacket, draw_texture_flush(texturePacket->next));
@@ -35,7 +35,8 @@ void RendererCoreTexture::updateClutBuffer(texbuffer_t* clutBuffer) {
}
}
RendererCoreTextureBuffers RendererCoreTexture::useTexture(Texture* t_tex) {
RendererCoreTextureBuffers RendererCoreTexture::useTexture(
const Texture* t_tex) {
TYRA_ASSERT(t_tex != nullptr, "Provided nullptr texture!");
auto allocated = getAllocatedBuffersByTextureId(t_tex->id);
@@ -23,7 +23,7 @@ void RendererCoreTextureSender::init(Path3* t_path3, RendererCoreGS* t_gs) {
}
RendererCoreTextureBuffers RendererCoreTextureSender::allocate(
Texture* t_texture) {
const Texture* t_texture) {
texbuffer_t* core = allocateTextureCore(t_texture);
texbuffer_t* clut = nullptr;
@@ -54,7 +54,7 @@ void RendererCoreTextureSender::deallocate(
}
texbuffer_t* RendererCoreTextureSender::allocateTextureCore(
Texture* t_texture) {
const Texture* t_texture) {
auto* result = new texbuffer_t;
const auto* core = t_texture->core;
@@ -73,7 +73,7 @@ texbuffer_t* RendererCoreTextureSender::allocateTextureCore(
}
texbuffer_t* RendererCoreTextureSender::allocateTextureClut(
Texture* t_texture) {
const Texture* t_texture) {
auto* result = new texbuffer_t;
const auto* clut = t_texture->clut;