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;
|
||||
loadChunks(tempMatdChunks, (*it)->position, (*it)->size);
|
||||
|
||||
vTextures.push_back("");
|
||||
|
||||
// analyse MATD subchunks
|
||||
analyseMatdChunks(tempMatdChunks);
|
||||
|
||||
@@ -193,7 +195,7 @@ void Object::analyseMatdChunks(std::list<ChunkHeader*>& chunkList)
|
||||
char* buffer = new char[(*it)->size + 1];
|
||||
*buffer = { 0 };
|
||||
fsMesh.read(buffer, (*it)->size);
|
||||
vTextures.push_back(buffer);
|
||||
vTextures.back() = buffer;
|
||||
delete buffer;
|
||||
continue;
|
||||
}
|
||||
@@ -389,6 +391,8 @@ void Object::analyseSegmChunks(Modl * dataDestination, std::list<ChunkHeader*>&
|
||||
/*if (!strcmp("NRML", (*it)->name))
|
||||
{
|
||||
fsMesh.seekg((*it)->position);
|
||||
std::uint32_t tempSize;
|
||||
fsMesh.read(reinterpret_cast<char*>(&tempSize), sizeof(tempSize));
|
||||
// List of normals
|
||||
// long int - 4 - number of normal vectores stored in this list
|
||||
// float[3][] - 12 each - UVW vector for each vertex
|
||||
|
@@ -324,7 +324,7 @@ void OpenGLController::updateScene()
|
||||
{
|
||||
// give texture to the shader
|
||||
std::uint32_t tempTexIndex = segIt->textureIndex >= vTextures.size() ? vTextures.size() - 1 : segIt->textureIndex;
|
||||
|
||||
|
||||
glTexImage2D(
|
||||
GL_TEXTURE_2D,
|
||||
0,
|
||||
@@ -399,7 +399,7 @@ void OpenGLController::loadMsh(const char * path)
|
||||
Vertex tempVertex;
|
||||
// every edge has 3 coordinates
|
||||
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
|
||||
if (segIt->uv == NULL)
|
||||
@@ -410,7 +410,7 @@ void OpenGLController::loadMsh(const char * path)
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
@@ -459,7 +459,6 @@ void OpenGLController::loadMsh(const char * path)
|
||||
}
|
||||
catch (std::invalid_argument e)
|
||||
{
|
||||
GLubyte solidColor[4] = { 0, 0, 255, 255 };
|
||||
tempData->alpha = true;
|
||||
tempData->width = 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)
|
||||
textureData* tempData = new textureData;
|
||||
GLubyte solidColor[4] = { 0, 0, 255, 255 };
|
||||
tempData->alpha = true;
|
||||
tempData->width = 1;
|
||||
tempData->height = 1;
|
||||
|
@@ -57,7 +57,6 @@ TextureTGA::TextureTGA(const char * filePath)
|
||||
std::uint8_t tempChunkHeader;
|
||||
std::uint8_t tempData[5];
|
||||
unsigned int tempByteIndex = 0;
|
||||
std::size_t tempPixelIndex = 0;
|
||||
|
||||
do {
|
||||
fsPicture.read(reinterpret_cast<char*>(&tempChunkHeader), sizeof(tempChunkHeader));
|
||||
|
@@ -17,7 +17,7 @@ int main(int argc, char** argv)
|
||||
else
|
||||
scene = OpenGLController::getInstance();
|
||||
|
||||
scene->loadMsh("..\\Release\\Msh\\cluster.msh");
|
||||
scene->loadMsh("..\\Release\\Msh\\quadPoly.msh");
|
||||
|
||||
do {
|
||||
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.
|
||||
|
||||
### To Do
|
||||
- cluster use wrong textures
|
||||
- use normals or fix ccw and cw
|
||||
- multipoly triangulation not 100% good
|
||||
- cloth testing
|
||||
- cloth not working correctly
|
||||
- optional display bones, shadow, collision,...
|
||||
- integrate into a software:
|
||||
-> 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