Deleted unused files.
@@ -74,7 +74,6 @@ LC_KEYBOARD_COMMAND DefaultKeyboardShortcuts[] =
|
||||
{ LC_VIEW_CAMERA_MAIN, "Camera Main", LC_KEYMOD_VIEWONLY, LC_KEY_M, 0 },
|
||||
// { LC_VIEW_CAMERA_MENU, "", 0, 0, 0 },
|
||||
// { LC_VIEW_CAMERA_RESET, "", 0, 0, 0 },
|
||||
// { LC_VIEW_AUTOPAN, "", 0, 0, 0 },
|
||||
// { LC_HELP_ABOUT, "", 0, 0, 0 },
|
||||
// { LC_TOOLBAR_ANIMATION, "", 0, 0, 0 },
|
||||
// { LC_TOOLBAR_ADDKEYS, "", 0, 0, 0 },
|
||||
|
||||
@@ -1834,50 +1834,3 @@ void Piece::RemoveConnections(CONNECTION_TYPE* pConnections)
|
||||
for (i = 0; i < RebuildList.GetSize(); i++)
|
||||
RebuildList[i]->BuildDrawInfo();
|
||||
}
|
||||
|
||||
/*
|
||||
// Performs exact collision detection using the RAPID library.
|
||||
// Check if there are 2 objects at the same place at the same time
|
||||
BOOL CPiece::Collide(CPiece* pPiece)
|
||||
{
|
||||
return CollideAt(pPiece, m_fRotation, m_fPosition);
|
||||
}
|
||||
|
||||
// Use this to check if the piece can be modified
|
||||
BOOL CPiece::CollideAt(CPiece* pPiece, float rot[4], float pos[3])
|
||||
{
|
||||
double rotation1[3][3], rotation2[3][3];
|
||||
double translation1[3], translation2[3];
|
||||
|
||||
CMatrix m1(rot, pos);
|
||||
rotation1[0][0] = m1.m[0];
|
||||
rotation1[0][1] = m1.m[4];
|
||||
rotation1[0][2] = m1.m[8];
|
||||
rotation1[1][0] = m1.m[1];
|
||||
rotation1[1][1] = m1.m[5];
|
||||
rotation1[1][2] = m1.m[9];
|
||||
rotation1[2][0] = m1.m[2];
|
||||
rotation1[2][1] = m1.m[6];
|
||||
rotation1[2][2] = m1.m[10];
|
||||
translation1[0] = m1.m[12];
|
||||
translation1[1] = m1.m[13];
|
||||
translation1[2] = m1.m[14];
|
||||
|
||||
CMatrix m2(pPiece->m_fRotation, pPiece->m_fPosition);
|
||||
rotation2[0][0] = m2.m[0];
|
||||
rotation2[0][1] = m2.m[4];
|
||||
rotation2[0][2] = m2.m[8];
|
||||
rotation2[1][0] = m2.m[1];
|
||||
rotation2[1][1] = m2.m[5];
|
||||
rotation2[1][2] = m2.m[9];
|
||||
rotation2[2][0] = m2.m[2];
|
||||
rotation2[2][1] = m2.m[6];
|
||||
rotation2[2][2] = m2.m[10];
|
||||
translation2[0] = m2.m[12];
|
||||
translation2[1] = m2.m[13];
|
||||
translation2[2] = m2.m[14];
|
||||
|
||||
return CollisionCheck(rotation1, translation1, m_pInfo->m_pRModel,
|
||||
rotation2, translation2, pPiece->m_pInfo->m_pRModel);
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -1410,94 +1410,6 @@ void PieceInfo::LoadInformation()
|
||||
}
|
||||
|
||||
free(buf);
|
||||
|
||||
/*
|
||||
// Now create the information for the CD
|
||||
// If the object is big this can block the program for serveral seconds.
|
||||
// ATTENTION: The RAPID CD library is based on triangles.
|
||||
|
||||
if (pInfo->pRModel)
|
||||
delete pInfo->pRModel;
|
||||
|
||||
pInfo->pRModel = new CRModel();
|
||||
pInfo->pRModel->BeginModel();
|
||||
|
||||
UINT col, loc, j, i;
|
||||
int vert = 0;
|
||||
|
||||
for (UINT c = 0; c < pInfo->cons; c++)
|
||||
{
|
||||
if (pInfo->connection[c].info == NULL)
|
||||
continue;
|
||||
if (pInfo->count > 65535)
|
||||
{
|
||||
UINT* info = (UINT*)pInfo->connection[c].info;
|
||||
loc = 1;
|
||||
col = info[0];
|
||||
while (col)
|
||||
{
|
||||
loc++;
|
||||
|
||||
j = info[loc];
|
||||
for (i = 0; i < j; i+=4)
|
||||
{
|
||||
pInfo->pRModel->AddTri(&pInfo->vertex[info[loc+i+1]*3], &pInfo->vertex[info[loc+i+2]*3],
|
||||
&pInfo->vertex[info[loc+i+3]*3], vert);
|
||||
vert++;
|
||||
pInfo->pRModel->AddTri(&pInfo->vertex[info[loc+i+3]*3], &pInfo->vertex[info[loc+i+4]*3],
|
||||
&pInfo->vertex[info[loc+i+1]*3], vert);
|
||||
vert++;
|
||||
}
|
||||
loc += j+1;
|
||||
j = info[loc];
|
||||
for (i = 0; i < j; i+=3)
|
||||
{
|
||||
pInfo->pRModel->AddTri(&pInfo->vertex[info[loc+i+1]*3], &pInfo->vertex[info[loc+i+2]*3],
|
||||
&pInfo->vertex[info[loc+i+3]*3], vert);
|
||||
vert++;
|
||||
}
|
||||
loc += j+1;
|
||||
loc += info[loc]+1;
|
||||
|
||||
col--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WORD* info = (WORD*)pInfo->connection[c].info;
|
||||
loc = 1;
|
||||
col = info[0];
|
||||
while (col)
|
||||
{
|
||||
loc++;
|
||||
|
||||
j = info[loc];
|
||||
for (i = 0; i < j; i+=4)
|
||||
{
|
||||
pInfo->pRModel->AddTri(&pInfo->vertex[info[loc+i+1]*3], &pInfo->vertex[info[loc+i+2]*3],
|
||||
&pInfo->vertex[info[loc+i+3]*3], vert);
|
||||
vert++;
|
||||
pInfo->pRModel->AddTri(&pInfo->vertex[info[loc+i+3]*3], &pInfo->vertex[info[loc+i+4]*3],
|
||||
&pInfo->vertex[info[loc+i+1]*3], vert);
|
||||
vert++;
|
||||
}
|
||||
loc += j+1;
|
||||
j = info[loc];
|
||||
for (i = 0; i < j; i+=3)
|
||||
{
|
||||
pInfo->pRModel->AddTri(&pInfo->vertex[info[loc+i+1]*3], &pInfo->vertex[info[loc+i+2]*3],
|
||||
&pInfo->vertex[info[loc+i+3]*3], vert);
|
||||
vert++;
|
||||
}
|
||||
loc += j+1;
|
||||
loc += info[loc]+1;
|
||||
|
||||
col--;
|
||||
}
|
||||
}
|
||||
}
|
||||
pInfo->pRModel->EndModel();
|
||||
*/
|
||||
}
|
||||
|
||||
void PieceInfo::FreeInformation()
|
||||
|
||||
@@ -6095,25 +6095,6 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
|
||||
CheckPoint("Reset Cameras");
|
||||
} break;
|
||||
|
||||
case LC_VIEW_AUTOPAN:
|
||||
{
|
||||
if (IsDrawing())
|
||||
break;
|
||||
|
||||
short x = (short)nParam;
|
||||
short y = (short)((nParam >> 16) & 0xFFFF);
|
||||
|
||||
x -= x > 0 ? 5 : -5;
|
||||
y -= y > 0 ? 5 : -5;
|
||||
|
||||
m_pViewCameras[m_nActiveViewport]->DoPan(x/4, y/4, 1, m_bAnimation ? m_nCurFrame : m_nCurStep, m_bAnimation, m_bAddKeys);
|
||||
m_nDownX = x;
|
||||
m_nDownY = y;
|
||||
UpdateOverlayScale();
|
||||
SystemUpdateFocus(NULL);
|
||||
UpdateAllViews();
|
||||
} break;
|
||||
|
||||
case LC_HELP_ABOUT:
|
||||
{
|
||||
SystemDoDialog(LC_DLG_ABOUT, 0);
|
||||
|
||||
@@ -88,7 +88,6 @@ typedef enum
|
||||
LC_VIEW_CAMERA_MAIN,
|
||||
LC_VIEW_CAMERA_MENU,
|
||||
LC_VIEW_CAMERA_RESET,
|
||||
LC_VIEW_AUTOPAN,
|
||||
LC_HELP_ABOUT,
|
||||
LC_TOOLBAR_ANIMATION,
|
||||
LC_TOOLBAR_ADDKEYS,
|
||||
|
||||
@@ -1,221 +0,0 @@
|
||||
// Hide math stuff here.
|
||||
//
|
||||
|
||||
static float Identity[16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
|
||||
|
||||
// Perform a 4x4 matrix multiplication (product = a x b).
|
||||
// WARNING: (product != b) assumed
|
||||
static __inline void matmul(float *product, const float *a, const float *b)
|
||||
{
|
||||
int i;
|
||||
|
||||
// #define M(row,col) m[col*4+row]
|
||||
#define A(row,col) a[(col<<2)+row]
|
||||
#define B(row,col) b[(col<<2)+row]
|
||||
#define P(row,col) product[(col<<2)+row]
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
float ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3);
|
||||
P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0);
|
||||
P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1);
|
||||
P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2);
|
||||
P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3);
|
||||
}
|
||||
|
||||
#undef A
|
||||
#undef B
|
||||
#undef P
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float m[16];
|
||||
} matrix;
|
||||
|
||||
static __inline void ConvertFromLDraw(matrix* m, float f[12])
|
||||
{
|
||||
float trans[16] = { 1,0,0,0, 0,0,-1,0, 0,1,0,0, 0,0,0,1 };
|
||||
float t[16] = { 1,0,0,0, 0,0,1,0, 0,-1,0,0, 0,0,0,1 };
|
||||
m->m[0] = f[3]; m->m[1] = f[6]; m->m[2] = f[9];
|
||||
m->m[4] = f[4]; m->m[5] = f[7]; m->m[6] = f[10];
|
||||
m->m[8] = f[5]; m->m[9] = f[8]; m->m[10]= f[11];
|
||||
m->m[12]= f[0]/25; m->m[13]= f[1]/25; m->m[14]= f[2]/25;
|
||||
matmul (m->m, m->m, t);
|
||||
matmul (trans, trans, m->m);
|
||||
memcpy (&m[0], &trans[0], sizeof(m->m));
|
||||
}
|
||||
|
||||
static __inline void LoadIdentity(matrix* m)
|
||||
{
|
||||
memcpy (&m->m[0], &Identity, sizeof(float[16]));
|
||||
}
|
||||
|
||||
static __inline void Multiply(matrix* m, matrix* m1, matrix* m2)
|
||||
{
|
||||
matmul (m->m, m1->m, m2->m);
|
||||
}
|
||||
|
||||
static __inline void TransformPoint(matrix* m, float out[], const float in[3])
|
||||
{
|
||||
out[0] = m->m[0]*in[0] + m->m[4]*in[1] + m->m[8]*in[2] + m->m[12];
|
||||
out[1] = m->m[1]*in[0] + m->m[5]*in[1] + m->m[9]*in[2] + m->m[13];
|
||||
out[2] = m->m[2]*in[0] + m->m[6]*in[1] + m->m[10]*in[2] + m->m[14];
|
||||
}
|
||||
|
||||
static __inline void TranslatePoint(matrix* m, float* in, float* t)
|
||||
{
|
||||
in[0] = m->m[0]*t[0] + m->m[4]*t[1] + m->m[8]*t[2] + m->m[12];
|
||||
in[1] = m->m[1]*t[0] + m->m[5]*t[1] + m->m[9]*t[2] + m->m[13];
|
||||
in[2] = m->m[2]*t[0] + m->m[6]*t[1] + m->m[10]*t[2] + m->m[14];
|
||||
}
|
||||
|
||||
static __inline void TransformPoints (matrix* m, float p[], int n)
|
||||
{
|
||||
int i;
|
||||
float tmp[3];
|
||||
|
||||
for (i = 0; i < n*3; i += 3)
|
||||
{
|
||||
tmp[0] = p[i];
|
||||
tmp[1] = p[i+1];
|
||||
tmp[2] = p[i+2];
|
||||
TransformPoint (m, &p[i], tmp);
|
||||
}
|
||||
}
|
||||
|
||||
static __inline void ConvertPoints (float pts[], int count)
|
||||
{
|
||||
float tmp;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
pts[3*i] /= 25;
|
||||
tmp = pts[3*i+1];
|
||||
pts[3*i+1] = pts[3*i+2]/25;
|
||||
pts[3*i+2] = -tmp/25;
|
||||
}
|
||||
}
|
||||
|
||||
static __inline void Resequence(float v[4][3], int a, int b, int c, int d)
|
||||
{
|
||||
float o[4][3];
|
||||
memcpy(o, v, sizeof(o));
|
||||
memcpy(v[0], o[a], sizeof(o[0]));
|
||||
memcpy(v[1], o[b], sizeof(o[0]));
|
||||
memcpy(v[2], o[c], sizeof(o[0]));
|
||||
memcpy(v[3], o[d], sizeof(o[0]));
|
||||
}
|
||||
|
||||
static __inline void Sub3(float v[], float q1[], float q2[])
|
||||
{
|
||||
v[0] = q1[0]-q2[0];
|
||||
v[1] = q1[1]-q2[1];
|
||||
v[2] = q1[2]-q2[2];
|
||||
}
|
||||
|
||||
static __inline float Dot3(float q1[], float q2[])
|
||||
{
|
||||
return q1[0]*q2[0]+q1[1]*q2[1]+q1[2]*q2[2];
|
||||
}
|
||||
|
||||
static __inline void Cross3(float v[], float q1[], float q2[])
|
||||
{
|
||||
v[0] = (q1[1]*q2[2]) - (q1[2]*q2[1]);
|
||||
v[1] = (q1[2]*q2[0]) - (q1[0]*q2[2]);
|
||||
v[2] = (q1[0]*q2[1]) - (q1[1]*q2[0]);
|
||||
}
|
||||
|
||||
static __inline void TestQuads(float quad[4][3])
|
||||
{
|
||||
float v01[3], v02[3], v03[3];
|
||||
float v12[3], v13[3], v23[3];
|
||||
float cp1[3], cp2[3];
|
||||
float dotA, dotB, dotC;
|
||||
int A, B, C;
|
||||
|
||||
// Calculate A
|
||||
Sub3(v01, quad[1], quad[0]);
|
||||
Sub3(v02, quad[2], quad[0]);
|
||||
Sub3(v03, quad[3], quad[0]);
|
||||
Cross3(cp1, v01, v02);
|
||||
Cross3(cp2, v02, v03);
|
||||
dotA = Dot3(cp1, cp2);
|
||||
A = (dotA > 0.0f);
|
||||
|
||||
if (A)
|
||||
{
|
||||
// 3 is in I, typical case, OK: 0123 D02 (convex/concave)
|
||||
// CONVEXINFO: quad is convex if (!B && !C): OK: 0123 D02/13 (convex)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Calculate B and C (may be postponed/discarded)
|
||||
// NOTE: postponed !
|
||||
Sub3(v12, quad[2], quad[1]);
|
||||
Sub3(v13, quad[3], quad[1]);
|
||||
Sub3(v23, quad[3], quad[2]);
|
||||
Cross3(cp1, v12, v01);
|
||||
Cross3(cp2, v01, v13);
|
||||
dotB = Dot3(cp1, cp2);
|
||||
B = (dotB > 0.0f);
|
||||
Cross3(cp1, v02, v12);
|
||||
Cross3(cp2, v12, v23);
|
||||
dotC = -Dot3(cp1, cp2);
|
||||
C = (dotC > 0.0f);
|
||||
|
||||
// 3 is in II, III, IV or V. Calculation of B and C could be postponed
|
||||
// to here if CONVEXINFO (above) is not needed
|
||||
if (B)
|
||||
{
|
||||
// 3 is in II or III
|
||||
if (C)
|
||||
{
|
||||
// 3 is in II, OK: 0123 D13 (concave)
|
||||
Resequence(quad, 1, 2, 3, 0); // just to shift diagonal
|
||||
}
|
||||
else
|
||||
{
|
||||
// 3 is in III, bow-tie error: using 0312 D01/D23 (convex)
|
||||
Resequence(quad, 0, 3, 1, 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 3 is in IV or V
|
||||
if (C)
|
||||
{
|
||||
// 3 is in IV, bow-tie error: using 0132 D12/D03 (convex)
|
||||
Resequence(quad, 0, 1, 3, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 3 is in V, OK: 0123 D13 (concave)
|
||||
Resequence(quad, 1, 2, 3, 0); // just to shift diagonal
|
||||
}
|
||||
}
|
||||
}
|
||||
// The four vertices quad[0], quad[1], quad[2] and quad[3] now have
|
||||
// the correct sequence, the polygon can be divided by the diagonal 02
|
||||
// into two triangles, 012 and 230.
|
||||
}
|
||||
|
||||
static __inline void FixQuads(float quad[])
|
||||
{
|
||||
float t[4][3];
|
||||
memcpy(t, quad, sizeof(t));
|
||||
TestQuads(t);
|
||||
memcpy(quad, t, sizeof(t));
|
||||
}
|
||||
|
||||
static __inline int FloatPointsClose (float pt1[], float pt2[])
|
||||
{
|
||||
if (fabs(pt1[0] - pt2[0]) > 0.01)
|
||||
return 0;
|
||||
if (fabs(pt1[1] - pt2[1]) > 0.01)
|
||||
return 0;
|
||||
if (fabs(pt1[2] - pt2[2]) > 0.01)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
|
||||
PIECES.IDX
|
||||
char[32] "LeoCAD piece library index file"
|
||||
unsigned char file version (currently = 3)
|
||||
unsigned char last updated installed
|
||||
|
||||
PIECE_DATA:
|
||||
char[8] name
|
||||
char[64] description
|
||||
short[6] bounding box (scaled)
|
||||
unsigned char flags
|
||||
unsigned long default group
|
||||
unsigned long offset in PIECES.BIN
|
||||
unsigned long info size
|
||||
|
||||
MOVED_DATA:
|
||||
char[8] old name
|
||||
char[8] new name
|
||||
|
||||
unsigned short moved count
|
||||
unsigned long PIECES.BIN File size
|
||||
unsigned short piece count
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
PIECES.BIN
|
||||
char[32] "LeoCAD piece library data file"
|
||||
|
||||
PIECE_DATA:
|
||||
unsigned long vertex count
|
||||
short[] vertex data (scaled)
|
||||
unsigned short connection count
|
||||
CONNECTION_DATA:
|
||||
unsigned short connection type
|
||||
short[3] position (scaled)
|
||||
short[3] up (<<14)
|
||||
|
||||
unsigned short group count
|
||||
GROUP_DATA:
|
||||
unsigned char group connection count
|
||||
unsigned short connections index
|
||||
void draw information
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
TEXTURES.IDX
|
||||
char[32] "LeoCAD texture index file"
|
||||
unsigned char file version (currently = 1)
|
||||
unsigned char last updated installed
|
||||
|
||||
TEXTURE_DATA:
|
||||
char[8] name
|
||||
unsigned short width
|
||||
unsigned short height
|
||||
unsigned char type (LUMINANCE, RGB, RGBA)
|
||||
unsigned long offset in TEXTURES.BIN
|
||||
|
||||
unsigned long TEXTURES.BIN File size
|
||||
unsigned short piece count
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
TEXTURES.BIN
|
||||
|
||||
char[32] "LeoCAD texture data file"
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
UPDATExx.LUP
|
||||
|
||||
char[32] "LeoCAD piece library update"
|
||||
unsigned char file version (currently = 2)
|
||||
unsigned char updated number
|
||||
|
||||
char[8] piece name
|
||||
unsigned char update type (del = 0, desc = 1, draw = 2, new = 4)
|
||||
|
||||
desc:
|
||||
char[64] description
|
||||
unsigned long default group
|
||||
|
||||
drawinfo:
|
||||
short[6] bounding box (scaled)
|
||||
unsigned char flags
|
||||
unsigned long info size
|
||||
void* data
|
||||
|
||||
new:
|
||||
char[64] description
|
||||
short[6] bounding box (scaled)
|
||||
unsigned long default group
|
||||
unsigned char flags
|
||||
unsigned long info size
|
||||
void* data
|
||||
|
||||
MOVED_DATA:
|
||||
char[8] old name
|
||||
char[8] new name
|
||||
|
||||
unsigned short moved count
|
||||
unsigned short changes count
|
||||
@@ -1,365 +0,0 @@
|
||||
4 3193
|
||||
5 3192
|
||||
6 3464
|
||||
9 3460
|
||||
11 3579
|
||||
12 7930
|
||||
13 7026
|
||||
16 3596
|
||||
18 3626A
|
||||
19 3624
|
||||
22 3581
|
||||
25 3582
|
||||
26 3497
|
||||
28 3062B
|
||||
34 7049
|
||||
40 3046
|
||||
47 3659
|
||||
48 3049
|
||||
56 3660
|
||||
57 3045
|
||||
62 3145
|
||||
64 3359
|
||||
65 3358
|
||||
89 9244
|
||||
93 3479
|
||||
94 3865
|
||||
95 2748
|
||||
96 3831
|
||||
97 3830
|
||||
98 3685
|
||||
99 3684
|
||||
100 3665
|
||||
101 3623
|
||||
102 3644
|
||||
103 73037
|
||||
114 3848
|
||||
116 3847
|
||||
117 3846
|
||||
117P47 3846P47
|
||||
118 3849
|
||||
121 3787
|
||||
122 122C01
|
||||
123 3641
|
||||
132 3483
|
||||
134 3794
|
||||
138 3855
|
||||
140 3821
|
||||
141 3822
|
||||
142 3741
|
||||
143 3742
|
||||
144 3854
|
||||
145 3856
|
||||
146 2529
|
||||
148 3957
|
||||
149 3962
|
||||
150 3899
|
||||
157 4070
|
||||
158 3189
|
||||
159 3188
|
||||
163 3315
|
||||
175 4178
|
||||
176 4023
|
||||
177 73092
|
||||
178 4175
|
||||
179 4073
|
||||
180 4161
|
||||
195 4170
|
||||
196 4171
|
||||
197 73090
|
||||
198 4176
|
||||
199 3675
|
||||
205 32073
|
||||
206 73071
|
||||
211 6100
|
||||
212 4229
|
||||
216 3612
|
||||
217 4228
|
||||
231 4349
|
||||
234 4286
|
||||
236 73312
|
||||
238 3048
|
||||
239 4528
|
||||
240 4287
|
||||
241 4529
|
||||
246 73435
|
||||
247 73436
|
||||
247B 73435
|
||||
248 3676
|
||||
252 4599
|
||||
256 3058
|
||||
257 4476
|
||||
258 4169
|
||||
259 4168
|
||||
262 3811
|
||||
262P01 3811P01
|
||||
274 4590
|
||||
275 4460
|
||||
278 4490
|
||||
249 4495
|
||||
291 4868
|
||||
292 4869
|
||||
293 3867
|
||||
294 4447
|
||||
295 4448
|
||||
296 4740
|
||||
297 4593
|
||||
299 4589
|
||||
302 4872
|
||||
305 2335
|
||||
306 2343
|
||||
307 4735
|
||||
321 2412
|
||||
324 2458
|
||||
338 2433
|
||||
339 4474
|
||||
340 2583
|
||||
352 4095
|
||||
368 2569
|
||||
369 3187
|
||||
370 3186
|
||||
371 2920
|
||||
372 2337
|
||||
373 6019
|
||||
376 4733
|
||||
380 6016
|
||||
381 6048
|
||||
386 6020
|
||||
387 6060
|
||||
388 6070
|
||||
391 6558
|
||||
395 3587
|
||||
396 4595
|
||||
401 2516
|
||||
404 6541
|
||||
407 71076
|
||||
408 71075
|
||||
415 6217
|
||||
418 6037
|
||||
426 6043
|
||||
427 6046
|
||||
428 75535
|
||||
432 6126
|
||||
461 3688
|
||||
497 7039
|
||||
513 3144
|
||||
583 30031
|
||||
588 71137
|
||||
602 32000
|
||||
605 6152
|
||||
708 3062A
|
||||
720 3218
|
||||
808 2348A
|
||||
810 6238
|
||||
829 3433
|
||||
860 6120
|
||||
960 2620
|
||||
961 4284
|
||||
965 4089
|
||||
2348 2348B
|
||||
2358P01 80547
|
||||
2418 2418B
|
||||
2455 3755
|
||||
2561 2566
|
||||
2562 2536
|
||||
2748 3857
|
||||
2837A 2838C01
|
||||
2872 2921
|
||||
3062 3062B
|
||||
3137A 3137
|
||||
3137B 20
|
||||
3149A 313
|
||||
3149B 314
|
||||
3149C 3149
|
||||
3324A 3324
|
||||
3465 3480
|
||||
3463 3481
|
||||
3626 3626B
|
||||
3626-4T 3626B-4T
|
||||
3626P01 3626BP01
|
||||
3626P02 3626BP02
|
||||
3709 3709B
|
||||
3944 3961
|
||||
3945 3839B
|
||||
3946 3963
|
||||
3949 3838
|
||||
3950 3959
|
||||
3951 3939
|
||||
3951P68 3939P68
|
||||
4203 4201
|
||||
4601 4624
|
||||
6237 601
|
||||
73590 73590B
|
||||
9326 973
|
||||
9326-4T 973S01
|
||||
9326P01 973P01
|
||||
9326P02 973P02
|
||||
9326P11 973P11
|
||||
9326P14 973P14
|
||||
9326P15 973P15
|
||||
9326P16 973P16
|
||||
9326P17 973P17
|
||||
9326P18 973P18
|
||||
9326P47 973P47
|
||||
9326P51 973P51
|
||||
9326P52 973P52
|
||||
9326P60 973P60
|
||||
9326P61 973P61
|
||||
9326P63 973P63
|
||||
9326P68 973P68
|
||||
9326T01 973P01
|
||||
9326T02 973P02
|
||||
4265 4265B
|
||||
571 6629
|
||||
973P101 973PS1
|
||||
3839 3839B
|
||||
4081 4081B
|
||||
151 32316
|
||||
3002PEYE 3003PE1
|
||||
4085 4085C
|
||||
3068P101 3068PS1
|
||||
3228 3228A
|
||||
2412 2412A
|
||||
2431P52 2431BP52
|
||||
2431P79 2431BP79
|
||||
3069P05 3069BP05
|
||||
3069P06 3069BP06
|
||||
3069P07 3069BP07
|
||||
3069P09 3069BP09
|
||||
3069P101 3069PS1
|
||||
3069P21 3069BP21
|
||||
3069P68 3069BP68
|
||||
3070DISP 3070BPC2
|
||||
3070P06 3070BP06
|
||||
6069P101 6069PS1
|
||||
788 4323
|
||||
3068P07 3068BP07
|
||||
3068P08 3068BP08
|
||||
3068P18 3068BP18
|
||||
3068P80 3068BP80
|
||||
3069P25 3069BP25
|
||||
3039P101 3039PS1
|
||||
124 3876
|
||||
133 3217
|
||||
3068P22 3068BP22
|
||||
3068P23 3068BP23
|
||||
3068P50 3068BP50
|
||||
3068P52 3068BP52
|
||||
3068P66 3068BP66
|
||||
3068P67 3068BP67
|
||||
3068P81 3068BP81
|
||||
3068P87 3068BP87
|
||||
3068PS1 3068BPS1
|
||||
3069P13 3069BP13
|
||||
4215 4215B
|
||||
4215P01 4215AP01
|
||||
4215P02 4215AP02
|
||||
4215P03 4215AP03
|
||||
4215P24 4215AP24
|
||||
4215P66 4215AP66
|
||||
4215P05 4215AP05
|
||||
4215P06 4215AP06
|
||||
4215P07 4215AP07
|
||||
4215P77 4215AP25
|
||||
4215P04 4215AP04
|
||||
2431B 2431
|
||||
2431BP52 2431P52
|
||||
2431BP79 2431P79
|
||||
174 4081B
|
||||
3069P01 3069BP01
|
||||
3070 3070A
|
||||
3846P43 3846P45
|
||||
973P15 973P1D
|
||||
161 4085C
|
||||
3068 3068A
|
||||
3069 3069A
|
||||
3962 3962B
|
||||
578 30374
|
||||
6538 6538A
|
||||
973P11 973P1A
|
||||
30389 30389A
|
||||
3942 3942B
|
||||
4285 4285B
|
||||
193 193A
|
||||
3005-1 3005PT1
|
||||
3005-1B 3005PV1
|
||||
3005-2 3005PT2
|
||||
3005-3 3005PT3
|
||||
3005-4 3005PT4
|
||||
3005-6B 3005PV6
|
||||
3005-7 3005PT7
|
||||
3005-E 3005PTE
|
||||
3005-F 3005PTF
|
||||
3005-H 3005PTH
|
||||
3005-I 3005PTI
|
||||
3005-J 3005PTJ
|
||||
3005-L 3005PTL
|
||||
3005-M 3005PTM
|
||||
3005-N 3005PTN
|
||||
3005-O 3005PTO
|
||||
3005-Q 3005PTQ
|
||||
3005-R 3005PTR
|
||||
3005-T 3005PTT
|
||||
3005-U 3005PTU
|
||||
3005-V 3005PTV
|
||||
3005-W 3005PTW
|
||||
3005-Y 3005PTY
|
||||
3005-Z 3005PTZ
|
||||
3068BP50 3068BP05
|
||||
3068P10 3068BP10
|
||||
3068P17 3068AP17
|
||||
3068P51 3068BP51
|
||||
3068P57 3068BP57
|
||||
3068P68 3068BP68
|
||||
3068PLC 3068BP16
|
||||
3068WARN 3068BP06
|
||||
4150P07 4150C07
|
||||
4345 4345B
|
||||
4688 4866
|
||||
2362 2362B
|
||||
2362P53 2362AP53
|
||||
2362P54 2362AP54
|
||||
3005-0 3005PT0
|
||||
3005-5 3005PT5
|
||||
3005-A 3005PTA
|
||||
3005-AE 3005PUA
|
||||
3005-B 3005PTB
|
||||
3005-C 3005PTC
|
||||
3005-D 3005PTD
|
||||
3005-G 3005PTG
|
||||
3005-K 3005PTK
|
||||
3005-P 3005PTP
|
||||
3005-S 3005PTS
|
||||
3005-X 3005PTX
|
||||
4864 4864B
|
||||
4864P33 4864BP10
|
||||
4864P34 4864BP11
|
||||
4864P66 4864AP02
|
||||
4864P89 4864AP03
|
||||
3040 3040B
|
||||
3475 3475B
|
||||
550 3245B
|
||||
2476 2476A
|
||||
298 4592
|
||||
298C01 4592C01
|
||||
300 44294
|
||||
30359 30359A
|
||||
4738 4738A
|
||||
480 30554
|
||||
4864P35 4864AP01
|
||||
530 41334
|
||||
552 32209
|
||||
554 42446
|
||||
6238 6238A
|
||||
770 2586
|
||||
770P4B 2586P4B
|
||||
770P4C 2586P4C
|
||||
770P4D 2586P4D
|
||||
770PH1 2586PH1
|
||||
770PS1 2586PS1
|
||||
770PW1 2586PW1
|
||||
6141 4073
|
||||
44237 2456
|
||||
30499 3684
|
||||
30039 3070B
|
||||
30002 2343
|
||||
@@ -1,120 +0,0 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <io.h>
|
||||
#include "texture.h"
|
||||
|
||||
void ConvertFile(char* szFilename, FILE* idx, FILE* bin, unsigned long* binoff)
|
||||
{
|
||||
long i, j;
|
||||
unsigned short width, height;
|
||||
unsigned char* buf = ReadBMP(szFilename, &width, &height);
|
||||
unsigned char bt;
|
||||
unsigned short sh;
|
||||
char* p;
|
||||
p = strrchr(szFilename, '.');
|
||||
*p = 0;
|
||||
p = strrchr(szFilename, '\\');
|
||||
strupr(p);
|
||||
p++;
|
||||
|
||||
char name[9];
|
||||
memset(name, 0, 9);
|
||||
strcpy(name, p);
|
||||
|
||||
fwrite(name, 8, 1, idx);
|
||||
sh = (unsigned short)width;
|
||||
fwrite(&sh, sizeof(sh), 1, idx);
|
||||
sh = (unsigned short)height;
|
||||
fwrite(&sh, sizeof(sh), 1, idx);
|
||||
|
||||
if (strcmp("SYSFONT", name) == 0)
|
||||
{
|
||||
bt = 0; // luminance
|
||||
fwrite(&bt, 1, 1, idx);
|
||||
|
||||
// Store top->bottom only this one
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
unsigned char* b = buf+(height-i-1)*width*3;
|
||||
|
||||
for (j = 0; j < width; j++)
|
||||
{
|
||||
if (b[j*3] > 0 || b[j*3+1] > 0 || b[j*3+2] > 0)
|
||||
bt = 0;
|
||||
else
|
||||
bt = 255;
|
||||
fwrite(&bt, 1, 1, bin);
|
||||
}
|
||||
}
|
||||
|
||||
fwrite(binoff, sizeof(*binoff), 1, idx);
|
||||
*binoff += width*height;
|
||||
}
|
||||
|
||||
if (strcmp("SPACE", name) == 0)
|
||||
{
|
||||
bt = 2; // RGBA
|
||||
fwrite(&bt, 1, 1, idx);
|
||||
for (i = 0; i < width*height; i++)
|
||||
{
|
||||
if (buf[i*3] == 255 && buf[i*3+1] == 0 && buf[i*3+2] == 255)
|
||||
{
|
||||
buf[i*3] = buf[i*3+1] = buf[i*3+2] = 255;
|
||||
bt = 0;
|
||||
}
|
||||
else
|
||||
bt = 255;
|
||||
|
||||
fwrite(&buf[i*3], 3, 1, bin);
|
||||
fwrite(&bt, 1, 1, bin);
|
||||
}
|
||||
|
||||
fwrite(binoff, sizeof(*binoff), 1, idx);
|
||||
*binoff += width*height*4;
|
||||
}
|
||||
|
||||
free (buf);
|
||||
}
|
||||
|
||||
static char* filepath = "f:\\ldraw\\textures\\";
|
||||
static char* filenames[] = { "SYSFONT", "SPACE" };
|
||||
static int filecount = 2;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char tmp[260];
|
||||
FILE *bin, *idx;
|
||||
unsigned long binoff;
|
||||
unsigned short count = 0;
|
||||
|
||||
char strbin[32] = "LeoCAD texture data file\0\0\0\0\0\0\0";
|
||||
char stridx[32] = "LeoCAD texture index file\0\0\0\0\0\0";
|
||||
unsigned char bt;
|
||||
|
||||
bin = fopen("TEXTURES.BIN", "wb");
|
||||
idx = fopen("TEXTURES.IDX", "wb");
|
||||
fwrite(strbin, 32, 1, bin);
|
||||
binoff = 32;
|
||||
fwrite(stridx, 32, 1, idx);
|
||||
bt = 1; // version
|
||||
fwrite(&bt, 1, 1, idx);
|
||||
bt = 3; // last update
|
||||
fwrite(&bt, 1, 1, idx);
|
||||
|
||||
for (int i = 0; i < filecount; i++)
|
||||
{
|
||||
strcpy(tmp, filepath);
|
||||
strcat(tmp, filenames[i]);
|
||||
strcat(tmp, ".bmp");
|
||||
count++;
|
||||
ConvertFile(tmp, idx, bin, &binoff);
|
||||
}
|
||||
|
||||
fclose(bin);
|
||||
fwrite(&binoff, sizeof(binoff), 1, idx);
|
||||
fwrite(&count, sizeof(count), 1, idx);
|
||||
fclose(idx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,678 +0,0 @@
|
||||
|
||||
static unsigned char* ReadBMP (char* filename, unsigned short *width, unsigned short *height)
|
||||
{
|
||||
int bmWidth;
|
||||
int bmHeight;
|
||||
unsigned char bmPlanes;
|
||||
unsigned char bmBitsPixel;
|
||||
typedef struct {
|
||||
unsigned char rgbBlue;
|
||||
unsigned char rgbGreen;
|
||||
unsigned char rgbRed;
|
||||
unsigned char rgbReserved;
|
||||
} RGBQUAD;
|
||||
unsigned char m1,m2;
|
||||
unsigned long sizeimage;
|
||||
short res1,res2;
|
||||
long filesize, pixoff;
|
||||
long bmisize, compression;
|
||||
long xscale, yscale;
|
||||
long colors, impcol;
|
||||
unsigned long m_bytesRead = 0;
|
||||
unsigned char* outbuf;
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen(filename,"rb");
|
||||
if (fp == NULL)
|
||||
return NULL;
|
||||
else
|
||||
{
|
||||
long rc;
|
||||
rc = fread(&m1, 1, 1, fp);
|
||||
m_bytesRead++;
|
||||
if (rc == -1)
|
||||
{
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc = fread(&m2, 1, 1, fp);
|
||||
m_bytesRead++;
|
||||
if ((m1!='B') || (m2!='M'))
|
||||
{
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc = fread((long*)&(filesize),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((int*)&(res1),2,1,fp); m_bytesRead+=2;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((int*)&(res2),2,1,fp); m_bytesRead+=2;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(pixoff),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(bmisize),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long *)&(bmWidth),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(bmHeight),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((int*)&(bmPlanes),2,1,fp); m_bytesRead+=2;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((int*)&(bmBitsPixel),2,1,fp); m_bytesRead+=2;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(compression),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(sizeimage),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) {fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(xscale),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(yscale),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(colors),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
rc = fread((long*)&(impcol),4,1,fp); m_bytesRead+=4;
|
||||
if (rc != 1) { fclose(fp); return NULL; }
|
||||
|
||||
// I don't do RLE files
|
||||
if (compression != 0) // BI_RGB
|
||||
{
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (colors == 0)
|
||||
colors = 1 << bmBitsPixel;
|
||||
|
||||
RGBQUAD *colormap = NULL;
|
||||
|
||||
switch (bmBitsPixel)
|
||||
{
|
||||
case 24:
|
||||
break;
|
||||
// read pallete
|
||||
case 1:
|
||||
case 4:
|
||||
case 8:
|
||||
colormap = new RGBQUAD[colors];
|
||||
if (colormap == NULL)
|
||||
{
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int i;
|
||||
for (i = 0; i < colors; i++)
|
||||
{
|
||||
unsigned char r ,g, b, dummy;
|
||||
|
||||
rc = fread(&b, 1, 1, fp);
|
||||
m_bytesRead++;
|
||||
if (rc!=1)
|
||||
{
|
||||
delete [] colormap;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc = fread(&g, 1, 1, fp);
|
||||
m_bytesRead++;
|
||||
if (rc!=1)
|
||||
{
|
||||
delete [] colormap;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc = fread(&r, 1, 1, fp);
|
||||
m_bytesRead++;
|
||||
if (rc != 1)
|
||||
{
|
||||
delete [] colormap;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
rc = fread(&dummy, 1, 1, fp);
|
||||
m_bytesRead++;
|
||||
if (rc != 1)
|
||||
{
|
||||
delete [] colormap;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
colormap[i].rgbRed=r;
|
||||
colormap[i].rgbGreen=g;
|
||||
colormap[i].rgbBlue=b;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ((long)m_bytesRead > pixoff)
|
||||
{
|
||||
delete [] colormap;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while ((long)m_bytesRead < pixoff)
|
||||
{
|
||||
char dummy;
|
||||
fread(&dummy,1,1,fp);
|
||||
m_bytesRead++;
|
||||
}
|
||||
|
||||
int w = bmWidth;
|
||||
int h = bmHeight;
|
||||
|
||||
// set the output params
|
||||
outbuf = (unsigned char*)malloc(w*h*3);
|
||||
long row_size = w * 3;
|
||||
long bufsize = (long)w * 3 * (long)h;
|
||||
|
||||
if (outbuf != NULL)
|
||||
{
|
||||
*width = w;
|
||||
*height = h;
|
||||
long row = 0;
|
||||
long rowOffset = 0;
|
||||
|
||||
// read rows in reverse order
|
||||
for (row = 0; row < bmHeight; row++)
|
||||
{
|
||||
// which row are we working on?
|
||||
rowOffset = (long unsigned)row*row_size;
|
||||
|
||||
if (bmBitsPixel == 24)
|
||||
{
|
||||
for (int col=0;col<w;col++)
|
||||
{
|
||||
long offset = col * 3;
|
||||
char pixel[3];
|
||||
|
||||
if (fread((void*)(pixel),1,3,fp)==3)
|
||||
{
|
||||
// we swap red and blue here
|
||||
*(outbuf + rowOffset + offset + 0)=pixel[2]; // r
|
||||
*(outbuf + rowOffset + offset + 1)=pixel[1]; // g
|
||||
*(outbuf + rowOffset + offset + 2)=pixel[0]; // b
|
||||
}
|
||||
}
|
||||
m_bytesRead += row_size;
|
||||
|
||||
// read DWORD padding
|
||||
while ((m_bytesRead-pixoff)&3)
|
||||
{
|
||||
char dummy;
|
||||
if (fread(&dummy,1,1,fp) != 1)
|
||||
{
|
||||
free(outbuf);
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
m_bytesRead++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// pixels are packed as 1 , 4 or 8 bit vals. need to unpack them
|
||||
int bit_count = 0;
|
||||
unsigned long mask = (1 << bmBitsPixel) - 1;
|
||||
|
||||
unsigned char inbyte = 0;
|
||||
|
||||
for (int col=0;col<w;col++)
|
||||
{
|
||||
int pix = 0;
|
||||
|
||||
// if we need another byte
|
||||
if (bit_count <= 0)
|
||||
{
|
||||
bit_count = 8;
|
||||
if (fread(&inbyte,1,1,fp) != 1)
|
||||
{
|
||||
free(outbuf);
|
||||
delete [] colormap;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
m_bytesRead++;
|
||||
}
|
||||
|
||||
// keep track of where we are in the bytes
|
||||
bit_count -= bmBitsPixel;
|
||||
pix = ( inbyte >> bit_count) & mask;
|
||||
|
||||
// lookup the color from the colormap - stuff it in our buffer
|
||||
// swap red and blue
|
||||
*(outbuf + rowOffset + col * 3 + 2) = colormap[pix].rgbBlue;
|
||||
*(outbuf + rowOffset + col * 3 + 1) = colormap[pix].rgbGreen;
|
||||
*(outbuf + rowOffset + col * 3 + 0) = colormap[pix].rgbRed;
|
||||
}
|
||||
|
||||
// read DWORD padding
|
||||
while ((m_bytesRead-pixoff)&3)
|
||||
{
|
||||
char dummy;
|
||||
if (fread(&dummy,1,1,fp)!=1)
|
||||
{
|
||||
free(outbuf);
|
||||
if (colormap)
|
||||
delete [] colormap;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
m_bytesRead++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (colormap)
|
||||
delete [] colormap;
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
// VerticalFlip(image);
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
#define WIDTHBYTES(bits) (((bits) + 31) / 32 * 4)
|
||||
|
||||
static BOOL VertFlipBuf(BYTE* inbuf, UINT widthBytes, UINT height)
|
||||
{
|
||||
BYTE *tb1, *tb2;
|
||||
ULONG off1 = 0, off2 = 0;
|
||||
|
||||
if (inbuf == NULL)
|
||||
return FALSE;
|
||||
|
||||
tb1 = (BYTE*)malloc(widthBytes);
|
||||
if (tb1 == NULL)
|
||||
return FALSE;
|
||||
|
||||
tb2 = (BYTE*)malloc(widthBytes);
|
||||
if (tb2 == NULL)
|
||||
{
|
||||
free(tb1);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (UINT row_cnt = 0; row_cnt < (height+1)/2; row_cnt++)
|
||||
{
|
||||
off1 = row_cnt*widthBytes;
|
||||
off2 = ((height-1)-row_cnt)*widthBytes;
|
||||
|
||||
memcpy(tb1, inbuf+off1, widthBytes);
|
||||
memcpy(tb2, inbuf+off2, widthBytes);
|
||||
memcpy(inbuf+off1, tb2, widthBytes);
|
||||
memcpy(inbuf+off2, tb1, widthBytes);
|
||||
}
|
||||
|
||||
free (tb1);
|
||||
free (tb2);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BYTE* MakeDwordAlignedBuf(BYTE *dataBuf, UINT widthPix, UINT height, UINT *uiOutWidthBytes)
|
||||
{
|
||||
if (dataBuf == NULL)
|
||||
return NULL;
|
||||
|
||||
UINT uiWidthBytes = WIDTHBYTES(widthPix * 24);
|
||||
DWORD dwNewsize = (DWORD)((DWORD)uiWidthBytes * (DWORD)height);
|
||||
BYTE *pNew;
|
||||
|
||||
pNew = (BYTE*)new BYTE[dwNewsize];
|
||||
if (pNew == NULL)
|
||||
return NULL;
|
||||
|
||||
// copy row-by-row
|
||||
UINT uiInWidthBytes = widthPix * 3;
|
||||
UINT uiCount;
|
||||
for (uiCount=0;uiCount < height;uiCount++)
|
||||
{
|
||||
BYTE* bpInAdd;
|
||||
BYTE* bpOutAdd;
|
||||
ULONG lInOff;
|
||||
ULONG lOutOff;
|
||||
|
||||
lInOff = uiInWidthBytes * uiCount;
|
||||
lOutOff = uiWidthBytes * uiCount;
|
||||
|
||||
bpInAdd = dataBuf + lInOff;
|
||||
bpOutAdd = pNew + lOutOff;
|
||||
|
||||
memcpy(bpOutAdd,bpInAdd,uiInWidthBytes);
|
||||
}
|
||||
|
||||
*uiOutWidthBytes = uiWidthBytes;
|
||||
return pNew;
|
||||
}
|
||||
|
||||
static BOOL BGRFromRGB(BYTE *buf, UINT widthPix, UINT height)
|
||||
{
|
||||
if (buf == NULL)
|
||||
return FALSE;
|
||||
|
||||
UINT col, row;
|
||||
for (row=0;row<height;row++) {
|
||||
for (col=0;col<widthPix;col++)
|
||||
{
|
||||
LPBYTE pRed, pGrn, pBlu;
|
||||
pRed = buf + row * widthPix * 3 + col * 3;
|
||||
pGrn = buf + row * widthPix * 3 + col * 3 + 1;
|
||||
pBlu = buf + row * widthPix * 3 + col * 3 + 2;
|
||||
|
||||
// swap red and blue
|
||||
BYTE tmp;
|
||||
tmp = *pRed;
|
||||
*pRed = *pBlu;
|
||||
*pBlu = tmp;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static unsigned char* ReadBMP (char* fileName, UINT *width, UINT *height)
|
||||
{
|
||||
BITMAP inBM;
|
||||
unsigned char m1,m2;
|
||||
unsigned long sizeimage;
|
||||
short res1,res2;
|
||||
long filesize, pixoff;
|
||||
long bmisize, compression;
|
||||
long xscale, yscale;
|
||||
long colors, impcol;
|
||||
FILE *fp;
|
||||
|
||||
unsigned char *outBuf=NULL;
|
||||
unsigned long m_bytesRead = 0;
|
||||
*width=0;
|
||||
*height=0;
|
||||
|
||||
fp=fopen(fileName,"rb");
|
||||
if (fp==NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
long rc;
|
||||
rc=fread((unsigned char*)&(m1),1,1,fp); m_bytesRead+=1;
|
||||
if (rc==-1) {fclose(fp); return NULL;}
|
||||
|
||||
rc=fread((unsigned char*)&(m2),1,1,fp); m_bytesRead+=1;
|
||||
if ((m1!='B') || (m2!='M')) {
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc=fread((long *)&(filesize),4,1,fp); m_bytesRead+=4;
|
||||
if (rc!=1) {fclose(fp); return NULL;}
|
||||
|
||||
rc=fread((int *)&(res1),2,1,fp); m_bytesRead+=2;
|
||||
if (rc!=1) {fclose(fp); return NULL;}
|
||||
|
||||
rc=fread((int *)&(res2),2,1,fp); m_bytesRead+=2;
|
||||
if (rc!=1) {fclose(fp); return NULL;}
|
||||
|
||||
rc=fread((long *)&(pixoff),4,1,fp); m_bytesRead+=4;
|
||||
if (rc!=1) {fclose(fp); return NULL;}
|
||||
|
||||
rc=fread((long *)&(bmisize),4,1,fp); m_bytesRead+=4;
|
||||
if (rc!=1) {fclose(fp); return NULL;}
|
||||
|
||||
rc=fread((long *)&(inBM.bmWidth),4,1,fp); m_bytesRead+=4;
|
||||
if (rc!=1) {fclose(fp); return NULL;}
|
||||
|
||||
rc=fread((long *)&(inBM.bmHeight),4,1,fp); m_bytesRead+=4;
|
||||
if (rc!=1) {fclose(fp); return NULL;}
|
||||
|
||||
rc=fread((int *)&(inBM.bmPlanes),2,1,fp); m_bytesRead+=2;
|
||||
if (rc!=1) {fclose(fp); return NULL;}
|
||||
|
||||
rc=fread((int *)&(inBM.bmBitsPixel),2,1,fp); m_bytesRead+=2;
|
||||
if (rc!=1) {fclose(fp); return NULL;}
|
||||
|
||||
rc=fread((long *)&(compression),4,1,fp); m_bytesRead+=4;
|
||||
if (rc!=1) {fclose(fp); return NULL;}
|
||||
|
||||
rc=fread((long *)&(sizeimage),4,1,fp); m_bytesRead+=4;
|
||||
if (rc!=1) {fclose(fp); return NULL;}
|
||||
|
||||
rc=fread((long *)&(xscale),4,1,fp); m_bytesRead+=4;
|
||||
if (rc!=1) {fclose(fp); return NULL;}
|
||||
|
||||
rc=fread((long *)&(yscale),4,1,fp); m_bytesRead+=4;
|
||||
if (rc!=1) {fclose(fp); return NULL;}
|
||||
|
||||
rc=fread((long *)&(colors),4,1,fp); m_bytesRead+=4;
|
||||
if (rc!=1) {fclose(fp); return NULL;}
|
||||
|
||||
rc=fread((long *)&(impcol),4,1,fp); m_bytesRead+=4;
|
||||
if (rc!=1) {fclose(fp); return NULL;}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// i don't do RLE files
|
||||
|
||||
if (compression!=BI_RGB) {
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (colors == 0) {
|
||||
colors = 1 << inBM.bmBitsPixel;
|
||||
}
|
||||
|
||||
|
||||
RGBQUAD *colormap = NULL;
|
||||
|
||||
switch (inBM.bmBitsPixel) {
|
||||
case 24:
|
||||
break;
|
||||
// read pallete
|
||||
case 1:
|
||||
case 4:
|
||||
case 8:
|
||||
colormap = new RGBQUAD[colors];
|
||||
if (colormap==NULL) {
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int i;
|
||||
for (i=0;i<colors;i++) {
|
||||
unsigned char r,g,b, dummy;
|
||||
|
||||
rc=fread((unsigned char*)&(b),1,1,fp);
|
||||
m_bytesRead++;
|
||||
if (rc!=1) {
|
||||
delete [] colormap;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc=fread((unsigned char*)&(g),1,1,fp);
|
||||
m_bytesRead++;
|
||||
if (rc!=1) {
|
||||
delete [] colormap;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc=fread((unsigned char*)&(r),1,1,fp);
|
||||
m_bytesRead++;
|
||||
if (rc!=1) {
|
||||
delete [] colormap;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
rc=fread((unsigned char*)&(dummy),1,1,fp);
|
||||
m_bytesRead++;
|
||||
if (rc!=1) {
|
||||
delete [] colormap;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
colormap[i].rgbRed=r;
|
||||
colormap[i].rgbGreen=g;
|
||||
colormap[i].rgbBlue=b;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ((long)m_bytesRead>pixoff) {
|
||||
delete [] colormap;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while ((long)m_bytesRead<pixoff) {
|
||||
char dummy;
|
||||
fread(&dummy,1,1,fp);
|
||||
m_bytesRead++;
|
||||
}
|
||||
|
||||
int w=inBM.bmWidth;
|
||||
int h=inBM.bmHeight;
|
||||
|
||||
// set the output params
|
||||
*width=w;
|
||||
*height=h;
|
||||
|
||||
long row_size = w * 3;
|
||||
long bufsize = (long)w * 3 * (long)h;
|
||||
|
||||
outBuf=(unsigned char*) new unsigned char[bufsize];
|
||||
if (outBuf!=NULL)
|
||||
{
|
||||
long row=0;
|
||||
long rowOffset=0;
|
||||
|
||||
// read rows in reverse order
|
||||
for (row=inBM.bmHeight-1;row>=0;row--) {
|
||||
|
||||
// which row are we working on?
|
||||
rowOffset=(long unsigned)row*row_size;
|
||||
|
||||
if (inBM.bmBitsPixel==24) {
|
||||
|
||||
for (int col=0;col<w;col++) {
|
||||
long offset = col * 3;
|
||||
char pixel[3];
|
||||
|
||||
if (fread((void *)(pixel),1,3,fp)==3) {
|
||||
// we swap red and blue here
|
||||
*(outBuf + rowOffset + offset + 0)=pixel[2]; // r
|
||||
*(outBuf + rowOffset + offset + 1)=pixel[1]; // g
|
||||
*(outBuf + rowOffset + offset + 2)=pixel[0]; // b
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
m_bytesRead+=row_size;
|
||||
|
||||
// read DWORD padding
|
||||
while ((m_bytesRead-pixoff)&3) {
|
||||
char dummy;
|
||||
if (fread(&dummy,1,1,fp)!=1) {
|
||||
delete [] outBuf;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
m_bytesRead++;
|
||||
}
|
||||
|
||||
|
||||
} else { // 1, 4, or 8 bit image
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// pixels are packed as 1 , 4 or 8 bit vals. need to unpack them
|
||||
|
||||
int bit_count = 0;
|
||||
UINT mask = (1 << inBM.bmBitsPixel) - 1;
|
||||
|
||||
unsigned char inbyte=0;
|
||||
|
||||
for (int col=0;col<w;col++) {
|
||||
|
||||
int pix=0;
|
||||
|
||||
// if we need another byte
|
||||
if (bit_count <= 0) {
|
||||
bit_count = 8;
|
||||
if (fread(&inbyte,1,1,fp)!=1) {
|
||||
delete [] outBuf;
|
||||
delete [] colormap;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
m_bytesRead++;
|
||||
}
|
||||
|
||||
// keep track of where we are in the bytes
|
||||
bit_count -= inBM.bmBitsPixel;
|
||||
pix = ( inbyte >> bit_count) & mask;
|
||||
|
||||
// lookup the color from the colormap - stuff it in our buffer
|
||||
// swap red and blue
|
||||
*(outBuf + rowOffset + col * 3 + 2) = colormap[pix].rgbBlue;
|
||||
*(outBuf + rowOffset + col * 3 + 1) = colormap[pix].rgbGreen;
|
||||
*(outBuf + rowOffset + col * 3 + 0) = colormap[pix].rgbRed;
|
||||
}
|
||||
|
||||
// read DWORD padding
|
||||
while ((m_bytesRead-pixoff)&3) {
|
||||
char dummy;
|
||||
if (fread(&dummy,1,1,fp)!=1) {
|
||||
delete [] outBuf;
|
||||
if (colormap)
|
||||
delete [] colormap;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
m_bytesRead++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (colormap) {
|
||||
delete [] colormap;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
}
|
||||
|
||||
return outBuf;
|
||||
}
|
||||
*/
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -88,8 +88,6 @@ IDB_PIECE BITMAP "res\\piece.bmp"
|
||||
IDB_CAMERA BITMAP "res\\camera.bmp"
|
||||
IDB_LIGHT BITMAP "res\\light.bmp"
|
||||
IDR_FULLSCREEN BITMAP "res\\fullscr.bmp"
|
||||
IDR_PIECEEDITOR BITMAP "res\\pieceed.bmp"
|
||||
IDB_EDITOR_ICONS BITMAP "res\\editor.bmp"
|
||||
IDR_LIBRARY BITMAP "res\\library.bmp"
|
||||
IDR_TERRAIN BITMAP "res\\terrain.bmp"
|
||||
IDR_PREVIEW BITMAP "res\\preview.bmp"
|
||||
@@ -161,13 +159,6 @@ BEGIN
|
||||
BUTTON ID_VIEW_FULLSCREEN
|
||||
END
|
||||
|
||||
IDR_PIECEEDITOR TOOLBAR 16, 15
|
||||
BEGIN
|
||||
BUTTON ID_EDITOR_FILE_NEW
|
||||
BUTTON ID_EDITOR_FILE_OPEN
|
||||
BUTTON ID_EDITOR_FILE_SAVE
|
||||
END
|
||||
|
||||
IDR_LIBRARY TOOLBAR 16, 15
|
||||
BEGIN
|
||||
BUTTON ID_LIBDLG_FILE_OPEN
|
||||
@@ -1513,7 +1504,7 @@ IDC_MOVE CURSOR "res\\Move.cur"
|
||||
IDC_PAINT CURSOR "res\\Paint.cur"
|
||||
IDC_PAN CURSOR "res\\Pan.cur"
|
||||
IDC_ANGLE CURSOR "res\\Angle.cur"
|
||||
IDC_ROTATE CURSOR "res\\Rotate.cur"
|
||||
IDC_ROTATE CURSOR "res\\rotate.cur"
|
||||
IDC_LIGHT CURSOR "res\\bulb.cur"
|
||||
IDC_ZOOM_REGION CURSOR "res\\Zoomrect.cur"
|
||||
IDC_SELECT_GROUP CURSOR "res\\SelctGrp.cur"
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////
|
||||
// The following stuff is to make the command update UI mechanism
|
||||
// work properly for flat tool bars. The main idea is to convert
|
||||
// a "checked" button state into a "pressed" button state. Changed
|
||||
// lines marked with "PD"
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "BarCmdUI.h"
|
||||
|
||||
void CFlatOrCoolBarCmdUI::Enable(BOOL bOn)
|
||||
{
|
||||
m_bEnableChanged = TRUE;
|
||||
CToolBar* pToolBar = (CToolBar*)m_pOther;
|
||||
ASSERT(pToolBar != NULL);
|
||||
ASSERT_KINDOF(CToolBar, pToolBar);
|
||||
ASSERT(m_nIndex < m_nIndexMax);
|
||||
|
||||
UINT nNewStyle = pToolBar->GetButtonStyle(m_nIndex) & ~TBBS_DISABLED;
|
||||
if (!bOn)
|
||||
{
|
||||
nNewStyle |= TBBS_DISABLED;
|
||||
// WINBUG: If a button is currently pressed and then is disabled
|
||||
// COMCTL32.DLL does not unpress the button, even after the mouse
|
||||
// button goes up! We work around this bug by forcing TBBS_PRESSED
|
||||
// off when a button is disabled.
|
||||
nNewStyle &= ~TBBS_PRESSED;
|
||||
}
|
||||
ASSERT(!(nNewStyle & TBBS_SEPARATOR));
|
||||
pToolBar->SetButtonStyle(m_nIndex, nNewStyle);
|
||||
}
|
||||
|
||||
// Take your pick:
|
||||
#define MYTBBS_CHECKED TBBS_CHECKED // use "checked" state
|
||||
//#define MYTBBS_CHECKED TBBS_PRESSED // use pressed state
|
||||
|
||||
//////////////////
|
||||
// This is the only function that has changed: instead of TBBS_CHECKED,
|
||||
// I use TBBS_PRESSED--PD
|
||||
//
|
||||
void CFlatOrCoolBarCmdUI::SetCheck(int nCheck)
|
||||
{
|
||||
ASSERT(nCheck >= 0 && nCheck <= 2); // 0=>off, 1=>on, 2=>indeterminate
|
||||
CToolBar* pToolBar = (CToolBar*)m_pOther;
|
||||
ASSERT(pToolBar != NULL);
|
||||
ASSERT_KINDOF(CToolBar, pToolBar);
|
||||
ASSERT(m_nIndex < m_nIndexMax);
|
||||
|
||||
|
||||
UINT nOldStyle = pToolBar->GetButtonStyle(m_nIndex); // PD
|
||||
UINT nNewStyle = nOldStyle &
|
||||
~(MYTBBS_CHECKED | TBBS_PRESSED |TBBS_INDETERMINATE); // PD
|
||||
|
||||
// fix check & hot bug
|
||||
if ((pToolBar->SendMessage (TB_GETHOTITEM,0,0) == (int)m_nIndex)
|
||||
&& (nCheck == 1))
|
||||
nNewStyle |= TBBS_PRESSED;
|
||||
else
|
||||
{
|
||||
if (nCheck == 1)
|
||||
nNewStyle |= MYTBBS_CHECKED; // PD
|
||||
else if (nCheck == 2)
|
||||
nNewStyle |= TBBS_INDETERMINATE;
|
||||
}
|
||||
|
||||
// Following is to fix display bug for TBBS_CHECKED:
|
||||
// If new state is unchecked, repaint--but only if style actually changing.
|
||||
// (Otherwise will end up with flicker)
|
||||
//
|
||||
if (nNewStyle != nOldStyle) {
|
||||
ASSERT(!(nNewStyle & TBBS_SEPARATOR));
|
||||
pToolBar->SetButtonStyle(m_nIndex, nNewStyle);
|
||||
pToolBar->Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void CFlatOrCoolBarCmdUI::SetText(LPCTSTR)
|
||||
{
|
||||
// ignore for now, but you should really set the text
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
////////////////
|
||||
// The following class was copied from BARTOOL.CPP in the MFC source.
|
||||
// All I changed was SetCheck--PD.
|
||||
//
|
||||
class CFlatOrCoolBarCmdUI : public CCmdUI // class private to this file !
|
||||
{
|
||||
public: // re-implementations only
|
||||
virtual void Enable(BOOL bOn);
|
||||
virtual void SetCheck(int nCheck);
|
||||
virtual void SetText(LPCTSTR lpszText);
|
||||
};
|
||||
|
||||
@@ -104,7 +104,6 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Arraydlg.cpp" />
|
||||
<ClCompile Include="Barcmdui.cpp" />
|
||||
<ClCompile Include="basewnd.cpp" />
|
||||
<ClCompile Include="Bmpmenu.cpp" />
|
||||
<ClCompile Include="Cadbar.cpp" />
|
||||
@@ -139,7 +138,6 @@
|
||||
<ClCompile Include="propertiespane.cpp" />
|
||||
<ClCompile Include="Propspgs.cpp" />
|
||||
<ClCompile Include="Propssht.cpp" />
|
||||
<ClCompile Include="Rmodel.cpp" />
|
||||
<ClCompile Include="Seldlg.cpp" />
|
||||
<ClCompile Include="Splitter.cpp" />
|
||||
<ClCompile Include="Stdafx.cpp">
|
||||
@@ -418,7 +416,6 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AboutDlg.h" />
|
||||
<ClInclude Include="ArrayDlg.h" />
|
||||
<ClInclude Include="Barcmdui.h" />
|
||||
<ClInclude Include="Bmpmenu.h" />
|
||||
<ClInclude Include="CADBar.h" />
|
||||
<ClInclude Include="CADDoc.h" />
|
||||
@@ -453,7 +450,6 @@
|
||||
<ClInclude Include="PropsPgs.h" />
|
||||
<ClInclude Include="PropsSht.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="RModel.h" />
|
||||
<ClInclude Include="SelDlg.h" />
|
||||
<ClInclude Include="Splitter.h" />
|
||||
<ClInclude Include="StdAfx.h" />
|
||||
|
||||
@@ -35,9 +35,6 @@
|
||||
<ClCompile Include="Arraydlg.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Barcmdui.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="basewnd.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -137,9 +134,6 @@
|
||||
<ClCompile Include="Propssht.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Rmodel.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Seldlg.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -586,9 +580,6 @@
|
||||
<ClInclude Include="ArrayDlg.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Barcmdui.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Bmpmenu.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -688,9 +679,6 @@
|
||||
<ClInclude Include="Resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RModel.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SelDlg.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
||||
|
Before Width: | Height: | Size: 478 B |
|
Before Width: | Height: | Size: 238 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 326 B |
|
Before Width: | Height: | Size: 630 B |
|
Before Width: | Height: | Size: 718 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 478 B |
@@ -1,6 +1,6 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by Leocad.rc
|
||||
// Used by LeoCAD.rc
|
||||
//
|
||||
#define IDAPPLY 3
|
||||
#define IDC_HTMDLG_IMAGEOPTIONS 3
|
||||
@@ -104,7 +104,6 @@
|
||||
#define IDS_COLOR28 203
|
||||
#define IDR_PIECEEDITOR 205
|
||||
#define IDD_PIECEEDITOR 208
|
||||
#define IDB_EDITOR_ICONS 209
|
||||
#define IDD_LIBRARY 211
|
||||
#define IDR_LIBRARY 213
|
||||
#define IDD_TERRAIN 216
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
// RModel.h: interface for the CRModel class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_RMODEL_H__2071A861_CBE3_11D2_8204_A9244A508F02__INCLUDED_)
|
||||
#define AFX_RMODEL_H__2071A861_CBE3_11D2_8204_A9244A508F02__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
///////////////////////////////////////
|
||||
// RAPID API RETURN VALUES
|
||||
#define RAPID_OK 0
|
||||
#define RAPID_ERR_MODEL_OUT_OF_MEMORY 1
|
||||
#define RAPID_ERR_COLLIDE_OUT_OF_MEMORY 2
|
||||
#define RAPID_ERR_UNPROCESSED_MODEL 3
|
||||
#define RAPID_ERR_BUILD_OUT_OF_SEQUENCE 4
|
||||
#define RAPID_ERR_BUILD_EMPTY_MODEL 5
|
||||
|
||||
#define RAPID_BUILD_STATE_CONST 0 // "empty" state, after constructor
|
||||
#define RAPID_BUILD_STATE_BEGIN 1 // after BeginModel()
|
||||
#define RAPID_BUILD_STATE_ADDTRI 2 // after AddTri()
|
||||
#define RAPID_BUILD_STATE_PROCESSED 3 // after EndModel()
|
||||
|
||||
// Find all pairwise intersecting triangles
|
||||
#define RAPID_ALL_CONTACTS 1
|
||||
// Just report one intersecting triangle pair, if there are any.
|
||||
#define RAPID_FIRST_CONTACT 2
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id1;
|
||||
int id2;
|
||||
} collision_pair;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id;
|
||||
double p1[3], p2[3], p3[3];
|
||||
} tri;
|
||||
|
||||
typedef struct box
|
||||
{
|
||||
// placement in parent's space
|
||||
// box to parent space: x_m = pR*x_b + pT
|
||||
// parent to box space: x_b = pR.T()*(x_m - pT)
|
||||
double pR[3][3];
|
||||
double pT[3];
|
||||
|
||||
// dimensions
|
||||
double d[3]; // this is "radius", that is, half the measure of a side length
|
||||
|
||||
box *P; // points to but does not "own".
|
||||
box *N;
|
||||
|
||||
tri *trp;
|
||||
|
||||
int leaf() { return (!P && !N); }
|
||||
double size() { return d[0]; }
|
||||
|
||||
int split_recurse(int *t, int n);
|
||||
int split_recurse(int *t); // specialized for leaf nodes
|
||||
} box;
|
||||
|
||||
class CRModel
|
||||
{
|
||||
public:
|
||||
CRModel();
|
||||
~CRModel();
|
||||
|
||||
int BeginModel();
|
||||
int EndModel();
|
||||
// int AddTri(const double *p1, const double *p2, const double *p3, int id);
|
||||
int AddTri(float *p1, float *p2, float *p3, int id);
|
||||
|
||||
protected:
|
||||
box *b;
|
||||
int num_boxes_alloced;
|
||||
|
||||
tri *tris;
|
||||
int num_tris;
|
||||
int num_tris_alloced;
|
||||
|
||||
int build_state;
|
||||
|
||||
int build_hierarchy();
|
||||
|
||||
friend int RAPID_Collide(double R1[3][3], double T1[3], double s1, CRModel *RAPID_model1,
|
||||
double R2[3][3], double T2[3], double s2, CRModel *RAPID_model2, int flag);
|
||||
};
|
||||
|
||||
// The only global function that should be called
|
||||
BOOL CollisionCheck(double R1[3][3], double T1[3], CRModel *RAPID_model1,
|
||||
double R2[3][3], double T2[3], CRModel *RAPID_model2, int flag = RAPID_FIRST_CONTACT);
|
||||
|
||||
#endif // !defined(AFX_RMODEL_H__2071A861_CBE3_11D2_8204_A9244A508F02__INCLUDED_)
|
||||