📄 flttohot.cpp
字号:
short *srec = (short *) tree -> record;
short rectype = *srec;
if (rectype == OPCODE_GROUP) {
if (!tree -> child) {
treePtr *next = tree -> next;
if (next) {
srec = (short *) next -> record;
rectype = *srec;
if (rectype == OPCODE_LONG_IDENTIFIER) {
treePtr *next1 = next -> next;
if (next1) {
srec = (short *) next1 -> record;
rectype = *srec;
if ((rectype == OPCODE_BOUNDING_BOX) ||
(rectype == OPCODE_BOUNDING_SPHERE)) {
next -> next = next1 -> next;
tree -> child = next1;
}
}
}
else {
if ((rectype == OPCODE_BOUNDING_BOX) ||
(rectype == OPCODE_BOUNDING_SPHERE)) {
tree -> next = next -> next;
tree -> child = next;
next -> next = 0;
}
}
}
}
}
processBounding (tree -> child);
processBounding (tree -> next);
}
}
void processRecord (treePtr *tree)
{
if (tree) {
processInfo (tree -> child);
processRecord (tree -> next);
}
}
void processInfo (treePtr *tree)
{
if (tree) {
short *srec = (short *) tree -> record;
short rectype = *srec;
if (rectype != OPCODE_VERTEX_LIST) {
processTreeRecord (tree);
}
processInfo (tree -> child);
processRecord (tree -> next);
}
}
void processRecord1 (treePtr *tree)
{
if (tree) {
processInfo1 (tree -> child);
processRecord1 (tree -> next);
}
}
void processInfo1 (treePtr *tree)
{
if (tree) {
processInfo1 (tree -> child);
processRecord1 (tree -> next);
processInfoSubface (tree -> subface);
}
}
void processInfoSubface (treePtr *tree)
{
if (tree) {
short *srec = (short *) tree -> record;
short rectype = *srec;
if (rectype != OPCODE_VERTEX_LIST) {
processTreeRecord (tree);
}
processInfoSubface (tree -> subface);
}
}
void processTreeRecord (treePtr *tree)
{
if (tree) {
char *rec = tree -> record;
short *srec = (short *) rec;
short rectype = *srec++;
short reclen = *srec++;
switch (rectype) {
case OPCODE_SWITCH_BEAD:
{
tree -> counter = switchcounter++;
tree -> beadcounter = ++beadcounter;
}
break;
case OPCODE_DEGREE_OF_FREEDOM:
{
tree -> counter = dofcounter++;
tree -> beadcounter = ++beadcounter;
}
break;
case OPCODE_LONG_IDENTIFIER:
{
if (tree -> prev) {
tree -> counter = tree -> prev -> counter;
tree -> beadcounter = tree -> prev -> beadcounter;
processPolygon (rectype, tree);
}
}
break;
case OPCODE_GROUP:
{
tree -> counter = groupcounter++;
tree -> beadcounter = ++beadcounter;
}
break;
case OPCODE_OBJECT:
{
tree -> counter = objectcounter++;
tree -> beadcounter = ++beadcounter;
processPolygon (rectype, tree);
}
break;
case OPCODE_BINARY_SEPARATING_PLANE:
{
tree -> counter = bspcounter++;
tree -> beadcounter = ++beadcounter;
}
break;
case OPCODE_POLYGON:
{
tree -> counter = polygoncounter++;
tree -> beadcounter += beadcounter;
}
break;
case OPCODE_BOUNDING_BOX:
{
tree -> counter = bboxcounter++;
tree -> beadcounter = ++beadcounter;
}
break;
case OPCODE_BOUNDING_SPHERE:
{
tree -> counter = bspherecounter++;
tree -> beadcounter = ++beadcounter;
}
break;
case OPCODE_TRANSFORMATION_MATRIX:
tree -> counter = matrixcounter++;
tree -> beadcounter += beadcounter;
break;
}
processTreeRecord (tree -> next);
}
}
void printInfoSubface (CFileIO& myfile, treePtr *tree, GLint count)
{
if (tree) {
short *srec = (short *) tree -> record;
if (*srec != OPCODE_VERTEX_LIST) {
sprintf (buffer, "====\nBeadList%d\n", count);
myfile.writedata (buffer);
printTreeRecord (myfile, tree);
myfile.writedata ("ZZZZ\n\n");
}
if (tree -> subface)
printInfoSubface (myfile, tree -> subface, tree -> subface -> beadcounter);
}
}
void printRecord1 (CFileIO& myfile, treePtr *tree, GLint count)
{
if (tree) {
if (tree -> child) printInfo1 (myfile, tree -> child, count);
if (tree -> next)
printRecord1 (myfile, tree -> next, tree -> next -> beadcounter);
}
}
void printInfo1 (CFileIO& myfile, treePtr *tree, GLint count)
{
if (tree) {
if (tree -> child)
printInfo1 (myfile, tree -> child, tree -> beadcounter);
if (tree -> next)
printRecord1 (myfile, tree -> next, tree -> next -> beadcounter);
if (tree -> subface)
printInfoSubface (myfile, tree -> subface, tree -> subface -> beadcounter);
}
}
void printRecord (CFileIO& myfile, treePtr *tree, GLint count)
{
if (tree) {
if (tree -> child) printInfo (myfile, tree -> child, count);
if (tree -> next)
printRecord (myfile, tree -> next, tree -> next -> beadcounter);
}
}
void printInfo (CFileIO& myfile, treePtr *tree, GLint count)
{
if (tree) {
short *srec = (short *) tree -> record;
if (*srec != OPCODE_VERTEX_LIST) {
sprintf (buffer, "====\nBeadList%d\n", count);
myfile.writedata (buffer);
printTreeRecord (myfile, tree);
myfile.writedata ("ZZZZ\n\n");
}
if (tree -> child)
printInfo (myfile, tree -> child, tree -> beadcounter);
if (tree -> next)
printRecord (myfile, tree -> next, tree -> next -> beadcounter);
}
}
void printTreeRecord (CFileIO& myfile, treePtr *tree)
{
if (tree) {
short *srec = (short *) tree -> record;
short rectype = *srec++;
switch (rectype) {
case OPCODE_SWITCH_BEAD:
{
sprintf (buffer, "Bead SwitchBead%d\n",
tree -> counter);
myfile.writedata (buffer);
sprintf (buffer, "Child BeadList%d\n",
tree -> beadcounter);
myfile.writedata (buffer);
}
break;
case OPCODE_DEGREE_OF_FREEDOM:
{
sprintf (buffer, "Bead DOFBead%d\n",
tree -> counter);
myfile.writedata (buffer);
sprintf (buffer, "Child BeadList%d\n",
tree -> beadcounter);
myfile.writedata (buffer);
}
break;
case OPCODE_GROUP:
{
sprintf (buffer, "Bead GroupBead%d\n",
tree -> counter);
myfile.writedata (buffer);
sprintf (buffer, "Child BeadList%d\n",
tree -> beadcounter);
myfile.writedata (buffer);
}
break;
case OPCODE_OBJECT:
{
sprintf (buffer, "Bead ObjectBead%d\n",
tree -> counter);
myfile.writedata (buffer);
sprintf (buffer, "Child BeadList%d\n",
tree -> beadcounter);
myfile.writedata (buffer);
}
break;
case OPCODE_BINARY_SEPARATING_PLANE:
{
sprintf (buffer, "Bead BSPBead%d\n",
tree -> counter);
myfile.writedata (buffer);
sprintf (buffer, "Child BeadList%d\n",
tree -> beadcounter);
myfile.writedata (buffer);
}
break;
case OPCODE_POLYGON:
{
sprintf (buffer, "Bead PolygonBead%d\n",
tree -> counter);
myfile.writedata (buffer);
sprintf (buffer, "Child 0\n");
myfile.writedata (buffer);
}
break;
case OPCODE_BOUNDING_BOX:
sprintf (buffer, "Bead BoundingBoxBead%d\n",
tree -> counter);
myfile.writedata (buffer);
sprintf (buffer, "Child BeadList%d\n",
tree -> beadcounter);
myfile.writedata (buffer);
break;
case OPCODE_BOUNDING_SPHERE:
sprintf (buffer, "Bead BoundingSphereBead%d\n",
tree -> counter);
myfile.writedata (buffer);
sprintf (buffer, "Child BeadList%d\n",
tree -> beadcounter);
myfile.writedata (buffer);
break;
case OPCODE_TRANSFORMATION_MATRIX:
sprintf (buffer, "Bead MatrixBead%d\n",
tree -> counter);
myfile.writedata (buffer);
sprintf (buffer, "Child 0\n");
myfile.writedata (buffer);
break;
}
printTreeRecord (myfile, tree -> next);
}
}
void processBeadElement (CFileIO& myfile, treePtr *tree)
{
if (tree) {
char *rec = tree -> record;
short *srec = (short *) rec;
short rectype = *srec++;
short reclen = *srec++;
switch (rectype) {
case OPCODE_SWITCH_BEAD:
{
flt_SwitchRecord *sw;
sw = (flt_SwitchRecord *) rec;
sprintf (buffer, "====\nSwitchBead%d\nName ",
tree -> counter);
myfile.writedata (buffer);
sprintf (buffer, "%s\n", sw -> IDField);
checkForLongID (tree);
myfile.writedata (buffer);
myfile.writedata ("Type Switch\n");
sprintf (buffer, "TotalMask %d\n", sw -> NumberMask);
myfile.writedata (buffer);
sprintf (buffer, "MaskValue %d\n", sw -> MaskList[0]);
myfile.writedata (buffer);
sprintf (buffer, "CurrentMaskIndex 0x%x\n", sw -> CurrentMaskIndex);
myfile.writedata (buffer);
sprintf (buffer, "NumberWordPerMask %d\n", sw -> NumberWordPerMask);
myfile.writedata (buffer);
myfile.writedata ("ZZZZ\n\n");
}
break;
case OPCODE_DEGREE_OF_FREEDOM:
{
flt_DegreeOfFreedomRecord *dof;
dof = (flt_DegreeOfFreedomRecord *) rec;
sprintf (buffer, "====\nDOFBead%d\nName ",
tree -> counter);
myfile.writedata (buffer);
sprintf (buffer, "%s\n", dof -> IDField);
checkForLongID (tree);
myfile.writedata (buffer);
myfile.writedata ("Type DegreeOfFreedom\n");
sprintf (buffer, "Origin %f %f %f\n",
dof -> originx, -dof -> originz, dof -> originy);
myfile.writedata (buffer);
sprintf (buffer, "PointXAxis %f %f %f\n",
dof -> pointxaxis_x, -dof -> pointxaxis_z, dof -> pointxaxis_y);
myfile.writedata (buffer);
sprintf (buffer, "PointXYPlane %f %f %f\n",
dof -> pointxyplane_x, -dof -> pointxyplane_z, dof -> pointxyplane_y);
myfile.writedata (buffer);
sprintf (buffer, "Yaw %f %f %f %f\n",
dof -> minyaw, dof -> maxyaw,
dof -> currentyaw, dof -> incrementyaw);
myfile.writedata (buffer);
sprintf (buffer, "Pitch %f %f %f %f\n",
dof -> minpitch, dof -> maxpitch,
dof -> currentpitch, dof -> incrementpitch);
myfile.writedata (buffer);
sprintf (buffer, "Roll %f %f %f %f\n",
dof -> minroll, dof -> maxroll,
dof -> currentroll, dof -> incrementroll);
myfile.writedata (buffer);
sprintf (buffer, "Scale %f %f %f %f\n",
dof -> minxscale, dof -> maxxscale,
dof -> currentxscale, dof -> incrementxscale);
myfile.writedata (buffer);
sprintf (buffer, "XTranslation %f %f %f %f\n",
dof -> minx, dof -> maxx,
dof -> currentx, dof -> incrementx);
myfile.writedata (buffer);
sprintf (buffer, "YTranslation %f %f %f %f\n",
-dof -> minz, -dof -> maxz,
-dof -> currentz, -dof -> incrementz);
myfile.writedata (buffer);
sprintf (buffer, "ZTranslation %f %f %f %f\n",
dof -> miny, dof -> maxy,
dof -> currenty, dof -> incrementy);
myfile.writedata (buffer);
myfile.writedata ("ZZZZ\n\n");
// just for comment
GLvertex XPointAxis, XYPlaneAxis, NormalAxis, YAxis;
XPointAxis.x = (GLfloat) (dof -> pointxaxis_x - dof -> originx);
XPointAxis.y = (GLfloat) ((-dof -> pointxaxis_z) - (-dof -> originz));
XPointAxis.z = (GLfloat) (dof -> pointxaxis_y - dof -> originy);
XYPlaneAxis.x = (GLfloat) (dof -> pointxyplane_x - dof -> originx);
XYPlaneAxis.y = (GLfloat) ((-dof -> pointxyplane_z) - (-dof -> originz));
XYPlaneAxis.z = (GLfloat) (dof -> pointxyplane_y - dof -> originy);
glNormalizedVector (&XPointAxis);
glNormalizedVector (&XYPlaneAxis);
glCrossProduct (&XPointAxis, &XYPlaneAxis, &NormalAxis);
glNormalizedVector (&NormalAxis);
glCrossProduct (&NormalAxis, &XPointAxis, &YAxis);
glNormalizedVector (&YAxis);
sprintf (buffer, "XAxis %f %f %f\n", XPointAxis.x, XPointAxis.y, XPointAxis.z);
myfile.writedata (buffer);
sprintf (buffer, "YAxis %f %f %f\n", YAxis.x, YAxis.y, YAxis.z);
myfile.writedata (buffer);
sprintf (buffer, "ZAxis %f %f %f\n", NormalAxis.x, NormalAxis.y, NormalAxis.z);
myfile.writedata (buffer);
myfile.writedata ("Axis in Falcon coordinate system\n");
sprintf (buffer, "XAxis %f %f %f\n", NormalAxis.z, NormalAxis.x, NormalAxis.y);
myfile.writedata (buffer);
sprintf (buffer, "YAxis %f %f %f\n", XPointAxis.z, XPointAxis.x, XPointAxis.y);
myfile.writedata (buffer);
sprintf (buffer, "ZAxis %f %f %f\n", YAxis.z, YAxis.x, YAxis.y);
myfile.writedata (buffer);
myfile.writedata ("\n\n");
}
break;
case OPCODE_GROUP:
{
flt_GroupRecord *group;
group = (flt_GroupRecord *) rec;
sprintf (buffer, "====\nGroupBead%d\nName ",
tree -> counter);
myfile.writedata (buffer);
sprintf (buffer, "%s\n", group -> IDField);
checkForLongID (tree);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -