Compare commits
4 Commits
Version_0.
...
Version_0.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
97a38d5260 | ||
![]() |
23ce58291e | ||
![]() |
232acedce7 | ||
![]() |
60cc7bb562 |
@@ -131,6 +131,8 @@ void Object::analyseMsh2Chunks(std::list<ChunkHeader*>& chunkList)
|
|||||||
std::list<ChunkHeader*> tempMatdChunks;
|
std::list<ChunkHeader*> tempMatdChunks;
|
||||||
loadChunks(tempMatdChunks, (*it)->position, (*it)->size);
|
loadChunks(tempMatdChunks, (*it)->position, (*it)->size);
|
||||||
|
|
||||||
|
vTextures.push_back("");
|
||||||
|
|
||||||
// analyse MATD subchunks
|
// analyse MATD subchunks
|
||||||
analyseMatdChunks(tempMatdChunks);
|
analyseMatdChunks(tempMatdChunks);
|
||||||
|
|
||||||
@@ -193,7 +195,7 @@ void Object::analyseMatdChunks(std::list<ChunkHeader*>& chunkList)
|
|||||||
char* buffer = new char[(*it)->size + 1];
|
char* buffer = new char[(*it)->size + 1];
|
||||||
*buffer = { 0 };
|
*buffer = { 0 };
|
||||||
fsMesh.read(buffer, (*it)->size);
|
fsMesh.read(buffer, (*it)->size);
|
||||||
vTextures.push_back(buffer);
|
vTextures.back() = buffer;
|
||||||
delete buffer;
|
delete buffer;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -389,6 +391,8 @@ void Object::analyseSegmChunks(Modl * dataDestination, std::list<ChunkHeader*>&
|
|||||||
/*if (!strcmp("NRML", (*it)->name))
|
/*if (!strcmp("NRML", (*it)->name))
|
||||||
{
|
{
|
||||||
fsMesh.seekg((*it)->position);
|
fsMesh.seekg((*it)->position);
|
||||||
|
std::uint32_t tempSize;
|
||||||
|
fsMesh.read(reinterpret_cast<char*>(&tempSize), sizeof(tempSize));
|
||||||
// List of normals
|
// List of normals
|
||||||
// long int - 4 - number of normal vectores stored in this list
|
// long int - 4 - number of normal vectores stored in this list
|
||||||
// float[3][] - 12 each - UVW vector for each vertex
|
// float[3][] - 12 each - UVW vector for each vertex
|
||||||
|
@@ -399,7 +399,7 @@ void OpenGLController::loadMsh(const char * path)
|
|||||||
Vertex tempVertex;
|
Vertex tempVertex;
|
||||||
// every edge has 3 coordinates
|
// every edge has 3 coordinates
|
||||||
for (int j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
tempVertex.position[j] = (GLfloat)segIt->vertex[(*mshIt)[triEdge > 0 ? tri + triEdge : 0] * 3 + j];
|
tempVertex.position[j] = (GLfloat)segIt->vertex[(*mshIt)[tri + triEdge - ((tri % 2) * (triEdge - 1) * 2)] * 3 + j];
|
||||||
|
|
||||||
// and 2 UV
|
// and 2 UV
|
||||||
if (segIt->uv == NULL)
|
if (segIt->uv == NULL)
|
||||||
@@ -410,7 +410,7 @@ void OpenGLController::loadMsh(const char * path)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 2; j++)
|
for (int j = 0; j < 2; j++)
|
||||||
tempVertex.uv[j] = (GLfloat)segIt->uv[(*mshIt)[triEdge > 0 ? tri + triEdge : 0] * 2 + j];
|
tempVertex.uv[j] = (GLfloat)segIt->uv[(*mshIt)[tri + triEdge - ((tri % 2) * (triEdge - 1) * 2)] * 2 + j];
|
||||||
}
|
}
|
||||||
tempBufferData.push_back(tempVertex);
|
tempBufferData.push_back(tempVertex);
|
||||||
}
|
}
|
||||||
@@ -459,7 +459,6 @@ void OpenGLController::loadMsh(const char * path)
|
|||||||
}
|
}
|
||||||
catch (std::invalid_argument e)
|
catch (std::invalid_argument e)
|
||||||
{
|
{
|
||||||
GLubyte solidColor[4] = { 0, 0, 255, 255 };
|
|
||||||
tempData->alpha = true;
|
tempData->alpha = true;
|
||||||
tempData->width = 1;
|
tempData->width = 1;
|
||||||
tempData->height = 1;
|
tempData->height = 1;
|
||||||
@@ -471,7 +470,6 @@ void OpenGLController::loadMsh(const char * path)
|
|||||||
|
|
||||||
// add a solid default color at the end (maybe there is an invalid index later)
|
// add a solid default color at the end (maybe there is an invalid index later)
|
||||||
textureData* tempData = new textureData;
|
textureData* tempData = new textureData;
|
||||||
GLubyte solidColor[4] = { 0, 0, 255, 255 };
|
|
||||||
tempData->alpha = true;
|
tempData->alpha = true;
|
||||||
tempData->width = 1;
|
tempData->width = 1;
|
||||||
tempData->height = 1;
|
tempData->height = 1;
|
||||||
|
@@ -57,7 +57,6 @@ TextureTGA::TextureTGA(const char * filePath)
|
|||||||
std::uint8_t tempChunkHeader;
|
std::uint8_t tempChunkHeader;
|
||||||
std::uint8_t tempData[5];
|
std::uint8_t tempData[5];
|
||||||
unsigned int tempByteIndex = 0;
|
unsigned int tempByteIndex = 0;
|
||||||
std::size_t tempPixelIndex = 0;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
fsPicture.read(reinterpret_cast<char*>(&tempChunkHeader), sizeof(tempChunkHeader));
|
fsPicture.read(reinterpret_cast<char*>(&tempChunkHeader), sizeof(tempChunkHeader));
|
||||||
|
@@ -17,7 +17,7 @@ int main(int argc, char** argv)
|
|||||||
else
|
else
|
||||||
scene = OpenGLController::getInstance();
|
scene = OpenGLController::getInstance();
|
||||||
|
|
||||||
scene->loadMsh("..\\Release\\Msh\\cluster.msh");
|
scene->loadMsh("..\\Release\\Msh\\quadPoly.msh");
|
||||||
|
|
||||||
do {
|
do {
|
||||||
scene->updateScene();
|
scene->updateScene();
|
||||||
|
@@ -13,10 +13,7 @@ Feel free to use my code the way you like. But remember i used some public libra
|
|||||||
licence, too.
|
licence, too.
|
||||||
|
|
||||||
### To Do
|
### To Do
|
||||||
- cluster use wrong textures
|
- cloth not working correctly
|
||||||
- use normals or fix ccw and cw
|
|
||||||
- multipoly triangulation not 100% good
|
|
||||||
- cloth testing
|
|
||||||
- optional display bones, shadow, collision,...
|
- optional display bones, shadow, collision,...
|
||||||
- integrate into a software:
|
- integrate into a software:
|
||||||
-> gui open file ( + drag and drop),
|
-> gui open file ( + drag and drop),
|
||||||
|
BIN
Release/Msh/1.tga
Normal file
BIN
Release/Msh/1.tga
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
BIN
Release/Msh/2.tga
Normal file
BIN
Release/Msh/2.tga
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
BIN
Release/Msh/3.tga
Normal file
BIN
Release/Msh/3.tga
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
BIN
Release/Msh/4-Poly.msh
Normal file
BIN
Release/Msh/4-Poly.msh
Normal file
Binary file not shown.
BIN
Release/Msh/4.tga
Normal file
BIN
Release/Msh/4.tga
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
BIN
Release/Msh/5-Poly.msh
Normal file
BIN
Release/Msh/5-Poly.msh
Normal file
Binary file not shown.
BIN
Release/Msh/5.tga
Normal file
BIN
Release/Msh/5.tga
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
BIN
Release/Msh/6-poly.msh
Normal file
BIN
Release/Msh/6-poly.msh
Normal file
Binary file not shown.
BIN
Release/Msh/6.tga
Normal file
BIN
Release/Msh/6.tga
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
BIN
Release/Msh/quadPoly.msh
Normal file
BIN
Release/Msh/quadPoly.msh
Normal file
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user