Compare commits
6 Commits
skmp/miami
...
ph3nom/mia
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80bad15904 | ||
|
|
4a453e3604 | ||
|
|
53261e57ed | ||
|
|
d79e4516a5 | ||
|
|
77530e641d | ||
|
|
ed540c8e00 |
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -7,7 +7,7 @@
|
||||
"program": "${workspaceFolder}/dreamcast/dca3-sim.elf",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}/dreamcast",
|
||||
"cwd": "${fileDirname}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
|
||||
@@ -1269,6 +1269,9 @@ CAnimManager::LoadAnimFile(RwStream *stream, bool compress, char (*uncompressedA
|
||||
}
|
||||
|
||||
debug("Loading ANIMS %s\n", animBlock->name);
|
||||
|
||||
bool stub_out = strcmp(animBlock->name, "law_1b") == 0;
|
||||
|
||||
animBlock->isLoaded = true;
|
||||
|
||||
int animIndex = animBlock->firstIndex;
|
||||
@@ -1321,12 +1324,12 @@ CAnimManager::LoadAnimFile(RwStream *stream, bool compress, char (*uncompressedA
|
||||
RwStreamRead(stream, &info, sizeof(info));
|
||||
if(strncmp(info.ident, "KRTS", 4) == 0){
|
||||
hasScale = true;
|
||||
seq->SetNumFrames(numFrames, true, compressHier);
|
||||
seq->SetNumFrames(stub_out ? 1 : numFrames, true, compressHier);
|
||||
}else if(strncmp(info.ident, "KRT0", 4) == 0){
|
||||
hasTranslation = true;
|
||||
seq->SetNumFrames(numFrames, true, compressHier);
|
||||
seq->SetNumFrames(stub_out ? 1 : numFrames, true, compressHier);
|
||||
}else if(strncmp(info.ident, "KR00", 4) == 0){
|
||||
seq->SetNumFrames(numFrames, false, compressHier);
|
||||
seq->SetNumFrames(stub_out ? 1 : numFrames, false, compressHier);
|
||||
}
|
||||
if(strstr(seq->name, "L Toe"))
|
||||
debug("anim %s has toe keyframes\n", hier->name); // BUG: seq->name
|
||||
@@ -1339,9 +1342,10 @@ CAnimManager::LoadAnimFile(RwStream *stream, bool compress, char (*uncompressedA
|
||||
CQuaternion rot(fbuf[0], fbuf[1], fbuf[2], fbuf[3]);
|
||||
rot.Invert();
|
||||
CVector trans(fbuf[4], fbuf[5], fbuf[6]);
|
||||
|
||||
seq->SetRotation(l, rot);
|
||||
seq->SetTranslation(l, trans);
|
||||
if (!stub_out || l ==0) {
|
||||
seq->SetRotation(l, rot);
|
||||
seq->SetTranslation(l, trans);
|
||||
}
|
||||
// scaling ignored
|
||||
frameTimes[l] = fbuf[10]; // absolute time here
|
||||
}else if(hasTranslation){
|
||||
@@ -1350,15 +1354,18 @@ CAnimManager::LoadAnimFile(RwStream *stream, bool compress, char (*uncompressedA
|
||||
rot.Invert();
|
||||
CVector trans(fbuf[4], fbuf[5], fbuf[6]);
|
||||
|
||||
seq->SetRotation(l, rot);
|
||||
seq->SetTranslation(l, trans);
|
||||
if (!stub_out || l ==0) {
|
||||
seq->SetRotation(l, rot);
|
||||
seq->SetTranslation(l, trans);
|
||||
}
|
||||
frameTimes[l] = fbuf[7]; // absolute time here
|
||||
}else{
|
||||
RwStreamRead(stream, buf, 0x14);
|
||||
CQuaternion rot(fbuf[0], fbuf[1], fbuf[2], fbuf[3]);
|
||||
rot.Invert();
|
||||
|
||||
seq->SetRotation(l, rot);
|
||||
if (!stub_out || l ==0) {
|
||||
seq->SetRotation(l, rot);
|
||||
}
|
||||
frameTimes[l] = fbuf[4]; // absolute time here
|
||||
}
|
||||
}
|
||||
@@ -1367,9 +1374,11 @@ CAnimManager::LoadAnimFile(RwStream *stream, bool compress, char (*uncompressedA
|
||||
float running_sum = 0.0f;
|
||||
for (l = 0; l < numFrames; l++) {
|
||||
auto dt = frameTimes[l] - running_sum;
|
||||
seq->SetDeltaTime(l, dt);
|
||||
assert(seq->GetDeltaTime(l) <= dt);
|
||||
running_sum += seq->GetDeltaTime(l);
|
||||
if (!stub_out || l ==0) {
|
||||
seq->SetDeltaTime(l, dt);
|
||||
assert(seq->GetDeltaTime(l) <= dt);
|
||||
running_sum += seq->GetDeltaTime(l);
|
||||
}
|
||||
// if (seq->GetDeltaTime(l) == 0.0f && dt != 0.0f) {
|
||||
// seq->SetDeltaTime(l, KF_MINDELTA);
|
||||
// }
|
||||
|
||||
@@ -1100,13 +1100,13 @@ CRadar::LoadTextures()
|
||||
WaypointSprite.SetTexture("radar_waypoint");
|
||||
if(!WaypointSprite.m_pTexture) {
|
||||
// create the texture if it's missing in TXD
|
||||
#define WAYPOINT_R (255)
|
||||
#define WAYPOINT_G (72)
|
||||
#define WAYPOINT_B (77)
|
||||
#define WAYPOINT_R (255>>4)
|
||||
#define WAYPOINT_G (72>>4)
|
||||
#define WAYPOINT_B (77>>4)
|
||||
|
||||
RwRaster *raster = RwRasterCreate(16, 16, 0, rwRASTERTYPETEXTURE | rwRASTERFORMAT8888);
|
||||
RwRaster *raster = RwRasterCreate(16, 16, 16, rwRASTERTYPETEXTURE | rwRASTERFORMAT4444);
|
||||
|
||||
RwUInt32 *pixels = (RwUInt32 *)RwRasterLock(raster, 0, rwRASTERLOCKWRITE);
|
||||
RwUInt16 *pixels = (RwUInt16 *)RwRasterLock(raster, 0, rwRASTERLOCKWRITE);
|
||||
for(int x = 0; x < 16; x++)
|
||||
for(int y = 0; y < 16; y++)
|
||||
{
|
||||
@@ -1117,13 +1117,9 @@ CRadar::LoadTextures()
|
||||
|| (x2 < 1 && y2 == 1)) // one pixel on each side of second to first/last line is transparent
|
||||
pixels[x + y * 16] = 0;
|
||||
else if((x2 == 2 && y2 >= 2)|| (y2 == 2 && x2 >= 2) )// colored square inside
|
||||
#ifdef RW_GL3
|
||||
pixels[x + y * 16] = WAYPOINT_R | (WAYPOINT_G << 8) | (WAYPOINT_B << 16) | (255 << 24);
|
||||
#else
|
||||
pixels[x + y * 16] = WAYPOINT_B | (WAYPOINT_G << 8) | (WAYPOINT_R << 16) | (255 << 24);
|
||||
#endif
|
||||
pixels[x + y * 16] = WAYPOINT_B | (WAYPOINT_G << 4) | (WAYPOINT_R << 8) | (255 << 12);
|
||||
else
|
||||
pixels[x + y * 16] = 0xFF000000; // black
|
||||
pixels[x + y * 16] = 0xF000; // black
|
||||
}
|
||||
RwRasterUnlock(raster);
|
||||
WaypointSprite.m_pTexture = RwTextureCreate(raster);
|
||||
|
||||
@@ -676,7 +676,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
|
||||
if(ms_aInfoForModel[streamId].m_loadState != STREAMSTATE_STARTED){
|
||||
ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_LOADED;
|
||||
#ifndef USE_CUSTOM_ALLOCATOR
|
||||
if(streamId < STREAM_OFFSET_TXD) {
|
||||
if (streamId < STREAM_OFFSET_TXD || streamId >= STREAM_OFFSET_COL) {
|
||||
ms_memoryUsed += ms_aInfoForModel[streamId].GetCdSize() * CDSTREAM_SECTOR_SIZE;
|
||||
memory_logf("ConvertBufferToObject: Memory used: %d\n", ms_memoryUsed);
|
||||
}
|
||||
@@ -746,7 +746,7 @@ CStreaming::FinishLoadingLargeFile(int8 *buf, int32 streamId)
|
||||
|
||||
ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_LOADED;
|
||||
#ifndef USE_CUSTOM_ALLOCATOR
|
||||
if(streamId < STREAM_OFFSET_TXD) {
|
||||
if (streamId < STREAM_OFFSET_TXD || streamId >= STREAM_OFFSET_COL) {
|
||||
ms_memoryUsed += ms_aInfoForModel[streamId].GetCdSize() * CDSTREAM_SECTOR_SIZE;
|
||||
memory_logf("FinishLoadingLargeFile: Memory used: %d\n", ms_memoryUsed);
|
||||
}
|
||||
@@ -1113,7 +1113,7 @@ CStreaming::RemoveModel(int32 id)
|
||||
assert(id < NUMSTREAMINFO);
|
||||
CAnimManager::RemoveAnimBlock(id - STREAM_OFFSET_ANIM);
|
||||
}
|
||||
if (id < STREAM_OFFSET_TXD) {
|
||||
if (id < STREAM_OFFSET_TXD || id >= STREAM_OFFSET_COL) {
|
||||
ms_memoryUsed -= ms_aInfoForModel[id].GetCdSize()*CDSTREAM_SECTOR_SIZE;
|
||||
memory_logf("Remove Model: %d\n", ms_memoryUsed);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ CClouds::Render(void)
|
||||
CCoronas::SunBlockedByClouds = false;
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
|
||||
|
||||
@@ -194,6 +194,10 @@ char* casepath(char const* path, bool checkPathFirst)
|
||||
}
|
||||
|
||||
size_t l = strlen(path);
|
||||
if (l > 2 && path[0] == '.' && (path[1] == '/' || path[1] == '\\')) {
|
||||
// remove ./ from the start of the path
|
||||
path += 2;
|
||||
}
|
||||
char* p = (char*)alloca(l + 1);
|
||||
char* out = (char*)malloc(l + 3); // for extra ./
|
||||
strcpy(p, path);
|
||||
|
||||
@@ -136,31 +136,28 @@ void CBulletInfo::Update(void)
|
||||
}
|
||||
pPed->InflictDamage(pBullet->m_pSource, pBullet->m_eWeaponType, pBullet->m_nDamage, (ePedPieceTypes)point.pieceB, pPed->GetLocalDirection(pPed->GetPosition() - point.point));
|
||||
CEventList::RegisterEvent(pPed->m_nPedType == PEDTYPE_COP ? EVENT_SHOOT_COP : EVENT_SHOOT_PED, EVENT_ENTITY_PED, pPed, (CPed*)pBullet->m_pSource, 1000);
|
||||
pBullet->m_bInUse = false;
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
bulletInfoInUse--;
|
||||
#endif
|
||||
vecNewPos = point.point;
|
||||
}
|
||||
if (CGame::nastyGame) {
|
||||
CVector vecParticleDirection = (point.point - pPed->GetPosition()) * 0.01f;
|
||||
vecParticleDirection.z = 0.01f;
|
||||
if (pPed->GetIsOnScreen()) {
|
||||
for (int j = 0; j < NUM_PED_BLOOD_PARTICLES; j++)
|
||||
CParticle::AddParticle(PARTICLE_BLOOD_SMALL, point.point + BLOOD_PARTICLE_OFFSET, vecParticleDirection);
|
||||
}
|
||||
if (pPed->GetPedState() == PED_DEAD) {
|
||||
CAnimBlendAssociation* pAnim;
|
||||
if (RpAnimBlendClumpGetFirstAssociation(pPed->GetClump(), ASSOC_FRONTAL))
|
||||
pAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_STD_HIT_FLOOR_FRONT, 8.0f);
|
||||
else
|
||||
pAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_STD_HIT_FLOOR, 8.0f);
|
||||
if (pAnim) {
|
||||
pAnim->SetCurrentTime(0.0f);
|
||||
pAnim->flags |= ASSOC_RUNNING;
|
||||
pAnim->flags &= ~ASSOC_FADEOUTWHENDONE;
|
||||
|
||||
if (CGame::nastyGame) {
|
||||
CVector vecParticleDirection = (point.point - pPed->GetPosition()) * 0.01f;
|
||||
vecParticleDirection.z = 0.01f;
|
||||
if (pPed->GetIsOnScreen()) {
|
||||
for (int j = 0; j < NUM_PED_BLOOD_PARTICLES; j++)
|
||||
CParticle::AddParticle(PARTICLE_BLOOD_SMALL, point.point + BLOOD_PARTICLE_OFFSET, vecParticleDirection);
|
||||
}
|
||||
if (pPed->GetPedState() == PED_DEAD) {
|
||||
CAnimBlendAssociation* pAnim;
|
||||
if (RpAnimBlendClumpGetFirstAssociation(pPed->GetClump(), ASSOC_FRONTAL))
|
||||
pAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_STD_HIT_FLOOR_FRONT, 8.0f);
|
||||
else
|
||||
pAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_STD_HIT_FLOOR, 8.0f);
|
||||
if (pAnim) {
|
||||
pAnim->SetCurrentTime(0.0f);
|
||||
pAnim->flags |= ASSOC_RUNNING;
|
||||
pAnim->flags &= ~ASSOC_FADEOUTWHENDONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pBullet->m_bInUse = false;
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
bulletInfoInUse--;
|
||||
|
||||
111
vendor/librw/src/dc/rwdc.cpp
vendored
111
vendor/librw/src/dc/rwdc.cpp
vendored
@@ -4876,9 +4876,6 @@ bool isDegenerateByIndex(uint16_t idx1, uint16_t idx2, uint16_t idx3) {
|
||||
return idx1 == idx2 || idx1 == idx3 || idx2 == idx3;
|
||||
}
|
||||
static int8_t packFloat8(float f) {
|
||||
if (std::isnan(f)) {
|
||||
f = 0;
|
||||
}
|
||||
auto rounded = lroundf(f * 127);
|
||||
|
||||
assert(rounded >= -127 && rounded <= 127);
|
||||
@@ -4906,16 +4903,8 @@ struct write_vector: std::vector<uint8_t> {
|
||||
std::copy(p, p + sizeof(T), begin() + offset);
|
||||
}
|
||||
|
||||
void packVertex(RwSphere* volume, V3d* vertex, TexCoords* texcoord, V3d* normal, RGBA* color, bool big_vertex, bool pad_xyz, bool big_uv, bool tiny_vertex) {
|
||||
if (tiny_vertex) {
|
||||
assert(!big_vertex);
|
||||
assert(!big_uv);
|
||||
assert(!pad_xyz);
|
||||
|
||||
write<int8_t>(packFloat8((vertex->x - volume->center.x) / volume->radius));
|
||||
write<int8_t>(packFloat8((vertex->y - volume->center.y) / volume->radius));
|
||||
write<int8_t>(packFloat8((vertex->z - volume->center.z) / volume->radius));
|
||||
} else if (big_vertex) {
|
||||
void packVertex(RwSphere* volume, V3d* vertex, TexCoords* texcoord, V3d* normal, RGBA* color, bool big_vertex, bool pad_xyz, bool big_uv) {
|
||||
if (big_vertex) {
|
||||
write<float>(vertex->x);
|
||||
write<float>(vertex->y);
|
||||
write<float>(vertex->z);
|
||||
@@ -4935,8 +4924,8 @@ struct write_vector: std::vector<uint8_t> {
|
||||
float16 v = texcoord->v;
|
||||
write<uint32_t>((u.raw << 16) | v.raw);
|
||||
} else {
|
||||
write<int8_t>(packFloat8(texcoord->u));
|
||||
write<int8_t>(packFloat8(texcoord->v));
|
||||
write<int8_t>(lroundf(texcoord->u * 127));
|
||||
write<int8_t>(lroundf(texcoord->v * 127));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4949,9 +4938,9 @@ struct write_vector: std::vector<uint8_t> {
|
||||
printf("*WARNING* invalid normal\n");
|
||||
}
|
||||
|
||||
int8_t nxi = packFloat8(normaly.x);
|
||||
int8_t nyi = packFloat8(normaly.y);
|
||||
int8_t nzi = packFloat8(normaly.z);
|
||||
int8_t nxi = lroundf(normaly.x * 127);
|
||||
int8_t nyi = lroundf(normaly.y * 127);
|
||||
int8_t nzi = lroundf(normaly.z * 127);
|
||||
|
||||
V3d normal2 = { static_cast<float32>(nxi), static_cast<float32>(nyi), static_cast<float32>(nzi) };
|
||||
|
||||
@@ -4962,9 +4951,7 @@ struct write_vector: std::vector<uint8_t> {
|
||||
write<int8_t>(nxi);
|
||||
write<int8_t>(nyi);
|
||||
write<int8_t>(nzi);
|
||||
if (!tiny_vertex) {
|
||||
write<int8_t>(0);
|
||||
}
|
||||
write<int8_t>(0);
|
||||
}
|
||||
|
||||
if (color) {
|
||||
@@ -4973,10 +4960,6 @@ struct write_vector: std::vector<uint8_t> {
|
||||
}
|
||||
};
|
||||
|
||||
bool isNotTinyVertex(const V3d& vtx) {
|
||||
return vtx.x > 1 || vtx.y > 1 || vtx.z > 1 || vtx.x < -1 || vtx.y < -1 || vtx.z < -1;
|
||||
}
|
||||
|
||||
bool isBigVertex(const V3d& vtx) {
|
||||
return vtx.x > 127 || vtx.y > 127 || vtx.z > 127 || vtx.x < -127 || vtx.y < -127 || vtx.z < -127;
|
||||
}
|
||||
@@ -4985,13 +4968,8 @@ bool isBigUV(const TexCoords& uv) {
|
||||
return uv.u > 1 || uv.v > 1 || uv.u < -1 || uv.v < -1;
|
||||
}
|
||||
|
||||
void adjustFlagsForAlingment(bool textured, bool colored, bool& big_vertex, bool& big_uv, bool& pad_xyz, bool tiny_vertex) {
|
||||
void adjustFlagsForAlingment(bool textured, bool colored, bool& big_vertex, bool& big_uv, bool& pad_xyz) {
|
||||
pad_xyz = false;
|
||||
if (tiny_vertex) {
|
||||
assert(!big_vertex);
|
||||
assert(!big_uv);
|
||||
return;
|
||||
}
|
||||
|
||||
if (textured) {
|
||||
if (big_vertex && !big_uv) {
|
||||
@@ -5004,13 +4982,7 @@ void adjustFlagsForAlingment(bool textured, bool colored, bool& big_vertex, bool
|
||||
}
|
||||
}
|
||||
|
||||
unsigned caluclateVertexAlignment(bool textured, bool normaled, bool colored, bool big_vertex, bool big_uv, bool pad_xyz, bool tiny_vertex) {
|
||||
if (tiny_vertex) {
|
||||
assert(!big_vertex);
|
||||
assert(!big_uv);
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned caluclateVertexAlignment(bool textured, bool normaled, bool colored, bool big_vertex, bool big_uv, bool pad_xyz) {
|
||||
if (big_vertex) {
|
||||
return 4;
|
||||
} else if (textured && big_uv) {
|
||||
@@ -5019,28 +4991,9 @@ unsigned caluclateVertexAlignment(bool textured, bool normaled, bool colored, bo
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
unsigned caluclateVertexSize(bool textured, bool normaled, bool colored, bool big_vertex, bool big_uv, bool pad_xyz, bool tiny_vertex) {
|
||||
unsigned caluclateVertexSize(bool textured, bool normaled, bool colored, bool big_vertex, bool big_uv, bool pad_xyz) {
|
||||
uint32_t vertexBytes = 0; //xyz
|
||||
|
||||
if (tiny_vertex) {
|
||||
assert(!big_vertex);
|
||||
assert(!big_uv);
|
||||
|
||||
vertexBytes += 3;
|
||||
|
||||
if (textured) {
|
||||
vertexBytes += 2;
|
||||
}
|
||||
|
||||
if (normaled) {
|
||||
vertexBytes += 3;
|
||||
}
|
||||
|
||||
if (colored) {
|
||||
vertexBytes += 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (big_vertex) {
|
||||
vertexBytes += 4 * 3;
|
||||
} else {
|
||||
@@ -5111,16 +5064,6 @@ struct meshlet {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isOfTinyVertex(V3d* vertexData, Sphere* volume) {
|
||||
return false;
|
||||
for (auto v : vertices) {
|
||||
if (isNotTinyVertex(sub(vertexData[v], volume->center))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isOfBigUV(TexCoords* uvData) {
|
||||
for (auto v : vertices) {
|
||||
if (isBigUV(uvData[v])) {
|
||||
@@ -5416,30 +5359,18 @@ void processGeom(Geometry *geo) {
|
||||
|
||||
bool big_vertex = meshlet.isOfBigVertex(vertices, &boundingSphere);
|
||||
bool big_uv = texcoorded && meshlet.isOfBigUV(texcoords);
|
||||
bool tiny_vertex = !big_uv && meshlet.isOfTinyVertex(vertices, &boundingSphere);
|
||||
|
||||
if (tiny_vertex) {
|
||||
fprintf(stderr, "\n***************OMG TINY VERTEX***************\n");
|
||||
}
|
||||
|
||||
bool pad_xyz;
|
||||
adjustFlagsForAlingment(texcoorded, colored, big_vertex, big_uv, pad_xyz, tiny_vertex);
|
||||
uint8_t vertexSize = caluclateVertexSize(texcoorded, normaled, colored, big_vertex, big_uv, pad_xyz, tiny_vertex);
|
||||
uint8_t vertexAlignment = caluclateVertexAlignment(texcoorded, normaled, colored, big_vertex, big_uv, pad_xyz, tiny_vertex);
|
||||
adjustFlagsForAlingment(texcoorded, colored, big_vertex, big_uv, pad_xyz);
|
||||
uint8_t vertexSize = caluclateVertexSize(texcoorded, normaled, colored, big_vertex, big_uv, pad_xyz);
|
||||
uint8_t vertexAlignment = caluclateVertexAlignment(texcoorded, normaled, colored, big_vertex, big_uv, pad_xyz);
|
||||
|
||||
assert(vertexSize % vertexAlignment == 0 || vertexSize % vertexAlignment == vertexAlignment);
|
||||
if (vertexData.size() % vertexAlignment && vertexAlignment != 1) {
|
||||
auto count = vertexAlignment - vertexData.size() % vertexAlignment;
|
||||
for (unsigned i = 0; i < count; i++) {
|
||||
vertexData.write<uint8_t>(0);
|
||||
}
|
||||
}
|
||||
assert(vertexData.size() % vertexAlignment == 0 || vertexData.size() % vertexAlignment == vertexAlignment);
|
||||
assert(vertexSize % vertexAlignment == 0);
|
||||
assert(vertexData.size() % vertexAlignment == 0);
|
||||
|
||||
meshlet.vertexDataOffset = vertexData.size();
|
||||
|
||||
for (auto &&idx: meshlet.vertices) {
|
||||
vertexData.packVertex(&boundingSphere, &vertices[idx], texcoorded ? &texcoords[idx] : nullptr, normaled ? &normals[idx] : nullptr, colored ? &colors[idx] : nullptr, big_vertex, pad_xyz, big_uv, tiny_vertex);
|
||||
vertexData.packVertex(&boundingSphere, &vertices[idx], texcoorded ? &texcoords[idx] : nullptr, normaled ? &normals[idx] : nullptr, colored ? &colors[idx] : nullptr, big_vertex, pad_xyz, big_uv);
|
||||
}
|
||||
|
||||
// write out index data
|
||||
@@ -5609,7 +5540,7 @@ void processGeom(Geometry *geo) {
|
||||
// write out meshlet data
|
||||
meshletData.write(boundingSphere);
|
||||
//isTextured, isNormaled, isColored, small_xyz, pad_xyz, small_uv
|
||||
uint16_t flags = texcoorded | (normaled << 1) | (colored << 2) | (!big_vertex << 3) | (pad_xyz << 4) | (!big_uv << 5) | (tiny_vertex << 6);
|
||||
uint16_t flags = texcoorded | (normaled << 1) | (colored << 2) | (!big_vertex << 3) | (pad_xyz << 4) | (!big_uv << 5);
|
||||
meshletData.write<uint16_t>(flags);
|
||||
meshletData.write<uint8_t>(0);
|
||||
//bool textured, bool normaled, bool colored, bool big_vertex, bool big_uv, bool pad_xyz
|
||||
@@ -5637,15 +5568,9 @@ void processGeom(Geometry *geo) {
|
||||
|
||||
bool isIdx8 = geo->numVertices < 256;
|
||||
|
||||
// align for skinWeightBase
|
||||
if (vertexData.size() % 2) {
|
||||
vertexData.write<uint8_t>(0);
|
||||
}
|
||||
|
||||
auto dataSize = meshData.size() + meshletData.size() + vertexData.size() + skinningIndexData.size() + skinningWeightData.size() + indexData.size();
|
||||
|
||||
auto vertexBase = meshData.size() + meshletData.size();
|
||||
|
||||
auto skinIndexBase = vertexBase + vertexData.size();
|
||||
auto skinWeightBase = skinIndexBase + skinningIndexData.size();
|
||||
assert(skinWeightBase % 2 == 0);
|
||||
|
||||
Reference in New Issue
Block a user