1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "nel/misc/file.h"
19 #include "nel/misc/path.h"
20 #include "nel/misc/common.h"
21 #include "nel/3d/scene_group.h"
22 #include "nel/3d/zone.h"
23 #include "nel/3d/skeleton_shape.h"
24 #include "nel/3d/register_3d.h"
25 #include "nel/3d/mesh.h"
26 #include "nel/3d/mesh_mrm.h"
27 #include "nel/3d/mesh_mrm_skinned.h"
28 #include "nel/3d/mesh_multi_lod.h"
32 #endif // NL_OS_WINDOWS
43 tcgetattr( STDIN_FILENO
, &oldt
);
45 newt
.c_lflag
&= ~( ICANON
| ECHO
);
46 tcsetattr( STDIN_FILENO
, TCSANOW
, &newt
);
48 tcsetattr( STDIN_FILENO
, TCSANOW
, &oldt
);
55 using namespace NLMISC
;
59 // ***************************************************************************
60 void displayGeom(FILE *logStream
, const CMeshGeom
&geom
)
64 for(i
=0;i
<geom
.getNbMatrixBlock();i
++)
66 for(j
=0;j
<geom
.getNbRdrPass(i
);j
++)
68 numFaces
+= geom
.getRdrPassPrimitiveBlock(i
,j
).getNumIndexes()/3;
71 fprintf(logStream
, "Standard Mesh %s\n", geom
.isSkinned()?"Skinned":"" );
72 fprintf(logStream
, " NumFaces: %d\n", numFaces
);
73 fprintf(logStream
, " NumVertices: %d\n", geom
.getVertexBuffer().getNumVertices() );
74 uint nbBS
= geom
.getNbBlendShapes();
76 fprintf(logStream
, " NumBlendShapes: %d\n", nbBS
);
77 IMeshVertexProgram
*mvp
= geom
.getMeshVertexProgram();
79 fprintf(logStream
, " MeshVertexProgram: %s\n", typeid(*mvp
).name() );
83 void displayMRMGeom(FILE *logStream
, const CMeshMRMGeom
&geom
)
87 uint numFacesLodMax
=0;
88 for(i
=0;i
<geom
.getNbLod();i
++)
90 for(j
=0;j
<geom
.getNbRdrPass(i
);j
++)
92 uint nPassFaces
= geom
.getRdrPassPrimitiveBlock(i
,j
).getNumIndexes()/3;
93 numFaces
+= nPassFaces
;
94 if(i
==geom
.getNbLod()-1)
95 numFacesLodMax
+= nPassFaces
;
98 fprintf(logStream
, "MRM Mesh %s\n", geom
.isSkinned()?"Skinned":"" );
99 fprintf(logStream
, " NumFaces(Max Lod): %d\n", numFacesLodMax
);
100 fprintf(logStream
, " NumFaces(Sum all Lods): %d\n", numFaces
);
101 fprintf(logStream
, " NumVertices(Sum all Lods): %d\n", geom
.getVertexBuffer().getNumVertices() );
102 fprintf(logStream
, " NumShadowSkinVertices: %d\n", geom
.getNumShadowSkinVertices() );
103 fprintf(logStream
, " Skinned: %s\n", geom
.isSkinned()?"true":"false" );
104 uint nbBS
= geom
.getNbBlendShapes();
106 fprintf(logStream
, " NumBlendShapes: %d\n", nbBS
);
110 void displayMRMSkinnedGeom(FILE *logStream
, const CMeshMRMSkinnedGeom
&geom
)
114 uint numFacesLodMax
=0;
115 for(i
=0;i
<geom
.getNbLod();i
++)
117 for(j
=0;j
<geom
.getNbRdrPass(i
);j
++)
120 geom
.getRdrPassPrimitiveBlock(i
,j
,block
);
121 uint nPassFaces
= block
.getNumIndexes()/3;
122 numFaces
+= nPassFaces
;
123 if(i
==geom
.getNbLod()-1)
124 numFacesLodMax
+= nPassFaces
;
127 fprintf(logStream
, "MRM Skinned Mesh\n");
128 fprintf(logStream
, " NumFaces(Max Lod): %d\n", numFacesLodMax
);
129 fprintf(logStream
, " NumFaces(Sum all Lods): %d\n", numFaces
);
131 geom
.getVertexBuffer(VB
);
132 fprintf(logStream
, " NumVertices(Sum all Lods): %d\n", VB
.getNumVertices() );
133 fprintf(logStream
, " NumShadowSkinVertices: %d\n", geom
.getNumShadowSkinVertices() );
137 uint MaxNumLightMap
= 0;
138 void displayMeshBase(FILE *logStream
, CMeshBase
*meshBase
)
140 uint nMat
= meshBase
->getNbMaterial();
141 uint nLms
= (uint
)meshBase
->_LightInfos
.size();
142 MaxNumLightMap
= max(MaxNumLightMap
, nLms
);
145 fprintf(logStream
, "The Mesh has %d lightmaps for %d Materials\n", nLms
, nMat
);
146 for(uint i
=0;i
<nLms
;i
++)
148 uint32 lg
= meshBase
->_LightInfos
[i
].LightGroup
;
149 string al
= meshBase
->_LightInfos
[i
].AnimatedLight
;
150 fprintf(logStream
, " LightGroup=%d; AnimatedLight='%s'; mat/stage: ", lg
, al
.c_str());
151 std::list
<CMeshBase::CLightMapInfoList::CMatStage
>::iterator it
= meshBase
->_LightInfos
[i
].StageList
.begin();
152 while(it
!=meshBase
->_LightInfos
[i
].StageList
.end())
154 fprintf(logStream
, "%d/%d, ", it
->MatId
, it
->StageId
);
157 fprintf(logStream
, "\n");
162 fprintf(logStream
, "The Mesh has %d Materials\n", nMat
);
165 fprintf(logStream
, "The mesh has a LodCharacterTexture: %s\n", meshBase
->getLodCharacterTexture()?"true":"false");
169 // ***************************************************************************
170 /// Dispaly info for file in stdout
171 void displayInfoFileInStream(FILE *logStream
, const char *fileName
, const set
<string
> &options
, bool displayShortFileName
)
176 bool ms
= options
.find ("-ms") != options
.end();
177 bool vi
= options
.find ("-vi") != options
.end();
178 bool vl
= options
.find ("-vl") != options
.end();
179 bool vp
= options
.find ("-vp") != options
.end();
180 bool veil
= options
.find ("-veil") != options
.end();
185 if(strstr(fileName
, ".shape"))
187 // read the skeleton.
188 CIFile
file(fileName
);
189 CShapeStream shapeStream
;
190 file
.serial(shapeStream
);
193 CMesh
*mesh
= dynamic_cast<CMesh
*>(shapeStream
.getShapePointer());
198 if( mesh
->getMeshGeom().isSkinned() )
200 fprintf(logStream
, "%s is Skinned, but without MRM!!!\n", fileName
);
205 delete shapeStream
.getShapePointer();
206 shapeStream
.setShapePointer(NULL
);
212 // some general info.
213 if(displayShortFileName
)
215 string sfn
= CFile::getFilename(fileName
);
216 fprintf(logStream
, "File: %s\n", sfn
.c_str());
220 fprintf(logStream
, "File: %s\n", fileName
);
222 fprintf(logStream
, "***********\n\n");
224 if(strstr(fileName
, ".zone"))
227 CIFile
file(fileName
);
231 // retreive info on Zone
233 zone
.retrieve(zoneInfo
);
235 // display Info on the zone:
236 fprintf(logStream
, " Num Patchs: %d\n", zone
.getNumPatchs() );
237 fprintf(logStream
, " Num PointLights: %u\n", (uint
)zoneInfo
.PointLights
.size() );
240 fprintf(logStream
, " Lights\n");
242 for(k
= 0; k
< zoneInfo
.PointLights
.size(); ++k
)
244 const CPointLightNamed
&pl
= zoneInfo
.PointLights
[k
];
245 CRGBA diffuse
= pl
.getDiffuse();
246 CRGBA defaultDiffuse
= pl
.getDefaultDiffuse ();
247 fprintf(logStream
, " light group = %d, anim = \"%s\" x=%.1f, y=%.1f, z=%.1f, r=%d, g=%d, b=%d, dr=%d, dg=%d, db=%d\n", pl
.LightGroup
,
248 pl
.AnimatedLight
.c_str(), pl
.getPosition().x
, pl
.getPosition().y
, pl
.getPosition().z
,
249 diffuse
.R
, diffuse
.G
, diffuse
.B
, defaultDiffuse
.R
, defaultDiffuse
.G
, defaultDiffuse
.B
);
255 zone
.retrieve (zoneInfo
);
259 for(k
= 0; k
< zoneInfo
.Patchs
.size(); ++k
)
261 fprintf(logStream
, " Patch %d, S %d, T %d, smooth flags %d %d %d %d, corner flags %d %d %d %d\n",
263 zoneInfo
.Patchs
[k
].OrderS
,
264 zoneInfo
.Patchs
[k
].OrderT
,
265 zoneInfo
.Patchs
[k
].getSmoothFlag (0),
266 zoneInfo
.Patchs
[k
].getSmoothFlag (1),
267 zoneInfo
.Patchs
[k
].getSmoothFlag (2),
268 zoneInfo
.Patchs
[k
].getSmoothFlag (3),
269 zoneInfo
.Patchs
[k
].getCornerSmoothFlag(0),
270 zoneInfo
.Patchs
[k
].getCornerSmoothFlag(1),
271 zoneInfo
.Patchs
[k
].getCornerSmoothFlag(2),
272 zoneInfo
.Patchs
[k
].getCornerSmoothFlag(3));
276 fprintf(logStream
, " Bind edge %d, NPatchs %d, ZoneId %d, Next %d %d %d %d, Edge %d %d %d %d\n",
278 zoneInfo
.Patchs
[k
].BindEdges
[l
].NPatchs
,
279 zoneInfo
.Patchs
[k
].BindEdges
[l
].ZoneId
,
280 zoneInfo
.Patchs
[k
].BindEdges
[l
].Next
[0],
281 zoneInfo
.Patchs
[k
].BindEdges
[l
].Next
[1],
282 zoneInfo
.Patchs
[k
].BindEdges
[l
].Next
[2],
283 zoneInfo
.Patchs
[k
].BindEdges
[l
].Next
[3],
284 zoneInfo
.Patchs
[k
].BindEdges
[l
].Edge
[0],
285 zoneInfo
.Patchs
[k
].BindEdges
[l
].Edge
[1],
286 zoneInfo
.Patchs
[k
].BindEdges
[l
].Edge
[2],
287 zoneInfo
.Patchs
[k
].BindEdges
[l
].Edge
[3]);
292 else if(strstr(fileName
, ".ig"))
295 CIFile
file(fileName
);
299 // display Info on the ig:
300 CVector gpos
= ig
.getGlobalPos();
301 fprintf(logStream
, " Global pos : x = %.1f, y = %.1f, z =%.1f\n", gpos
.x
, gpos
.y
, gpos
.z
);
302 fprintf(logStream
, " Num Instances: %d\n", ig
.getNumInstance() );
303 fprintf(logStream
, " Num PointLights: %u\n", (uint
)ig
.getPointLightList().size() );
304 fprintf(logStream
, " Realtime sun contribution = %s\n", ig
.getRealTimeSunContribution() ? "on" : "off");
307 fprintf(logStream
, " Instances:\n");
309 for(k
= 0; k
< ig
._InstancesInfos
.size(); ++k
)
311 fprintf(logStream
, " Instance %3d: shape = %s, name = %s, x = %.1f, y = %.1f, z = %.1f, sx = %.1f, sy = %.1f, sz = %.1f\n", k
, ig
._InstancesInfos
[k
].Name
.c_str(), ig
._InstancesInfos
[k
].InstanceName
.c_str(), ig
._InstancesInfos
[k
].Pos
.x
+ gpos
.x
, ig
._InstancesInfos
[k
].Pos
.y
+ gpos
.y
, ig
._InstancesInfos
[k
].Pos
.z
+ gpos
.z
, ig
._InstancesInfos
[k
].Scale
.x
, ig
._InstancesInfos
[k
].Scale
.y
, ig
._InstancesInfos
[k
].Scale
.z
);
316 fprintf(logStream
, " Lights:\n");
318 for(k
= 0; k
< ig
.getNumPointLights(); ++k
)
320 const CPointLightNamed
&pl
= ig
.getPointLightNamed(k
);
321 CRGBA diffuse
= pl
.getDiffuse();
322 CRGBA defaultDiffuse
= pl
.getDefaultDiffuse ();
323 fprintf(logStream
, " Light %3d: Light group = %d, anim = \"%s\" x=%.1f, y=%.1f, z=%.1f, r=%d, g=%d, b=%d, dr=%d, dg=%d, db=%d\n", k
, pl
.LightGroup
,
324 pl
.AnimatedLight
.c_str(), pl
.getPosition().x
+ gpos
.x
, pl
.getPosition().y
+ gpos
.y
, pl
.getPosition().z
+ gpos
.z
,
325 diffuse
.R
, diffuse
.G
, diffuse
.B
, defaultDiffuse
.R
, defaultDiffuse
.G
, defaultDiffuse
.B
);
330 fprintf(logStream
, " Instances Bound To Lights:\n");
331 fprintf(logStream
, " WordList:\n");
332 fprintf(logStream
, " 'StaticLight Not Computed' means the instance has a ASP flag or the ig is not yet lighted\n");
333 fprintf(logStream
, " If lighted, for each instance, the format is 'SunContribution(8Bit) - idLight0;idLight1 (or NOLIGHT) - LocalAmbientId (or GLOBAL_AMBIENT)' \n");
334 fprintf(logStream
, " DCS means the instance don't cast shadow (used in the lighter)\n");
335 fprintf(logStream
, " DCSINT Same but very special for ig_lighter only\n");
336 fprintf(logStream
, " DCSEXT Same but very special for zone_lighter and zone_ig_lighter only\n");
337 fprintf(logStream
, " ASP means the instance AvoidStaticLightPreCompute (used in the lighter)\n");
338 fprintf(logStream
, " -------------------------------------------------------------\n");
340 for(k
= 0; k
< ig
._InstancesInfos
.size(); ++k
)
342 CInstanceGroup::CInstance
&instance
= ig
._InstancesInfos
[k
];
343 fprintf(logStream
, " Instance %3d: ", k
);
344 if(!instance
.StaticLightEnabled
)
345 fprintf(logStream
, " StaticLight Not Computed.");
348 fprintf(logStream
, " %3d - ", instance
.SunContribution
);
349 if(instance
.Light
[0]==0xFF)
350 fprintf(logStream
, "NOLIGHT - ");
353 fprintf(logStream
, "%3d;", instance
.Light
[0]);
354 if(instance
.Light
[1]!=0xFF)
355 fprintf(logStream
, "%3d", instance
.Light
[1]);
357 fprintf(logStream
, " "); //, instance.Light[1]);
358 fprintf(logStream
, " - ");
360 if(instance
.LocalAmbientId
==0xFF)
361 fprintf(logStream
, "GLOBAL_AMBIENT. ");
363 fprintf(logStream
, "%d. ", instance
.LocalAmbientId
);
365 if(instance
.DontCastShadow
)
366 fprintf(logStream
, "DCS,");
367 if(instance
.DontCastShadowForInterior
)
368 fprintf(logStream
, "DCSINT,");
369 if(instance
.DontCastShadowForExterior
)
370 fprintf(logStream
, "DCSEXT,");
371 if(instance
.AvoidStaticLightPreCompute
)
372 fprintf(logStream
, "ASP,");
374 fprintf(logStream
, "\n");
378 else if(strstr(fileName
, ".skel"))
380 // read the skeleton.
381 CIFile
file(fileName
);
382 CShapeStream shapeStream
;
383 file
.serial(shapeStream
);
384 CSkeletonShape
*skel
= dynamic_cast<CSkeletonShape
*>(shapeStream
.getShapePointer());
388 vector
<CBoneBase
> bones
;
389 skel
->retrieve(bones
);
390 // Display Bone Infos.
391 fprintf(logStream
, "Num Bones: %u\n", (uint
)bones
.size());
392 for(uint i
=0; i
<bones
.size(); i
++)
396 sint32 parent
= bones
[i
].FatherId
;
399 bool inheritScale
= bones
[i
].UnheritScale
;
402 CVector pos
= bones
[i
].DefaultPos
.getDefaultValue();
404 // get default rotquat.
405 CQuat rotQuat
= bones
[i
].DefaultRotQuat
.getDefaultValue();
407 // get default scale.
408 CVector scale
= bones
[i
].DefaultScale
.getDefaultValue();
411 CMatrix invBindPos
= bones
[i
].InvBindPos
;
412 CVector invBindPosI
= invBindPos
.getI();
413 CVector invBindPosJ
= invBindPos
.getJ();
414 CVector invBindPosK
= invBindPos
.getK();
415 CVector invBindPosT
= invBindPos
.getPos();
418 fprintf(logStream
, "Bone %2d. %s.\n", i
, bones
[i
].Name
.c_str());
419 fprintf(logStream
, " Parent: %d\n", parent
);
420 fprintf(logStream
, " InheritScale: %d\n", inheritScale
);
421 fprintf(logStream
, " Position: (%2.3f, %2.3f, %2.3f)\n",
422 pos
.x
, pos
.y
, pos
.z
);
423 fprintf(logStream
, " RotQuat: (%2.3f, %2.3f, %2.3f, %2.3f)\n",
424 rotQuat
.x
, rotQuat
.y
, rotQuat
.z
, rotQuat
.w
);
425 fprintf(logStream
, " Scale: (%2.3f, %2.3f, %2.3f)\n",
426 scale
.x
, scale
.y
, scale
.z
);
427 fprintf(logStream
, " InvBindPos: I: (%2.3f, %2.3f, %2.3f)\n",
428 invBindPosI
.x
, invBindPosI
.y
, invBindPosI
.z
);
429 fprintf(logStream
, " InvBindPos: J: (%2.3f, %2.3f, %2.3f)\n",
430 invBindPosJ
.x
, invBindPosJ
.y
, invBindPosJ
.z
);
431 fprintf(logStream
, " InvBindPos: K: (%2.3f, %2.3f, %2.3f)\n",
432 invBindPosK
.x
, invBindPosK
.y
, invBindPosK
.z
);
433 fprintf(logStream
, " InvBindPos: Pos: (%2.3f, %2.3f, %2.3f)\n",
434 invBindPosT
.x
, invBindPosT
.y
, invBindPosT
.z
);
440 fprintf(logStream
, "Bad Skel file\n");
444 delete shapeStream
.getShapePointer();
445 shapeStream
.setShapePointer(NULL
);
447 else if(strstr(fileName
, ".shape"))
450 CIFile
file(fileName
);
451 CShapeStream shapeStream
;
452 file
.serial(shapeStream
);
455 CMesh
*mesh
= dynamic_cast<CMesh
*>(shapeStream
.getShapePointer());
456 CMeshMRM
*meshMRM
= dynamic_cast<CMeshMRM
*>(shapeStream
.getShapePointer());
457 CMeshMRMSkinned
*meshMRMSkinned
= dynamic_cast<CMeshMRMSkinned
*>(shapeStream
.getShapePointer());
458 CMeshMultiLod
*meshMulti
= dynamic_cast<CMeshMultiLod
*>(shapeStream
.getShapePointer());
461 CMeshBase
*meshBase
= dynamic_cast<CMeshBase
*>(shapeStream
.getShapePointer());
464 displayMeshBase(logStream
, meshBase
);
470 displayGeom(logStream
, mesh
->getMeshGeom());
475 displayMRMGeom(logStream
, meshMRM
->getMeshGeom());
477 else if( meshMRMSkinned
)
479 displayMRMSkinnedGeom(logStream
, meshMRMSkinned
->getMeshGeom());
484 uint numSlots
= meshMulti
->getNumSlotMesh ();
485 fprintf(logStream
, " Num Lods: %d\n", numSlots
);
488 const CMeshGeom
*meshGeom
= dynamic_cast<const CMeshGeom
*>(&(meshMulti
->getMeshGeom(0)));
489 const CMeshMRMGeom
*meshMRMGeom
= dynamic_cast<const CMeshMRMGeom
*>(&(meshMulti
->getMeshGeom(0)));
491 displayGeom(logStream
, *meshGeom
);
492 else if( meshMRMGeom
)
493 displayMRMGeom(logStream
, *meshMRMGeom
);
498 fprintf(logStream
, "Unsupported .shape type for display info\n");
502 delete shapeStream
.getShapePointer();
503 shapeStream
.setShapePointer(NULL
);
505 else if(strstr(fileName
, ".anim"))
508 CIFile
file(fileName
);
513 std::set
<std::string
> tracks
;
514 anim
.getTrackNames (tracks
);
515 std::set
<std::string
>::iterator ite
= tracks
.begin();
516 while (ite
!= tracks
.end())
519 fprintf(logStream
, "Track name=%s", ite
->c_str());
521 uint trackId
= anim
.getIdTrackByName (*ite
);
522 ITrack
*track
= anim
.getTrack (trackId
);
525 fprintf(logStream
, " type=%s", typeid(*track
).name());
527 UTrackKeyframer
*keyFramer
= dynamic_cast<UTrackKeyframer
*> (track
);
530 TAnimationTime begin
= track
->getBeginTime ();
531 TAnimationTime end
= track
->getEndTime ();
532 std::vector
<TAnimationTime
> keys
;
533 keyFramer
->getKeysInRange(begin
, end
, keys
);
544 if (track
->interpolate (begin
, fvalue
))
546 fprintf(logStream
, " floats\n");
547 for (i
=0; i
<keys
.size(); i
++)
549 if (track
->interpolate (keys
[i
], fvalue
))
550 fprintf(logStream
, "\tKey %d : time=%f, value=%f\n", i
, keys
[i
], fvalue
);
553 else if (track
->interpolate (begin
, ivalue
))
555 fprintf(logStream
, " integers\n");
556 for (i
=0; i
<keys
.size(); i
++)
558 if (track
->interpolate (keys
[i
], ivalue
))
559 fprintf(logStream
, "\tKey %d : time=%f, value=%d\n", i
, keys
[i
], ivalue
);
562 else if (track
->interpolate (begin
, cvalue
))
564 fprintf(logStream
, " color\n");
565 for (i
=0; i
<keys
.size(); i
++)
567 if (track
->interpolate (keys
[i
], cvalue
))
568 fprintf(logStream
, "\tKey %d : time=%f, r=%d, g=%d, b=%d, a=%d\n", i
, keys
[i
], cvalue
.R
, cvalue
.G
, cvalue
.B
, cvalue
.A
);
571 else if (track
->interpolate (begin
, vvalue
))
573 fprintf(logStream
, " vector\n");
574 for (i
=0; i
<keys
.size(); i
++)
576 if (track
->interpolate (keys
[i
], vvalue
))
577 fprintf(logStream
, "\tKey %d : time=%f, x=%f, y=%f, z=%f\n", i
, keys
[i
], vvalue
.x
, vvalue
.y
, vvalue
.z
);
580 else if (track
->interpolate (begin
, qvalue
))
582 fprintf(logStream
, " quaternion\n");
583 for (i
=0; i
<keys
.size(); i
++)
585 if (track
->interpolate (keys
[i
], qvalue
))
586 fprintf(logStream
, "\tKey %d : time=%f, x=%f, y=%f, z=%f, w=%f\n", i
, keys
[i
], qvalue
.x
, qvalue
.y
, qvalue
.z
, qvalue
.w
);
589 else if (track
->interpolate (begin
, svalue
))
591 fprintf(logStream
, " string\n");
592 for (i
=0; i
<keys
.size(); i
++)
594 if (track
->interpolate (keys
[i
], svalue
))
595 fprintf(logStream
, "\tKey %d : time=%f, value=%s\n", i
, keys
[i
], svalue
.c_str());
598 else if (track
->interpolate (begin
, bvalue
))
600 fprintf(logStream
, " bool\n");
601 for (i
=0; i
<keys
.size(); i
++)
603 if (track
->interpolate (keys
[i
], bvalue
))
604 fprintf(logStream
, "\tKey %d : time=%f, value=%s\n", i
, keys
[i
], bvalue
?"true":"false");
616 fprintf(logStream
, "unsupported format\n");
622 // ***************************************************************************
623 // dispaly info for a file.
624 void displayInfoFile(FILE *logStream
, const char *fileName
, const set
<string
> &options
, bool displayShortFileName
)
626 // Display on screen.
627 displayInfoFileInStream(stdout
, fileName
,options
, displayShortFileName
);
630 displayInfoFileInStream(logStream
, fileName
,options
, displayShortFileName
);
634 // ***************************************************************************
635 /// Dispaly info cmd line
636 int main(int argc
, const char *argv
[])
642 puts("Usage: ig_info file.??? [opt]");
643 puts("Usage: ig_info directory [opt]");
644 puts(" For now, only .ig, .zone, .skel, .shape are supported");
645 puts(" Results are displayed too in \"c:/temp/file_info.log\" ");
646 puts(" [opt] can get: ");
647 puts(" -ms display only a Warning if file is a .shape and is a Mesh, skinned, but without MRM");
648 puts(" -vi verbose instance information");
649 puts(" -vl verbose light information");
650 puts(" -vp verbose patche information");
651 puts(" -veil verbose instances bound to light extra information");
652 puts("Press any key");
660 for (i
=2; i
<argc
; i
++)
661 options
.insert (argv
[i
]);
664 FILE *logStream
= nlfopen(getLogDirectory() + "file_info.log", "wt");
666 // parse dir or file ??
667 const char *fileName
= argv
[1];
668 if(CFile::isDirectory(fileName
))
671 std::vector
<std::string
> listFile
;
672 CPath::getPathContent (fileName
, false, false, true, listFile
);
674 fprintf(stdout
, "Scanning Directory '%s' .........\n\n\n", fileName
);
676 fprintf(logStream
, "Scanning Directory '%s' .........\n\n\n", fileName
);
679 for(uint i
=0;i
<listFile
.size();i
++)
681 displayInfoFile(logStream
, listFile
[i
].c_str(), options
, true);
684 // display info for lightmaps
685 fprintf(stdout
, "\n\n ************** \n I HAVE FOUND AT MAX %d LIGHTMAPS IN A SHAPE\n", MaxNumLightMap
);
687 fprintf(logStream
, "\n\n ************** \n I HAVE FOUND AT MAX %d LIGHTMAPS IN A SHAPE\n", MaxNumLightMap
);
691 displayInfoFile(logStream
, fileName
, options
, false);
700 puts("Press any key");