📄 scanconverter.h
字号:
////////////////////////////////////////////////////////////////////////
//
// ScanConverter.h
//
// Copyright (c) 2003 Nokia Phones Ltd All rights reserved.
//
////////////////////////////////////////////////////////////////////////
#ifndef _SCANCONVERTER_H
#define _SCANCONVERTER_H
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
#include "Camera.h"
////////////////////////////////////////////////////////////////////////
class TScreenVertex;
////////////////////////////////////////////////////////////////////////
class TIntersectionBuffer
{
public:
TIntersectionBuffer();
void Reset();
void ScanEdge
(
const TScreenVertex &aVertexA,
const TScreenVertex &aVertexB,
TMathLookup &aMath
);
public:
enum
{
// Hardwired to current Series 60 screen height: will need
// changing for other Symbian OS variants. (A more sophisticated
// solution would be to allocate the entry array at construction
// time, but note that this would require re-implementing as a C class.)
//
// NB: the value must be at least as large as the screen height, but
// a larger value does no harm.
//
numEntries = 208,
interpolationUnityLog = 14,
interpolationUnity = ( 1 << interpolationUnityLog ),
//
// resultUnityLog == number of fractional bits to be left in result (screen) coords:
//
resultUnityLog = Geometry3D::screenCoordUnityLog,
resultDownshift = ( interpolationUnityLog - resultUnityLog ),
};
TInt iMinY;
TInt iMaxY;
TInt iEntry[numEntries];
};
////////////////////////////////////////////////////////////////////////
class TScanConverter
{
//
// NB: This class assumes 16 bpp and a pixel format of 444 RGB.
//
public:
TScanConverter(const TSize& aSize);
void SetScreenPtr(TUint16 * aScreenPtr){ iScreenPtr = aScreenPtr; }
void TransformVerts
(
TInt aNumVerts,
const TVector3 * aSrcVertPtr,
TAffineTransform &aAffine,
TScreenVertex * aDestVertPtr,
TVector3 &aCameraInModelSpace
);
void ClipAndRender( TClipFace &aFaceA, TClipFace &aFaceB, TMathLookup &aMath );
void ClearScreen(TUint16 aFillColor);
void PlotPixel(TInt aX, TInt aY, TUint16 aFillColor);
void ResetScan();
void ScanEdge
(
const TScreenVertex &aVertexA,
const TScreenVertex &aVertexB,
TMathLookup &aMath
);
void Fill(TUint16 aFlatColor);
private:
TCamera iCamera;
TSize iSize;
TUint16 * iScreenPtr;
TInt iLeftX;
TInt iRightX;
TInt iTopY;
TInt iBottomY;
TIntersectionBuffer iLeftBuffer;
TIntersectionBuffer iRightBuffer;
};
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
#endif
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -