mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
weights generation first commit
This commit is contained in:
+1
-1
@@ -254,7 +254,7 @@ namespace battleship{
|
||||
|
||||
vector<Ray::CollisionResult> results;
|
||||
Vector3 rayDir = (endPos - camPos).norm();
|
||||
Ray::retrieveCollisions(camPos, rayDir, map->getWaterNode(), results);
|
||||
Ray::retrieveCollisions(camPos, rayDir, map->getNodeParent(), results);
|
||||
std::map<Node*, Unit*> unitData;
|
||||
|
||||
Ray::sortResults(results);
|
||||
|
||||
@@ -66,6 +66,7 @@ namespace battleship{
|
||||
mat->addTexUniform("textures[0]", t, true);
|
||||
model->setMaterial(mat);
|
||||
root->getRootNode()->attachChild(model);
|
||||
nodeParent->attachChild(model);
|
||||
}
|
||||
|
||||
void Map::loadWaterbodies(LuaManager *luaManager){
|
||||
@@ -89,7 +90,7 @@ namespace battleship{
|
||||
mat->addTexUniform("textures[0]", t, true);
|
||||
quad->setMaterial(mat);
|
||||
|
||||
waterNode = new Node();
|
||||
Node *waterNode = new Node();
|
||||
waterNode->attachMesh(quad);
|
||||
root->getRootNode()->attachChild(waterNode);
|
||||
float posX = luaManager->getFloatFromTable(table, vector<Index>{Index("posX", true)});
|
||||
@@ -97,6 +98,7 @@ namespace battleship{
|
||||
float posZ = luaManager->getFloatFromTable(table, vector<Index>{Index("posZ", true)});
|
||||
waterNode->setPosition(Vector3(posX, posY, posZ));
|
||||
waterNode->setOrientation(Quaternion(-1.57, Vector3::VEC_I));
|
||||
nodeParent->attachChild(waterNode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,13 +106,15 @@ namespace battleship{
|
||||
LuaManager *luaManager = LuaManager::getSingleton();
|
||||
luaManager->buildScript(vector<string>{GameManager::getSingleton()->getPath() + "Models/Maps/" + mapName + "/" + mapName + ".lua"});
|
||||
|
||||
nodeParent = new Node();
|
||||
Root *root = Root::getSingleton();
|
||||
root->getRootNode()->attachChild(nodeParent);
|
||||
|
||||
loadSkybox(luaManager);
|
||||
loadTerrain(luaManager);
|
||||
loadWaterbodies(luaManager);
|
||||
|
||||
generateCells();
|
||||
|
||||
Camera *cam = Root::getSingleton()->getCamera();
|
||||
Camera *cam = root->getCamera();
|
||||
cam->setPosition(Vector3(1, 1, 1) * 10);
|
||||
cam->lookAt(Vector3(-1, -1, -1).norm(), Vector3(-1, 1, -1).norm());
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ namespace battleship{
|
||||
void update();
|
||||
void load();
|
||||
void unload();
|
||||
inline vb01::Node* getWaterNode(){return waterNode;}
|
||||
inline vb01::Node* getNodeParent(){return nodeParent;}
|
||||
private:
|
||||
vb01::Node *waterNode = nullptr;
|
||||
vb01::Node *nodeParent = nullptr;
|
||||
std::string mapName;
|
||||
float cellSize = 1;
|
||||
GraphNode*** cells = nullptr;
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace battleship{
|
||||
vertStrich = i;
|
||||
initVertStrichSet = true;
|
||||
}
|
||||
|
||||
if(initVertStrichSet && (distances[vertStrich] > distances[i]))
|
||||
vertStrich = i;
|
||||
}
|
||||
@@ -60,4 +61,7 @@ namespace battleship{
|
||||
|
||||
return paths[dest];
|
||||
}
|
||||
|
||||
void Pathfinder::generateWeights(u32 **weights, int &size, Vector3* verts[], Vector2 mapSize){
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace battleship{
|
||||
public:
|
||||
static Pathfinder* getSingleton();
|
||||
std::vector<int> findPath(vb01::u32**, int, int, int);
|
||||
void generateWeights(vb01::u32**, int&, vb01::Vector3*[], vb01::Vector2);
|
||||
private:
|
||||
Pathfinder();
|
||||
};
|
||||
|
||||
@@ -41,6 +41,9 @@ namespace battleship{
|
||||
CPPUNIT_ASSERT(sumPathWeights == 9);
|
||||
}
|
||||
|
||||
void PathfinderTest::testGenerateWeights(){
|
||||
}
|
||||
|
||||
void PathfinderTest::setUp(){
|
||||
pathfinder = Pathfinder::getSingleton();
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace battleship{
|
||||
public:
|
||||
PathfinderTest(){}
|
||||
void testFindPath();
|
||||
void testGenerateWeights();
|
||||
void setUp();
|
||||
void tearDown();
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user