Merge branch 'feature/migration-libspacket'
This commit is contained in:
@@ -108,7 +108,7 @@ public:
|
|||||||
// ----
|
// ----
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load mesh data from .obj files. Animation not supported.
|
* Load mesh data from .obj files. Animation supported.
|
||||||
* Be aware that texture names will be grabbed from material name.
|
* Be aware that texture names will be grabbed from material name.
|
||||||
* So no .mtl file is needed. Please check if material names in .obj file
|
* So no .mtl file is needed. Please check if material names in .obj file
|
||||||
* are equal to texture file names.
|
* are equal to texture file names.
|
||||||
@@ -124,7 +124,7 @@ public:
|
|||||||
void loadObj(char *t_subfolder, char *t_objFile, const float &t_scale, const u32 &t_framesCount, const u8 &t_invertT);
|
void loadObj(char *t_subfolder, char *t_objFile, const float &t_scale, const u32 &t_framesCount, const u8 &t_invertT);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load mesh data from .obj file. Animation supported.
|
* Load mesh data from .obj file. Animation not supported.
|
||||||
* Be aware that texture names will be grabbed from material name.
|
* Be aware that texture names will be grabbed from material name.
|
||||||
* So no .mtl file is needed. Please check if material names in .obj file
|
* So no .mtl file is needed. Please check if material names in .obj file
|
||||||
* are equal to texture file names.
|
* are equal to texture file names.
|
||||||
|
|||||||
@@ -103,6 +103,8 @@ public:
|
|||||||
|
|
||||||
TextureRepository *getTextureRepository() { return &textureRepo; };
|
TextureRepository *getTextureRepository() { return &textureRepo; };
|
||||||
|
|
||||||
|
void drawRectangle();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void changeTexture(const Mesh &t_mesh, u32 t_materialId);
|
void changeTexture(const Mesh &t_mesh, u32 t_materialId);
|
||||||
u32 lastTextureId;
|
u32 lastTextureId;
|
||||||
@@ -116,6 +118,7 @@ private:
|
|||||||
Matrix perspective;
|
Matrix perspective;
|
||||||
RenderData renderData;
|
RenderData renderData;
|
||||||
TextureRepository textureRepo;
|
TextureRepository textureRepo;
|
||||||
|
ScreenSettings *screen;
|
||||||
GifSender *gifSender;
|
GifSender *gifSender;
|
||||||
VifSender *vifSender;
|
VifSender *vifSender;
|
||||||
packet2_t *flipPacket;
|
packet2_t *flipPacket;
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ void GifSender::sendClear(zbuffer_t *t_zBuffer)
|
|||||||
packet2_update(packet2, draw_enable_tests(packet2->next, 0, t_zBuffer));
|
packet2_update(packet2, draw_enable_tests(packet2->next, 0, t_zBuffer));
|
||||||
packet2_update(packet2, draw_finish(packet2->next));
|
packet2_update(packet2, draw_finish(packet2->next));
|
||||||
packet2_chain_close_tag(packet2);
|
packet2_chain_close_tag(packet2);
|
||||||
|
dma_channel_wait(DMA_CHANNEL_GIF, 0);
|
||||||
dma_channel_send_packet2(packet2, DMA_CHANNEL_GIF, true);
|
dma_channel_send_packet2(packet2, DMA_CHANNEL_GIF, true);
|
||||||
dma_channel_wait(DMA_CHANNEL_GIF, 0);
|
dma_channel_wait(DMA_CHANNEL_GIF, 0);
|
||||||
packet2_free(packet2);
|
packet2_free(packet2);
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ Renderer::Renderer(u32 t_packetSize, ScreenSettings *t_screen)
|
|||||||
allocateBuffers(t_screen->width, t_screen->height);
|
allocateBuffers(t_screen->width, t_screen->height);
|
||||||
initDrawingEnv(t_screen->width, t_screen->height);
|
initDrawingEnv(t_screen->width, t_screen->height);
|
||||||
setPrim();
|
setPrim();
|
||||||
|
screen = t_screen;
|
||||||
gifSender = new GifSender(t_packetSize, t_screen);
|
gifSender = new GifSender(t_packetSize, t_screen);
|
||||||
vifSender = new VifSender();
|
vifSender = new VifSender();
|
||||||
perspective.setPerspective(*t_screen);
|
perspective.setPerspective(*t_screen);
|
||||||
@@ -100,6 +101,40 @@ void Renderer::changeTexture(const Mesh &t_mesh, u32 t_materialId)
|
|||||||
PRINT_ERR("Texture was not found in texture repository!");
|
PRINT_ERR("Texture was not found in texture repository!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Renderer::drawRectangle()
|
||||||
|
{
|
||||||
|
beginFrameIfNeeded();
|
||||||
|
packet2_t *packet2 = packet2_create(20, P2_TYPE_NORMAL, P2_MODE_NORMAL, 0);
|
||||||
|
packet2_update(packet2, draw_primitive_xyoffset(packet2->next, 0, 2048, 2048));
|
||||||
|
|
||||||
|
int loop0 = 10;
|
||||||
|
|
||||||
|
packet2_add_s64(packet2, GIF_SET_TAG(4, 0, 0, 0, GIF_FLG_PACKED, 1));
|
||||||
|
packet2_add_s64(packet2, GIF_REG_AD);
|
||||||
|
|
||||||
|
packet2_add_s64(packet2, GIF_SET_PRIM(6, 0, 0, 0, 0, 0, 0, 0, 0));
|
||||||
|
packet2_add_s64(packet2, GIF_REG_PRIM);
|
||||||
|
|
||||||
|
packet2_add_s64(packet2, GIF_SET_RGBAQ((loop0 * 10), 0, 255 - (loop0 * 10), 0x80, 0x3F800000));
|
||||||
|
packet2_add_s64(packet2, GIF_REG_RGBAQ);
|
||||||
|
|
||||||
|
packet2_add_s64(packet2, GIF_SET_XYZ(((loop0 * 20) << 4) + (2048 << 4), ((loop0 * 10) << 4) + (2048 << 4), -128));
|
||||||
|
packet2_add_s64(packet2, GIF_REG_XYZ2);
|
||||||
|
|
||||||
|
packet2_add_s64(packet2, GIF_SET_XYZ((((loop0 * 20) + 100) << 4) + (2048 << 4), (((loop0 * 10) + 100) << 4) + (2048 << 4), -128));
|
||||||
|
packet2_add_s64(packet2, GIF_REG_XYZ2);
|
||||||
|
|
||||||
|
packet2_update(packet2,
|
||||||
|
draw_primitive_xyoffset(
|
||||||
|
packet2->next,
|
||||||
|
0,
|
||||||
|
(2048 - (screen->width / 2)), (2048 - (screen->height / 2))));
|
||||||
|
packet2_update(packet2, draw_finish(packet2->next));
|
||||||
|
dma_channel_wait(DMA_CHANNEL_GIF, 0);
|
||||||
|
dma_channel_send_packet2(packet2, DMA_CHANNEL_GIF, true);
|
||||||
|
packet2_free(packet2);
|
||||||
|
}
|
||||||
|
|
||||||
/** Initializes drawing environment (1st app packet) */
|
/** Initializes drawing environment (1st app packet) */
|
||||||
void Renderer::initDrawingEnv(float t_screenW, float t_screenH)
|
void Renderer::initDrawingEnv(float t_screenW, float t_screenH)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void Ari::onInit()
|
|||||||
texRepo->addByMesh("sunnyisl/", islandAddons);
|
texRepo->addByMesh("sunnyisl/", islandAddons);
|
||||||
texRepo->addByMesh("skybox/", skybox);
|
texRepo->addByMesh("skybox/", skybox);
|
||||||
texRepo->addByMesh("ari/", player.mesh);
|
texRepo->addByMesh("ari/", player.mesh);
|
||||||
// engine->audio.playSong();
|
engine->audio.playSong();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ari::initBulb()
|
void Ari::initBulb()
|
||||||
@@ -98,6 +98,7 @@ void Ari::onUpdate()
|
|||||||
if (engine->pad.isCircleClicked)
|
if (engine->pad.isCircleClicked)
|
||||||
engine->audio.playADPCM(adpcm2);
|
engine->audio.playADPCM(adpcm2);
|
||||||
camera.update(engine->pad, player.mesh);
|
camera.update(engine->pad, player.mesh);
|
||||||
|
engine->renderer->drawRectangle();
|
||||||
engine->renderer->draw(skybox);
|
engine->renderer->draw(skybox);
|
||||||
engine->renderer->draw(island);
|
engine->renderer->draw(island);
|
||||||
engine->renderer->draw(islandAddons);
|
engine->renderer->draw(islandAddons);
|
||||||
|
|||||||
Reference in New Issue
Block a user