Skip to content
Snippets Groups Projects
Commit 4c40d140 authored by Anakin's avatar Anakin
Browse files

cloth now has specular

parent f47e1cc7
No related branches found
No related tags found
No related merge requests found
......@@ -42,10 +42,10 @@ struct Material {
QString tx3d;
QOpenGLTexture* texture0 = Q_NULLPTR;
QOpenGLTexture* texture1 = Q_NULLPTR;
QVector4D specularColor = { 1.0, 1.0, 1.0, 1.0 };
QVector4D specularColor = { 0.1f, 0.1f, 0.1f, 1.0 };
QVector4D diffuseColor = { 1.0, 0.0, 0.0, 1.0 };
QVector4D ambientColor = { 1.0, 1.0, 1.0, 1.0 };
float shininess = 80;
float shininess = 1;
bool flags[8] = { false };
bool transparent = false;
quint8 rendertype = 0;
......
#include "..\Header\MshFile.h"
#include "..\Header\tga.h"
#include "..\Header\OutputDevice.h"
#include <QVector3D>
// helper function to save data from file to any variable type
......@@ -662,12 +663,26 @@ void MshFile::analyseClthChunks(Model * dataDestination, QList<ChunkHeader*>& ch
m_file.read(F2V(tmp_size), sizeof(tmp_size));
// for every triangle..
for (unsigned int i = 0; i < tmp_size * 3; i++)
for (unsigned int i = 0; i < tmp_size; i++)
{
quint32 tmp_value;
m_file.read(F2V(tmp_value), sizeof(quint32));
quint32 tmp_value[3];
for (unsigned int j = 0; j < 3; j++)
{
m_file.read(F2V(tmp_value[j]), sizeof(quint32));
new_segment->indices.push_back((GLuint)tmp_value[j]);
}
new_segment->indices.push_back((GLuint)tmp_value);
QVector3D vec1, vec2, norm;
vec1 = new_segment->vertices[new_segment->indices[i * 3]].position - new_segment->vertices[new_segment->indices[i * 3 + 1]].position;
vec2 = new_segment->vertices[new_segment->indices[i * 3]].position - new_segment->vertices[new_segment->indices[i * 3 + 2]].position;
norm = QVector3D::crossProduct(vec1, vec2);
for (int k = 0; k < 3; k++)
{
new_segment->vertices[new_segment->indices[i * 3 + k]].vertexNormal += norm;
new_segment->vertices[new_segment->indices[i * 3 + k]].vertexNormal.normalize();
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment