mirror of
https://github.com/leozide/leocad.git
synced 2026-07-27 19:56:49 +00:00
Merge branch 'master' of https://github.com/leozide/leocad
This commit is contained in:
@@ -110,6 +110,9 @@ bool lcContext::InitializeRenderer()
|
|||||||
|
|
||||||
void lcContext::ShutdownRenderer()
|
void lcContext::ShutdownRenderer()
|
||||||
{
|
{
|
||||||
|
if (!mGlobalOffscreenContext)
|
||||||
|
return;
|
||||||
|
|
||||||
mGlobalOffscreenContext->MakeCurrent();
|
mGlobalOffscreenContext->MakeCurrent();
|
||||||
lcContext* Context = mGlobalOffscreenContext.get();
|
lcContext* Context = mGlobalOffscreenContext.get();
|
||||||
|
|
||||||
|
|||||||
@@ -573,6 +573,7 @@ void lcMeshLoaderTypeData::AddMeshData(const lcMeshLoaderTypeData& Data, const l
|
|||||||
{
|
{
|
||||||
const lcArray<lcMeshLoaderVertex>& DataVertices = Data.mVertices;
|
const lcArray<lcMeshLoaderVertex>& DataVertices = Data.mVertices;
|
||||||
lcArray<quint32> IndexRemap(DataVertices.GetSize());
|
lcArray<quint32> IndexRemap(DataVertices.GetSize());
|
||||||
|
const lcMatrix33 NormalTransform = lcMatrix33Transpose(lcMatrix33(lcMatrix44Inverse(Transform)));
|
||||||
|
|
||||||
if (!TextureMap)
|
if (!TextureMap)
|
||||||
{
|
{
|
||||||
@@ -589,7 +590,7 @@ void lcMeshLoaderTypeData::AddMeshData(const lcMeshLoaderTypeData& Data, const l
|
|||||||
Index = AddVertex(Position, true);
|
Index = AddVertex(Position, true);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lcVector3 Normal = lcNormalize(lcMul30(DataVertex.Normal, Transform));
|
lcVector3 Normal = lcNormalize(lcMul(DataVertex.Normal, NormalTransform));
|
||||||
if (InvertNormals)
|
if (InvertNormals)
|
||||||
Normal = -Normal;
|
Normal = -Normal;
|
||||||
Index = AddVertex(Position, Normal, true);
|
Index = AddVertex(Position, Normal, true);
|
||||||
@@ -601,7 +602,7 @@ void lcMeshLoaderTypeData::AddMeshData(const lcMeshLoaderTypeData& Data, const l
|
|||||||
Index = AddTexturedVertex(Position, DataVertex.TexCoord, true);
|
Index = AddTexturedVertex(Position, DataVertex.TexCoord, true);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lcVector3 Normal = lcNormalize(lcMul30(DataVertex.Normal, Transform));
|
lcVector3 Normal = lcNormalize(lcMul(DataVertex.Normal, NormalTransform));
|
||||||
if (InvertNormals)
|
if (InvertNormals)
|
||||||
Normal = -Normal;
|
Normal = -Normal;
|
||||||
Index = AddTexturedVertex(Position, Normal, DataVertex.TexCoord, true);
|
Index = AddTexturedVertex(Position, Normal, DataVertex.TexCoord, true);
|
||||||
@@ -625,7 +626,7 @@ void lcMeshLoaderTypeData::AddMeshData(const lcMeshLoaderTypeData& Data, const l
|
|||||||
Index = AddTexturedVertex(Position, TexCoord, true);
|
Index = AddTexturedVertex(Position, TexCoord, true);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lcVector3 Normal = lcNormalize(lcMul30(DataVertex.Normal, Transform));
|
lcVector3 Normal = lcNormalize(lcMul(DataVertex.Normal, NormalTransform));
|
||||||
if (InvertNormals)
|
if (InvertNormals)
|
||||||
Normal = -Normal;
|
Normal = -Normal;
|
||||||
Index = AddTexturedVertex(Position, Normal, TexCoord, true);
|
Index = AddTexturedVertex(Position, Normal, TexCoord, true);
|
||||||
@@ -696,6 +697,7 @@ void lcMeshLoaderTypeData::AddMeshDataNoDuplicateCheck(const lcMeshLoaderTypeDat
|
|||||||
{
|
{
|
||||||
const lcArray<lcMeshLoaderVertex>& DataVertices = Data.mVertices;
|
const lcArray<lcMeshLoaderVertex>& DataVertices = Data.mVertices;
|
||||||
quint32 BaseIndex;
|
quint32 BaseIndex;
|
||||||
|
const lcMatrix33 NormalTransform = lcMatrix33Transpose(lcMatrix33(lcMatrix44Inverse(Transform)));
|
||||||
|
|
||||||
if (!TextureMap)
|
if (!TextureMap)
|
||||||
{
|
{
|
||||||
@@ -709,7 +711,7 @@ void lcMeshLoaderTypeData::AddMeshDataNoDuplicateCheck(const lcMeshLoaderTypeDat
|
|||||||
const lcMeshLoaderVertex& SrcVertex = DataVertices[SrcVertexIdx];
|
const lcMeshLoaderVertex& SrcVertex = DataVertices[SrcVertexIdx];
|
||||||
lcMeshLoaderVertex& DstVertex = mVertices.Add();
|
lcMeshLoaderVertex& DstVertex = mVertices.Add();
|
||||||
DstVertex.Position = lcMul31(SrcVertex.Position, Transform);
|
DstVertex.Position = lcMul31(SrcVertex.Position, Transform);
|
||||||
DstVertex.Normal = lcNormalize(lcMul30(SrcVertex.Normal, Transform));
|
DstVertex.Normal = lcNormalize(lcMul(SrcVertex.Normal, NormalTransform));
|
||||||
if (InvertNormals)
|
if (InvertNormals)
|
||||||
DstVertex.Normal = -DstVertex.Normal;
|
DstVertex.Normal = -DstVertex.Normal;
|
||||||
DstVertex.NormalWeight = SrcVertex.NormalWeight;
|
DstVertex.NormalWeight = SrcVertex.NormalWeight;
|
||||||
@@ -732,7 +734,7 @@ void lcMeshLoaderTypeData::AddMeshDataNoDuplicateCheck(const lcMeshLoaderTypeDat
|
|||||||
lcVector2 TexCoord = lcCalculateTexCoord(Position, TextureMap);
|
lcVector2 TexCoord = lcCalculateTexCoord(Position, TextureMap);
|
||||||
|
|
||||||
DstVertex.Position = Position;
|
DstVertex.Position = Position;
|
||||||
DstVertex.Normal = lcNormalize(lcMul30(SrcVertex.Normal, Transform));
|
DstVertex.Normal = lcNormalize(lcMul(SrcVertex.Normal, NormalTransform));
|
||||||
if (InvertNormals)
|
if (InvertNormals)
|
||||||
DstVertex.Normal = -DstVertex.Normal;
|
DstVertex.Normal = -DstVertex.Normal;
|
||||||
DstVertex.NormalWeight = SrcVertex.NormalWeight;
|
DstVertex.NormalWeight = SrcVertex.NormalWeight;
|
||||||
@@ -1240,7 +1242,7 @@ lcMesh* lcLibraryMeshData::CreateMesh()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
quint16 BaseVertex = BaseConditionalVertices[LodIdx];
|
quint32 BaseVertex = BaseConditionalVertices[LodIdx];
|
||||||
|
|
||||||
for (int IndexIdx = 0; IndexIdx < SrcSection->mIndices.GetSize(); IndexIdx++)
|
for (int IndexIdx = 0; IndexIdx < SrcSection->mIndices.GetSize(); IndexIdx++)
|
||||||
*Index++ = BaseVertex + SrcSection->mIndices[IndexIdx];
|
*Index++ = BaseVertex + SrcSection->mIndices[IndexIdx];
|
||||||
|
|||||||
@@ -659,6 +659,7 @@ void lcModel::LoadLDraw(QIODevice& Device, Project* Project)
|
|||||||
Piece->SetColorCode(ColorCode);
|
Piece->SetColorCode(ColorCode);
|
||||||
Piece->VerifyControlPoints(ControlPoints);
|
Piece->VerifyControlPoints(ControlPoints);
|
||||||
Piece->SetControlPoints(ControlPoints);
|
Piece->SetControlPoints(ControlPoints);
|
||||||
|
ControlPoints.RemoveAll();
|
||||||
|
|
||||||
if (Piece->mPieceInfo->IsModel() && Piece->mPieceInfo->GetModel()->IncludesModel(this))
|
if (Piece->mPieceInfo->IsModel() && Piece->mPieceInfo->GetModel()->IncludesModel(this))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,5 +28,5 @@ void main()
|
|||||||
if (Cross1 * Cross2 >= 0.0)
|
if (Cross1 * Cross2 >= 0.0)
|
||||||
gl_Position = Position;
|
gl_Position = Position;
|
||||||
else
|
else
|
||||||
gl_Position = vec4(2.0, 2.0, 2.0, 1.0);
|
gl_Position = vec4(p1.x, p1.y, 2.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user