Fix game:addSpawnShapesByZone
[ryzomcore.git] / nel / tools / 3d / ig_info / ig_info.cpp
blobf88eae9728699c2c4a6313f4aac4d123cccb0ac0
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
6 //
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "nel/3d/scene_group.h"
22 #include "nel/misc/file.h"
23 #include "nel/misc/common.h"
24 #include <string>
25 #include "stdio.h"
27 using namespace NL3D;
28 using namespace NLMISC;
29 using namespace std;
31 int main(int argc, char **argv)
33 if (argc != 2)
35 printf("usage : %s file.ig\n", argv[0]);
36 return -1;
38 try
40 uint k;
41 CInstanceGroup ig;
42 CIFile inputStream;
43 if (!inputStream.open(string(argv[1])))
45 printf("unable to open %s\n", argv[1]);
46 return -1;
48 ig.serial(inputStream);
49 printf("Origine\n");
50 printf("---------\n");
51 CVector gpos = ig.getGlobalPos();
52 printf("global pos : x = %.1f, y = %.1f, z =%.1f\n", gpos.x, gpos.y, gpos.z);
53 printf("Instances\n");
54 printf("---------\n");
55 for(k = 0; k < ig._InstancesInfos.size(); ++k)
57 printf("instance %s : x = %.1f, y = %.1f, z = %.1f, sx = %.1f, sy = %.1f, sz = %.1f, a = %.1f\n", ig._InstancesInfos[k].Name.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, ig._InstancesInfos[k].Rot.getAngle());
59 printf("\n");
60 printf("Lights\n");
61 printf("---------\n");
62 for(k = 0; k < ig.getNumPointLights(); ++k)
64 const CPointLightNamed &pl = ig.getPointLightNamed(k);
65 printf("light group = %d, anim = \"%s\" x = %.1f, y = %.1f, z = %.1f\n", pl.LightGroup, pl.AnimatedLight.c_str(), pl.getPosition().x + gpos.x, pl.getPosition().y + gpos.y, pl.getPosition().z + gpos.z);
67 printf("---------\n");
68 printf("Realtime sun contribution = %s\n", ig.getRealTimeSunContribution() ? "on" : "off");
69 printf("---------\n");
70 // IGSurfaceLight info.
71 const CIGSurfaceLight::TRetrieverGridMap &rgm= ig.getIGSurfaceLight().getRetrieverGridMap();
72 printf("IGSurfaceLighting: CellSize: %f. NumGridRetriever: %u\n",
73 ig.getIGSurfaceLight().getCellSize(), (uint)rgm.size() );
74 uint rgmInst= 0;
75 uint totalCells= 0;
76 CIGSurfaceLight::TRetrieverGridMap::const_iterator it= rgm.begin();
77 for(;it!=rgm.end();it++)
79 for(uint i=0;i<it->second.Grids.size();i++)
81 printf("grid(%d, %d): %dx%d\n", rgmInst, i, it->second.Grids[i].Width, it->second.Grids[i].Height );
82 totalCells+= it->second.Grids[i].Cells.size();
84 rgmInst++;
86 printf("TotalCells: %d\n", totalCells);
89 catch (const std::exception &e)
91 printf("%s\n", e.what());