Jump to content

  • Log In with Google      Sign In   
  • Create Account

lucky6969b

Member Since 06 Apr 2007
Offline Last Active Private

#5293491 Do you usually prefix your classes with the letter 'C' or something e...

Posted by lucky6969b on 25 May 2016 - 11:04 PM

I think it's a good practice to do so.

I prefix stuff like CTextureManager, it is quite neat.

But when it comes to classes like

AStar, I feel very strange to have such a letter as the prefix...

I don't like to call it CAStar, which is very windy...

Thanks

Jack




#5291571 What is the best way to update a Quadtree/Octree?

Posted by lucky6969b on 14 May 2016 - 09:55 AM

One more tiny question to ask,
I am wondering if say a tractor of a truck enters a warehouse,
and the floor of the tractor becomes part of the world,
the quad tree is to be extended, I don't really want to extrude
that part of the quad tree in advance and pretend it was there before the truck enters,
I want the new area to be stitched to the original quad tree.
The problem being is where should I seed the pivot point
of the new quads?

BTW, I decided not to store the ids in an array, I store them in a hash map
Anyways, the ids can be reused when required...
Thanks
Jack




#5289728 Need Help parsing the X file using D3DX?

Posted by lucky6969b on 02 May 2016 - 08:04 AM

I've solved it myself. I actually retrieve the parent of the parent and pass the sibling ID as the childID

to the _linkframe function, and it solved the problem

BTW, I've rewritten the _linkframe function significantly. But you can find it here

 

https://github.com/yorung/dx11bvh

 

Thanks

Jack




#5288257 towards a faster A*

Posted by lucky6969b on 23 April 2016 - 02:25 AM

http://www.codeproject.com/Articles/118015/Fast-A-Star-D-Implementation-for-C

This guy here wrote an extremely fast heap priority queue.

Let's try it.

It runs very fast in my program




#5278652 How to clear this offset bit?

Posted by lucky6969b on 29 February 2016 - 02:06 AM

I need to check it. But for the time being, it is working as normal.

But I am not sure, because I copy it off somewhere from the web.




#5278643 How to clear this offset bit?

Posted by lucky6969b on 29 February 2016 - 12:24 AM

void Remove(const T* inValue)
{
    int offset = inValue->x*MAXTILE_YLEN + inValue->z;
    mbVisited[offset] &= ~(1 << inValue->direction);
    Count--;
}

BYTE     mbVisited[MAXTILE_XLEN*MAXTILE_YLEN];

I want to clear the corresponding mbVisited bit based on the x,y and dir given as
the argument to Remove.
But I am not sure if this would work or not?
Thanks
Jack




#5276273 How to get the total polycount in the scene from recast/detour?

Posted by lucky6969b on 18 February 2016 - 01:27 AM

How do I get the total polycount in the scene from recast/detour?

BTW,
when I chose tiled mesh, and keep intermediate results, there is no way to show the tiles
and tile structure in the pane, but with temp obstacle, I can see the tiles laid out
but still no polys inside the tiles?
Why?




#5273314 Smoothing out a TimeAStar Path.

Posted by lucky6969b on 29 January 2016 - 11:06 PM

If the returned timeastar path consists of discrete times like 1,2,3,4

and I want to interpolate it with a catmull-rom spline.

I have to blend the waypoints between time say 1 and 2

while timeastar works best with discrete time and discrete locations.

Is it possible to make the timeastar path continuous by intepolating it

with catmull rom? If I do it like that, I have to make up some

real times like 1.25, 1.50, 1.75 to add between the time of 1 and 2

and the timeastar is no longer discrete in nature.

 

Should I double up the waypoints this way?

I find that there is one problem with this, if 2 waypoints are really close to each other, the effect of smoothing is not prominent?

D3DXVECTOR3& CMyApp::GotoWaypoint(const D3DXVECTOR3& vSrc, const D3DXVECTOR3& vDest, float fSpeed, bool bSmoothPath)
{
    D3DXVECTOR3 vOut;
    if (bSmoothPath) {
        D3DXVECTOR3 p[4];
        p[0] = vSrc;
        p[1] = vSrc;
        p[2] = vDest;
        p[3] = vDest;
        vOut = *D3DXVec3CatmullRom(&vOut, &p[0], &p[1], &p[2], &p[3], fSpeed);
    }
    else {
        vOut = *D3DXVec3Lerp(&vOut, &vSrc, &vDest, fSpeed);
    }
    return vOut;
}

These interpolated waypoints using catmull rom give abrupt turn to the agent

Wp is 4.84535 0 -0.498869
Wp is 4.8462 0 -0.501389
Wp is 4.84722 0 -0.504407
Wp is 4.84823 0 -0.507419
Wp is 4.84925 0 -0.510424
Wp is 4.85026 0 -0.513422
Wp is 4.8511 0 -0.515915
Wp is 4.8521 0 -0.518901
Wp is 4.85294 0 -0.521384
Wp is 4.85394 0 -0.524357
Wp is 4.85494 0 -0.527323
Wp is 4.85577 0 -0.52979
Wp is 4.85677 0 -0.532743
Wp is 4.85776 0 -0.53569
Wp is 4.85859 0 -0.53814
Wp is 4.85974 0 -0.541561
Wp is 4.86073 0 -0.544486
Wp is 4.86155 0 -0.546918
Wp is 4.86253 0 -0.54983
Wp is 4.86351 0 -0.552735
Wp is 4.86433 0 -0.55515
Wp is 4.86546 0 -0.558522
Wp is 4.86643 0 -0.561405
Wp is 4.8674 0 -0.56428
Wp is 4.86901 0 -0.569055
Wp is 4.8703 0 -0.57286
Wp is 4.87126 0 -0.575705
Wp is 4.87237 0 -0.579015
Wp is 4.8738 0 -0.583255
Wp is 4.87475 0 -0.586071
Wp is 4.8757 0 -0.588881
Wp is 4.87664 0 -0.591682
Wp is 4.87758 0 -0.594475
Wp is 4.87852 0 -0.59726
Wp is 4.8793 0 -0.599576
Wp is 4.88024 0 -0.602346
Wp is 4.88117 0 -0.605109
Wp is 4.88194 0 -0.607405
Wp is 4.88287 0 -0.610153
Wp is 4.88379 0 -0.612893
Wp is 4.88456 0 -0.61517
Wp is 4.88548 0 -0.617895
Wp is 4.8864 0 -0.620612
Wp is 4.88731 0 -0.62332
Wp is 4.88807 0 -0.625571
Wp is 4.88913 0 -0.628711
Wp is 4.88988 0 -0.630948
Wp is 4.89078 0 -0.633624
Wp is 4.89168 0 -0.636292
Wp is 4.89243 0 -0.638508
Wp is 4.89333 0 -0.64116
Wp is 4.89422 0 -0.643803
Wp is 4.89496 0 -0.645999
Wp is 4.89584 0 -0.648627
Wp is 4.89673 0 -0.651245
Wp is 4.89746 0 -0.653421
Wp is 4.89834 0 -0.656023
Wp is 4.89965 0 -0.659911
Wp is 4.90037 0 -0.662061
Wp is 4.90124 0 -0.664634
Wp is 4.9021 0 -0.667198

I am using

float x = m_CharInfo[name].vEndPos.x - m_CharInfo[name].vStartPos.x;
float z = m_CharInfo[name].vEndPos.z - m_CharInfo[name].vStartPos.z;
float fNewDir = atan2f(-x, -z);
m_CharObject[name]->SetRot(D3DXVECTOR3(fNewDir, 0.0f, 0.0f));

This is something I would want to try.

http://www.gamasutra.com/view/feature/131505/toward_more_realistic_pathfinding.php

But the thing is if I have to test 8 starting directions from the start, and 8 ending directions it will end up with.

there are on maximum 64 transitions per iteration, which will put the burden over the cooperative pathfinding thread a lot...

 

 

How can I avoid the abrupt turn of agent?

Thanks

Jack




#5272549 Setting the maximum no of animation sets in anim controller?

Posted by lucky6969b on 25 January 2016 - 12:39 AM

The animation controller had only one animationset when created off the hierarchy allocator.
Now, it only allows one animationset to be available
even though I register another one later on.
How do I alter this number?
Thanks
Jack




#5266199 About QuadTree AStar

Posted by lucky6969b on 13 December 2015 - 10:01 PM

You can see that the path costs are not uniform, due to the nature of quadtrees.

And I am using 4 directional moves at the moment, On the last step of this dump,

I find the the pathfinder has lost its properties.

 

X: -23.1811 Z 6.16012

is certainly better than

X: -20.7061 Z 13.5007

 

And BTW, I have enough clearance for the agent to get to its destination.

 

 

Any ideas that I can make improvements on this?

 

Update:

Sorry, guys, I know now, I got some unwanted geometries in my scene when generating the grid, so the destination cannot be reached.

Thanks for helping

Src:
m_vPos = 0x000000000cb4e0bc {-18.2310867, 0.000000000, 15.9476185}
 
Dest:
m_vPos = 0x000000000e9f2c5c {-33.6998367, 0.000000000, -22.5906639}
 
From: AStar 1 X: -18.2311 Z15.9476 total_cost 44.9457 path_cost 0 estimated_cost 44.9457

From: AStar ===========
From: AStar 1 X: -18.2311 Z13.5007 total_cost 44.9457 path_cost 2.44687 estimated_cost 42.4988

From: AStar 2 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 3 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 4 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925

From: AStar ===========
From: AStar 1 X: -18.2311 Z11.0539 total_cost 44.9457 path_cost 4.89375 estimated_cost 40.0519

From: AStar 2 X: -20.7061 Z13.5007 total_cost 46.3955 path_cost 4.92188 estimated_cost 41.4736

From: AStar 3 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 4 X: -15.7561 Z13.5007 total_cost 48.4458 path_cost 4.92187 estimated_cost 43.524

From: AStar 5 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 6 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925

From: AStar ===========
From: AStar 1 X: -18.2311 Z8.60699 total_cost 44.9457 path_cost 7.34062 estimated_cost 37.605

From: AStar 2 X: -20.7061 Z11.0539 total_cost 46.3955 path_cost 7.36875 estimated_cost 39.0267

From: AStar 3 X: -20.7061 Z13.5007 total_cost 46.3955 path_cost 4.92188 estimated_cost 41.4736

From: AStar 4 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 5 X: -15.7561 Z11.0539 total_cost 48.4458 path_cost 7.36875 estimated_cost 41.0771

From: AStar 6 X: -15.7561 Z13.5007 total_cost 48.4458 path_cost 4.92187 estimated_cost 43.524

From: AStar 7 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 8 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925

From: AStar ===========
From: AStar 1 X: -18.2311 Z6.16012 total_cost 44.9457 path_cost 9.7875 estimated_cost 35.1582

From: AStar 2 X: -20.7061 Z8.60699 total_cost 46.3955 path_cost 9.81563 estimated_cost 36.5798

From: AStar 3 X: -20.7061 Z11.0539 total_cost 46.3955 path_cost 7.36875 estimated_cost 39.0267

From: AStar 4 X: -20.7061 Z13.5007 total_cost 46.3955 path_cost 4.92188 estimated_cost 41.4736

From: AStar 5 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 6 X: -15.7561 Z11.0539 total_cost 48.4458 path_cost 7.36875 estimated_cost 41.0771

From: AStar 7 X: -15.7561 Z8.60699 total_cost 48.4458 path_cost 9.81562 estimated_cost 38.6302

From: AStar 8 X: -15.7561 Z13.5007 total_cost 48.4458 path_cost 4.92187 estimated_cost 43.524

From: AStar 9 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 10 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925

From: AStar ===========
From: AStar 1 X: -20.7061 Z6.16012 total_cost 46.3955 path_cost 12.2625 estimated_cost 34.133

From: AStar 2 X: -20.7061 Z8.60699 total_cost 46.3955 path_cost 9.81563 estimated_cost 36.5798

From: AStar 3 X: -20.7061 Z11.0539 total_cost 46.3955 path_cost 7.36875 estimated_cost 39.0267

From: AStar 4 X: -20.7061 Z13.5007 total_cost 46.3955 path_cost 4.92188 estimated_cost 41.4736

From: AStar 5 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 6 X: -15.7561 Z11.0539 total_cost 48.4458 path_cost 7.36875 estimated_cost 41.0771

From: AStar 7 X: -15.7561 Z6.16012 total_cost 48.4458 path_cost 12.2625 estimated_cost 36.1833

From: AStar 8 X: -15.7561 Z8.60699 total_cost 48.4458 path_cost 9.81562 estimated_cost 38.6302

From: AStar 9 X: -15.7561 Z13.5007 total_cost 48.4458 path_cost 4.92187 estimated_cost 43.524

From: AStar 10 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 11 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925

From: AStar ===========
From: AStar 1 X: -20.7061 Z8.60699 total_cost 46.3955 path_cost 9.81563 estimated_cost 36.5798

From: AStar 2 X: -20.7061 Z11.0539 total_cost 46.3955 path_cost 7.36875 estimated_cost 39.0267

From: AStar 3 X: -20.7061 Z13.5007 total_cost 46.3955 path_cost 4.92188 estimated_cost 41.4736

From: AStar 4 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 5 X: -23.1811 Z6.16012 total_cost 47.8453 path_cost 14.7375 estimated_cost 33.1078

From: AStar 6 X: -15.7561 Z11.0539 total_cost 48.4458 path_cost 7.36875 estimated_cost 41.0771

From: AStar 7 X: -15.7561 Z6.16012 total_cost 48.4458 path_cost 12.2625 estimated_cost 36.1833

From: AStar 8 X: -15.7561 Z8.60699 total_cost 48.4458 path_cost 9.81562 estimated_cost 38.6302

From: AStar 9 X: -15.7561 Z13.5007 total_cost 48.4458 path_cost 4.92187 estimated_cost 43.524

From: AStar 10 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 11 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925

From: AStar ===========
From: AStar 1 X: -20.7061 Z11.0539 total_cost 46.3955 path_cost 7.36875 estimated_cost 39.0267

From: AStar 2 X: -20.7061 Z13.5007 total_cost 46.3955 path_cost 4.92188 estimated_cost 41.4736

From: AStar 3 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 4 X: -23.1811 Z6.16012 total_cost 47.8453 path_cost 14.7375 estimated_cost 33.1078

From: AStar 5 X: -23.1811 Z8.60699 total_cost 47.8453 path_cost 12.2906 estimated_cost 35.5547

From: AStar 6 X: -15.7561 Z11.0539 total_cost 48.4458 path_cost 7.36875 estimated_cost 41.0771

From: AStar 7 X: -15.7561 Z6.16012 total_cost 48.4458 path_cost 12.2625 estimated_cost 36.1833

From: AStar 8 X: -15.7561 Z8.60699 total_cost 48.4458 path_cost 9.81562 estimated_cost 38.6302

From: AStar 9 X: -15.7561 Z13.5007 total_cost 48.4458 path_cost 4.92187 estimated_cost 43.524

From: AStar 10 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 11 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925

From: AStar ===========
From: AStar 1 X: -20.7061 Z13.5007 total_cost 46.3955 path_cost 4.92188 estimated_cost 41.4736

From: AStar 2 X: -20.7061 Z15.9476 total_cost 46.3955 path_cost 2.475 estimated_cost 43.9205

From: AStar 3 X: -23.1811 Z11.0539 total_cost 47.8453 path_cost 9.84375 estimated_cost 38.0015

From: AStar 4 X: -23.1811 Z6.16012 total_cost 47.8453 path_cost 14.7375 estimated_cost 33.1078

From: AStar 5 X: -23.1811 Z8.60699 total_cost 47.8453 path_cost 12.2906 estimated_cost 35.5547

From: AStar 6 X: -15.7561 Z11.0539 total_cost 48.4458 path_cost 7.36875 estimated_cost 41.0771

From: AStar 7 X: -15.7561 Z6.16012 total_cost 48.4458 path_cost 12.2625 estimated_cost 36.1833

From: AStar 8 X: -15.7561 Z8.60699 total_cost 48.4458 path_cost 9.81562 estimated_cost 38.6302

From: AStar 9 X: -15.7561 Z13.5007 total_cost 48.4458 path_cost 4.92187 estimated_cost 43.524

From: AStar 10 X: -15.7561 Z15.9476 total_cost 48.4458 path_cost 2.475 estimated_cost 45.9708

From: AStar 11 X: -18.2311 Z18.3945 total_cost 49.8394 path_cost 2.44687 estimated_cost 47.3925
AStarPath* AStar::findPath(QuadNode* start, QuadNode* destination, CObject* unit, bool bBackupMode)
{

 
    if (start == NULL || destination == NULL)
        return NULL;
    

    OpenCloseMap<QuadNode> m_ClosedSet;
    OpenCloseMap<QuadNode> m_OpenSet;
    QuadNode* current = NULL;
    bool solved = false;
    int iterations = 0;    
    std::set<QuadNode, QuadSetComparator> m_OrderedOpenSet;

    

    try {
        start->path_cost = 0;
        start->estimated_cost = start->distance(destination);
        start->total_cost = start->estimated_cost;

        m_OpenSet.Add(start);
        m_OrderedOpenSet.insert(*start);
        

        while (!m_OpenSet.IsEmpty())
        {

            
            int i = 1;
            typedef std::set<QuadNode, QuadSetComparator>::const_iterator itr;
            for (itr it = m_OrderedOpenSet.begin(); it != m_OrderedOpenSet.end(); it++) {
                const QuadNode& on = (*it);                
                std::stringstream oss;
                oss << i++ << " X: " << on.m_vPos[0] << " Z: " << on.m_vPos[2] << " total_cost " << on.total_cost << " path_cost " << on.path_cost << " estimated_cost " << on.estimated_cost << endl;
                LogFileSingletonGeneral::print("AStar", oss.str());
            }

            

            LogFileSingletonGeneral::print("AStar", "===========");
            

            current = new QuadNode(*m_OrderedOpenSet.begin());

            if (bBackupMode) {
                m_BackupPool.AddBackupNode(unit->GetName(), current);
            }

            if (current->contains(destination))
            {
                solved = true;
            }


            m_OpenSet.Remove(current);
            m_ClosedSet.Add(current);

            if (!m_OrderedOpenSet.empty())
                m_OrderedOpenSet.erase(m_OrderedOpenSet.begin());

            std::vector<QuadNode*>& neighborNodes = current->neighbours();


            for (int i = 0; i < neighborNodes.size(); i++)
            {
                QuadNode* neighbour = new QuadNode(*neighborNodes[i]);
                iterations++;

                float cost = current->distance(neighbour);

                if (neighbour->status == QuadNode::OBSTRUCTED)
                    continue;

                if (m_ClosedSet.Contains(neighbour))
                    continue;

                // in open list
                if (m_OpenSet.Contains(neighbour))
                {
                    // current is better, update the info
                    if (current->path_cost + cost < neighbour->path_cost)
                    {


                        // neighbour G cost greater than current->G + neighbour cost
                        m_OpenSet.Remove(neighbour);

                        if (!m_OrderedOpenSet.empty())
                            m_OrderedOpenSet.erase(m_OrderedOpenSet.find(*neighbour));

                        // sets the neighbour to the current's neighbour
                        neighbour->ancestor = current;
                        neighbour->path_cost = current->path_cost + cost;
                        neighbour->total_cost = neighbour->path_cost + neighbour->estimated_cost;
                        m_OpenSet.Add(neighbour);
                        m_OrderedOpenSet.insert(*neighbour);


                    }

                }
                else
                {

                    // open a new node
                    neighbour->ancestor = current;
                    neighbour->path_cost = current->path_cost + cost;
                    neighbour->estimated_cost = neighbour->distance(destination);
                    neighbour->total_cost = neighbour->path_cost + neighbour->estimated_cost;
                    m_OpenSet.Add(neighbour);
                    m_OrderedOpenSet.insert(*neighbour);

                }
            }
        }

        if (solved) {
            float totalCost = current->path_cost;
            std::vector<AStarTransition*> transitions;
            while (current->ancestor != NULL) {
                transitions.emplace(transitions.begin(), new AStarTransition(current, current->ancestor));

                // get where it originates from
                current = (QuadNode*)current->ancestor;
            }     
            cout << "Takes " << iterations << endl;



            return new AStarPath(start, transitions, totalCost);
        }
    }
    catch (...) {
        cout << "\nNo Path found " << endl;
        return NULL;
    }
    
    cout << "\nNo Path found " << endl;
    return NULL;
                
 
}



#5262688 Visual Studio includes a 3d modeller!

Posted by lucky6969b on 18 November 2015 - 10:56 PM

Guess what.
The visual studio 2013 community already got a 3d modeller built-in
I don't even need to pay for a 3d asset converter and anything like that.
It is as easy as that
 

Attached Thumbnails

  • 2015_11_19_12_53_06_Operator2.FBX_Microsoft_Visual_Studio.png



#5256144 Map/Hash a range of D3DXVECTOR3 into a grid space?

Posted by lucky6969b on 07 October 2015 - 10:20 PM

I am puzzled where the unordered_map should be sparsed and a range of D3DXVECTOR3 should map
into this space.
But this statement just won't work

// this thing doesn't work
tileMap.insert(ptVec.begin(), ptVec.end());



#include "stdafx.h"
#include <d3dx9.h>
#include "NavmeshSingleton.h"
#include "navmesher.h"
#include <boost/functional/hash.hpp>
#include <unordered_map>
#include <iostream>

using namespace std;

struct cPoint {
public:
    cPoint() { }
    cPoint(const cPoint& other) {
        this->id = other.id;
        this->x = other.x;
        this->z = other.z;
        this->vec3 = other.vec3;
    }
    cPoint(const QuadNode& other) {
        this->id = other.Index;
        this->x = other.x;
        this->z = other.z;        

    }
 
    int id;
    int x;
    int z;
    D3DXVECTOR3 vec3;
};



struct D3DXVec3KeyHasher {
public:
    std::size_t operator()(const D3DXVECTOR3 &vec3) const
    {
        std::size_t seed = 0;
        //boost::hash_combine(seed, x.from);
        //boost::hash_combine(seed, x.to);
        float fXInc = NavmeshSingleton::GetNavMesher()->GetXInc();
        float fZInc = NavmeshSingleton::GetNavMesher()->GetZInc();

        const D3DXVECTOR3& bmin = NavmeshSingleton::GetNavMesher()->GetMin();
        const D3DXVECTOR3& bmax = NavmeshSingleton::GetNavMesher()->GetMax();

        // -30 - (-30) / 10 = 0
        // -29 - (-30) / 10 = 0.1xx =>floor => 0

        int newX = std::floor((vec3.x - bmin.x) / fXInc);
        int newZ = std::floor((bmin.z - vec3.z) / fZInc);

        boost::hash_combine(seed, newX);
        boost::hash_combine(seed, newZ);

        return seed;
    }
};

int _tmain(int argc, _TCHAR* argv[])
{
    std::unordered_map<D3DXVECTOR3, cPoint*, D3DXVec3KeyHasher> tileMap;
    std::vector<QuadNode*> walkables = NavmeshSingleton::GetNavMesher()->GetWalkables();    

    std::vector<cPoint*> ptVec;
    for (auto& w : walkables) {        
        cPoint* pt = new cPoint(*w);
        ptVec.push_back(pt);
    }
        // this thing doesn't work
    tileMap.insert(ptVec.begin(), ptVec.end());

    for (auto& t : tileMap) {
        cout << "t x:" << t.second->x << " z:" << t.second->z << endl;
        getchar();
    }

    // Test hashing
    D3DXVECTOR3 testVec3;
    testVec3.x = 0;
    testVec3.z = 0;

    cPoint* pt = tileMap[testVec3];

    cout << "pt x:" << pt->x << " z:" << pt->z << endl;

    
    return 0;
}



#5238306 How to run a DX8 application on windows 7 64-bit

Posted by lucky6969b on 03 July 2015 - 10:53 PM

Yes, the IDE does work on windows 7, choose compatibility option and make it compatible with XP Service Pack 2 or up.

All of the programs work normally under this environment without problems.

Do you know where can I get those activex dlls?

Thanks

Jack




#5233786 CMake for ogitor

Posted by lucky6969b on 09 June 2015 - 07:11 AM

http://www.ogitor.org/wiki/getting_started/building_ogitor/windows

 

I think I must follow this route... Try that tomorrow, have to go now.

Thanks

Jack




#5231610 Getting move back direction from an orientation matrix?

Posted by lucky6969b on 29 May 2015 - 01:02 AM

Thanks man






PARTNERS