Continue block shapes
This commit is contained in:
parent
9e3bf000cf
commit
c4d56de0d4
3 changed files with 124 additions and 25 deletions
22
renderer.h
22
renderer.h
|
@ -13,6 +13,11 @@
|
|||
|
||||
#include "small3dlib.h"
|
||||
|
||||
/**
|
||||
Renderer specific unit, length of one map square.
|
||||
*/
|
||||
#define LCR_RENDERER_UNIT S3L_FRACTIONS_PER_UNIT
|
||||
|
||||
struct LCR_Renderer
|
||||
{
|
||||
// TODO
|
||||
|
@ -29,7 +34,7 @@ S3L_Index LCR_mapTriangles[LCR_SETTING_MAX_MAP_TRIANGLES * 3];
|
|||
|
||||
void LCR_pixelFunc3D(S3L_PixelInfo *pixel)
|
||||
{
|
||||
LCR_drawPixelXYSafe(pixel->x,pixel->y,0xff00);
|
||||
LCR_drawPixelXYSafe(pixel->x,pixel->y, 0xff00 + (pixel->triangleID % 16) * 16 );
|
||||
}
|
||||
|
||||
S3L_Index _LCR_addMapVertex(S3L_Unit x, S3L_Unit y, S3L_Unit z)
|
||||
|
@ -88,7 +93,10 @@ uint8_t _LCR_rendererBuildMapModel(void)
|
|||
|
||||
S3L_model3DInit(LCR_mapVertices,0,LCR_mapTriangles,0,LCR_mapModel);
|
||||
|
||||
LCR_mapGetBlockShape(0,0,blockShapeBytes,&blockShapeByteCount);
|
||||
LCR_mapGetBlockShape(0,
|
||||
|
||||
LCR_BLOCK_TRANSFORM_ROT_270
|
||||
,blockShapeBytes,&blockShapeByteCount);
|
||||
|
||||
uint8_t vx, vy, vz, vi = 0;
|
||||
uint8_t *bytes = blockShapeBytes;
|
||||
|
@ -98,12 +106,10 @@ for (int i = 0; i < blockShapeByteCount; ++i)
|
|||
{
|
||||
LCR_decodeMapBlockCoords(blockShapeBytes[i],&vx,&vy,&vz);
|
||||
|
||||
printf("%d: %d %d %d\n",blockShapeBytes[i],vx,vy,vz);
|
||||
|
||||
triangleIndices[vi] = _LCR_addMapVertex(
|
||||
(LCR_SQUARE_SIDE_LEN * ((LCR_SpaceUnit) vx)) / 12,
|
||||
(LCR_SQUARE_SIDE_LEN / 2 * ((LCR_SpaceUnit) vy)) / 12,
|
||||
(LCR_SQUARE_SIDE_LEN * ((LCR_SpaceUnit) vz)) / 12);
|
||||
triangleIndices[vi] = _LCR_addMapVertex(
|
||||
(LCR_RENDERER_UNIT * ((S3L_Unit) vx)) / 12,
|
||||
(LCR_RENDERER_UNIT / 2 * ((S3L_Unit) vy)) / 12,
|
||||
(LCR_RENDERER_UNIT * ((S3L_Unit) vz)) / 12);
|
||||
|
||||
if (vi < 2)
|
||||
vi++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue