mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 19:37:01 +00:00
[10471] Drop vmap_debugger.
After new vmaps version it not work and useless. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
73a85b0989
commit
16f912190f
9 changed files with 1 additions and 2728 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,570 +0,0 @@
|
||||||
#include "ModelContainerView.h"
|
|
||||||
|
|
||||||
namespace VMAP
|
|
||||||
{
|
|
||||||
char* gDataDir = NULL;
|
|
||||||
char* gLogFile = NULL;
|
|
||||||
//==========================================
|
|
||||||
|
|
||||||
ModelContainerView::ModelContainerView(const G3D::GApp::Settings& settings) : GApp(settings) {
|
|
||||||
i_App = this;
|
|
||||||
|
|
||||||
iCommandFileRW.setFileName(gLogFile);
|
|
||||||
iCurrCmdIndex = 0;
|
|
||||||
iVMapManager = new VMapManager();
|
|
||||||
iDrawLine = false;
|
|
||||||
|
|
||||||
iVARAreaRef = VARArea::create(1024*1024*60);
|
|
||||||
iVARAreaRef2 = VARArea::create(1024*1024*2);
|
|
||||||
iInstanceId = -1;
|
|
||||||
iPosSent = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
//===================================================
|
|
||||||
|
|
||||||
ModelContainerView::~ModelContainerView(void)
|
|
||||||
{
|
|
||||||
Array<std::string > keys = iTriVarTable.getKeys();
|
|
||||||
Array<std::string>::ConstIterator i = keys.begin();
|
|
||||||
while(i != keys.end()) {
|
|
||||||
VAR* var = iTriVarTable.get(*i);
|
|
||||||
delete var;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//===================================================
|
|
||||||
|
|
||||||
void ModelContainerView::cleanup() {
|
|
||||||
}
|
|
||||||
|
|
||||||
//===================================================
|
|
||||||
Vector3 getViewPos(const ModelContainer* mc, unsigned int pModelNr = 0) {
|
|
||||||
if(mc->getNSubModel() < pModelNr) {
|
|
||||||
pModelNr = mc->getNSubModel();
|
|
||||||
}
|
|
||||||
const SubModel sm = mc->getSubModel(pModelNr);
|
|
||||||
return (sm.getAABoxBounds().low());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelContainerView::init() {
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================
|
|
||||||
|
|
||||||
void fillSubModelArary(const ModelContainer* pModelContainer, const TreeNode *root, Array<SubModel>& array, Vector3& pLo, Vector3& pHi) {
|
|
||||||
Vector3 lo = Vector3(inf(), inf(), inf());
|
|
||||||
Vector3 hi = Vector3(-inf(), -inf(), -inf());
|
|
||||||
|
|
||||||
for(int i=0; i< root->getNValues(); i++) {
|
|
||||||
SubModel sm = pModelContainer->getSubModel(root->getStartPosition() + i);
|
|
||||||
lo = lo.min(sm.getAABoxBounds().low());
|
|
||||||
hi = hi.max(sm.getAABoxBounds().high());
|
|
||||||
array.append(sm);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(root->getChild((TreeNode *) &pModelContainer->getTreeNode(0), 0)) {
|
|
||||||
fillSubModelArary(pModelContainer, root->getChild((TreeNode *)&pModelContainer->getTreeNode(0), 0), array, lo, hi);
|
|
||||||
}
|
|
||||||
if(root->getChild((TreeNode *)&pModelContainer->getTreeNode(0), 1)) {
|
|
||||||
fillSubModelArary(pModelContainer, root->getChild((TreeNode *)&pModelContainer->getTreeNode(0), 1), array, lo, hi);
|
|
||||||
}
|
|
||||||
|
|
||||||
float dist1 = (hi -lo).magnitude();
|
|
||||||
AABox b;
|
|
||||||
root->getBounds(b);
|
|
||||||
float dist2 = (b.high() -b.low()).magnitude();
|
|
||||||
if(dist1 > dist2) {
|
|
||||||
// error
|
|
||||||
int xxx = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================
|
|
||||||
void ModelContainerView::addModelContainer(const std::string& pName,const ModelContainer* pModelContainer) {
|
|
||||||
// VARArea::UsageHint::WRITE_EVERY_FEW_FRAMES
|
|
||||||
|
|
||||||
int offset=0;
|
|
||||||
|
|
||||||
Array<int> iIndexArray;
|
|
||||||
Array<Vector3> iGlobArray;
|
|
||||||
|
|
||||||
Array<SubModel> SMArray;
|
|
||||||
Vector3 lo, hi;
|
|
||||||
fillSubModelArary(pModelContainer, &pModelContainer->getTreeNode(0), SMArray,lo,hi);
|
|
||||||
|
|
||||||
|
|
||||||
for(int i=0; i<SMArray.size(); ++i) {
|
|
||||||
SubModel sm = SMArray[i];
|
|
||||||
Array<Vector3> vArray;
|
|
||||||
Array<int> iArray;
|
|
||||||
fillVertexAndIndexArrays(sm, vArray, iArray);
|
|
||||||
|
|
||||||
for(int j=0;j<iArray.size(); ++j) {
|
|
||||||
iIndexArray.append(offset+iArray[j]);
|
|
||||||
|
|
||||||
}
|
|
||||||
for(int j=0;j<vArray.size(); ++j) {
|
|
||||||
iGlobArray.append(vArray[j]);
|
|
||||||
}
|
|
||||||
offset += vArray.size();
|
|
||||||
//break;
|
|
||||||
}
|
|
||||||
iTriVarTable.set(pName, new VAR(iGlobArray ,iVARAreaRef));
|
|
||||||
iTriIndexTable.set(pName, iIndexArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
//===================================================
|
|
||||||
|
|
||||||
void ModelContainerView::removeModelContainer(const std::string& pName, const ModelContainer* pModelContainer) {
|
|
||||||
VAR* var = iTriVarTable.get(pName);
|
|
||||||
iTriVarTable.remove(pName);
|
|
||||||
delete var;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector3 p1,p2,p3,p4,p5,p6,p7;
|
|
||||||
Array<AABox>gBoxArray;
|
|
||||||
Array<G3D::Triangle>gTriArray;
|
|
||||||
int gCount1 = 0, gCount2 = 0 , gCount3 = 0, gCount4 = 0;
|
|
||||||
bool myfound=false;
|
|
||||||
|
|
||||||
//===================================================
|
|
||||||
|
|
||||||
void ModelContainerView::onInit() {
|
|
||||||
// Called before the application loop beings. Load data here and
|
|
||||||
// not in the constructor so that common exceptions will be
|
|
||||||
// automatically caught.
|
|
||||||
iSky = Sky::fromFile("../../data/sky/");
|
|
||||||
|
|
||||||
iSkyParameters = SkyParameters(G3D::toSeconds(11, 00, 00, AM));
|
|
||||||
iLighting = Lighting::fromSky(iSky, iSkyParameters, Color3::white());
|
|
||||||
|
|
||||||
// This simple demo has no shadowing, so make all lights unshadowed
|
|
||||||
iLighting->lightArray.append(iLighting->shadowedLightArray);
|
|
||||||
iLighting->shadowedLightArray.clear();
|
|
||||||
|
|
||||||
// Example debug GUI:
|
|
||||||
//debugPane->addCheckBox("Use explicit checking", &explicitCheck);
|
|
||||||
debugWindow->setVisible(true);
|
|
||||||
|
|
||||||
toneMap->setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelContainerView::onGraphics(RenderDevice* rd, Array<PosedModelRef> &posed3D, Array<PosedModel2DRef> &posed2D) {
|
|
||||||
Array<PosedModel::Ref> opaque, transparent;
|
|
||||||
LightingRef localLighting = toneMap->prepareLighting(iLighting);
|
|
||||||
SkyParameters localSky = toneMap->prepareSkyParameters(iSkyParameters);
|
|
||||||
|
|
||||||
|
|
||||||
toneMap->beginFrame(rd);
|
|
||||||
rd->setProjectionAndCameraMatrix(defaultCamera);
|
|
||||||
|
|
||||||
rd->setColorClearValue(Color3::black());
|
|
||||||
rd->clear();
|
|
||||||
//iSky->render(rd, localSky);
|
|
||||||
|
|
||||||
// Setup lighting
|
|
||||||
rd->enableLighting();
|
|
||||||
//rd->setLight(0, localLighting->lightArray[0]);
|
|
||||||
//rd->setAmbientLightColor(localLighting->ambientAverage());
|
|
||||||
|
|
||||||
GLight light =GLight::directional(defaultController.pointer()->position() + defaultController.pointer()->lookVector()*2,Color3::white());
|
|
||||||
rd->setLight(0,light);
|
|
||||||
|
|
||||||
rd->setColor(Color3::blue());
|
|
||||||
|
|
||||||
Array<std::string > keys = iTriVarTable.getKeys();
|
|
||||||
Array<std::string>::ConstIterator i = keys.begin();
|
|
||||||
while(i != keys.end()) {
|
|
||||||
VAR* var = iTriVarTable.get(*i);
|
|
||||||
Array<int> indexArray = iTriIndexTable.get(*i);
|
|
||||||
|
|
||||||
rd->beginIndexedPrimitives();
|
|
||||||
rd->setVertexArray(*var);
|
|
||||||
rd->sendIndices(RenderDevice::LINES, indexArray);
|
|
||||||
rd->endIndexedPrimitives();
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
for(int i=0; i<gBoxArray.size(); ++i) {
|
|
||||||
AABox b = gBoxArray[i];
|
|
||||||
Draw::box(b,rd,Color4(Color3::red(),0.9f));
|
|
||||||
}
|
|
||||||
//-------
|
|
||||||
//triangles
|
|
||||||
{
|
|
||||||
if(iTriDebugArray.size() > 0)
|
|
||||||
{
|
|
||||||
rd->setColor(Color3::red());
|
|
||||||
rd->beginIndexedPrimitives();
|
|
||||||
rd->setVertexArray(iTriDebugVar);
|
|
||||||
rd->sendIndices(RenderDevice::LINES, iTriDebugArray);
|
|
||||||
rd->endIndexedPrimitives();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//--------
|
|
||||||
if(iDrawLine) {
|
|
||||||
Draw::lineSegment(LineSegment::fromTwoPoints(iPos1, iPos2), rd, iColor, 3);
|
|
||||||
|
|
||||||
if(myfound) {
|
|
||||||
//Draw::lineSegment(LineSegment::fromTwoPoints(p1, p2), rd, iColor, 3);
|
|
||||||
//Draw::lineSegment(LineSegment::fromTwoPoints(p2, p3), rd, iColor, 3);
|
|
||||||
//Draw::lineSegment(LineSegment::fromTwoPoints(p3, p1), rd, iColor, 3);
|
|
||||||
Draw::sphere(Sphere(p4,0.5),rd, iColor);
|
|
||||||
//Draw::sphere(Sphere(p5,0.5),rd, Color3::green());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Always render the posed models passed in or the Developer Window and
|
|
||||||
// other Widget features will not appear.
|
|
||||||
if (posed3D.size() > 0) {
|
|
||||||
Vector3 lookVector = renderDevice->getCameraToWorldMatrix().lookVector();
|
|
||||||
PosedModel::sort(posed3D, lookVector, opaque, transparent);
|
|
||||||
|
|
||||||
for (int i = 0; i < opaque.size(); ++i) {
|
|
||||||
opaque[i]->render(renderDevice);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < transparent.size(); ++i) {
|
|
||||||
transparent[i]->render(renderDevice);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rd->disableLighting();
|
|
||||||
|
|
||||||
toneMap->endFrame(rd);
|
|
||||||
PosedModel2D::sortAndRender(rd, posed2D);
|
|
||||||
}
|
|
||||||
|
|
||||||
//===================================================
|
|
||||||
|
|
||||||
void ModelContainerView::fillRenderArray(const SubModel& pSm, Array<TriangleBox> &pArray, const TreeNode* pTreeNode) {
|
|
||||||
for(int i=0;i<pTreeNode->getNValues(); i++) {
|
|
||||||
pArray.append(pSm.getTriangles()[i+pTreeNode->getStartPosition()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pTreeNode->getChild(pSm.getTreeNodes(), 0) != 0) {
|
|
||||||
fillRenderArray(pSm, pArray, pTreeNode->getChild(pSm.getTreeNodes(), 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pTreeNode->getChild(pSm.getTreeNodes(), 1) != 0) {
|
|
||||||
fillRenderArray(pSm, pArray, pTreeNode->getChild(pSm.getTreeNodes(), 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//===================================================
|
|
||||||
|
|
||||||
void ModelContainerView::fillVertexAndIndexArrays(const SubModel& pSm, Array<Vector3>& vArray, Array<int>& iArray) {
|
|
||||||
Array<TriangleBox> tbarray;
|
|
||||||
|
|
||||||
fillRenderArray(pSm, tbarray, &pSm.getTreeNode(0));
|
|
||||||
MeshBuilder builder;
|
|
||||||
int len = tbarray.size();
|
|
||||||
int count = 0;
|
|
||||||
for(int i=0;i<len;++i) {
|
|
||||||
Triangle t = Triangle(tbarray[i].vertex(0).getVector3() + pSm.getBasePosition(),
|
|
||||||
tbarray[i].vertex(1).getVector3() + pSm.getBasePosition(),
|
|
||||||
tbarray[i].vertex(2).getVector3() + pSm.getBasePosition());
|
|
||||||
|
|
||||||
vArray.append(t.vertex(0));
|
|
||||||
vArray.append(t.vertex(1));
|
|
||||||
vArray.append(t.vertex(2));
|
|
||||||
|
|
||||||
iArray.append(count+0);
|
|
||||||
iArray.append(count+1);
|
|
||||||
iArray.append(count+1);
|
|
||||||
iArray.append(count+2);
|
|
||||||
iArray.append(count+2);
|
|
||||||
iArray.append(count+0);
|
|
||||||
count+=3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//====================================================================
|
|
||||||
|
|
||||||
void ModelContainerView::showMap(int pMapId, int x, int y) {
|
|
||||||
MapTree* mt = iVMapManager->getInstanceMapTree(pMapId);
|
|
||||||
std::string dirFileName = iVMapManager->getDirFileName(pMapId);
|
|
||||||
if(!mt->hasDirFile(dirFileName)) {
|
|
||||||
dirFileName = iVMapManager->getDirFileName(pMapId, x, y);
|
|
||||||
}
|
|
||||||
showMap(mt,dirFileName);
|
|
||||||
iInstanceId = pMapId;
|
|
||||||
}
|
|
||||||
|
|
||||||
//====================================================================
|
|
||||||
|
|
||||||
bool ModelContainerView::loadAndShowTile(int pMapId, int x, int y) {
|
|
||||||
char buffer[500];
|
|
||||||
sprintf(buffer, "%s/vmaps",gDataDir);
|
|
||||||
bool result = false;
|
|
||||||
//if(pMapId == 1) return true; //+++
|
|
||||||
int val = iVMapManager->loadMap(buffer,(unsigned int) pMapId, x,y);
|
|
||||||
if(val == VMAP_LOAD_RESULT_OK) {
|
|
||||||
result = true;
|
|
||||||
showMap(pMapId,x,y);
|
|
||||||
} else {
|
|
||||||
printf("Unable to load %s\n", buffer);
|
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void ModelContainerView::showMap(MapTree* mt, std::string dirFileName) {
|
|
||||||
if(mt->hasDirFile(dirFileName)) {
|
|
||||||
FilesInDir filesInDir = mt->getDirFiles(dirFileName);
|
|
||||||
if(filesInDir.getRefCount() == 1) {
|
|
||||||
Array<std::string> fileNames = filesInDir.getFiles();
|
|
||||||
for(int i=0; i<fileNames.size(); ++i) {
|
|
||||||
std::string name = fileNames[i];
|
|
||||||
ManagedModelContainer* mc = mt->getModelContainer(name);
|
|
||||||
//if(mc->getNSubModel() == 791) {
|
|
||||||
addModelContainer(name, mc);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
bool ModelContainerView::loadAndShowTile(int pMapId) {
|
|
||||||
char buffer[500];
|
|
||||||
sprintf(buffer, "%s/vmaps",gDataDir);
|
|
||||||
bool result = false;
|
|
||||||
int val = iVMapManager->loadMap(buffer, (unsigned int) pMapId,-1,-1);
|
|
||||||
if(val == VMAP_LOAD_RESULT_OK) {
|
|
||||||
result = true;
|
|
||||||
MapTree* mt = iVMapManager->getInstanceMapTree(pMapId);
|
|
||||||
std::string dirFileName = iVMapManager->getDirFileName(pMapId);
|
|
||||||
iTriVarTable = Table<std::string , VAR*>();
|
|
||||||
iTriIndexTable = Table<std::string , Array<int> >(); // reset table
|
|
||||||
iInstanceId = pMapId;
|
|
||||||
showMap(mt,dirFileName);
|
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
//====================================================================
|
|
||||||
|
|
||||||
void ModelContainerView::processCommand() {
|
|
||||||
iDrawLine = false;
|
|
||||||
if(iCurrCmdIndex < iCmdArray.size()) {
|
|
||||||
bool cmdfound = false;
|
|
||||||
while(!cmdfound && (iCurrCmdIndex < iCmdArray.size())) {
|
|
||||||
Command c = iCmdArray[iCurrCmdIndex];
|
|
||||||
if(c.getType() == LOAD_TILE) {
|
|
||||||
iPrevLoadCommands.push_back(c);
|
|
||||||
if(iPosSent) {
|
|
||||||
if(loadAndShowTile(c.getInt(2), c.getInt(0), c.getInt(1))) {
|
|
||||||
printf("load tile mapId=%d, %d, %d\n", c.getInt(2), c.getInt(0), c.getInt(1));
|
|
||||||
} else {
|
|
||||||
printf("ERROR: unable to load tile mapId= %d, %d, %d\n", c.getInt(2), c.getInt(0), c.getInt(1));
|
|
||||||
}
|
|
||||||
cmdfound = true;
|
|
||||||
} else {
|
|
||||||
printf("ignore load tile mapId=%d, %d, %d\n", c.getInt(2), c.getInt(0), c.getInt(1));
|
|
||||||
}
|
|
||||||
} else if(c.getType() == LOAD_INSTANCE) {
|
|
||||||
if(loadAndShowTile(c.getInt(0))) {
|
|
||||||
printf("load instance %d\n", c.getInt(0));
|
|
||||||
}
|
|
||||||
cmdfound = true;
|
|
||||||
} else if(c.getType() == UNLOAD_TILE) {
|
|
||||||
/*
|
|
||||||
iVMapManager->unloadMap(c.getInt(2), c.getInt(0), c.getInt(1));
|
|
||||||
printf("unload tile %d, %d\n", c.getInt(0), c.getInt(1));
|
|
||||||
|
|
||||||
std::string dirFileName = iVMapManager->getDirFileName(iVMapManager->getMapIdNames(c.getInt(2)).iMapGroupName.c_str(), c.getInt(0), c.getInt(1));
|
|
||||||
MapTree* mt = iVMapManager->getInstanceMapTree(c.getInt(2));
|
|
||||||
if(mt->hasDirFile(dirFileName)) {
|
|
||||||
Array<std::string> fileNames = mt->getDirFiles(dirFileName).getFiles();
|
|
||||||
for(int i=0; i<fileNames.size(); ++i) {
|
|
||||||
std::string name = fileNames[i];
|
|
||||||
ManagedModelContainer* mc = mt->getModelContainer(name);
|
|
||||||
removeModelContainer(name, mc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
} else if(c.getType() == SET_POS) {
|
|
||||||
if(!iPosSent) {
|
|
||||||
int count = 3;
|
|
||||||
while(iPrevLoadCommands.size() > 0 && count>0) {
|
|
||||||
Command lc = iPrevLoadCommands.last();
|
|
||||||
iPrevLoadCommands.pop_back();
|
|
||||||
// first time, load the last map needed
|
|
||||||
if(loadAndShowTile(lc.getInt(2), lc.getInt(0), lc.getInt(1))) {
|
|
||||||
printf("load tile mapid=%d, %d, %d\n", lc.getInt(2), lc.getInt(0), lc.getInt(1));
|
|
||||||
} else {
|
|
||||||
printf("ERROR: unable to load tile mapid=%d, %d, %d\n", lc.getInt(2), lc.getInt(0), lc.getInt(1));
|
|
||||||
}
|
|
||||||
--count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
iPosSent = true;
|
|
||||||
defaultCamera.setPosition(Vector3(c.getVector(0).x,c.getVector(0).y+3, c.getVector(0).z));
|
|
||||||
defaultController.pointer()->setPosition(Vector3(c.getVector(0).x,c.getVector(0).y+3, c.getVector(0).z));
|
|
||||||
printf("set pos to %f, %f, %f\n",c.getVector(0).x, c.getVector(0).y, c.getVector(0).z );
|
|
||||||
cmdfound = true;
|
|
||||||
} else if(c.getType() == TEST_VIS) {
|
|
||||||
printf("TEST line of sight\n");
|
|
||||||
iDrawLine = true;
|
|
||||||
iPos1 = iVMapManager->convertPositionToInternalRep(c.getVector(0).x, c.getVector(0).y, c.getVector(0).z);
|
|
||||||
iPos2 = iVMapManager->convertPositionToInternalRep(c.getVector(1).x, c.getVector(1).y, c.getVector(1).z);
|
|
||||||
if(c.getInt(0) != 0) {
|
|
||||||
iColor = Color3::green();
|
|
||||||
} else {
|
|
||||||
iColor = Color3::red();
|
|
||||||
}
|
|
||||||
cmdfound = true;
|
|
||||||
/*
|
|
||||||
{
|
|
||||||
// draw debug-lines
|
|
||||||
int count = 0;
|
|
||||||
for(int i=0; i<gTriArray.size(); ++i) {
|
|
||||||
Triangle &t = gTriArray[i];
|
|
||||||
|
|
||||||
iVTriDebugArray.append(t.vertex(0));
|
|
||||||
iVTriDebugArray.append(t.vertex(1));
|
|
||||||
iVTriDebugArray.append(t.vertex(2));
|
|
||||||
|
|
||||||
iTriDebugArray.append(count+0);
|
|
||||||
iTriDebugArray.append(count+1);
|
|
||||||
iTriDebugArray.append(count+1);
|
|
||||||
iTriDebugArray.append(count+2);
|
|
||||||
iTriDebugArray.append(count+2);
|
|
||||||
iTriDebugArray.append(count+0);
|
|
||||||
count+=3;
|
|
||||||
}
|
|
||||||
iTriDebugVar = VAR(iVTriDebugArray ,iVARAreaRef2);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
++iCurrCmdIndex;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
printf("end reached\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//====================================================================
|
|
||||||
|
|
||||||
Vector3 ModelContainerView::convertPositionToMangosRep(float x, float y, float z) const {
|
|
||||||
float pos[3];
|
|
||||||
pos[0] = z;
|
|
||||||
pos[1] = x;
|
|
||||||
pos[2] = y;
|
|
||||||
double full = 64.0*533.33333333;
|
|
||||||
double mid = full/2.0;
|
|
||||||
pos[0] = -((mid+pos[0])-full);
|
|
||||||
pos[1] = -((mid+pos[1])-full);
|
|
||||||
|
|
||||||
return(Vector3(pos));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//====================================================================
|
|
||||||
|
|
||||||
|
|
||||||
void ModelContainerView::onUserInput(UserInput* ui) {
|
|
||||||
GApp::onUserInput(ui);
|
|
||||||
|
|
||||||
if(ui->keyPressed(GKey::fromString("l"))) { //load
|
|
||||||
iCmdArray = Array<Command>();
|
|
||||||
iCommandFileRW.getNewCommands(iCmdArray);
|
|
||||||
iCurrCmdIndex = 0;
|
|
||||||
processCommand();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ui->keyPressed(GKey::fromString("r"))) { //restart
|
|
||||||
iCurrCmdIndex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ui->keyPressed(GKey::fromString("1"))) { //inc count1
|
|
||||||
gCount1++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ui->keyPressed(GKey::fromString("h"))) { //inc count1
|
|
||||||
#if 0
|
|
||||||
i_App->defaultController.getPosition();
|
|
||||||
Vector3 pos = i_App->defaultController.getPosition();
|
|
||||||
Vector3 pos2 = convertPositionToMangosRep(pos.x, pos.y, pos.z);
|
|
||||||
//Vector3 pos3 = iVMapManager->convertPositionToInternalRep(pos2.x, pos2.y, pos2.z);
|
|
||||||
//pos3 = iVMapManager->convertPositionToInternalRep(pos2.x, pos2.y, pos2.z);
|
|
||||||
|
|
||||||
float hight = iVMapManager->getHeight(iInstanceId, pos2.x, pos2.y, pos2.z);
|
|
||||||
printf("Hight = %f\n",hight);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(ui->keyPressed(GKey::fromString("2"))) { //dec count1
|
|
||||||
gCount1--;
|
|
||||||
if(gCount1 < 0)
|
|
||||||
gCount1 = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ui->keyPressed(GKey::fromString("z"))) { //zero pos
|
|
||||||
i_App->defaultCamera.setPosition(Vector3(0,0,0));
|
|
||||||
printf("set pos to 0, 0, 0\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(ui->keyPressed(GKey::fromString("c"))) { //restart
|
|
||||||
if(iCurrCmdIndex > 0) {
|
|
||||||
if(iCmdArray[iCurrCmdIndex-1].getType() == TEST_VIS) {
|
|
||||||
Vector3 p1 = iCmdArray[iCurrCmdIndex-1].getVector(0);
|
|
||||||
Vector3 p2 = iCmdArray[iCurrCmdIndex-1].getVector(1);
|
|
||||||
bool result;
|
|
||||||
int mapId = iCmdArray[iCurrCmdIndex-1].getInt(1);
|
|
||||||
gCount3 = gCount2 = 0;// debug counter
|
|
||||||
gBoxArray = Array<AABox>();
|
|
||||||
result = iVMapManager->isInLineOfSight(mapId, p1.x,p1.y,p1.z,p2.x,p2.y,p2.z);
|
|
||||||
printf("recalc last line of light: result = %d\n", result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(ui->keyPressed(GKey::LEFT_MOUSE)) {
|
|
||||||
if( iCurrCmdIndex>0) {
|
|
||||||
--iCurrCmdIndex;
|
|
||||||
printf("restart last command\n");
|
|
||||||
processCommand();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ui->keyPressed(GKey::MIDDLE_MOUSE)) {
|
|
||||||
processCommand();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//==========================================
|
|
||||||
|
|
||||||
void ModelContainerView::setViewPosition(const Vector3& pPosition) {
|
|
||||||
//i_App->defaultController.setPosition(pPosition);
|
|
||||||
i_App->defaultCamera.setPosition(pPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================
|
|
||||||
//==========================================
|
|
||||||
}
|
|
||||||
G3D_START_AT_MAIN();
|
|
||||||
int main(int argc, char** argv) {
|
|
||||||
if(argc == 3) {
|
|
||||||
VMAP::gDataDir = argv[1];
|
|
||||||
VMAP::gLogFile = argv[2];
|
|
||||||
|
|
||||||
G3D::GApp::Settings settings;
|
|
||||||
settings.window.width = 1024;
|
|
||||||
settings.window.height = 768;
|
|
||||||
//settings.useDeveloperTools = true;
|
|
||||||
|
|
||||||
VMAP::ModelContainerView modelContainerView(settings);
|
|
||||||
modelContainerView.run();
|
|
||||||
} else {
|
|
||||||
printf("%s <data dir> <vmapcmd.log file>\n",argv[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,89 +0,0 @@
|
||||||
#ifndef _MODELCONTAINERVIEW_H
|
|
||||||
#define _MODELCONTAINERVIEW_H
|
|
||||||
|
|
||||||
#include <G3D/G3DAll.h>
|
|
||||||
#include <G3D/System.h>
|
|
||||||
#include "ModelContainer.h"
|
|
||||||
#include "DebugCmdLogger.h"
|
|
||||||
#include "vmapmanager.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace VMAP
|
|
||||||
{
|
|
||||||
//==========================================
|
|
||||||
|
|
||||||
|
|
||||||
//==========================================
|
|
||||||
|
|
||||||
class ModelContainerView :
|
|
||||||
public G3D::GApp
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
SkyRef iSky;
|
|
||||||
LightingRef iLighting;
|
|
||||||
SkyParameters iSkyParameters;
|
|
||||||
|
|
||||||
VARAreaRef iVARAreaRef;
|
|
||||||
Table<std::string , VAR*> iTriVarTable;
|
|
||||||
Table<std::string , Array<int> > iTriIndexTable;
|
|
||||||
|
|
||||||
VARAreaRef iVARAreaRef2;
|
|
||||||
VAR iTriDebugVar;
|
|
||||||
Array<Vector3> iVTriDebugArray;
|
|
||||||
Array<int> iTriDebugArray;
|
|
||||||
|
|
||||||
//Array<int> iLineIndexArray;
|
|
||||||
|
|
||||||
GApp* i_App;
|
|
||||||
CommandFileRW iCommandFileRW;
|
|
||||||
Array<Command> iCmdArray;
|
|
||||||
int iCurrCmdIndex;
|
|
||||||
|
|
||||||
VMapManager* iVMapManager;
|
|
||||||
|
|
||||||
Vector3 iPos1;
|
|
||||||
Vector3 iPos2;
|
|
||||||
Color3 iColor;
|
|
||||||
bool iDrawLine;
|
|
||||||
int iInstanceId;
|
|
||||||
bool iPosSent;
|
|
||||||
Array<Command> iPrevLoadCommands;
|
|
||||||
private:
|
|
||||||
Vector3 convertPositionToMangosRep(float x, float y, float z) const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
ModelContainerView(const G3D::GApp::Settings& settings);
|
|
||||||
|
|
||||||
~ModelContainerView(void);
|
|
||||||
|
|
||||||
void addModelContainer(const std::string& pName,const ModelContainer* pModelContainer);
|
|
||||||
void removeModelContainer(const std::string& pName, const ModelContainer* pModelContainer);
|
|
||||||
void setViewPosition(const Vector3& pPosition);
|
|
||||||
|
|
||||||
void onGraphics(RenderDevice* rd, Array<PosedModelRef> &posed3D, Array<PosedModel2DRef> &posed2D);
|
|
||||||
virtual void onInit();
|
|
||||||
void init();
|
|
||||||
void cleanup();
|
|
||||||
void onUserInput(UserInput* ui);
|
|
||||||
|
|
||||||
void fillRenderArray(const SubModel& pSm,Array<TriangleBox> &pArray, const TreeNode* pTreeNode);
|
|
||||||
void fillVertexAndIndexArrays(const SubModel& pSm, Array<Vector3>& vArray, Array<int>& iArray);
|
|
||||||
|
|
||||||
bool loadAndShowTile(int pMapId, int x, int y);
|
|
||||||
void showMap(int pMapId, int x, int y);
|
|
||||||
|
|
||||||
void showMap(MapTree* mt, std::string dirFileName);
|
|
||||||
bool loadAndShowTile(int pMapId);
|
|
||||||
|
|
||||||
|
|
||||||
void processCommand();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
//==========================================
|
|
||||||
//==========================================
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Binary file not shown.
|
|
@ -1,308 +0,0 @@
|
||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="8,00"
|
|
||||||
Name="vmapdebugger"
|
|
||||||
ProjectGUID="{0F6BDF3C-9B6F-45A0-A443-E26E31C8A015}"
|
|
||||||
RootNamespace="vmapdebugger"
|
|
||||||
Keyword="Win32Proj"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
OutputDirectory="Debug"
|
|
||||||
IntermediateDirectory="Debug"
|
|
||||||
ConfigurationType="1"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="..\..\..\src\shared\vmap;"G:\Core My Work\G3D-7.00\include""
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_DEBUG_VMAPS"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="3"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="4"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile="$(OutDir)/vmapdebugger.exe"
|
|
||||||
LinkIncremental="2"
|
|
||||||
AdditionalLibraryDirectories=""G:\Core My Work\G3D-7.00\lib""
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
ProgramDatabaseFile="$(OutDir)/vmapdebugger.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory="Release"
|
|
||||||
IntermediateDirectory="Release"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories="..\..\..\src\shared\vmap;"G:\Core My Work\G3D-7.00\include""
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_DEBUG;_DEBUG_VMAPS"
|
|
||||||
RuntimeLibrary="2"
|
|
||||||
UsePrecompiledHeader="0"
|
|
||||||
WarningLevel="3"
|
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile="$(OutDir)/vmapdebugger.exe"
|
|
||||||
LinkIncremental="1"
|
|
||||||
AdditionalLibraryDirectories=""G:\Core My Work\G3D-7.00\lib""
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
SubSystem="1"
|
|
||||||
OptimizeReferences="2"
|
|
||||||
EnableCOMDATFolding="2"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<Filter
|
|
||||||
Name="Source Files"
|
|
||||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
|
||||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
|
||||||
>
|
|
||||||
<File
|
|
||||||
RelativePath="..\ModelContainerView.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\ModelContainerView.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="vmap"
|
|
||||||
>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\AABSPTree.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\BaseModel.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\BaseModel.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\CoordModelMapping.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\CoordModelMapping.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\DebugCmdLogger.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\DebugCmdLogger.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\IVMapManager.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\ManagedModelContainer.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\ManagedModelContainer.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\ModelContainer.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\ModelContainer.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\NodeValueAccess.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\ShortBox.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\ShortVector.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\SubModel.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\SubModel.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\TileAssembler.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\TileAssembler.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\TreeNode.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\TreeNode.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\VMapDefinitions.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\VMapFactory.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\VMapFactory.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\VMapManager.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\VMapManager.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\shared\vmap\VMapTools.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
||||||
Binary file not shown.
|
|
@ -1,121 +0,0 @@
|
||||||
Here you find a visual debugging tool. With that you can check it yourself. You need to compile it
|
|
||||||
yourself or just use the precompiled version. The precompiled version should not need any
|
|
||||||
additional libraries. If you try to compile it yourself you need G3D library 7.00 and
|
|
||||||
SDL 1.2.8 or higher.
|
|
||||||
|
|
||||||
There is NO “how to compile support”.... You will manage it, if you need to...
|
|
||||||
|
|
||||||
What does it do?
|
|
||||||
|
|
||||||
The program analyses the content of the vmapcmd.log file created by [b] mangosd compiled
|
|
||||||
in debug mode [/b] with vmap support. The commands written to disk are read and the result
|
|
||||||
is displayed in a graphical view. This view shows a wire frame model of the loaded vmaps
|
|
||||||
and you can move in these maps. Furthermore you can see witch line of sight query where
|
|
||||||
performed and its result. You are able to perform the ling of sight query again and will see, if
|
|
||||||
the current version of the vmap source compiled against the debugger, produces the same
|
|
||||||
result. This last function is useful for debugging the line of sight code.
|
|
||||||
|
|
||||||
The little program is a real hack, but is fits is purpose.
|
|
||||||
|
|
||||||
How to use it:
|
|
||||||
|
|
||||||
[b]Logging[b]
|
|
||||||
You will need to set _VMAP_LOG_DEBUG when compiling core in debug mode to get this log.
|
|
||||||
If mangos is compiled in debug mode it will then write the vmapcmd.log file. The file does only
|
|
||||||
contain the information which vmaps are loaded. I addition to that the file need the
|
|
||||||
information where your character currently in standing in the maps. This position information
|
|
||||||
has to be inserted manually. To do that I modified the .announce command to send the
|
|
||||||
position of the current character to the log file (modification is in the attached patch).
|
|
||||||
|
|
||||||
The line of sight query is only stored in the log file if you enable this kind of logging. This is
|
|
||||||
done by performing the modified .gm off command. Enabling line of sight and moving your
|
|
||||||
character a bit will log the queries and there results. Don’t do this for log, it will produce lots
|
|
||||||
of data, which is hard to analyze later.
|
|
||||||
|
|
||||||
The modified command .gm on will stop the logging of the line of sight calculation.
|
|
||||||
|
|
||||||
What do you have to do for logging?
|
|
||||||
1. Apply the patch to mangos to modify your .announce, .gmoff and .gmon commands
|
|
||||||
2. Compile mangos in debug mode
|
|
||||||
3. Go to the position where you suspect a problem
|
|
||||||
4. Use .gmon to be sure you will not be attacked when you login
|
|
||||||
5. Save, Logoff and stop mangosd
|
|
||||||
6. Delete the vmapcmd.log from the mangos dir. The logger will append to that file.
|
|
||||||
7. Start mangos
|
|
||||||
8. Login with your character
|
|
||||||
9. Send your position to the log file. Do this with the .announce command (.announce
|
|
||||||
foo)
|
|
||||||
10. Type .gmoff enabling the line of sight logging
|
|
||||||
11. Move a bit to get the attention of the mobs
|
|
||||||
12. Type .gmon to stop the logging
|
|
||||||
|
|
||||||
[b]Analysing the log file[/b]
|
|
||||||
1. Start the vmap debugger with the path to the mangos data dir and the full path (name) of
|
|
||||||
the log file
|
|
||||||
2. The debugger is controlled by single keys and the mouse. Here is a list of key commands.
|
|
||||||
The result is displayed at the console:
|
|
||||||
|
|
||||||
l – (small L) Load the next block off logging data into the command queue and process the
|
|
||||||
first command from the queue. When the end is reached a message “end reached” is display at
|
|
||||||
the console. If you reached the you can press l again. Sending .gm on sets an end mark to the
|
|
||||||
file. You have to load the next logging block after each .gmon command.
|
|
||||||
|
|
||||||
r – Reload the last command block
|
|
||||||
|
|
||||||
mouse middle click – process the next command from the queue
|
|
||||||
|
|
||||||
mouse left click – reprocess the last command from the queue
|
|
||||||
|
|
||||||
c – recalculate the last line of sight command and send the result to the console
|
|
||||||
|
|
||||||
w,s,a,d – move within the 3D view
|
|
||||||
|
|
||||||
ESC – exit
|
|
||||||
|
|
||||||
TAB – release/grep the mouse
|
|
||||||
|
|
||||||
[b]How to test the included example with the precompiled version with the included
|
|
||||||
vmapcmd.log file:[b]
|
|
||||||
|
|
||||||
open your console
|
|
||||||
move to the contrib\vmap_debugger\bin directory
|
|
||||||
run: vmapdebugger.exe <your mangos data dir> vmapcmd.log
|
|
||||||
Wait until the block screen is open and arrange the console and the screen, so you can see
|
|
||||||
both
|
|
||||||
Press: l (small L not one)
|
|
||||||
click middle
|
|
||||||
click middle
|
|
||||||
click middle
|
|
||||||
|
|
||||||
Now you should see the wire frame model of scholo and the green line of sight line in the
|
|
||||||
display. The green line means the test was performed and you are seen. A red line means you
|
|
||||||
are not seen. Move around a bit with the mouse and the w,s,a,d keys.
|
|
||||||
|
|
||||||
Press c
|
|
||||||
Press ESC
|
|
||||||
|
|
||||||
[b]Problems with your gfx.card[/b]
|
|
||||||
Maybe the program does not woth with your graphics card. In this case you have dad luck.
|
|
||||||
One think might help, if not .... I do not know...:
|
|
||||||
|
|
||||||
Here I take 60 MB Ram from Gfx-Card [b]VARArea::create(1024*1024*60)[/b]. That
|
|
||||||
might cause problems on your system.
|
|
||||||
|
|
||||||
[code]
|
|
||||||
ModelContainerView::ModelContainerView(GApp* pApp) : GApplet(pApp) {
|
|
||||||
i_App = pApp;
|
|
||||||
|
|
||||||
iCommandFileRW.setFileName(gLogFile);
|
|
||||||
iCurrCmdIndex = 0;
|
|
||||||
iVMapManager = new VMapManager();
|
|
||||||
iDrawLine = false;
|
|
||||||
|
|
||||||
iVARAreaRef = VARArea::create(1024*1024*60);
|
|
||||||
iInstanceId = -1;
|
|
||||||
|
|
||||||
}
|
|
||||||
[/code]
|
|
||||||
|
|
||||||
This should give all of you who, are interested the chance to check the content and behavior
|
|
||||||
of the vmaps.
|
|
||||||
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
|
||||||
# Visual Studio 2005
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vmapdebugger", "VC8\vmapdebugger.vcproj", "{0F6BDF3C-9B6F-45A0-A443-E26E31C8A015}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Win32 = Debug|Win32
|
|
||||||
Release|Win32 = Release|Win32
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{0F6BDF3C-9B6F-45A0-A443-E26E31C8A015}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{0F6BDF3C-9B6F-45A0-A443-E26E31C8A015}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{0F6BDF3C-9B6F-45A0-A443-E26E31C8A015}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{0F6BDF3C-9B6F-45A0-A443-E26E31C8A015}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10470"
|
#define REVISION_NR "10471"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue