fix tex coords to full numbers
This commit is contained in:
@@ -54,37 +54,35 @@ void McpipMultiTexBlockData::allocateTempData() {
|
|||||||
tempVerts[23].set(1.0F, 1.0F, 1.0F);
|
tempVerts[23].set(1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
tempTexCoords = new Tyra::Vec4[tempVertsStsCount];
|
tempTexCoords = new Tyra::Vec4[tempVertsStsCount];
|
||||||
tempTexCoords[0].set(0.062721F, 0.813282F, 1.0F, 0.0F);
|
// Y = 1.0F - Y
|
||||||
tempTexCoords[1].set(0.062721F, 0.875327F, 1.0F, 0.0F);
|
tempTexCoords[0].set(0.0625F, 0.1875F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[2].set(0.000676F, 0.875327F, 1.0F, 0.0F);
|
tempTexCoords[1].set(0.0625F, 0.1250F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[3].set(0.000676F, 0.813282F, 1.0F, 0.0F);
|
tempTexCoords[2].set(0.0000F, 0.1250F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[4].set(0.062095F, 0.750461F, 1.0F, 0.0F);
|
tempTexCoords[3].set(0.0000F, 0.1875F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[5].set(0.062095F, 0.812244F, 1.0F, 0.0F);
|
tempTexCoords[4].set(0.0625F, 0.2500F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[6].set(0.000311F, 0.812244F, 1.0F, 0.0F);
|
tempTexCoords[5].set(0.0625F, 0.1875F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[7].set(0.000311F, 0.750461F, 1.0F, 0.0F);
|
tempTexCoords[6].set(0.0000F, 0.1875F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[8].set(0.062629F, 0.687779F, 1.0F, 0.0F);
|
tempTexCoords[7].set(0.0000F, 0.2500F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[9].set(0.000000F, 0.687779F, 1.0F, 0.0F);
|
tempTexCoords[8].set(0.0625F, 0.3125F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[10].set(0.000000F, 0.624816F, 1.0F, 0.0F);
|
tempTexCoords[9].set(0.0000F, 0.3125F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[11].set(0.062629F, 0.624816F, 1.0F, 0.0F);
|
tempTexCoords[10].set(0.0000F, 0.3750F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[12].set(0.062667F, 0.626382F, 1.0F, 0.0F);
|
tempTexCoords[11].set(0.0625F, 0.3750F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[13].set(0.000000F, 0.626382F, 1.0F, 0.0F);
|
tempTexCoords[12].set(0.0625F, 0.3750F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[14].set(0.000000F, 0.561642F, 1.0F, 0.0F);
|
tempTexCoords[13].set(0.0000F, 0.3750F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[15].set(0.062667F, 0.561642F, 1.0F, 0.0F);
|
tempTexCoords[14].set(0.0000F, 0.4375F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[16].set(0.000000F, 0.937621F, 1.0F, 0.0F);
|
tempTexCoords[15].set(0.0625F, 0.4375F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[17].set(0.000000F, 0.875134F, 1.0F, 0.0F);
|
tempTexCoords[16].set(0.0000F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[18].set(0.062128F, 0.875134F, 1.0F, 0.0F);
|
tempTexCoords[17].set(0.0000F, 0.1250F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[19].set(0.062128F, 0.937621F, 1.0F, 0.0F);
|
tempTexCoords[18].set(0.0625F, 0.1250F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[20].set(0.000000F, 0.937223F, 1.0F, 0.0F);
|
tempTexCoords[19].set(0.0625F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[21].set(0.062223F, 0.937223F, 1.0F, 0.0F);
|
tempTexCoords[20].set(0.0000F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[22].set(0.062223F, 0.999641F, 1.0F, 0.0F);
|
tempTexCoords[21].set(0.0625F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[23].set(0.000000F, 0.999641F, 1.0F, 0.0F);
|
tempTexCoords[22].set(0.0625F, 0.0000F, 1.0000F, 0.0000F);
|
||||||
|
tempTexCoords[23].set(0.0000F, 0.0000F, 1.0000F, 0.0000F);
|
||||||
|
|
||||||
// Because 16 blocks can fit in single column of 256x256 tex atlas
|
// Because 16 blocks can fit in single column of 256x256 tex atlas
|
||||||
offset = 1.0F / 16.0F;
|
offset = 1.0F / 16.0F;
|
||||||
|
|
||||||
for (u32 i = 0; i < tempVertsStsCount; i++)
|
|
||||||
tempTexCoords[i].y = 1.0F - tempTexCoords[i].y;
|
|
||||||
|
|
||||||
tempVertFaces = new u32[36];
|
tempVertFaces = new u32[36];
|
||||||
tempTexCoordsFaces = new u32[36];
|
tempTexCoordsFaces = new u32[36];
|
||||||
|
|
||||||
|
|||||||
@@ -54,37 +54,35 @@ void McpipSingleTexBlockData::allocateTempData() {
|
|||||||
tempVerts[23].set(1.0F, 1.0F, 1.0F);
|
tempVerts[23].set(1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
tempTexCoords = new Tyra::Vec4[tempVertsStsCount];
|
tempTexCoords = new Tyra::Vec4[tempVertsStsCount];
|
||||||
tempTexCoords[0].set(0.000618F, 0.937685F, 1.0F, 0.0F);
|
// Y = 1.0F - Y
|
||||||
tempTexCoords[1].set(0.062592F, 0.937685F, 1.0F, 0.0F);
|
tempTexCoords[0].set(0.0000F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[2].set(0.062592F, 0.999658F, 1.0F, 0.0F);
|
tempTexCoords[1].set(0.0625F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[3].set(0.000618F, 0.999658F, 1.0F, 0.0F);
|
tempTexCoords[2].set(0.0625F, 0.0000F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[4].set(0.062608F, 0.937379F, 1.0F, 0.0F);
|
tempTexCoords[3].set(0.0000F, 0.0000F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[5].set(0.062576F, 0.999352F, 1.0F, 0.0F);
|
tempTexCoords[4].set(0.0625F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[6].set(0.000602F, 0.999320F, 1.0F, 0.0F);
|
tempTexCoords[5].set(0.0625F, 0.0000F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[7].set(0.000634F, 0.937346F, 1.0F, 0.0F);
|
tempTexCoords[6].set(0.0000F, 0.0000F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[8].set(0.062592F, 0.937381F, 1.0F, 0.0F);
|
tempTexCoords[7].set(0.0000F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[9].set(0.062592F, 0.999354F, 1.0F, 0.0F);
|
tempTexCoords[8].set(0.0625F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[10].set(0.000618F, 0.999354F, 1.0F, 0.0F);
|
tempTexCoords[9].set(0.0625F, 0.0000F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[11].set(0.000618F, 0.937381F, 1.0F, 0.0F);
|
tempTexCoords[10].set(0.0000F, 0.0000F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[12].set(0.062618F, 0.937600F, 1.0F, 0.0F);
|
tempTexCoords[11].set(0.0000F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[13].set(0.062618F, 0.999542F, 1.0F, 0.0F);
|
tempTexCoords[12].set(0.0625F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[14].set(0.000603F, 0.999576F, 1.0F, 0.0F);
|
tempTexCoords[13].set(0.0625F, 0.0000F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[15].set(0.000616F, 0.937585F, 1.0F, 0.0F);
|
tempTexCoords[14].set(0.0000F, 0.0000F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[16].set(0.062561F, 0.937533F, 1.0F, 0.0F);
|
tempTexCoords[15].set(0.0000F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[17].set(0.062561F, 0.999446F, 1.0F, 0.0F);
|
tempTexCoords[16].set(0.0625F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[18].set(0.000649F, 0.999446F, 1.0F, 0.0F);
|
tempTexCoords[17].set(0.0625F, 0.0000F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[19].set(0.000649F, 0.937533F, 1.0F, 0.0F);
|
tempTexCoords[18].set(0.0000F, 0.0000F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[20].set(0.000556F, 0.937533F, 1.0F, 0.0F);
|
tempTexCoords[19].set(0.0000F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[21].set(0.062530F, 0.937533F, 1.0F, 0.0F);
|
tempTexCoords[20].set(0.0000F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[22].set(0.062530F, 0.999506F, 1.0F, 0.0F);
|
tempTexCoords[21].set(0.0625F, 0.0625F, 1.0000F, 0.0000F);
|
||||||
tempTexCoords[23].set(0.000556F, 0.999506F, 1.0F, 0.0F);
|
tempTexCoords[22].set(0.0625F, 0.0000F, 1.0000F, 0.0000F);
|
||||||
|
tempTexCoords[23].set(0.0000F, 0.0000F, 1.0000F, 0.0000F);
|
||||||
|
|
||||||
// Because 16 blocks can fit in single column of 256x256 tex atlas
|
// Because 16 blocks can fit in single column of 256x256 tex atlas
|
||||||
offset = 1.0F / 16.0F;
|
offset = 1.0F / 16.0F;
|
||||||
|
|
||||||
for (u32 i = 0; i < tempVertsStsCount; i++)
|
|
||||||
tempTexCoords[i].y = 1.0F - tempTexCoords[i].y;
|
|
||||||
|
|
||||||
tempVertFaces = new u32[36];
|
tempVertFaces = new u32[36];
|
||||||
tempTexCoordsFaces = new u32[36];
|
tempTexCoordsFaces = new u32[36];
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ class Tutorial01 : public Game {
|
|||||||
DynPipOptions* dynOptions;
|
DynPipOptions* dynOptions;
|
||||||
Texture* warriorTex;
|
Texture* warriorTex;
|
||||||
Texture* blocksTex;
|
Texture* blocksTex;
|
||||||
|
Texture* blocksTex2;
|
||||||
|
|
||||||
u32 blocksCount;
|
u32 blocksCount;
|
||||||
McpipBlock* blocks;
|
McpipBlock* blocks;
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ void Tutorial01 ::init() {
|
|||||||
|
|
||||||
blocksTex = engine->renderer.core.texture.repository.add(
|
blocksTex = engine->renderer.core.texture.repository.add(
|
||||||
FileUtils::fromCwd("blocks.png"));
|
FileUtils::fromCwd("blocks.png"));
|
||||||
|
blocksTex2 = engine->renderer.core.texture.repository.add(
|
||||||
|
FileUtils::fromCwd("texture_atlas.png"));
|
||||||
|
|
||||||
mcPip.setRenderer(&engine->renderer.core);
|
mcPip.setRenderer(&engine->renderer.core);
|
||||||
dynpip.setRenderer(&engine->renderer.core);
|
dynpip.setRenderer(&engine->renderer.core);
|
||||||
@@ -95,8 +97,8 @@ void Tutorial01 ::init() {
|
|||||||
for (u32 i = 0; i < picturesCount; i++)
|
for (u32 i = 0; i < picturesCount; i++)
|
||||||
pictures[i] = get2DPicture(&engine->renderer);
|
pictures[i] = get2DPicture(&engine->renderer);
|
||||||
|
|
||||||
u32 rows = 16; // 64
|
u32 rows = 2; // 64
|
||||||
u32 columns = 16; // 64
|
u32 columns = 2; // 64
|
||||||
blocksCount = rows * columns;
|
blocksCount = rows * columns;
|
||||||
|
|
||||||
float offset = 4.0F;
|
float offset = 4.0F;
|
||||||
@@ -112,10 +114,12 @@ void Tutorial01 ::init() {
|
|||||||
|
|
||||||
translations[i].translateX(row * offset - center);
|
translations[i].translateX(row * offset - center);
|
||||||
translations[i].translateY(column * offset - center);
|
translations[i].translateY(column * offset - center);
|
||||||
translations[i].translateZ(-50.0F);
|
translations[i].translateZ(-10.0F);
|
||||||
|
|
||||||
u32 randRow = rand() % (rows + 1);
|
// u32 randRow = rand() % (rows + 1);
|
||||||
u32 randColumn = rand() % (columns + 1);
|
// u32 randColumn = rand() % (columns + 1);
|
||||||
|
u32 randRow = 0;
|
||||||
|
u32 randColumn = 0;
|
||||||
|
|
||||||
blocks[i].textureOffset =
|
blocks[i].textureOffset =
|
||||||
Vec4(mcPip.getTextureOffset() * randRow,
|
Vec4(mcPip.getTextureOffset() * randRow,
|
||||||
@@ -145,9 +149,9 @@ void Tutorial01 ::loop() {
|
|||||||
engine->renderer.beginFrame(CameraInfo3D(&cameraPosition, &cameraLookAt));
|
engine->renderer.beginFrame(CameraInfo3D(&cameraPosition, &cameraLookAt));
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < blocksCount; i++) {
|
for (u32 i = 0; i < blocksCount; i++) {
|
||||||
rotations[i].rotateX(0.04F);
|
// rotations[i].rotateX(0.04F);
|
||||||
rotations[i].rotateY(0.01F);
|
rotations[i].rotateY(0.04F);
|
||||||
rotations[i].rotateZ(0.01F);
|
// rotations[i].rotateZ(0.01F);
|
||||||
|
|
||||||
blocks[i].model = translations[i] * rotations[i] * scales[i];
|
blocks[i].model = translations[i] * rotations[i] * scales[i];
|
||||||
}
|
}
|
||||||
@@ -155,26 +159,26 @@ void Tutorial01 ::loop() {
|
|||||||
for (u32 i = 0; i < picturesCount; i++)
|
for (u32 i = 0; i < picturesCount; i++)
|
||||||
engine->renderer.renderer2D.render(pictures[i]);
|
engine->renderer.renderer2D.render(pictures[i]);
|
||||||
|
|
||||||
engine->renderer.renderer3D.usePipeline(&stapip);
|
// engine->renderer.renderer3D.usePipeline(&stapip);
|
||||||
{
|
// {
|
||||||
stapip.render(staticMesh, staOptions);
|
// stapip.render(staticMesh, staOptions);
|
||||||
stapip.render(skybox, skyboxOptions);
|
// stapip.render(skybox, skyboxOptions);
|
||||||
}
|
// }
|
||||||
|
|
||||||
engine->renderer.renderer3D.usePipeline(&dynpip);
|
// engine->renderer.renderer3D.usePipeline(&dynpip);
|
||||||
{
|
// {
|
||||||
dynpip.render(cube);
|
// dynpip.render(cube);
|
||||||
Threading::switchThread();
|
// Threading::switchThread();
|
||||||
for (u8 i = 0; i < warriorsCount; i++) {
|
// for (u8 i = 0; i < warriorsCount; i++) {
|
||||||
dynpip.render(warriors[i], dynOptions);
|
// dynpip.render(warriors[i], dynOptions);
|
||||||
if (i == 5) Threading::switchThread();
|
// if (i == 5) Threading::switchThread();
|
||||||
if (i == 10) Threading::switchThread();
|
// if (i == 10) Threading::switchThread();
|
||||||
if (i == 15) Threading::switchThread();
|
// if (i == 15) Threading::switchThread();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
engine->renderer.renderer3D.usePipeline(&mcPip);
|
engine->renderer.renderer3D.usePipeline(&mcPip);
|
||||||
{ mcPip.render(blocks, blocksCount, blocksTex); }
|
{ mcPip.render(blocks, blocksCount, blocksTex2, true); }
|
||||||
}
|
}
|
||||||
engine->renderer.endFrame();
|
engine->renderer.endFrame();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user