mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
Compile PandAI with ppremake
This commit is contained in:
parent
bd5e89e4a5
commit
fc4b36b1ec
82
contrib/src/ai/Sources.pp
Executable file
82
contrib/src/ai/Sources.pp
Executable file
@ -0,0 +1,82 @@
|
|||||||
|
#define LOCAL_LIBS contribbase
|
||||||
|
#define BUILDING_DLL BUILDING_PANDAAI
|
||||||
|
|
||||||
|
#define OTHER_LIBS \
|
||||||
|
panda:c \
|
||||||
|
express:c putil:c pandabase:c pandaexpress:m \
|
||||||
|
interrogatedb:c prc:c dconfig:c dtoolconfig:m \
|
||||||
|
dtoolutil:c dtoolbase:c dtool:m
|
||||||
|
|
||||||
|
#begin lib_target
|
||||||
|
#define TARGET pandaai
|
||||||
|
|
||||||
|
#define COMBINED_SOURCES ai_composite1.cxx
|
||||||
|
|
||||||
|
#define SOURCES \
|
||||||
|
aiBehaviors.h \
|
||||||
|
aiCharacter.h \
|
||||||
|
aiGlobals.h \
|
||||||
|
aiNode.h \
|
||||||
|
aiPathFinder.h \
|
||||||
|
aiWorld.h \
|
||||||
|
arrival.h \
|
||||||
|
config_ai.h \
|
||||||
|
evade.h \
|
||||||
|
flee.h \
|
||||||
|
flock.h \
|
||||||
|
globals.h \
|
||||||
|
meshNode.h \
|
||||||
|
obstacleAvoidance.h \
|
||||||
|
pathFind.h \
|
||||||
|
pathFollow.h \
|
||||||
|
pursue.h \
|
||||||
|
seek.h \
|
||||||
|
wander.h
|
||||||
|
|
||||||
|
#define INCLUDED_SOURCES \
|
||||||
|
aiBehaviors.cxx \
|
||||||
|
aiCharacter.cxx \
|
||||||
|
aiNode.cxx \
|
||||||
|
aiPathFinder.cxx \
|
||||||
|
aiWorld.cxx \
|
||||||
|
ai_composite.cxx \
|
||||||
|
ai_composite1.cxx \
|
||||||
|
arrival.cxx \
|
||||||
|
config_ai.cxx \
|
||||||
|
evade.cxx \
|
||||||
|
flee.cxx \
|
||||||
|
flock.cxx \
|
||||||
|
meshNode.cxx \
|
||||||
|
obstacleAvoidance.cxx \
|
||||||
|
pathFind.cxx \
|
||||||
|
pathFollow.cxx \
|
||||||
|
pursue.cxx \
|
||||||
|
seek.cxx \
|
||||||
|
wander.cxx
|
||||||
|
|
||||||
|
|
||||||
|
#define INSTALL_HEADERS \
|
||||||
|
aiBehaviors.h \
|
||||||
|
aiCharacter.h \
|
||||||
|
aiGlobals.h \
|
||||||
|
aiNode.h \
|
||||||
|
aiPathFinder.h \
|
||||||
|
aiWorld.h \
|
||||||
|
arrival.h \
|
||||||
|
config_ai.h \
|
||||||
|
evade.h \
|
||||||
|
flee.h \
|
||||||
|
flock.h \
|
||||||
|
globals.h \
|
||||||
|
meshNode.h \
|
||||||
|
obstacleAvoidance.h \
|
||||||
|
pathFind.h \
|
||||||
|
pathFollow.h \
|
||||||
|
pursue.h \
|
||||||
|
seek.h \
|
||||||
|
wander.h
|
||||||
|
|
||||||
|
#define IGATESCAN all
|
||||||
|
|
||||||
|
#end lib_target
|
||||||
|
|
@ -162,7 +162,7 @@ void AIBehaviors::accumulate_force(string force_type, LVecBase3f force) {
|
|||||||
// Function: calculate_prioritized
|
// Function: calculate_prioritized
|
||||||
// Description: This function updates the main steering force
|
// Description: This function updates the main steering force
|
||||||
// for the ai character using the accumulate function
|
// for the ai character using the accumulate function
|
||||||
// and checks for max force and arrival force.
|
// and checks for max force and arrival force.
|
||||||
// It finally returns this steering force which is
|
// It finally returns this steering force which is
|
||||||
// accessed by the update function in the AICharacter
|
// accessed by the update function in the AICharacter
|
||||||
// class.
|
// class.
|
||||||
@ -502,7 +502,7 @@ void AIBehaviors::pause_ai(string ai_type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 8: {
|
case 8: {
|
||||||
if (BT_obstacle_avoidance != NULL) {
|
if (_obstacle_avoidance_obj != NULL) {
|
||||||
turn_off("obstacle_avoidance");
|
turn_off("obstacle_avoidance");
|
||||||
turn_off("obstacle_avoidance_activate");
|
turn_off("obstacle_avoidance_activate");
|
||||||
}
|
}
|
||||||
@ -670,7 +670,7 @@ void AIBehaviors::flee(LVecBase3f pos, double panic_distance,
|
|||||||
// Function: pursue
|
// Function: pursue
|
||||||
// Description: This function activates pursue.
|
// Description: This function activates pursue.
|
||||||
// This is the function we want the user to call
|
// This is the function we want the user to call
|
||||||
// for pursue to be done.
|
// for pursue to be done.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void AIBehaviors::pursue(NodePath target_object, float pursue_wt) {
|
void AIBehaviors::pursue(NodePath target_object, float pursue_wt) {
|
||||||
_pursue_obj = new Pursue(_ai_char, target_object, pursue_wt);
|
_pursue_obj = new Pursue(_ai_char, target_object, pursue_wt);
|
||||||
@ -683,7 +683,7 @@ void AIBehaviors::pursue(NodePath target_object, float pursue_wt) {
|
|||||||
// Description: This function activates evade_activate.
|
// Description: This function activates evade_activate.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void AIBehaviors::evade(NodePath target_object, double panic_distance,
|
void AIBehaviors::evade(NodePath target_object, double panic_distance,
|
||||||
double relax_distance, float evade_wt) {
|
double relax_distance, float evade_wt) {
|
||||||
_evade_obj = new Evade(_ai_char, target_object, panic_distance, relax_distance, evade_wt);
|
_evade_obj = new Evade(_ai_char, target_object, panic_distance, relax_distance, evade_wt);
|
||||||
_evade_list.insert(_evade_list.end(), *_evade_obj);
|
_evade_list.insert(_evade_list.end(), *_evade_obj);
|
||||||
|
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
#ifndef AICHARACTER_H
|
#ifndef AICHARACTER_H
|
||||||
#define AICHARACTER_H
|
#define AICHARACTER_H
|
||||||
|
|
||||||
#include "aiBehaviors.h"
|
|
||||||
#include "aiWorld.h"
|
|
||||||
|
|
||||||
class AIBehaviors;
|
class AIBehaviors;
|
||||||
class AIWorld;
|
class AIWorld;
|
||||||
|
|
||||||
@ -31,7 +28,7 @@ class AIWorld;
|
|||||||
// update.
|
// update.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class AICharacter {
|
class AICharacter {
|
||||||
public:
|
public:
|
||||||
double _mass;
|
double _mass;
|
||||||
double _max_force;
|
double _max_force;
|
||||||
LVecBase3f _velocity;
|
LVecBase3f _velocity;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
// on the mesh.
|
// on the mesh.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class AINode {
|
class AINode {
|
||||||
public:
|
PUBLISHED:
|
||||||
// This variable specifies whether the node is an obtacle or not.
|
// This variable specifies whether the node is an obtacle or not.
|
||||||
// Used for dynamic obstacle addition to the environment.
|
// Used for dynamic obstacle addition to the environment.
|
||||||
// obstacle = false
|
// obstacle = false
|
||||||
|
@ -32,7 +32,7 @@ AINode* find_in_mesh(NavMesh nav_mesh, LVecBase3f pos, int grid_size);
|
|||||||
// calculated using the manhattan method.
|
// calculated using the manhattan method.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class PathFinder {
|
class PathFinder {
|
||||||
public:
|
PUBLISHED:
|
||||||
AINode *_src_node;
|
AINode *_src_node;
|
||||||
AINode *_dest_node;
|
AINode *_dest_node;
|
||||||
vector<AINode*> _open_list;
|
vector<AINode*> _open_list;
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
////////////////////////////////////////////////////////////////////////
|
// Filename: globals.h
|
||||||
//! Filename : globals.h
|
// Created by: Deepak, John, Navin (26Apr10)
|
||||||
//! Created by : Deepak, John, Navin
|
//
|
||||||
//! Date: 8 Sep 09
|
////////////////////////////////////////////////////////////////////
|
||||||
//!
|
//
|
||||||
////////////////////////////////////////////////////////////////////////
|
// PANDA 3D SOFTWARE
|
||||||
//!
|
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||||
//! PANDA3D SOFTWARE
|
//
|
||||||
//! Copyright(c) Carnegie Mellon University. All rights reserved.
|
// All use of this software is subject to the terms of the revised BSD
|
||||||
//!
|
// license. You should have received a copy of this license along
|
||||||
//! All use of this software is subjest to the terms of the revised BSD
|
// with this source code in a file named "LICENSE."
|
||||||
//! license. You should have received a copy of this license along with this source code in a file named "LICENSE"
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma warning (disable:4996)
|
#pragma warning (disable:4996)
|
||||||
#pragma warning (disable:4005)
|
#pragma warning (disable:4005)
|
||||||
#pragma warning(disable:4275)
|
#pragma warning (disable:4275)
|
||||||
|
|
||||||
#ifndef _GLOBALS_H
|
#ifndef _GLOBALS_H
|
||||||
#define _GLOBALS_H
|
#define _GLOBALS_H
|
||||||
|
@ -4,64 +4,64 @@
|
|||||||
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
//!
|
// Class : Node
|
||||||
//! Class : Node
|
// Description : This class is used to assign the nodes on the mesh.
|
||||||
//! Description : This class is used to assign the nodes on the mesh. It holds all the data necessary to
|
// It holds all the data necessary to compute A*
|
||||||
//! compute A* algorithm. It also maintains a lot of vital information such as the neighbor
|
// algorithm. It also maintains a lot of vital
|
||||||
//! nodes of each node and also its position on the mesh.
|
// information such as the neighbor nodes of each
|
||||||
//! Note: The Mesh Generator which is a stand alone tool makes use of this class to generate the nodes on the
|
// node and also its position on the mesh.
|
||||||
//! mesh.
|
// Note: the Mesh Generator which is a stand alone
|
||||||
|
// tool makes use of this class to generate the nodes
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
// on the mesh.
|
||||||
|
///////////////////////////////////////////////////////////////////
|
||||||
class Node {
|
class Node {
|
||||||
public:
|
public:
|
||||||
// This variable specifies whether the node is an obtacle or not.
|
// This variable specifies whether the node is an obtacle or not.
|
||||||
// Used for dynamic obstacle addition to the environment.
|
// Used for dynamic obstacle addition to the environment.
|
||||||
// obstacle = false
|
// obstacle = false
|
||||||
// navigational = true
|
// navigational = true
|
||||||
bool _type;
|
bool _type;
|
||||||
|
|
||||||
// This variable specifies the node status whether open, close or neutral.
|
// This variable specifies the node status whether open, close or neutral.
|
||||||
// open = belongs to _open_list.
|
// open = belongs to _open_list.
|
||||||
// close = belongs to _closed_list.
|
// close = belongs to _closed_list.
|
||||||
// neutral = unexamined node.
|
// neutral = unexamined node.
|
||||||
enum Status {
|
enum Status {
|
||||||
open,
|
open,
|
||||||
close,
|
close,
|
||||||
neutral
|
neutral
|
||||||
};
|
};
|
||||||
Status _status;
|
Status _status;
|
||||||
|
|
||||||
// The score is used to compute the traversal expense to nodes when using A*.
|
// The score is used to compute the traversal expense to nodes when using A*.
|
||||||
// _score = _cost + heuristic
|
// _score = _cost + heuristic
|
||||||
int _score;
|
int _score;
|
||||||
int _cost;
|
int _cost;
|
||||||
int _heuristic;
|
int _heuristic;
|
||||||
|
|
||||||
// Used to trace back the path after it is generated using A*.
|
// Used to trace back the path after it is generated using A*.
|
||||||
Node *_prv_node;
|
Node *_prv_node;
|
||||||
|
|
||||||
// Position of the node in the 2d grid.
|
// Position of the node in the 2d grid.
|
||||||
int _grid_x, _grid_y;
|
int _grid_x, _grid_y;
|
||||||
|
|
||||||
// Position of the node in 3D space.
|
// Position of the node in 3D space.
|
||||||
LVecBase3f _position;
|
LVecBase3f _position;
|
||||||
|
|
||||||
// Dimensions of each face / cell on the mesh.
|
// Dimensions of each face / cell on the mesh.
|
||||||
// Height is given in case of expansion to a 3d mesh. Currently not used.
|
// Height is given in case of expansion to a 3d mesh. Currently not used.
|
||||||
float _width, _length ,_height;
|
float _width, _length ,_height;
|
||||||
Node *_neighbours[8]; // anti-clockwise from top left corner.
|
Node *_neighbours[8]; // anti-clockwise from top left corner.
|
||||||
|
|
||||||
// The _next pointer is used for traversal during mesh generation from the model.
|
// The _next pointer is used for traversal during mesh generation from the model.
|
||||||
// Note: The data in this member is discarded when mesh data is written into navmesh.csv file.
|
// Note: The data in this member is discarded when mesh data is written into navmesh.csv file.
|
||||||
Node *_next;
|
Node *_next;
|
||||||
|
|
||||||
Node(int grid_x, int grid_y, LVecBase3f pos, float w, float l, float h);
|
Node(int grid_x, int grid_y, LVecBase3f pos, float w, float l, float h);
|
||||||
~Node();
|
~Node();
|
||||||
|
|
||||||
bool contains(float x, float y);
|
bool contains(float x, float y);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
13
contrib/src/contribbase/Sources.pp
Normal file
13
contrib/src/contribbase/Sources.pp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
|
||||||
|
dtoolutil:c dtoolbase:c dtool:m prc:c
|
||||||
|
|
||||||
|
#begin lib_target
|
||||||
|
#define TARGET contribbase
|
||||||
|
|
||||||
|
#define SOURCES \
|
||||||
|
contribbase.cxx contribbase.h contribsymbols.h \
|
||||||
|
|
||||||
|
#define INSTALL_HEADERS \
|
||||||
|
contribbase.h contribbase.h
|
||||||
|
|
||||||
|
#end lib_target
|
15
contrib/src/contribbase/contribbase.cxx
Normal file
15
contrib/src/contribbase/contribbase.cxx
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Filename: contribbase.cxx
|
||||||
|
// Created by: rdb (26Apr10)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the revised BSD
|
||||||
|
// license. You should have received a copy of this license along
|
||||||
|
// with this source code in a file named "LICENSE."
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "contribbase.h"
|
Loading…
x
Reference in New Issue
Block a user