📄 mgcsoftc.cpp
字号:
// Magic Software, Inc.
// http://www.magic-software.com
// Copyright (c) 2000, All Rights Reserved
//
// Source code from Magic Software is supplied under the terms of a license
// agreement and may not be copied or disclosed except in accordance with the
// terms of that agreement. The various license agreements may be found at
// the Magic Software web site. This file is subject to the license
//
// RESTRICTED USE SOURCE CODE
// http://www.magic-software.com/License/restricted.pdf
#include "MgcSoftASM.h"
#include "MgcSoftRenderer.h"
//---------------------------------------------------------------------------
void MgcSoftRenderer::DrawEdgeC (unsigned int uiV0, unsigned int uiV1)
{
EdgeSetupParameters
LinAttrSetup(3)
MgcColor& rkC0 = m_kMesh.Color(uiV0);
MgcColor& rkC1 = m_kMesh.Color(uiV1);
MgcSoftASM_FloatToIntMult(rkC0.r,aiA0[0],8);
MgcSoftASM_FloatToIntMult(rkC0.g,aiA0[1],8);
MgcSoftASM_FloatToIntMult(rkC0.b,aiA0[2],8);
MgcSoftASM_FloatToIntMult(rkC1.r,aiA1[0],8);
MgcSoftASM_FloatToIntMult(rkC1.g,aiA1[1],8);
MgcSoftASM_FloatToIntMult(rkC1.b,aiA1[2],8);
EdgeInitX
InitLinAttrX
EdgePrologTraverseX
m_akBuffer[iIndex] = MgcSoftColor(aiA0[0],aiA0[1],aiA0[2]);
EdgeReturnX
UpdateLinAttrX
EdgeEpilogTraverseX
EdgeExitX
EdgeInitY
InitLinAttrY
EdgePrologTraverseY
m_akBuffer[iIndex] = MgcSoftColor(aiA0[0],aiA0[1],aiA0[2]);
EdgeReturnY
UpdateLinAttrY
EdgeEpilogTraverseY
EdgeExitY
}
//---------------------------------------------------------------------------
void MgcSoftRenderer::DrawTriC (unsigned int uiV0, unsigned int uiV1,
unsigned int uiV2)
{
TriangleSetupParameters
LinAttrSetup(3)
m_uiNumLinAttr = 3; // r, g, b
m_uiNumPerAttr = 0; // none
MgcColor& rkC0 = m_kMesh.Color(uiV0);
MgcColor& rkC1 = m_kMesh.Color(uiV1);
MgcColor& rkC2 = m_kMesh.Color(uiV2);
m_aafLinAttr[0][0] = rkC0[0];
m_aafLinAttr[0][1] = rkC0[1];
m_aafLinAttr[0][2] = rkC0[2];
m_aafLinAttr[1][0] = rkC1[0];
m_aafLinAttr[1][1] = rkC1[1];
m_aafLinAttr[1][2] = rkC1[2];
m_aafLinAttr[2][0] = rkC2[0];
m_aafLinAttr[2][1] = rkC2[1];
m_aafLinAttr[2][2] = rkC2[2];
TriBeginLoop
MgcSoftASM_FloatToIntMult(m_aafLinAttrMin[iY][0],aiA0[0],8);
MgcSoftASM_FloatToIntMult(m_aafLinAttrMin[iY][1],aiA0[1],8);
MgcSoftASM_FloatToIntMult(m_aafLinAttrMin[iY][2],aiA0[2],8);
MgcSoftASM_FloatToIntMult(m_aafLinAttrMax[iY][0],aiA1[0],8);
MgcSoftASM_FloatToIntMult(m_aafLinAttrMax[iY][1],aiA1[1],8);
MgcSoftASM_FloatToIntMult(m_aafLinAttrMax[iY][2],aiA1[2],8);
if ( iDx > 1 )
{
InitLinAttrX
for (int iX = iX0, iAx = 2*iDx; iX <= iX1; iX++, iIndex++)
{
m_akBuffer[iIndex] = MgcSoftColor(aiA0[0],aiA0[1],aiA0[2]);
UpdateLinAttrX
}
}
else if ( iDx == 1 )
{
m_akBuffer[iIndex++] = MgcSoftColor(aiA0[0],aiA0[1],aiA0[2]);
m_akBuffer[iIndex] = MgcSoftColor(aiA1[0],aiA1[1],aiA1[2]);
}
else
{
m_akBuffer[iIndex] = MgcSoftColor(aiA0[0],aiA0[1],aiA0[2]);
}
TriEndLoop
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -