Remove unused functions

renderLine16_Blend(), renderLine16_Decal(), renderLine32_Blend(), renderLine32_Decal()
clipLine()
frand()
drawRectangle() and drawLine()

remove unused private fields
This commit is contained in:
JosiahWI 2021-11-09 13:47:54 -06:00 committed by sfan5
parent 2f2d37dce6
commit d4119ba664
12 changed files with 4 additions and 434 deletions

@ -21,9 +21,6 @@ public:
//! generates a pseudo random number in the range 0..randMax()
virtual s32 rand() const =0;
//! generates a pseudo random number in the range 0..1
virtual f32 frand() const =0;
//! get maxmimum number generated by rand()
virtual s32 randMax() const =0;
};

@ -26,7 +26,7 @@ namespace scene
//! Constructor
CB3DMeshFileLoader::CB3DMeshFileLoader(scene::ISceneManager* smgr)
: SceneManager(smgr), AnimatedMesh(0), B3DFile(0), NormalsInFile(false),
: AnimatedMesh(0), B3DFile(0), NormalsInFile(false),
HasVertexColors(false), ShowWarning(true)
{
#ifdef _DEBUG

@ -68,7 +68,6 @@ private:
core::array<video::S3DVertex2TCoords> BaseVertices;
ISceneManager* SceneManager;
CSkinnedMesh* AnimatedMesh;
io::IReadFile* B3DFile;

@ -85,96 +85,6 @@ inline u32 GetClipCode( const AbsRectangle &r, const core::position2d<s32> &p )
return code;
}
/*!
Cohen Sutherland clipping
@return: 1 if valid
*/
static int ClipLine(const AbsRectangle &clipping,
core::position2d<s32> &p0,
core::position2d<s32> &p1,
const core::position2d<s32>& p0_in,
const core::position2d<s32>& p1_in)
{
u32 code0;
u32 code1;
u32 code;
p0 = p0_in;
p1 = p1_in;
code0 = GetClipCode( clipping, p0 );
code1 = GetClipCode( clipping, p1 );
// trivial accepted
while ( code0 | code1 )
{
s32 x=0;
s32 y=0;
// trivial reject
if ( code0 & code1 )
return 0;
if ( code0 )
{
// clip first point
code = code0;
}
else
{
// clip last point
code = code1;
}
if ( (code & CLIPCODE_BOTTOM) == CLIPCODE_BOTTOM )
{
// clip bottom viewport
y = clipping.y1;
x = p0.X + ( p1.X - p0.X ) * ( y - p0.Y ) / ( p1.Y - p0.Y );
}
else
if ( (code & CLIPCODE_TOP) == CLIPCODE_TOP )
{
// clip to viewport
y = clipping.y0;
x = p0.X + ( p1.X - p0.X ) * ( y - p0.Y ) / ( p1.Y - p0.Y );
}
else
if ( (code & CLIPCODE_RIGHT) == CLIPCODE_RIGHT )
{
// clip right viewport
x = clipping.x1;
y = p0.Y + ( p1.Y - p0.Y ) * ( x - p0.X ) / ( p1.X - p0.X );
}
else
if ( (code & CLIPCODE_LEFT) == CLIPCODE_LEFT )
{
// clip left viewport
x = clipping.x0;
y = p0.Y + ( p1.Y - p0.Y ) * ( x - p0.X ) / ( p1.X - p0.X );
}
if ( code == code0 )
{
// modify first point
p0.X = x;
p0.Y = y;
code0 = GetClipCode( clipping, p0 );
}
else
{
// modify second point
p1.X = x;
p1.Y = y;
code1 = GetClipCode( clipping, p1 );
}
}
return 1;
}
/*
*/
inline void GetClip(AbsRectangle &clipping, video::IImage * t)
@ -226,263 +136,6 @@ inline u32 PixelLerp32(const u32 source, const u32 value)
}
/*
*/
static void RenderLine32_Decal(video::IImage *t,
const core::position2d<s32> &p0,
const core::position2d<s32> &p1,
u32 argb )
{
s32 dx = p1.X - p0.X;
s32 dy = p1.Y - p0.Y;
s32 c;
s32 m;
s32 d = 0;
s32 run;
s32 xInc = 4;
s32 yInc = (s32) t->getPitch();
if ( dx < 0 )
{
xInc = -xInc;
dx = -dx;
}
if ( dy < 0 )
{
yInc = -yInc;
dy = -dy;
}
u32 *dst;
dst = (u32*) ( (u8*) t->getData() + ( p0.Y * t->getPitch() ) + ( p0.X * 4 ) );
if ( dy > dx )
{
s32 tmp;
tmp = dx;
dx = dy;
dy = tmp;
tmp = xInc;
xInc = yInc;
yInc = tmp;
}
c = dx << 1;
m = dy << 1;
run = dx;
do
{
*dst = argb;
dst = (u32*) ( (u8*) dst + xInc ); // x += xInc
d += m;
if ( d > dx )
{
dst = (u32*) ( (u8*) dst + yInc ); // y += yInc
d -= c;
}
run -= 1;
} while (run>=0);
}
/*
*/
static void RenderLine32_Blend(video::IImage *t,
const core::position2d<s32> &p0,
const core::position2d<s32> &p1,
u32 argb, u32 alpha)
{
s32 dx = p1.X - p0.X;
s32 dy = p1.Y - p0.Y;
s32 c;
s32 m;
s32 d = 0;
s32 run;
s32 xInc = 4;
s32 yInc = (s32) t->getPitch();
if ( dx < 0 )
{
xInc = -xInc;
dx = -dx;
}
if ( dy < 0 )
{
yInc = -yInc;
dy = -dy;
}
u32 *dst;
dst = (u32*) ( (u8*) t->getData() + ( p0.Y * t->getPitch() ) + ( p0.X * 4 ) );
if ( dy > dx )
{
s32 tmp;
tmp = dx;
dx = dy;
dy = tmp;
tmp = xInc;
xInc = yInc;
yInc = tmp;
}
c = dx << 1;
m = dy << 1;
run = dx;
const u32 packA = packAlpha ( alpha );
do
{
*dst = packA | PixelBlend32( *dst, argb, alpha );
dst = (u32*) ( (u8*) dst + xInc ); // x += xInc
d += m;
if ( d > dx )
{
dst = (u32*) ( (u8*) dst + yInc ); // y += yInc
d -= c;
}
run -= 1;
} while (run>=0);
}
/*
*/
static void RenderLine16_Decal(video::IImage *t,
const core::position2d<s32> &p0,
const core::position2d<s32> &p1,
u32 argb )
{
s32 dx = p1.X - p0.X;
s32 dy = p1.Y - p0.Y;
s32 c;
s32 m;
s32 d = 0;
s32 run;
s32 xInc = 2;
s32 yInc = (s32) t->getPitch();
if ( dx < 0 )
{
xInc = -xInc;
dx = -dx;
}
if ( dy < 0 )
{
yInc = -yInc;
dy = -dy;
}
u16 *dst;
dst = (u16*) ( (u8*) t->getData() + ( p0.Y * t->getPitch() ) + ( p0.X * 2 ) );
if ( dy > dx )
{
s32 tmp;
tmp = dx;
dx = dy;
dy = tmp;
tmp = xInc;
xInc = yInc;
yInc = tmp;
}
c = dx << 1;
m = dy << 1;
run = dx;
do
{
*dst = (u16)argb;
dst = (u16*) ( (u8*) dst + xInc ); // x += xInc
d += m;
if ( d > dx )
{
dst = (u16*) ( (u8*) dst + yInc ); // y += yInc
d -= c;
}
run -= 1;
} while (run>=0);
}
/*
*/
static void RenderLine16_Blend(video::IImage *t,
const core::position2d<s32> &p0,
const core::position2d<s32> &p1,
u16 argb,
u16 alpha)
{
s32 dx = p1.X - p0.X;
s32 dy = p1.Y - p0.Y;
s32 c;
s32 m;
s32 d = 0;
s32 run;
s32 xInc = 2;
s32 yInc = (s32) t->getPitch();
if ( dx < 0 )
{
xInc = -xInc;
dx = -dx;
}
if ( dy < 0 )
{
yInc = -yInc;
dy = -dy;
}
u16 *dst;
dst = (u16*) ( (u8*) t->getData() + ( p0.Y * t->getPitch() ) + ( p0.X * 2 ) );
if ( dy > dx )
{
s32 tmp;
tmp = dx;
dx = dy;
dy = tmp;
tmp = xInc;
xInc = yInc;
yInc = tmp;
}
c = dx << 1;
m = dy << 1;
run = dx;
const u16 packA = alpha ? 0x8000 : 0;
do
{
*dst = packA | PixelBlend16( *dst, argb, alpha );
dst = (u16*) ( (u8*) dst + xInc ); // x += xInc
d += m;
if ( d > dx )
{
dst = (u16*) ( (u8*) dst + yInc ); // y += yInc
d -= c;
}
run -= 1;
} while (run>=0);
}
/*!
*/
static void executeBlit_TextureCopy_x_to_x( const SBlitJob * job )
@ -1471,56 +1124,6 @@ static s32 StretchBlit(eBlitter operation,
}
#endif
// Methods for Software drivers
//! draws a rectangle
static void drawRectangle(video::IImage* img, const core::rect<s32>& rect, const video::SColor &color)
{
Blit(color.getAlpha() == 0xFF ? BLITTER_COLOR : BLITTER_COLOR_ALPHA,
img, 0, &rect.UpperLeftCorner, 0, &rect, color.color);
}
//! draws a line from to with color
static void drawLine(video::IImage* img, const core::position2d<s32>& from,
const core::position2d<s32>& to, const video::SColor &color)
{
AbsRectangle clip;
GetClip(clip, img);
core::position2d<s32> p[2];
if (ClipLine( clip, p[0], p[1], from, to))
{
u32 alpha = extractAlpha(color.color);
switch(img->getColorFormat())
{
case video::ECF_A1R5G5B5:
if (alpha == 256)
{
RenderLine16_Decal(img, p[0], p[1], video::A8R8G8B8toA1R5G5B5(color.color));
}
else
{
RenderLine16_Blend(img, p[0], p[1], video::A8R8G8B8toA1R5G5B5(color.color), alpha >> 3);
}
break;
case video::ECF_A8R8G8B8:
if (alpha == 256)
{
RenderLine32_Decal(img, p[0], p[1], color.color);
}
else
{
RenderLine32_Blend(img, p[0], p[1], color.color, alpha);
}
break;
default:
break;
}
}
}
}
#endif

@ -308,11 +308,6 @@ namespace
return os::Randomizer::rand();
}
virtual f32 frand() const _IRR_OVERRIDE_
{
return os::Randomizer::frand();
}
virtual s32 randMax() const _IRR_OVERRIDE_
{
return os::Randomizer::randMax();

@ -26,8 +26,6 @@ namespace scene
#define _IRR_DEBUG_OBJ_LOADER_
#endif
static const u32 WORD_BUFFER_LENGTH = 512;
//! Constructor
COBJMeshFileLoader::COBJMeshFileLoader(scene::ISceneManager* smgr, io::IFileSystem* fs)
: SceneManager(smgr), FileSystem(fs)

@ -38,14 +38,7 @@ const u16 COpenGLDriver::Quad2DIndices[4] = { 0, 1, 2, 3 };
COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager)
: CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(), CacheHandler(0), CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
Transformation3DChanged(true), AntiAlias(params.AntiAlias), ColorFormat(ECF_R8G8B8), FixedPipelineState(EOFPS_ENABLE), Params(params),
ContextManager(contextManager),
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
DeviceType(EIDT_WIN32)
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
DeviceType(EIDT_X11)
#else
DeviceType(EIDT_OSX)
#endif
ContextManager(contextManager)
{
#ifdef _DEBUG
setDebugName("COpenGLDriver");
@ -58,7 +51,7 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFil
: CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(), CacheHandler(0),
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), Transformation3DChanged(true),
AntiAlias(params.AntiAlias), ColorFormat(ECF_R8G8B8), FixedPipelineState(EOFPS_ENABLE),
Params(params), SDLDevice(device), ContextManager(0), DeviceType(EIDT_SDL)
Params(params), SDLDevice(device), ContextManager(0)
{
#ifdef _DEBUG
setDebugName("COpenGLDriver");

@ -522,8 +522,6 @@ namespace video
#endif
IContextManager* ContextManager;
E_DEVICE_TYPE DeviceType;
};
} // end namespace video

@ -28,8 +28,7 @@ namespace scene
//! Constructor
CXMeshFileLoader::CXMeshFileLoader(scene::ISceneManager* smgr, io::IFileSystem* fs)
: SceneManager(smgr), FileSystem(fs), AnimatedMesh(0),
Buffer(0), P(0), End(0), BinaryNumCount(0), Line(0),
: AnimatedMesh(0), Buffer(0), P(0), End(0), BinaryNumCount(0), Line(0),
CurFrame(0), MajorVersion(0), MinorVersion(0), BinaryFormat(false), FloatSize(0)
{
#ifdef _DEBUG

@ -159,9 +159,6 @@ private:
bool readRGB(video::SColor& color);
bool readRGBA(video::SColor& color);
ISceneManager* SceneManager;
io::IFileSystem* FileSystem;
CSkinnedMesh* AnimatedMesh;
c8* Buffer;

@ -338,12 +338,6 @@ namespace os
return seed-1; // -1 because we want it to start at 0
}
//! generates a pseudo random number
f32 Randomizer::frand()
{
return rand()*(1.f/rMax);
}
s32 Randomizer::randMax()
{
return rMax;

@ -58,9 +58,6 @@ namespace os
//! generates a pseudo random number in the range 0..randMax()
static s32 rand();
//! generates a pseudo random number in the range 0..1
static f32 frand();
//! get maximum number generated by rand()
static s32 randMax();