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