diff --git a/contrib/src/ai/aiBehaviors.cxx b/contrib/src/ai/aiBehaviors.cxx index f629c0599c..3981c6991b 100644 --- a/contrib/src/ai/aiBehaviors.cxx +++ b/contrib/src/ai/aiBehaviors.cxx @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : aiBehaviors.cxx -// Created by : Deepak, John, Navin -// Date : 8 Sep 09 +// Filename: aiBehaviors.cxx +// Created by: Deepak, John, Navin (08Sep09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -48,15 +47,12 @@ AIBehaviors::~AIBehaviors() { } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : is_conflict -// Description : Checks for conflict between steering forces. -// If there is a conflict it returns 'true' and sets _conflict to 'true'. -// If there is no conflict it returns 'false' and sets _conflict to 'false'. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: is_conflict +// Description: Checks for conflict between steering forces. +// If there is a conflict it returns 'true' and sets _conflict to 'true'. +// If there is no conflict it returns 'false' and sets _conflict to 'false'. +//////////////////////////////////////////////////////////////////// bool AIBehaviors::is_conflict() { int value = int(is_on(_seek)) + int(is_on(_flee)) + int(is_on(_pursue)) + int(is_on(_evade)) + int(is_on(_wander)) + int(is_on(_flock))+ int(is_on(_obstacle_avoidance)); @@ -102,14 +98,12 @@ bool AIBehaviors::is_conflict() { return false; } -///////////////////////////////////////////////////////////////////////////////////////////////////// -// -// Function : accumulate_force -// Description : This function updates the individual steering forces for each of the ai characters. -// These accumulated forces are eventually what comprise the resultant -// steering force of the character. - -///////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: accumulate_force +// Description: This function updates the individual steering forces for each of the ai characters. +// These accumulated forces are eventually what comprise the resultant +// steering force of the character. +//////////////////////////////////////////////////////////////////// void AIBehaviors::accumulate_force(string force_type, LVecBase3 force) { @@ -159,15 +153,13 @@ void AIBehaviors::accumulate_force(string force_type, LVecBase3 force) { } -////////////////////////////////////////////////////////////////////////////////////////////// -// -// Function : calculate_prioritized -// Description : This function updates the main steering force for the ai character using -// the accumulate function and checks for max force and arrival force. -// It finally returns this steering force which is accessed by the update -// function in the AICharacter class. - -////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: calculate_prioritized +// Description: This function updates the main steering force for the ai character using +// the accumulate function and checks for max force and arrival force. +// It finally returns this steering force which is accessed by the update +// function in the AICharacter class. +//////////////////////////////////////////////////////////////////// LVecBase3 AIBehaviors::calculate_prioritized() { LVecBase3 force; @@ -313,14 +305,10 @@ LVecBase3 AIBehaviors::calculate_prioritized() { return _steering_force; } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : remove_ai -// Description : This function removes individual or all the AIs. - -///////////////////////////////////////////////////////////////////////////////// - -//add for path follow +//////////////////////////////////////////////////////////////////// +// Function: remove_ai +// Description: This function removes individual or all the AIs. +//////////////////////////////////////////////////////////////////// void AIBehaviors::remove_ai(string ai_type) { switch(char_to_int(ai_type)) { case 0: { @@ -434,14 +422,10 @@ void AIBehaviors::remove_ai(string ai_type) { } } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : pause_ai -// Description : This function pauses individual or all the AIs. - -///////////////////////////////////////////////////////////////////////////////// - -//add for path follow +//////////////////////////////////////////////////////////////////// +// Function: pause_ai +// Description: This function pauses individual or all the AIs. +//////////////////////////////////////////////////////////////////// void AIBehaviors::pause_ai(string ai_type) { switch(char_to_int(ai_type)) { case 0: { @@ -537,13 +521,10 @@ void AIBehaviors::pause_ai(string ai_type) { } } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : resume_ai -// Description : This function resumes individual or all the AIs - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: resume_ai +// Description: This function resumes individual or all the AIs +//////////////////////////////////////////////////////////////////// void AIBehaviors::resume_ai(string ai_type) { switch(char_to_int(ai_type)) { case 0: { @@ -634,15 +615,12 @@ void AIBehaviors::resume_ai(string ai_type) { } } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : seek -// Description : This function activates seek and makes an object of the Seek class. -// This is the function we want the user to call for seek to be done. -// This function is overloaded to accept a NodePath or an LVecBase3. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: seek +// Description: This function activates seek and makes an object of the Seek class. +// This is the function we want the user to call for seek to be done. +// This function is overloaded to accept a NodePath or an LVecBase3. +//////////////////////////////////////////////////////////////////// void AIBehaviors::seek(NodePath target_object, float seek_wt) { _seek_obj = new Seek(_ai_char, target_object, seek_wt); turn_on("seek"); @@ -653,14 +631,11 @@ void AIBehaviors::seek(LVecBase3 pos, float seek_wt) { turn_on("seek"); } -////////////////////////////////////////////////////////////////////////////////////////////////// -// -// Function : flee -// Description : This function activates flee_activate and creates an object of the Flee class. -// This function is overloaded to accept a NodePath or an LVecBase3. - -////////////////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: flee +// Description: This function activates flee_activate and creates an object of the Flee class. +// This function is overloaded to accept a NodePath or an LVecBase3. +//////////////////////////////////////////////////////////////////// void AIBehaviors::flee(NodePath target_object, double panic_distance, double relax_distance, float flee_wt) { _flee_obj = new Flee(_ai_char, target_object, panic_distance, relax_distance, flee_wt); _flee_list.insert(_flee_list.end(), *_flee_obj); @@ -675,27 +650,21 @@ void AIBehaviors::flee(LVecBase3 pos, double panic_distance, double relax_distan turn_on("flee_activate"); } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : pursue -// Description : This function activates pursue. -// This is the function we want the user to call for pursue to be done. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: pursue +// Description: This function activates pursue. +// This is the function we want the user to call for pursue to be done. +//////////////////////////////////////////////////////////////////// void AIBehaviors::pursue(NodePath target_object, float pursue_wt) { _pursue_obj = new Pursue(_ai_char, target_object, pursue_wt); turn_on("pursue"); } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : evade -// Description : This function activates evade_activate. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: evade +// Description: This function activates evade_activate. +//////////////////////////////////////////////////////////////////// void AIBehaviors::evade(NodePath target_object, double panic_distance, double relax_distance, float evade_wt) { _evade_obj = new Evade(_ai_char, target_object, panic_distance, relax_distance, evade_wt); _evade_list.insert(_evade_list.end(), *_evade_obj); @@ -703,14 +672,11 @@ void AIBehaviors::evade(NodePath target_object, double panic_distance, double re turn_on("evade_activate"); } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : arrival -// Description : This function activates arrival. -// This is the function we want the user to call for arrival to be done. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: arrival +// Description: This function activates arrival. +// This is the function we want the user to call for arrival to be done. +//////////////////////////////////////////////////////////////////// void AIBehaviors::arrival(double distance) { if(_pursue_obj) { _arrival_obj = new Arrival(_ai_char, distance); @@ -727,14 +693,11 @@ void AIBehaviors::arrival(double distance) { } } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : flock -// Description : This function activates flock. -// This is the function we want the user to call for flock to be done. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: flock +// Description: This function activates flock. +// This is the function we want the user to call for flock to be done. +//////////////////////////////////////////////////////////////////// void AIBehaviors::flock(float flock_wt) { _flock_weight = flock_wt; @@ -742,14 +705,11 @@ void AIBehaviors::flock(float flock_wt) { turn_on("flock_activate"); } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : flock_activate -// Description : This function checks whether any other behavior exists to work with flock. -// When this is true, it calls the do_flock function. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: flock_activate +// Description: This function checks whether any other behavior exists to work with flock. +// When this is true, it calls the do_flock function. +//////////////////////////////////////////////////////////////////// void AIBehaviors::flock_activate() { if(is_on(_seek) || is_on(_flee) || is_on(_pursue) || is_on(_evade) || is_on(_wander)) { turn_off("flock_activate"); @@ -757,18 +717,15 @@ void AIBehaviors::flock_activate() { } } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : do_flock -// Description : This function contains the logic for flocking behavior. This is -// an emergent behavior and is obtained by combining three other -// behaviors which are separation, cohesion and alignment based on -// Craig Reynold's algorithm. Also, this behavior does not work by -// itself. It works only when combined with other steering behaviors -// such as wander, pursue, evade, seek and flee. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: do_flock +// Description: This function contains the logic for flocking behavior. This is +// an emergent behavior and is obtained by combining three other +// behaviors which are separation, cohesion and alignment based on +// Craig Reynold's algorithm. Also, this behavior does not work by +// itself. It works only when combined with other steering behaviors +// such as wander, pursue, evade, seek and flee. +//////////////////////////////////////////////////////////////////// LVecBase3 AIBehaviors::do_flock() { //! Initialize variables required to compute the flocking force on the ai char. @@ -839,141 +796,109 @@ LVecBase3 AIBehaviors::do_flock() { + cohesion_force * _flock_group->_cohesion_wt); } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : wander -// Description : This function activates wander. +//////////////////////////////////////////////////////////////////// +// Function: wander +// Description: This function activates wander. // This is the function we want the user to call for flock to be done. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// void AIBehaviors::wander(double wander_radius, int flag, double aoe, float wander_weight) { _wander_obj = new Wander(_ai_char, wander_radius, flag, aoe, wander_weight); turn_on("wander"); } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : obstacle avoidance -// Description : This function activates obstacle avoidance for a given character. +//////////////////////////////////////////////////////////////////// +// Function: obstacle avoidance +// Description: This function activates obstacle avoidance for a given character. // This is the function we want the user to call for // obstacle avoidance to be performed. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// void AIBehaviors::obstacle_avoidance(float obstacle_avoidance_weight) { _obstacle_avoidance_obj = new ObstacleAvoidance(_ai_char, obstacle_avoidance_weight); turn_on("obstacle_avoidance_activate"); } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : path_follow -// Description : This function activates path following. -// This is the function we want the user to call for path following. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: path_follow +// Description: This function activates path following. +// This is the function we want the user to call for path following. +//////////////////////////////////////////////////////////////////// void AIBehaviors::path_follow(float follow_wt) { _path_follow_obj = new PathFollow(_ai_char, follow_wt); } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : add_to_path -// Description : This function adds positions to the path to follow. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: add_to_path +// Description: This function adds positions to the path to follow. +//////////////////////////////////////////////////////////////////// void AIBehaviors::add_to_path(LVecBase3 pos) { _path_follow_obj->add_to_path(pos); } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : start_follow -// Description : This function starts the path follower. - -///////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: start_follow +// Description: This function starts the path follower. +//////////////////////////////////////////////////////////////////// void AIBehaviors::start_follow(string type) { _path_follow_obj->start(type); } -///////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: init_path_find +// Description: This function activates path finding in the character. +// This function accepts the meshdata in .csv format. // -// Function : init_path_find -// Description : This function activates path finding in the character. -// This function accepts the meshdata in .csv format. -// - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// void AIBehaviors::init_path_find(const char* navmesh_filename) { _path_find_obj = new PathFind(_ai_char); _path_find_obj->set_path_find(navmesh_filename); } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : path_find_to (for pathfinding towards a static position) -// Description : This function checks for the source and target in the navigation mesh -// for its availability and then finds the best path via the A* algorithm -// Then it calls the path follower to make the object follow the path. - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: path_find_to (for pathfinding towards a static position) +// Description: This function checks for the source and target in the navigation mesh +// for its availability and then finds the best path via the A* algorithm +// Then it calls the path follower to make the object follow the path. +//////////////////////////////////////////////////////////////////// void AIBehaviors::path_find_to(LVecBase3 pos, string type) { _path_find_obj->path_find(pos, type); } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : path_find_to (for pathfinding towards a moving target (a NodePath)) -// Description : This function checks for the source and target in the navigation mesh -// for its availability and then finds the best path via the A* algorithm -// Then it calls the path follower to make the object follow the path. - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: path_find_to (for pathfinding towards a moving target (a NodePath)) +// Description: This function checks for the source and target in the navigation mesh +// for its availability and then finds the best path via the A* algorithm +// Then it calls the path follower to make the object follow the path. +//////////////////////////////////////////////////////////////////// void AIBehaviors::path_find_to(NodePath target, string type) { _path_find_obj->path_find(target, type); } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : add_static_obstacle -// Description : This function allows the user to dynamically add obstacles to the -// game environment. The function will update the nodes within the -// bounding volume of the obstacle as non-traversable. Hence will not be -// considered by the pathfinding algorithm. - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: add_static_obstacle +// Description: This function allows the user to dynamically add obstacles to the +// game environment. The function will update the nodes within the +// bounding volume of the obstacle as non-traversable. Hence will not be +// considered by the pathfinding algorithm. +//////////////////////////////////////////////////////////////////// void AIBehaviors::add_static_obstacle(NodePath obstacle) { _path_find_obj->add_obstacle_to_mesh(obstacle); } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : add_dynamic_obstacle -// Description : This function starts the pathfinding obstacle navigation for the -// passed in obstacle. - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: add_dynamic_obstacle +// Description: This function starts the pathfinding obstacle navigation for the +// passed in obstacle. +//////////////////////////////////////////////////////////////////// void AIBehaviors::add_dynamic_obstacle(NodePath obstacle) { _path_find_obj->dynamic_avoid(obstacle); } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : behavior_status -// Description : This function returns the status of an AI Type whether it is active, -// paused or disabled. It returns -1 if an invalid string is passed. - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: behavior_status +// Description: This function returns the status of an AI Type whether it is active, +// paused or disabled. It returns -1 if an invalid string is passed. +//////////////////////////////////////////////////////////////////// string AIBehaviors::behavior_status(string ai_type) { switch(char_to_int(ai_type)) { case 1: @@ -1188,14 +1113,11 @@ string AIBehaviors::behavior_status(string ai_type) { } } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : char_to_int -// Description : This function is used to derive int values from the ai types strings. -// Returns -1 if an invalid string is passed. - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: char_to_int +// Description: This function is used to derive int values from the ai types strings. +// Returns -1 if an invalid string is passed. +//////////////////////////////////////////////////////////////////// int AIBehaviors::char_to_int(string ai_type) { if(ai_type == "all") { return 0; @@ -1252,13 +1174,10 @@ int AIBehaviors::char_to_int(string ai_type) { return -1; } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : turn_on -// Description : This function turns on any aiBehavior which is passed as a string. - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: turn_on +// Description: This function turns on any aiBehavior which is passed as a string. +//////////////////////////////////////////////////////////////////// void AIBehaviors::turn_on(string ai_type) { switch(char_to_int(ai_type)) { case 1: { @@ -1318,13 +1237,10 @@ void AIBehaviors::turn_on(string ai_type) { } } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : turn_off -// Description : This function turns off any aiBehavior which is passed as a string. - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: turn_off +// Description: This function turns off any aiBehavior which is passed as a string. +//////////////////////////////////////////////////////////////////// void AIBehaviors::turn_off(string ai_type) { switch(char_to_int(ai_type)) { case 1: { @@ -1426,24 +1342,18 @@ switch(char_to_int(ai_type)) { } } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : is_on -// Description : This function returns true if an aiBehavior is on - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: is_on +// Description: This function returns true if an aiBehavior is on +//////////////////////////////////////////////////////////////////// bool AIBehaviors::is_on(_behavior_type bt) { return (_behaviors_flags & bt) == bt; } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : is_on -// Description : This function returns true if pathfollow or pathfinding is on - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: is_on +// Description: This function returns true if pathfollow or pathfinding is on +//////////////////////////////////////////////////////////////////// bool AIBehaviors::is_on(string ai_type) { if(ai_type == "pathfollow") { if(_path_follow_obj) { @@ -1466,24 +1376,18 @@ bool AIBehaviors::is_on(string ai_type) { return false; } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : is_off -// Description : This function returns true if an aiBehavior is off - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: is_off +// Description: This function returns true if an aiBehavior is off +//////////////////////////////////////////////////////////////////// bool AIBehaviors::is_off(_behavior_type bt) { return ((_behaviors_flags | bt) == bt); } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : is_off -// Description : This function returns true if pathfollow or pathfinding is off - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: is_off +// Description: This function returns true if pathfollow or pathfinding is off +//////////////////////////////////////////////////////////////////// bool AIBehaviors::is_off(string ai_type) { if(ai_type == "pathfollow") { if(_path_follow_obj && _path_follow_obj->_start) { diff --git a/contrib/src/ai/aiBehaviors.h b/contrib/src/ai/aiBehaviors.h index edba504662..e8e4207d1e 100644 --- a/contrib/src/ai/aiBehaviors.h +++ b/contrib/src/ai/aiBehaviors.h @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : aiBehaviors.cxx -// Created by : Deepak, John, Navin -// Date : 8 Sep 09 +// Filename: aiBehaviors.h +// Created by: Deepak, John, Navin (08Sep09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -22,18 +21,6 @@ #include "aiGlobals.h" -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// -// Class : AIBehaviors -// Description : This class implements all the steering behaviors of the AI framework, such as -// seek, flee, pursue, evade, wander and flock. Each steering behavior has a weight which is used when more than -// one type of steering behavior is acting on the same ai character. The weight decides the contribution of each -// type of steering behavior. The AICharacter class has a handle to an object of this class and this allows to -// invoke the steering behaviors via the AICharacter. This class also provides functionality such as pausing, resuming -// and removing the AI behaviors of an AI character at anytime. - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - class AICharacter; class Seek; class Flee; @@ -49,8 +36,16 @@ class ObstacleAvoidance; typedef list > ListFlee; typedef list > ListEvade; +//////////////////////////////////////////////////////////////////// +// Class : AIBehaviors +// Description : This class implements all the steering behaviors of the AI framework, such as +// seek, flee, pursue, evade, wander and flock. Each steering behavior has a weight which is used when more than +// one type of steering behavior is acting on the same ai character. The weight decides the contribution of each +// type of steering behavior. The AICharacter class has a handle to an object of this class and this allows to +// invoke the steering behaviors via the AICharacter. This class also provides functionality such as pausing, resuming +// and removing the AI behaviors of an AI character at anytime. +//////////////////////////////////////////////////////////////////// class EXPCL_PANDAAI AIBehaviors { - public: enum _behavior_type { _none = 0x00000, @@ -174,14 +169,3 @@ PUBLISHED: }; #endif - - - - - - - - - - - diff --git a/contrib/src/ai/aiCharacter.cxx b/contrib/src/ai/aiCharacter.cxx index fffa7ac2bb..b5c2736f56 100644 --- a/contrib/src/ai/aiCharacter.cxx +++ b/contrib/src/ai/aiCharacter.cxx @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : aiCharacter.cxx -// Created by : Deepak, John, Navin -// Date : 8 Sep 09 +// Filename: aiCharacter.cxx +// Created by: Deepak, John, Navin (08Sep09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -35,14 +34,13 @@ AICharacter::AICharacter(string model_name, NodePath model_np, double mass, doub AICharacter::~AICharacter() { } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : update -// Description : Each character's update will update its ai and physics -// based on his resultant steering force. -// This also makes the character look at the direction of the force. - -///////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: update +// Description: Each character's update will update its AI and +// physics based on his resultant steering force. +// This also makes the character look in the direction +// of the force. +//////////////////////////////////////////////////////////////////// void AICharacter:: update() { if (!_steering->is_off(_steering->_none)) { diff --git a/contrib/src/ai/aiCharacter.h b/contrib/src/ai/aiCharacter.h index f7af68a372..259518fe83 100644 --- a/contrib/src/ai/aiCharacter.h +++ b/contrib/src/ai/aiCharacter.h @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : aiCharacter.h -// Created by : Deepak, John, Navin -// Date : 8 Sep 09 +// Filename: aiCharacter.h +// Created by: Deepak, John, Navin (08Sep09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -23,15 +22,14 @@ #include "aiBehaviors.h" -//////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// -// Class : AICharacter -// Description : This class is used for creating the ai characters. It assigns both physics and ai -// attributes to the character. It also has an update function which updates the physics and ai -// of the character. This update function is called by the AIWorld update. - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Class : AICharacter +// Description : This class is used for creating the AI characters. +// It assigns both physics and AI attributes to the +// character. It also has an update function which +// updates the physics and AI of the character. +// This update function is called by the AIWorld update. +//////////////////////////////////////////////////////////////////// class AIBehaviors; class AIWorld; diff --git a/contrib/src/ai/aiGlobals.h b/contrib/src/ai/aiGlobals.h index 0732537ca2..29a0ac0ccc 100644 --- a/contrib/src/ai/aiGlobals.h +++ b/contrib/src/ai/aiGlobals.h @@ -1,7 +1,5 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : aiGlobals.h -// Created by : Deepak, John, Navin -// Date: 8 Sep 09 +// Filename: aiGlobals.h +// Created by: Deepak, John, Navin (08Sep09) // //////////////////////////////////////////////////////////////////// // diff --git a/contrib/src/ai/aiPathFinder.cxx b/contrib/src/ai/aiPathFinder.cxx index 789b587a7d..f465028ec3 100644 --- a/contrib/src/ai/aiPathFinder.cxx +++ b/contrib/src/ai/aiPathFinder.cxx @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : aiPathFinder.cxx -// Created by : Deepak, John, Navin -// Date : 10 Nov 09 +// Filename: aiPathFinder.cxx +// Created by: Deepak, John, Navin (10Nov09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -22,14 +21,11 @@ PathFinder::PathFinder(NavMesh nav_mesh) { PathFinder::~PathFinder() { } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : find_path -// Description : This function initializes the pathfinding process by accepting the +//////////////////////////////////////////////////////////////////// +// Function: find_path +// Description: This function initializes the pathfinding process by accepting the // source and destination nodes. It then calls the generate_path(). - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// void PathFinder::find_path(Node *src_node, Node *dest_node) { _src_node = src_node; _dest_node = dest_node; @@ -48,14 +44,11 @@ void PathFinder::find_path(Node *src_node, Node *dest_node) { generate_path(); } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : generate_path -// Description : This function performs the pathfinding process using the A* algorithm. +//////////////////////////////////////////////////////////////////// +// Function: generate_path +// Description: This function performs the pathfinding process using the A* algorithm. // It updates the openlist and closelist. - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// void PathFinder::generate_path() { // All the A* algorithm is implemented here. // The check is > 1 due to the existence of the dummy node. @@ -87,14 +80,11 @@ void PathFinder::generate_path() { _closed_list.clear(); } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : identify_neighbors -// Description : This function traverses through the 8 neigbors of the parent node and +//////////////////////////////////////////////////////////////////// +// Function: identify_neighbors +// Description: This function traverses through the 8 neigbors of the parent node and // then adds the neighbors to the _open_list based on A* criteria. - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// void PathFinder::identify_neighbors(Node *parent_node) { // Remove the parent node from the open_list so that it is not considered // while adding new nodes to the open list heap. @@ -114,30 +104,25 @@ void PathFinder::identify_neighbors(Node *parent_node) { } } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : calc_node_score -// Description : This function calculates the score of each node. +//////////////////////////////////////////////////////////////////// +// Function: calc_node_score +// Description: This function calculates the score of each node. // Score = Cost + Heuristics. - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// void PathFinder::calc_node_score(Node *nd) { nd->_cost = calc_cost_frm_src(nd); nd->_heuristic = calc_heuristic(nd); nd->_score = nd->_cost + nd->_heuristic; } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : calc_cost_frm_src -// Description : This function calculates the cost of each node by finding out -// the number of node traversals required to reach the source node. -// Diagonal traversals have cost = 14. -// Horizontal / Vertical traversals have cost = 10. - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: calc_cost_frm_src +// Description: This function calculates the cost of each node by +// finding out the number of node traversals required +// to reach the source node. Diagonal traversals have +// cost = 14. Horizontal and vertical traversals have +// cost = 10. +//////////////////////////////////////////////////////////////////// int PathFinder::calc_cost_frm_src(Node *nd) { int cost = 0; Node *start_node = nd; @@ -160,15 +145,14 @@ int PathFinder::calc_cost_frm_src(Node *nd) { return cost; } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : calc_heuristic -// Description : This function calculates the heuristic of the nodes using Manhattan method. -// All it does is predict the number of node traversals required to reach the target node. -// No diagonal traversals are allowed in this technique. - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: calc_heuristic +// Description: This function calculates the heuristic of the nodes +// using Manhattan method. All it does is predict the +// number of node traversals required to reach the +// target node. No diagonal traversals are allowed in +// this technique. +//////////////////////////////////////////////////////////////////// int PathFinder::calc_heuristic(Node *nd) { int row_diff = abs(_dest_node->_grid_x - nd->_grid_x); int col_diff = abs(_dest_node->_grid_y - nd->_grid_y); @@ -177,13 +161,10 @@ int PathFinder::calc_heuristic(Node *nd) { return heuristic; } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : is_diagonal_node -// Description : This function checks if the traversal from a node is diagonal. - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: is_diagonal_node +// Description: This function checks if the traversal from a node is diagonal. +//////////////////////////////////////////////////////////////////// bool PathFinder::is_diagonal_node(Node *nd) { // Calculate the row and column differences between child and parent nodes. float row_diff = nd->_grid_x - nd->_prv_node->_grid_x; @@ -198,15 +179,11 @@ bool PathFinder::is_diagonal_node(Node *nd) { } } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : add_to_olist -// Description : This function adds a node to the open list heap. +//////////////////////////////////////////////////////////////////// +// Function: add_to_olist +// Description: This function adds a node to the open list heap. // A binay heap is maintained to improve the search. - -///////////////////////////////////////////////////////////////////////////////////////// - - +//////////////////////////////////////////////////////////////////// void PathFinder::add_to_olist(Node *nd) { // Variables required to search the binary heap. Node *child_node, *parent_node; @@ -245,14 +222,11 @@ void PathFinder::add_to_olist(Node *nd) { // At this point the Node with the smallest score will be at the top of the heap. } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : remove_from_olist -// Description : This function removes a node from the open list. +//////////////////////////////////////////////////////////////////// +// Function: remove_from_olist +// Description: This function removes a node from the open list. // During the removal the binary heap is maintained. - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// void PathFinder::remove_from_olist() { // Variables for maintaining the binary heap. Node *child_node, *child_node_1, *child_node_2; @@ -340,13 +314,10 @@ void PathFinder::remove_from_olist() { // At this point the Node was succesfully removed and the binary heap re-arranged. } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : add_to_clist -// Description : This function adds a node to the closed list. - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: add_to_clist +// Description: This function adds a node to the closed list. +//////////////////////////////////////////////////////////////////// void PathFinder::add_to_clist(Node *nd) { // Set the status as closed. nd->_status = nd->close; @@ -354,13 +325,10 @@ void PathFinder::add_to_clist(Node *nd) { _closed_list.push_back(nd); } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : remove_from_clist -// Description : This function removes a node from the closed list. - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: remove_from_clist +// Description: This function removes a node from the closed list. +//////////////////////////////////////////////////////////////////// void PathFinder::remove_from_clist(int r, int c) { for(unsigned int i = 0; i < _closed_list.size(); ++i) { if(_closed_list[i]->_grid_x == r && _closed_list[i]->_grid_y == c) { @@ -370,15 +338,12 @@ void PathFinder::remove_from_clist(int r, int c) { } } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : find_in_mesh -// Description : This function allows the user to pass a position and it returns the +//////////////////////////////////////////////////////////////////// +// Function: find_in_mesh +// Description: This function allows the user to pass a position and it returns the // corresponding node on the navigation mesh. A very useful function as // it allows for dynamic updation of the mesh based on position. - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// Node* find_in_mesh(NavMesh nav_mesh, LVecBase3 pos, int grid_size) { int size = grid_size; float x = pos[0]; diff --git a/contrib/src/ai/aiPathFinder.h b/contrib/src/ai/aiPathFinder.h index eb2f8de70b..5f46e05302 100644 --- a/contrib/src/ai/aiPathFinder.h +++ b/contrib/src/ai/aiPathFinder.h @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : aiPathFinder.h -// Created by : Deepak, John, Navin -// Date : 10 Nov 09 +// Filename: aiPathFinder.h +// Created by: Deepak, John, Navin (10Nov09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -25,14 +24,13 @@ typedef vector NavMesh; Node* find_in_mesh(NavMesh nav_mesh, LVecBase3 pos, int grid_size); -//////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// -// Class : PathFinder -// Description : This class implements pathfinding using A* algorithm. It also uses a Binary Heap search to -// search the open list. The heuristics are calculated using the manhattan method. - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Class : PathFinder +// Description : This class implements pathfinding using A* algorithm. +// It also uses a Binary Heap search to search the +// open list. The heuristics are calculated using +// the manhattan method. +//////////////////////////////////////////////////////////////////// class EXPCL_PANDAAI PathFinder { public: Node *_src_node; @@ -61,4 +59,3 @@ public: }; #endif - diff --git a/contrib/src/ai/aiWorld.cxx b/contrib/src/ai/aiWorld.cxx index 418a4f99aa..129a737e69 100644 --- a/contrib/src/ai/aiWorld.cxx +++ b/contrib/src/ai/aiWorld.cxx @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : aiWorld.cxx -// Created by : Deepak, John, Navin -// Date : 8 Sep 09 +// Filename: aiWorld.cxx +// Created by: Deepak, John, Navin (08Sep09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -56,13 +55,11 @@ void AIWorld::print_list() { _ai_char_pool->print_list(); } -//////////////////////////////////////////////////////////////////////// -// Function : update -// Description : The AIWorld update function calls the update function of all the -// AI characters which have been added to the AIWorld. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: update +// Description: The AIWorld update function calls the update function of all the +// AI characters which have been added to the AIWorld. +//////////////////////////////////////////////////////////////////// void AIWorld::update() { AICharPool::node *ai_pool; ai_pool = _ai_char_pool->_head; @@ -73,15 +70,12 @@ void AIWorld::update() { } } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : add_flock -// Description : This function adds all the AI characters in the Flock object to -// the AICharPool. This function allows adding the AI characetrs as -// part of a flock. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: add_flock +// Description: This function adds all the AI characters in the Flock object to +// the AICharPool. This function allows adding the AI characetrs as +// part of a flock. +//////////////////////////////////////////////////////////////////// void AIWorld::add_flock(Flock *flock) { // Add all the ai_characters in the flock to the AIWorld. for(unsigned int i = 0; i < flock->_ai_char_list.size(); ++i) { @@ -91,13 +85,10 @@ void AIWorld::add_flock(Flock *flock) { _flock_pool.push_back(flock); } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : get_flock -// Description : This function returns a handle to the Flock whose id is passed. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: get_flock +// Description: This function returns a handle to the Flock whose id is passed. +//////////////////////////////////////////////////////////////////// Flock AIWorld::get_flock(unsigned int flock_id) { for(unsigned int i=0; i < _flock_pool.size(); ++i) { if(_flock_pool[i]->get_id() == flock_id) { @@ -108,13 +99,10 @@ Flock AIWorld::get_flock(unsigned int flock_id) { return *null_flock; } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : remove_flock -// Description : This function removes the flock behavior completely. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: remove_flock +// Description: This function removes the flock behavior completely. +//////////////////////////////////////////////////////////////////// void AIWorld::remove_flock(unsigned int flock_id) { for(unsigned int i = 0; i < _flock_pool.size(); ++i) { if(_flock_pool[i]->get_id() == flock_id) { @@ -129,14 +117,11 @@ void AIWorld::remove_flock(unsigned int flock_id) { } } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : flock_off -// Description : This function turns off the flock behavior temporarily. Similar to -// pausing the behavior. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: flock_off +// Description: This function turns off the flock behavior temporarily. Similar to +// pausing the behavior. +//////////////////////////////////////////////////////////////////// void AIWorld::flock_off(unsigned int flock_id) { for(unsigned int i = 0; i < _flock_pool.size(); ++i) { if(_flock_pool[i]->get_id() == flock_id) { @@ -149,13 +134,10 @@ void AIWorld::flock_off(unsigned int flock_id) { } } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : flock_on -// Description : This function turns on the flock behavior. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: flock_on +// Description: This function turns on the flock behavior. +//////////////////////////////////////////////////////////////////// void AIWorld::flock_on(unsigned int flock_id) { for(unsigned int i = 0; i < _flock_pool.size(); ++i) { if(_flock_pool[i]->get_id() == flock_id) { @@ -234,14 +216,11 @@ void AICharPool::del(string name) { } } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : print_list -// Description : This function prints the ai characters in the AICharPool. Used for -// debugging purposes. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: print_list +// Description: This function prints the ai characters in the AICharPool. Used for +// debugging purposes. +//////////////////////////////////////////////////////////////////// void AICharPool::print_list() { node* q; q = _head; @@ -251,26 +230,20 @@ void AICharPool::print_list() { } } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : add_obstacle -// Description : This function adds the nodepath as an obstacle that is needed -// by the obstacle avoidance behavior. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: add_obstacle +// Description: This function adds the nodepath as an obstacle that is needed +// by the obstacle avoidance behavior. +//////////////////////////////////////////////////////////////////// void AIWorld::add_obstacle(NodePath obstacle) { _obstacles.push_back(obstacle); } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : remove_obstacle -// Description : This function removes the nodepath from the obstacles list that is needed -// by the obstacle avoidance behavior. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: remove_obstacle +// Description: This function removes the nodepath from the obstacles list that is needed +// by the obstacle avoidance behavior. +//////////////////////////////////////////////////////////////////// void AIWorld::remove_obstacle(NodePath obstacle) { for(unsigned int i = 0; i <= _obstacles.size(); ++i) { if(_obstacles[i] == obstacle) { diff --git a/contrib/src/ai/aiWorld.h b/contrib/src/ai/aiWorld.h index bd6f0be3a6..58b0fbae20 100644 --- a/contrib/src/ai/aiWorld.h +++ b/contrib/src/ai/aiWorld.h @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : aiWorld.h -// Created by : Deepak, John, Navin -// Date : 8 Sep 09 +// Filename: aiWorld.h +// Created by: Deepak, John, Navin (08Sep09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -28,16 +27,12 @@ class AICharacter; class Flock; -/////////////////////////////////////////////////////////////////////// -// -// Class : AICharPool -// Description : This class implements a linked list of AI Characters allowing -// the user to add and delete characters from the linked list. -// This will be used in the AIWorld class. - -//////////////////////////////////////////////////////////////////////// - - +//////////////////////////////////////////////////////////////////// +// Class : AICharPool +// Description : This class implements a linked list of AI Characters allowing +// the user to add and delete characters from the linked list. +// This will be used in the AIWorld class. +//////////////////////////////////////////////////////////////////// class EXPCL_PANDAAI AICharPool { public: struct node { @@ -54,18 +49,14 @@ class EXPCL_PANDAAI AICharPool { }; -/////////////////////////////////////////////////////////////////////// -// -// Class : AIWorld -// Description : A class that implements the virtual AI world which keeps track -// of the AI characters active at any given time. It contains a linked -// list of AI characters, obstactle data and unique name for each -// character. It also updates each characters state. The AI characters -// can also be added to the world as flocks. - -//////////////////////////////////////////////////////////////////////// - - +//////////////////////////////////////////////////////////////////// +// Class : AIWorld +// Description : A class that implements the virtual AI world which keeps track +// of the AI characters active at any given time. It contains a linked +// list of AI characters, obstactle data and unique name for each +// character. It also updates each characters state. The AI characters +// can also be added to the world as flocks. +//////////////////////////////////////////////////////////////////// class EXPCL_PANDAAI AIWorld { private: AICharPool * _ai_char_pool; @@ -97,12 +88,3 @@ PUBLISHED: }; #endif - - - - - - - - - diff --git a/contrib/src/ai/arrival.cxx b/contrib/src/ai/arrival.cxx index 14b84030d4..83c4468bbc 100644 --- a/contrib/src/ai/arrival.cxx +++ b/contrib/src/ai/arrival.cxx @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : arrival.cxx -// Created by : Deepak, John, Navin -// Date : 24 Oct 09 +// Filename: arrival.cxx +// Created by: Deepak, John, Navin (24Oct09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -25,17 +24,14 @@ Arrival::Arrival(AICharacter *ai_ch, double distance) { Arrival::~Arrival() { } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : do_arrival -// Description : This function performs the arrival and returns an arrival force which is used -// in the calculate_prioritized function. -// In case the steering force = 0, it resets to arrival_activate. -// The arrival behavior works only when seek or pursue is active. -// This function is not to be used by the user. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: do_arrival +// Description: This function performs the arrival and returns an arrival force which is used +// in the calculate_prioritized function. +// In case the steering force = 0, it resets to arrival_activate. +// The arrival behavior works only when seek or pursue is active. +// This function is not to be used by the user. +//////////////////////////////////////////////////////////////////// LVecBase3 Arrival::do_arrival() { LVecBase3 direction_to_target; double distance; @@ -88,15 +84,12 @@ LVecBase3 Arrival::do_arrival() { return(LVecBase3(0.0, 0.0, 0.0)); } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : arrival_activate -// Description : This function checks for whether the target is within the arrival distance. -// When this is true, it calls the do_arrival function and sets the arrival direction. -// This function is not to be used by the user. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: arrival_activate +// Description: This function checks for whether the target is within the arrival distance. +// When this is true, it calls the do_arrival function and sets the arrival direction. +// This function is not to be used by the user. +//////////////////////////////////////////////////////////////////// void Arrival::arrival_activate() { LVecBase3 dirn; if(_arrival_type) { diff --git a/contrib/src/ai/arrival.h b/contrib/src/ai/arrival.h index 788db0c1dd..02864ac614 100644 --- a/contrib/src/ai/arrival.h +++ b/contrib/src/ai/arrival.h @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : arrival.h -// Created by : Deepak, John, Navin -// Date : 24 Oct 09 +// Filename: arrival.h +// Created by: Deepak, John, Navin (24Oct09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE diff --git a/contrib/src/ai/evade.cxx b/contrib/src/ai/evade.cxx index c40f920ca9..0c9fcae21d 100644 --- a/contrib/src/ai/evade.cxx +++ b/contrib/src/ai/evade.cxx @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : evade.cxx -// Created by : Deepak, John, Navin -// Date : 24 Oct 09 +// Filename: evade.cxx +// Created by: Deepak, John, Navin (24Oct09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -31,17 +30,14 @@ Evade::Evade(AICharacter *ai_ch, NodePath target_object, double panic_distance, Evade::~Evade() { } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : do_evade -// Description : This function performs the evade and returns an evade force which is used -// in the calculate_prioritized function. -// In case the AICharacter is past the (panic + relax) distance, -// it resets to evade_activate. -// This function is not to be used by the user. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: do_evade +// Description: This function performs the evade and returns an evade force which is used +// in the calculate_prioritized function. +// In case the AICharacter is past the (panic + relax) distance, +// it resets to evade_activate. +// This function is not to be used by the user. +//////////////////////////////////////////////////////////////////// LVecBase3 Evade::do_evade() { assert(_evade_target && "evade target not assigned"); @@ -66,15 +62,12 @@ LVecBase3 Evade::do_evade() { } } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : evade_activate -// Description : This function checks for whether the target is within the panic distance. -// When this is true, it calls the do_evade function and sets the evade direction. -// This function is not to be used by the user. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: evade_activate +// Description: This function checks for whether the target is within the panic distance. +// When this is true, it calls the do_evade function and sets the evade direction. +// This function is not to be used by the user. +//////////////////////////////////////////////////////////////////// void Evade::evade_activate() { _evade_direction = (_ai_char->_ai_char_np.get_pos(_ai_char->_window_render) - _evade_target.get_pos(_ai_char->_window_render)); double distance = _evade_direction.length(); diff --git a/contrib/src/ai/evade.h b/contrib/src/ai/evade.h index 4de79149fa..50ad316c92 100644 --- a/contrib/src/ai/evade.h +++ b/contrib/src/ai/evade.h @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : evade.h -// Created by : Deepak, John, Navin -// Date : 24 Oct 09 +// Filename: evade.h +// Created by: Deepak, John, Navin (24Oct09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -22,7 +21,6 @@ class AICharacter; class EXPCL_PANDAAI Evade { - public: AICharacter *_ai_char; diff --git a/contrib/src/ai/flee.cxx b/contrib/src/ai/flee.cxx index b1579aeedb..192a936ce9 100644 --- a/contrib/src/ai/flee.cxx +++ b/contrib/src/ai/flee.cxx @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : flee.cxx -// Created by : Deepak, John, Navin -// Date : 24 Oct 09 +// Filename: flee.cxx +// Created by: Deepak, John, Navin (24Oct09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -46,17 +45,14 @@ Flee::Flee(AICharacter *ai_ch, LVecBase3 pos, double panic_distance, Flee::~Flee() { } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : do_flee -// Description : This function performs the flee and returns a flee force which is used -// in the calculate_prioritized function. -// In case the AICharacter is past the (panic + relax) distance, -// it resets to flee_activate. -// This function is not to be used by the user. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: do_flee +// Description: This function performs the flee and returns a flee force which is used +// in the calculate_prioritized function. +// In case the AICharacter is past the (panic + relax) distance, +// it resets to flee_activate. +// This function is not to be used by the user. +//////////////////////////////////////////////////////////////////// LVecBase3 Flee::do_flee() { LVecBase3 dirn; double distance; @@ -80,15 +76,12 @@ LVecBase3 Flee::do_flee() { } } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : flee_activate -// Description : This function checks for whether the target is within the panic distance. -// When this is true, it calls the do_flee function and sets the flee direction. -// This function is not to be used by the user. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: flee_activate +// Description: This function checks for whether the target is within the panic distance. +// When this is true, it calls the do_flee function and sets the flee direction. +// This function is not to be used by the user. +//////////////////////////////////////////////////////////////////// void Flee::flee_activate() { LVecBase3 dirn; double distance; diff --git a/contrib/src/ai/flee.h b/contrib/src/ai/flee.h index 0d63b47baa..98a08b8127 100644 --- a/contrib/src/ai/flee.h +++ b/contrib/src/ai/flee.h @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : flee.h -// Created by : Deepak, John, Navin -// Date : 24 Oct 09 +// Filename: flee.h +// Created by: Deepak, John, Navin (24Oct09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -22,7 +21,6 @@ class AICharacter; class EXPCL_PANDAAI Flee { - public: AICharacter *_ai_char; diff --git a/contrib/src/ai/flock.cxx b/contrib/src/ai/flock.cxx index b2b039947d..70d52dcb26 100644 --- a/contrib/src/ai/flock.cxx +++ b/contrib/src/ai/flock.cxx @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : flock.cxx -// Created by : Deepak, John, Navin -// Date : 12 Oct 09 +// Filename: flock.cxx +// Created by: Deepak, John, Navin (24Oct09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -28,13 +27,10 @@ Flock::Flock(unsigned int flock_id, double vcone_angle, double vcone_radius, uns Flock::~Flock() { } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : add_ai_char -// Description : This function adds AI characters to the flock. - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: add_ai_char +// Description: This function adds AI characters to the flock. +//////////////////////////////////////////////////////////////////// void Flock::add_ai_char(AICharacter *ai_char) { ai_char->_ai_char_flock_id = _flock_id; ai_char->_steering->_flock_group = this; diff --git a/contrib/src/ai/flock.h b/contrib/src/ai/flock.h index 66a10c57b3..6eb318b0bd 100644 --- a/contrib/src/ai/flock.h +++ b/contrib/src/ai/flock.h @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : flock.h -// Created by : Deepak, John, Navin -// Date : 12 Oct 09 +// Filename: flock.h +// Created by: Deepak, John, Navin (24Oct09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -21,14 +20,11 @@ class AICharacter; -/////////////////////////////////////////////////////////////////////////////////////// -// -// Class : Flock +//////////////////////////////////////////////////////////////////// +// Class : Flock // Description : This class is used to define the flock attributes and the AI characters -// which are part of the flock. - -/////////////////////////////////////////////////////////////////////////////////////// - +// which are part of the flock. +//////////////////////////////////////////////////////////////////// class EXPCL_PANDAAI Flock { private: unsigned int _flock_id; diff --git a/contrib/src/ai/meshNode.cxx b/contrib/src/ai/meshNode.cxx index 9d119bbb66..f846ac14b1 100644 --- a/contrib/src/ai/meshNode.cxx +++ b/contrib/src/ai/meshNode.cxx @@ -24,14 +24,11 @@ Node::Node(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) { Node::~Node() { } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : contains -// Description : This is a handy function which returns true if the passed position is +//////////////////////////////////////////////////////////////////// +// Function: contains +// Description: This is a handy function which returns true if the passed position is // within the node's dimensions. - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// bool Node::contains(float x, float y) { if(_position.get_x() - _width / 2 <= x && _position.get_x() + _width / 2 >= x && _position.get_y() - _length / 2 <= y && _position.get_y() + _length / 2 >= y) { @@ -40,4 +37,4 @@ bool Node::contains(float x, float y) { else { return false; } -} \ No newline at end of file +} diff --git a/contrib/src/ai/meshNode.h b/contrib/src/ai/meshNode.h index b9e1421558..e74641c649 100644 --- a/contrib/src/ai/meshNode.h +++ b/contrib/src/ai/meshNode.h @@ -4,17 +4,18 @@ #include "aiGlobals.h" -//////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Class : Node +// Description : This class is used to assign the nodes on the mesh. +// It holds all the data necessary to compute A* +// algorithm. It also maintains a lot of vital +// information such as the neighbor nodes of each node +// and also its position on the mesh. // -// Class : Node -// Description : This class is used to assign the nodes on the mesh. It holds all the data necessary to -// compute A* algorithm. It also maintains a lot of vital information such as the neighbor -// nodes of each node and also its position on the mesh. -// Note: The Mesh Generator which is a stand alone tool makes use of this class to generate the nodes on the -// mesh. - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////// - +// Note: The Mesh Generator which is a stand alone tool +// makes use of this class to generate the nodes on the +// mesh. +//////////////////////////////////////////////////////////////////// class EXPCL_PANDAAI Node { public: // This variable specifies whether the node is an obtacle or not. diff --git a/contrib/src/ai/obstacleAvoidance.cxx b/contrib/src/ai/obstacleAvoidance.cxx index 9cb9deed9c..0f86122a15 100644 --- a/contrib/src/ai/obstacleAvoidance.cxx +++ b/contrib/src/ai/obstacleAvoidance.cxx @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : obstacleAvoidance.cxx -// Created by : Deepak, John, Navin -// Date : 10 Nov 09 +// Filename: obstacleAvoidance.cxx +// Created by: Deepak, John, Navin (10Nov09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -15,23 +14,23 @@ #include "obstacleAvoidance.h" -ObstacleAvoidance::ObstacleAvoidance(AICharacter *ai_char, float feeler_length) { +ObstacleAvoidance:: +ObstacleAvoidance(AICharacter *ai_char, float feeler_length) { _ai_char = ai_char; _feeler = feeler_length; } -ObstacleAvoidance::~ObstacleAvoidance() { +ObstacleAvoidance:: +~ObstacleAvoidance() { } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : obstacle_detection -// Description : This function checks if an obstacle is near to the AICharacter and +//////////////////////////////////////////////////////////////////// +// Function: obstacle_detection +// Description: This function checks if an obstacle is near to the AICharacter and // if an obstacle is detected returns true - -///////////////////////////////////////////////////////////////////////////////// - -bool ObstacleAvoidance::obstacle_detection() { +//////////////////////////////////////////////////////////////////// +bool ObstacleAvoidance:: +obstacle_detection() { // Calculate the volume of the AICharacter with respect to render PT(BoundingVolume) np_bounds = _ai_char->get_node_path().get_bounds(); CPT(BoundingSphere) np_sphere = np_bounds->as_bounding_sphere(); @@ -51,46 +50,44 @@ bool ObstacleAvoidance::obstacle_detection() { expanded_radius = bsphere->get_radius() + np_sphere->get_radius(); } } - LVecBase3 feeler = _feeler * _ai_char->get_char_render().get_relative_vector(_ai_char->get_node_path(), LVector3::forward()); - feeler.normalize(); - feeler *= (expanded_radius + np_sphere->get_radius()) ; - to_obstacle = _nearest_obstacle.get_pos() - _ai_char->get_node_path().get_pos(); - LVector3 line_vector = _ai_char->get_char_render().get_relative_vector(_ai_char->get_node_path(), LVector3::forward()); - LVecBase3 project = (to_obstacle.dot(line_vector) * line_vector) / line_vector.length_squared(); - LVecBase3 perp = project - to_obstacle; - // If the nearest obstacle will collide with our AICharacter then send obstacle detection as true - if((_nearest_obstacle) && (perp.length() < expanded_radius - np_sphere->get_radius()) && (project.length() < feeler.length())) { - return true; - } - return false; + + LVecBase3 feeler = _feeler * _ai_char->get_char_render().get_relative_vector(_ai_char->get_node_path(), LVector3::forward()); + feeler.normalize(); + feeler *= (expanded_radius + np_sphere->get_radius()) ; + to_obstacle = _nearest_obstacle.get_pos() - _ai_char->get_node_path().get_pos(); + LVector3 line_vector = _ai_char->get_char_render().get_relative_vector(_ai_char->get_node_path(), LVector3::forward()); + LVecBase3 project = (to_obstacle.dot(line_vector) * line_vector) / line_vector.length_squared(); + LVecBase3 perp = project - to_obstacle; + + // If the nearest obstacle will collide with our AICharacter then send obstacle detection as true + if (_nearest_obstacle && (perp.length() < expanded_radius - np_sphere->get_radius()) && (project.length() < feeler.length())) { + return true; + } + return false; } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : obstacle_avoidance_activate -// Description : This function activates obstacle_avoidance if a obstacle +//////////////////////////////////////////////////////////////////// +// Function: obstacle_avoidance_activate +// Description: This function activates obstacle_avoidance if a obstacle // is detected - -///////////////////////////////////////////////////////////////////////////////// - -void ObstacleAvoidance::obstacle_avoidance_activate() { - if(obstacle_detection()) { +//////////////////////////////////////////////////////////////////// +void ObstacleAvoidance:: +obstacle_avoidance_activate() { + if (obstacle_detection()) { _ai_char->_steering->turn_off("obstacle_avoidance_activate"); _ai_char->_steering->turn_on("obstacle_avoidance"); } } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : do_obstacle_avoidance -// Description : This function returns the force necessary by the AICharacter to +//////////////////////////////////////////////////////////////////// +// Function: do_obstacle_avoidance +// Description: This function returns the force necessary by the AICharacter to // avoid the nearest obstacle detected by obstacle_detection // function // NOTE : This assumes the obstacles are spherical - -///////////////////////////////////////////////////////////////////////////////// - -LVecBase3 ObstacleAvoidance::do_obstacle_avoidance() { +//////////////////////////////////////////////////////////////////// +LVecBase3 ObstacleAvoidance:: +do_obstacle_avoidance() { LVecBase3 offset = _ai_char->get_node_path().get_pos() - _nearest_obstacle.get_pos(); PT(BoundingVolume) bounds =_nearest_obstacle.get_bounds(); CPT(BoundingSphere) bsphere = bounds->as_bounding_sphere(); diff --git a/contrib/src/ai/obstacleAvoidance.h b/contrib/src/ai/obstacleAvoidance.h index 787a417592..aeba5fe21b 100644 --- a/contrib/src/ai/obstacleAvoidance.h +++ b/contrib/src/ai/obstacleAvoidance.h @@ -1,10 +1,6 @@ -#ifndef OBSTACLE_AVOIDANCE_H -#define OBSTACLE_AVOIDANCE_H - -//////////////////////////////////////////////////////////////////////// -// Filename : obstacleAvoidance.h -// Created by : Deepak, John, Navin -// Date : 10 Nov 2009 +// Filename: obstacleAvoidance.h +// Created by: Deepak, John, Navin (10Nov09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -16,6 +12,9 @@ // //////////////////////////////////////////////////////////////////// +#ifndef OBSTACLE_AVOIDANCE_H +#define OBSTACLE_AVOIDANCE_H + #include "aiCharacter.h" #include "boundingSphere.h" diff --git a/contrib/src/ai/pathFind.cxx b/contrib/src/ai/pathFind.cxx index f4c8fd7d9f..4ae0eebf0d 100644 --- a/contrib/src/ai/pathFind.cxx +++ b/contrib/src/ai/pathFind.cxx @@ -18,13 +18,10 @@ PathFind::PathFind(AICharacter *ai_ch) { PathFind::~PathFind() { } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : create_nav_mesh -// Description : This function recreates the navigation mesh from the .csv file - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: create_nav_mesh +// Description: This function recreates the navigation mesh from the .csv file +//////////////////////////////////////////////////////////////////// void PathFind::create_nav_mesh(const char* navmesh_filename) { // Stage variables. int grid_x, grid_y; @@ -96,14 +93,11 @@ void PathFind::create_nav_mesh(const char* navmesh_filename) { } } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : assign_neighbor_nodes -// Description : This function assigns the neighbor nodes for each main node present in -// _nav_mesh. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: assign_neighbor_nodes +// Description: This function assigns the neighbor nodes for each +// main node present in _nav_mesh. +//////////////////////////////////////////////////////////////////// void PathFind::assign_neighbor_nodes(const char* navmesh_filename){ ifstream nav_mesh_file (navmesh_filename); @@ -161,15 +155,11 @@ void PathFind::assign_neighbor_nodes(const char* navmesh_filename){ } } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : set_path_find -// Description : This function starts the path finding process after reading the given -// navigation mesh. - -/////////////////////////////////////////////////////////////////////////////////////// - - +//////////////////////////////////////////////////////////////////// +// Function: set_path_find +// Description: This function starts the path finding process after reading the given +// navigation mesh. +//////////////////////////////////////////////////////////////////// void PathFind::set_path_find(const char* navmesh_filename) { create_nav_mesh(navmesh_filename); @@ -187,16 +177,12 @@ void PathFind::set_path_find(const char* navmesh_filename) { _path_finder_obj = new PathFinder(_nav_mesh); } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : path_find (for pathfinding towards a static position) -// Description : This function checks for the source and target in the navigation mesh -// for its availability and then finds the best path via the A* algorithm -// Then it calls the path follower to make the object follow the path. - -/////////////////////////////////////////////////////////////////////////////////////// - - +//////////////////////////////////////////////////////////////////// +// Function: path_find (for pathfinding towards a static position) +// Description: This function checks for the source and target in the navigation mesh +// for its availability and then finds the best path via the A* algorithm +// Then it calls the path follower to make the object follow the path. +//////////////////////////////////////////////////////////////////// void PathFind::path_find(LVecBase3 pos, string type) { if(type == "addPath") { if(_ai_char->_steering->_path_follow_obj) { @@ -230,15 +216,12 @@ void PathFind::path_find(LVecBase3 pos, string type) { } } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : path_find (for pathfinding towards a moving target (a NodePath)) -// Description : This function checks for the source and target in the navigation mesh -// for its availability and then finds the best path via the A* algorithm -// Then it calls the path follower to make the object follow the path. - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: path_find (for pathfinding towards a moving target (a NodePath)) +// Description: This function checks for the source and target in the navigation mesh +// for its availability and then finds the best path via the A* algorithm +// Then it calls the path follower to make the object follow the path. +//////////////////////////////////////////////////////////////////// void PathFind::path_find(NodePath target, string type) { if(type == "addPath") { if(_ai_char->_steering->_path_follow_obj) { @@ -277,13 +260,10 @@ void PathFind::path_find(NodePath target, string type) { } } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : clear_path -// Description : Helper function to restore the path and mesh to its initial state - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: clear_path +// Description: Helper function to restore the path and mesh to its initial state +//////////////////////////////////////////////////////////////////// void PathFind::clear_path() { // Initialize to zero for(int i = 0; i < _grid_size; ++i) { @@ -304,15 +284,12 @@ void PathFind::clear_path() { } } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : trace_path -// Description : This function is the function which sends the path information one by -// one to the path follower so that it can store the path needed to be -// traversed by the pathfinding object - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: trace_path +// Description: This function is the function which sends the path information one by +// one to the path follower so that it can store the path needed to be +// traversed by the pathfinding object +//////////////////////////////////////////////////////////////////// void PathFind::trace_path(Node* src) { if(_ai_char->_pf_guide) { _parent->remove_all_children(); @@ -336,16 +313,13 @@ void PathFind::trace_path(Node* src) { } } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : add_obstacle_to_mesh -// Description : This function allows the user to dynamically add obstacles to the -// game environment. The function will update the nodes within the -// bounding volume of the obstacle as non-traversable. Hence will not be -// considered by the pathfinding algorithm. - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: add_obstacle_to_mesh +// Description: This function allows the user to dynamically add obstacles to the +// game environment. The function will update the nodes within the +// bounding volume of the obstacle as non-traversable. Hence will not be +// considered by the pathfinding algorithm. +//////////////////////////////////////////////////////////////////// void PathFind::add_obstacle_to_mesh(NodePath obstacle) { PT(BoundingVolume) np_bounds = obstacle.get_bounds(); CPT(BoundingSphere) np_sphere = np_bounds->as_bounding_sphere(); @@ -373,14 +347,11 @@ void PathFind::add_obstacle_to_mesh(NodePath obstacle) { } } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : do_dynamic_avoid() -// Description : This function does the updation of the collisions to the mesh based -// on the new positions of the obstacles. - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: do_dynamic_avoid() +// Description: This function does the updation of the collisions to the mesh based +// on the new positions of the obstacles. +//////////////////////////////////////////////////////////////////// void PathFind::do_dynamic_avoid() { clear_previous_obstacles(); _previous_obstacles.clear(); @@ -389,28 +360,22 @@ void PathFind::do_dynamic_avoid() { } } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : clear_previous_obstacles() -// Description : Helper function to reset the collisions if the obstacle is not on the -// node anymore - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: clear_previous_obstacles() +// Description: Helper function to reset the collisions if the obstacle is not on the +// node anymore +//////////////////////////////////////////////////////////////////// void PathFind::clear_previous_obstacles(){ for(unsigned int i = 0; i < _previous_obstacles.size(); i = i + 2) { _nav_mesh[_previous_obstacles[i]][_previous_obstacles[i + 1]]->_type = true; } } -/////////////////////////////////////////////////////////////////////////////////////// -// -// Function : dynamic_avoid -// Description : This function starts the pathfinding obstacle navigation for the -// passed in obstacle. - -/////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: dynamic_avoid +// Description: This function starts the pathfinding obstacle navigation for the +// passed in obstacle. +//////////////////////////////////////////////////////////////////// void PathFind::dynamic_avoid(NodePath obstacle) { _dynamic_avoid = true; _dynamic_obstacle.insert(_dynamic_obstacle.end(), obstacle); diff --git a/contrib/src/ai/pathFind.h b/contrib/src/ai/pathFind.h index cb9030e000..4306e9378c 100644 --- a/contrib/src/ai/pathFind.h +++ b/contrib/src/ai/pathFind.h @@ -1,8 +1,6 @@ - -//////////////////////////////////////////////////////////////////////// -// Filename : pathFind.h -// Created by : Deepak, John, Navin -// Date : 12 Oct 09 +// Filename: pathFind.h +// Created by: Deepak, John, Navin (12Oct09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -24,15 +22,15 @@ class AICharacter; -//////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// -// Class : PathFind -// Description : This class contains all the members and functions that are required to form an interface between -// the AIBehaviors class and the PathFinder class. An object (pointer) of this class is provided in the -// AIBehaviors class. It is only via this object that the user can activate pathfinding. - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Class : PathFind +// Description : This class contains all the members and functions +// that are required to form an interface between +// the AIBehaviors class and the PathFinder class. +// An object (pointer) of this class is provided in +// the AIBehaviors class. It is only via this object +// that the user can activate pathfinding. +//////////////////////////////////////////////////////////////////// class EXPCL_PANDAAI PathFind { public: AICharacter *_ai_char; diff --git a/contrib/src/ai/pathFollow.cxx b/contrib/src/ai/pathFollow.cxx index 43e155028b..1927d73750 100644 --- a/contrib/src/ai/pathFollow.cxx +++ b/contrib/src/ai/pathFollow.cxx @@ -12,25 +12,19 @@ PathFollow::PathFollow(AICharacter *ai_ch, float follow_wt) { PathFollow::~PathFollow() { } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : add_to_path -// Description : This function adds the positions generated from a pathfind or a simple +//////////////////////////////////////////////////////////////////// +// Function: add_to_path +// Description: This function adds the positions generated from a pathfind or a simple // path follow behavior to the _path list. - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// void PathFollow::add_to_path(LVecBase3 pos) { _path.push_back(pos); } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : start -// Description : This function initiates the path follow behavior. - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: start +// Description: This function initiates the path follow behavior. +//////////////////////////////////////////////////////////////////// void PathFollow::start(string type) { _type = type; _start = true; @@ -43,19 +37,16 @@ void PathFollow::start(string type) { } } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : do_follow -// Description : This function allows continuous path finding by ai chars. There are 2 +//////////////////////////////////////////////////////////////////// +// Function: do_follow +// Description: This function allows continuous path finding by ai chars. There are 2 // ways in which this is implemented. // 1. The character re-calculates the optimal path everytime the target -// changes its position. Less computationally expensive. +// changes its position. Less computationally expensive. // 2. The character continuosly re-calculates its optimal path to the -// target. This is used in a scenario where the ai chars have to avoid -// other ai chars. More computationally expensive. - -///////////////////////////////////////////////////////////////////////////////////////// - +// target. This is used in a scenario where the ai chars have to avoid +// other ai chars. More computationally expensive. +//////////////////////////////////////////////////////////////////// void PathFollow::do_follow() { if((_myClock->get_real_time() - _time) > 0.5) { if(_type=="pathfind") { @@ -109,14 +100,11 @@ void PathFollow::do_follow() { } } -///////////////////////////////////////////////////////////////////////////////////////// -// -// Function : check_if_possible -// Description : This function checks if the current positions of the ai char and the +//////////////////////////////////////////////////////////////////// +// Function: check_if_possible +// Description: This function checks if the current positions of the ai char and the // target char can be used to generate an optimal path. - -///////////////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// bool PathFollow::check_if_possible() { Node* src = find_in_mesh(_ai_char->_steering->_path_find_obj->_nav_mesh, _ai_char->_ai_char_np.get_pos(_ai_char->_window_render), _ai_char->_steering->_path_find_obj->_grid_size); LVecBase3 _prev_position = _ai_char->_steering->_path_find_obj->_path_find_target.get_pos(_ai_char->_window_render); diff --git a/contrib/src/ai/pursue.cxx b/contrib/src/ai/pursue.cxx index d14bb60514..2e7d24d830 100644 --- a/contrib/src/ai/pursue.cxx +++ b/contrib/src/ai/pursue.cxx @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : pursue.cxx -// Created by : Deepak, John, Navin -// Date : 24 Oct 09 +// Filename: pursue.cxx +// Created by: Deepak, John, Navin (24Oct09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -15,7 +14,8 @@ #include "pursue.h" -Pursue::Pursue(AICharacter *ai_ch, NodePath target_object, float pursue_wt) { +Pursue:: +Pursue(AICharacter *ai_ch, NodePath target_object, float pursue_wt) { _ai_char = ai_ch; _pursue_target = target_object; @@ -24,20 +24,19 @@ Pursue::Pursue(AICharacter *ai_ch, NodePath target_object, float pursue_wt) { _pursue_done = false; } -Pursue::~Pursue() { +Pursue:: +~Pursue() { } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : do_pursue -// Description : This function performs the pursue and returns a pursue force which is used -// in the calculate_prioritized function. -// In case the target has been reached it resets the forces to 0 so that the character stops. -// This function is not to be used by the user. - -///////////////////////////////////////////////////////////////////////////////// - -LVecBase3 Pursue::do_pursue() { +//////////////////////////////////////////////////////////////////// +// Function: do_pursue +// Description: This function performs the pursue and returns a pursue force which is used +// in the calculate_prioritized function. +// In case the target has been reached it resets the forces to 0 so that the character stops. +// This function is not to be used by the user. +//////////////////////////////////////////////////////////////////// +LVecBase3 Pursue:: +do_pursue() { assert(_pursue_target && "pursue target not assigned"); LVecBase3 present_pos = _ai_char->_ai_char_np.get_pos(_ai_char->_window_render); @@ -47,7 +46,7 @@ LVecBase3 Pursue::do_pursue() { _pursue_done = true; _ai_char->_steering->_steering_force = LVecBase3(0.0, 0.0, 0.0); _ai_char->_steering->_pursue_force = LVecBase3(0.0, 0.0, 0.0); - return(LVecBase3(0.0, 0.0, 0.0)); + return LVecBase3(0.0, 0.0, 0.0); } else { _pursue_done = false; @@ -57,5 +56,5 @@ LVecBase3 Pursue::do_pursue() { _pursue_direction.normalize(); LVecBase3 desired_force = _pursue_direction * _ai_char->_movt_force; - return(desired_force); + return desired_force; } diff --git a/contrib/src/ai/pursue.h b/contrib/src/ai/pursue.h index e26d107129..6e63682fd6 100644 --- a/contrib/src/ai/pursue.h +++ b/contrib/src/ai/pursue.h @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : pursue.h -// Created by : Deepak, John, Navin -// Date : 24 Oct 09 +// Filename: pursue.h +// Created by: Deepak, John, Navin (24Oct09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE diff --git a/contrib/src/ai/seek.cxx b/contrib/src/ai/seek.cxx index f11b3cf21f..4a2e2f0abc 100644 --- a/contrib/src/ai/seek.cxx +++ b/contrib/src/ai/seek.cxx @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : seek.cxx -// Created by : Deepak, John, Navin -// Date : 24 Oct 09 +// Filename: seek.cxx +// Created by: Deepak, John, Navin (24Oct09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -42,15 +41,12 @@ Seek::Seek(AICharacter *ai_ch, LVecBase3 pos, float seek_wt) { Seek::~Seek() { } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : do_seek -// Description : This function performs the seek and returns a seek force which is used -// in the calculate_prioritized function. -// This function is not to be used by the user. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: do_seek +// Description: This function performs the seek and returns a seek force which is used +// in the calculate_prioritized function. +// This function is not to be used by the user. +//////////////////////////////////////////////////////////////////// LVecBase3 Seek::do_seek() { double target_distance = (_seek_position - _ai_char->_ai_char_np.get_pos(_ai_char->_window_render)).length(); diff --git a/contrib/src/ai/seek.h b/contrib/src/ai/seek.h index 2d2cd998f4..8cd9fba6db 100644 --- a/contrib/src/ai/seek.h +++ b/contrib/src/ai/seek.h @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : seek.h -// Created by : Deepak, John, Navin -// Date : 24 Oct 09 +// Filename: seek.h +// Created by: Deepak, John, Navin (24Oct09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE diff --git a/contrib/src/ai/wander.cxx b/contrib/src/ai/wander.cxx index 48d72114f9..c3ddc63c0c 100644 --- a/contrib/src/ai/wander.cxx +++ b/contrib/src/ai/wander.cxx @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : wander.cxx -// Created by : Deepak, John, Navin -// Date : 24 Oct 09 +// Filename: wander.cxx +// Created by: Deepak, John, Navin (24Oct09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -15,26 +14,20 @@ #include "wander.h" -///////////////////////////////////////////////////////////////////////////////// -// -// Function : rand_float -// Description : This function creates a random float point number - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// +// Function: rand_float +// Description: This function creates a random float point number +//////////////////////////////////////////////////////////////////// double rand_float() { const static double rand_max = 0x7fff; return ((rand()) / (rand_max + 1.0)); } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : random_clamped -// Description : This function returns a random floating point number in the range +//////////////////////////////////////////////////////////////////// +// Function: random_clamped +// Description: This function returns a random floating point number in the range // -1 to 1. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// double random_clamped() { return (rand_float() - rand_float()); } @@ -82,15 +75,12 @@ Wander::Wander(AICharacter *ai_ch, double wander_radius,int flag, double aoe, fl Wander::~Wander() { } -///////////////////////////////////////////////////////////////////////////////// -// -// Function : do_wander -// Description : This function performs the wander and returns the wander force which is used +//////////////////////////////////////////////////////////////////// +// Function: do_wander +// Description: This function performs the wander and returns the wander force which is used // in the calculate_prioritized function. // This function is not to be used by the user. - -///////////////////////////////////////////////////////////////////////////////// - +//////////////////////////////////////////////////////////////////// LVecBase3 Wander::do_wander() { LVecBase3 present_pos = _ai_char->get_node_path().get_pos(_ai_char->get_char_render()); // Create the random slices to enable random movement of wander for x,y,z respectively @@ -123,6 +113,7 @@ LVecBase3 Wander::do_wander() { _wander_target *= _wander_radius; LVecBase3 target = _ai_char->get_char_render().get_relative_vector(_ai_char->get_node_path(), LVector3::forward()); target.normalize(); + // Project wander target onto global space target = _wander_target + target; LVecBase3 desired_target = present_pos + target; diff --git a/contrib/src/ai/wander.h b/contrib/src/ai/wander.h index a760bbb15a..572e2f98d5 100644 --- a/contrib/src/ai/wander.h +++ b/contrib/src/ai/wander.h @@ -1,7 +1,6 @@ -//////////////////////////////////////////////////////////////////////// -// Filename : wander.h -// Created by : Deepak, John, Navin -// Date : 24 Oct 09 +// Filename: wander.h +// Created by: Deepak, John, Navin (24Oct09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE diff --git a/direct/src/dcparser/dcClass.cxx b/direct/src/dcparser/dcClass.cxx index c3e37f6421..0262f69fb1 100644 --- a/direct/src/dcparser/dcClass.cxx +++ b/direct/src/dcparser/dcClass.cxx @@ -72,7 +72,7 @@ public: // Description: //////////////////////////////////////////////////////////////////// DCClass:: -DCClass(DCFile *dc_file, const string &name, bool is_struct, bool bogus_class) : +DCClass(DCFile *dc_file, const string &name, bool is_struct, bool bogus_class) : #ifdef WITHIN_PANDA _class_update_pcollector(_update_pcollector, name), _class_generate_pcollector(_generate_pcollector, name), @@ -116,7 +116,7 @@ DCClass:: //////////////////////////////////////////////////////////////////// // Function: DCClass::as_class // Access: Published, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// DCClass *DCClass:: as_class() { @@ -126,7 +126,7 @@ as_class() { //////////////////////////////////////////////////////////////////// // Function: DCClass::as_class // Access: Published, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const DCClass *DCClass:: as_class() const { @@ -155,7 +155,7 @@ get_parent(int n) const { nassertr(n >= 0 && n < (int)_parents.size(), NULL); return _parents[n]; } - + //////////////////////////////////////////////////////////////////// // Function: DCClass::has_constructor // Access: Published @@ -166,7 +166,7 @@ bool DCClass:: has_constructor() const { return (_constructor != (DCField *)NULL); } - + //////////////////////////////////////////////////////////////////// // Function: DCClass::get_constructor // Access: Published @@ -284,7 +284,7 @@ get_field_by_index(int index_number) const { //////////////////////////////////////////////////////////////////// int DCClass:: get_num_inherited_fields() const { - if (dc_multiple_inheritance && dc_virtual_inheritance && + if (dc_multiple_inheritance && dc_virtual_inheritance && _dc_file != (DCFile *)NULL) { _dc_file->check_inherited_fields(); if (_inherited_fields.empty()) { @@ -303,7 +303,7 @@ get_num_inherited_fields() const { for (pi = _parents.begin(); pi != _parents.end(); ++pi) { num_fields += (*pi)->get_num_inherited_fields(); } - + return num_fields; } } @@ -312,7 +312,7 @@ get_num_inherited_fields() const { // Function: DCClass::get_inherited_field // Access: Published // Description: Returns the nth field field in the class and all of -// its ancestors. +// its ancestors. // // This *used* to be the same thing as // get_field_by_index(), back when the fields were @@ -322,7 +322,7 @@ get_num_inherited_fields() const { //////////////////////////////////////////////////////////////////// DCField *DCClass:: get_inherited_field(int n) const { - if (dc_multiple_inheritance && dc_virtual_inheritance && + if (dc_multiple_inheritance && dc_virtual_inheritance && _dc_file != (DCFile *)NULL) { _dc_file->check_inherited_fields(); if (_inherited_fields.empty()) { @@ -338,18 +338,18 @@ get_inherited_field(int n) const { if (n < psize) { return (*pi)->get_inherited_field(n); } - + n -= psize; } - + return get_field(n); } } //////////////////////////////////////////////////////////////////// -// Function : DCClass::inherits_from_bogus_class -// Access : Published -// Description : Returns true if this class, or any class in the +// Function: DCClass::inherits_from_bogus_class +// Access: Published +// Description: Returns true if this class, or any class in the // inheritance heirarchy for this class, is a "bogus" // class--a forward reference to an as-yet-undefined // class. @@ -371,10 +371,10 @@ inherits_from_bogus_class() const { } //////////////////////////////////////////////////////////////////// -// Function : DCClass::output -// Access : Published, Virtual -// Description : Write a string representation of this instance to -// . +// Function: DCClass::output +// Access: Published, Virtual +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void DCClass:: output(ostream &out) const { @@ -667,7 +667,7 @@ receive_update_other(PyObject *distobj, DatagramIterator &di) const { // value blob. //////////////////////////////////////////////////////////////////// void DCClass:: -direct_update(PyObject *distobj, const string &field_name, +direct_update(PyObject *distobj, const string &field_name, const string &value_blob) { DCField *field = get_field_by_name(field_name); nassertv_always(field != NULL); @@ -688,7 +688,7 @@ direct_update(PyObject *distobj, const string &field_name, // datagram. //////////////////////////////////////////////////////////////////// void DCClass:: -direct_update(PyObject *distobj, const string &field_name, +direct_update(PyObject *distobj, const string &field_name, const Datagram &datagram) { direct_update(distobj, field_name, datagram.get_message()); } @@ -708,7 +708,7 @@ direct_update(PyObject *distobj, const string &field_name, // Returns true on success, false on failure. //////////////////////////////////////////////////////////////////// bool DCClass:: -pack_required_field(Datagram &datagram, PyObject *distobj, +pack_required_field(Datagram &datagram, PyObject *distobj, const DCField *field) const { DCPacker packer; packer.begin_pack(field); @@ -738,7 +738,7 @@ pack_required_field(Datagram &datagram, PyObject *distobj, // Returns true on success, false on failure. //////////////////////////////////////////////////////////////////// bool DCClass:: -pack_required_field(DCPacker &packer, PyObject *distobj, +pack_required_field(DCPacker &packer, PyObject *distobj, const DCField *field) const { const DCParameter *parameter = field->as_parameter(); if (parameter != (DCParameter *)NULL) { @@ -762,14 +762,14 @@ pack_required_field(DCPacker &packer, PyObject *distobj, nassert_raise(strm.str()); return false; } - PyObject *result = + PyObject *result = PyObject_GetAttrString(distobj, (char *)field_name.c_str()); nassertr(result != (PyObject *)NULL, false); // Now pack the value into the datagram. bool pack_ok = parameter->pack_args(packer, result); Py_DECREF(result); - + return pack_ok; } @@ -805,7 +805,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj, nassert_raise(strm.str()); return false; } - + string getter_name = setter_name; if (setter_name.substr(0, 3) == "set") { // If the original method started with "set", we mangle this @@ -818,7 +818,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj, getter_name = "get" + setter_name; getter_name[3] = toupper(getter_name[3]); } - + // Now we have to look up the getter on the distributed object // and call it. if (!PyObject_HasAttrString(distobj, (char *)getter_name.c_str())) { @@ -837,10 +837,10 @@ pack_required_field(DCPacker &packer, PyObject *distobj, nassert_raise(strm.str()); return false; } - PyObject *func = + PyObject *func = PyObject_GetAttrString(distobj, (char *)getter_name.c_str()); nassertr(func != (PyObject *)NULL, false); - + PyObject *empty_args = PyTuple_New(0); PyObject *result = PyObject_CallObject(func, empty_args); Py_DECREF(empty_args); @@ -851,7 +851,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj, cerr << "Error when calling " << getter_name << "\n"; return false; } - + if (atom->get_num_elements() == 1) { // In this case, we expect the getter to return one object, // which we wrap up in a tuple. @@ -865,13 +865,13 @@ pack_required_field(DCPacker &packer, PyObject *distobj, if (!PySequence_Check(result)) { ostringstream strm; strm << "Since dclass " << get_name() << " method " << setter_name - << " is declared to have multiple parameters, Python function " + << " is declared to have multiple parameters, Python function " << getter_name << " must return a list or tuple.\n"; nassert_raise(strm.str()); return false; } } - + // Now pack the arguments into the datagram. bool pack_ok = atom->pack_args(packer, result); Py_DECREF(result); @@ -889,7 +889,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj, // object from the client. //////////////////////////////////////////////////////////////////// Datagram DCClass:: -client_format_update(const string &field_name, DOID_TYPE do_id, +client_format_update(const string &field_name, DOID_TYPE do_id, PyObject *args) const { DCField *field = get_field_by_name(field_name); if (field == (DCField *)NULL) { @@ -913,7 +913,7 @@ client_format_update(const string &field_name, DOID_TYPE do_id, // object from the AI. //////////////////////////////////////////////////////////////////// Datagram DCClass:: -ai_format_update(const string &field_name, DOID_TYPE do_id, +ai_format_update(const string &field_name, DOID_TYPE do_id, CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const { DCField *field = get_field_by_name(field_name); if (field == (DCField *)NULL) { @@ -938,7 +938,7 @@ ai_format_update(const string &field_name, DOID_TYPE do_id, // object from the AI. //////////////////////////////////////////////////////////////////// Datagram DCClass:: -ai_format_update_msg_type(const string &field_name, DOID_TYPE do_id, +ai_format_update_msg_type(const string &field_name, DOID_TYPE do_id, CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, int msg_type, PyObject *args) const { DCField *field = get_field_by_name(field_name); if (field == (DCField *)NULL) { @@ -968,7 +968,7 @@ ai_format_update_msg_type(const string &field_name, DOID_TYPE do_id, // This method is only called by the CMU implementation. //////////////////////////////////////////////////////////////////// Datagram DCClass:: -client_format_generate_CMU(PyObject *distobj, DOID_TYPE do_id, +client_format_generate_CMU(PyObject *distobj, DOID_TYPE do_id, ZONEID_TYPE zone_id, PyObject *optional_fields) const { DCPacker packer; @@ -1041,7 +1041,7 @@ client_format_generate_CMU(PyObject *distobj, DOID_TYPE do_id, // in addition to the normal required fields. //////////////////////////////////////////////////////////////////// Datagram DCClass:: -ai_format_generate(PyObject *distobj, DOID_TYPE do_id, +ai_format_generate(PyObject *distobj, DOID_TYPE do_id, DOID_TYPE parent_id, ZONEID_TYPE zone_id, CHANNEL_TYPE district_channel_id, CHANNEL_TYPE from_channel_id, PyObject *optional_fields) const { @@ -1059,7 +1059,7 @@ ai_format_generate(PyObject *distobj, DOID_TYPE do_id, } else { packer.raw_pack_uint16(STATESERVER_OBJECT_GENERATE_WITH_REQUIRED); } - + // Parent is a bit overloaded; this parent is not about inheritance, // this one is about the visibility container parent, i.e. the zone // parent: @@ -1126,14 +1126,14 @@ ai_format_generate(PyObject *distobj, DOID_TYPE do_id, // Description: Generates a datagram containing the message necessary // to create a new database distributed object from the AI. // -// First Pass is to only incldue required values -// (with Defaults). +// First Pass is to only include required values +// (with Defaults). //////////////////////////////////////////////////////////////////// Datagram DCClass:: ai_database_generate_context( unsigned int context_id, DOID_TYPE parent_id, ZONEID_TYPE zone_id, CHANNEL_TYPE owner_channel, - CHANNEL_TYPE database_server_id, CHANNEL_TYPE from_channel_id) const + CHANNEL_TYPE database_server_id, CHANNEL_TYPE from_channel_id) const { DCPacker packer; packer.raw_pack_uint8(1); @@ -1141,7 +1141,7 @@ ai_database_generate_context( packer.RAW_PACK_CHANNEL(from_channel_id); //packer.raw_pack_uint8('A'); packer.raw_pack_uint16(STATESERVER_OBJECT_CREATE_WITH_REQUIRED_CONTEXT); - packer.raw_pack_uint32(parent_id); + packer.raw_pack_uint32(parent_id); packer.raw_pack_uint32(zone_id); packer.RAW_PACK_CHANNEL(owner_channel); packer.raw_pack_uint16(_number); // DCD class ID @@ -1170,13 +1170,13 @@ ai_database_generate_context( // Description: Generates a datagram containing the message necessary // to create a new database distributed object from the AI. // -// First Pass is to only incldue required values -// (with Defaults). +// First Pass is to only include required values +// (with Defaults). //////////////////////////////////////////////////////////////////// Datagram DCClass:: ai_database_generate_context_old( unsigned int context_id, DOID_TYPE parent_id, ZONEID_TYPE zone_id, - CHANNEL_TYPE database_server_id, CHANNEL_TYPE from_channel_id) const + CHANNEL_TYPE database_server_id, CHANNEL_TYPE from_channel_id) const { DCPacker packer; packer.raw_pack_uint8(1); @@ -1184,7 +1184,7 @@ ai_database_generate_context_old( packer.RAW_PACK_CHANNEL(from_channel_id); //packer.raw_pack_uint8('A'); packer.raw_pack_uint16(STATESERVER_OBJECT_CREATE_WITH_REQUIRED_CONTEXT); - packer.raw_pack_uint32(parent_id); + packer.raw_pack_uint32(parent_id); packer.raw_pack_uint32(zone_id); packer.raw_pack_uint16(_number); // DCD class ID packer.raw_pack_uint32(context_id); @@ -1205,10 +1205,10 @@ ai_database_generate_context_old( #endif // HAVE_PYTHON //////////////////////////////////////////////////////////////////// -// Function : DCClass::output -// Access : Public, Virtual -// Description : Write a string representation of this instance to -// . +// Function: DCClass::output +// Access: Public, Virtual +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void DCClass:: output(ostream &out, bool brief) const { @@ -1284,7 +1284,7 @@ write(ostream &out, bool brief, int indent_level) const { // the indicated output stream. //////////////////////////////////////////////////////////////////// void DCClass:: -output_instance(ostream &out, bool brief, const string &prename, +output_instance(ostream &out, bool brief, const string &prename, const string &name, const string &postname) const { if (_is_struct) { out << "struct"; @@ -1380,7 +1380,7 @@ rebuild_inherited_fields() { Names names; _inherited_fields.clear(); - + // First, all of the inherited fields from our parent are at the top // of the list. Parents::const_iterator pi; @@ -1413,7 +1413,7 @@ rebuild_inherited_fields() { for (fi = _fields.begin(); fi != _fields.end(); ++fi) { DCField *field = (*fi); if (field->get_name().empty()) { - // Unnamed fields are always added. + // Unnamed fields are always added. _inherited_fields.push_back(field); } else { @@ -1500,7 +1500,7 @@ add_field(DCField *field) { } } - if (_dc_file != (DCFile *)NULL && + if (_dc_file != (DCFile *)NULL && ((dc_virtual_inheritance && dc_sort_inheritance_by_file) || !is_struct())) { if (dc_multiple_inheritance) { _dc_file->set_new_index_number(field); diff --git a/direct/src/dcparser/dcDeclaration.cxx b/direct/src/dcparser/dcDeclaration.cxx index e0c2963897..c3bc368f13 100644 --- a/direct/src/dcparser/dcDeclaration.cxx +++ b/direct/src/dcparser/dcDeclaration.cxx @@ -27,7 +27,7 @@ DCDeclaration:: //////////////////////////////////////////////////////////////////// // Function: DCDeclaration::as_class // Access: Published, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// DCClass *DCDeclaration:: as_class() { @@ -37,7 +37,7 @@ as_class() { //////////////////////////////////////////////////////////////////// // Function: DCDeclaration::as_class // Access: Published, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const DCClass *DCDeclaration:: as_class() const { @@ -47,7 +47,7 @@ as_class() const { //////////////////////////////////////////////////////////////////// // Function: DCDeclaration::as_switch // Access: Published, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// DCSwitch *DCDeclaration:: as_switch() { @@ -57,7 +57,7 @@ as_switch() { //////////////////////////////////////////////////////////////////// // Function: DCDeclaration::as_switch // Access: Published, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const DCSwitch *DCDeclaration:: as_switch() const { @@ -65,10 +65,10 @@ as_switch() const { } //////////////////////////////////////////////////////////////////// -// Function : DCDeclaration::output -// Access : Published, Virtual -// Description : Write a string representation of this instance to -// . +// Function: DCDeclaration::output +// Access: Published, Virtual +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void DCDeclaration:: output(ostream &out) const { @@ -76,10 +76,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : DCDeclaration:: -// Access : Published -// Description : Write a string representation of this instance to -// . +// Function: DCDeclaration:: +// Access: Published +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void DCDeclaration:: write(ostream &out, int indent_level) const { diff --git a/direct/src/dcparser/dcField.I b/direct/src/dcparser/dcField.I index 37eaf7b32d..c056d26b2a 100644 --- a/direct/src/dcparser/dcField.I +++ b/direct/src/dcparser/dcField.I @@ -178,10 +178,10 @@ is_airecv() const { } //////////////////////////////////////////////////////////////////// -// Function : DCField::output -// Access : Published -// Description : Write a string representation of this instance to -// . +// Function: DCField::output +// Access: Published +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// INLINE void DCField:: output(ostream &out) const { @@ -189,10 +189,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : DCField:: -// Access : Published -// Description : Write a string representation of this instance to -// . +// Function: DCField:: +// Access: Published +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// INLINE void DCField:: write(ostream &out, int indent_level) const { diff --git a/direct/src/dcparser/dcKeyword.cxx b/direct/src/dcparser/dcKeyword.cxx index 8801f4d5a6..1c5ecb83af 100644 --- a/direct/src/dcparser/dcKeyword.cxx +++ b/direct/src/dcparser/dcKeyword.cxx @@ -19,7 +19,7 @@ //////////////////////////////////////////////////////////////////// // Function: DCKeyword::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// DCKeyword:: DCKeyword(const string &name, int historical_flag) : @@ -74,10 +74,10 @@ clear_historical_flag() { } //////////////////////////////////////////////////////////////////// -// Function : DCKeyword::output -// Access : Public, Virtual -// Description : Write a string representation of this instance to -// . +// Function: DCKeyword::output +// Access: Public, Virtual +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void DCKeyword:: output(ostream &out, bool brief) const { @@ -87,7 +87,7 @@ output(ostream &out, bool brief) const { //////////////////////////////////////////////////////////////////// // Function: DCKeyword::write // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void DCKeyword:: write(ostream &out, bool, int indent_level) const { diff --git a/direct/src/dcparser/dcSwitch.cxx b/direct/src/dcparser/dcSwitch.cxx index d4132c6565..ad03554a54 100644 --- a/direct/src/dcparser/dcSwitch.cxx +++ b/direct/src/dcparser/dcSwitch.cxx @@ -67,7 +67,7 @@ DCSwitch:: //////////////////////////////////////////////////////////////////// // Function: DCSwitch::as_switch // Access: Published, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// DCSwitch *DCSwitch:: as_switch() { @@ -77,7 +77,7 @@ as_switch() { //////////////////////////////////////////////////////////////////// // Function: DCSwitch::as_switch // Access: Published, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const DCSwitch *DCSwitch:: as_switch() const { @@ -351,10 +351,10 @@ apply_switch(const char *value_data, size_t length) const { } //////////////////////////////////////////////////////////////////// -// Function : DCSwitch::output -// Access : Public, Virtual -// Description : Write a string representation of this instance to -// . +// Function: DCSwitch::output +// Access: Public, Virtual +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void DCSwitch:: output(ostream &out, bool brief) const { @@ -379,7 +379,7 @@ write(ostream &out, bool brief, int indent_level) const { // the indicated output stream. //////////////////////////////////////////////////////////////////// void DCSwitch:: -output_instance(ostream &out, bool brief, const string &prename, +output_instance(ostream &out, bool brief, const string &prename, const string &name, const string &postname) const { out << "switch"; if (!_name.empty()) { @@ -426,7 +426,7 @@ output_instance(ostream &out, bool brief, const string &prename, //////////////////////////////////////////////////////////////////// void DCSwitch:: write_instance(ostream &out, bool brief, int indent_level, - const string &prename, const string &name, + const string &prename, const string &name, const string &postname) const { indent(out, indent_level) << "switch"; @@ -532,7 +532,7 @@ pack_default_value(DCPackData &pack_data, bool &pack_error) const { // default. packer.pack_default_value(); fields = _default_case; - } + } if (!packer.end_pack()) { pack_error = true; @@ -634,7 +634,7 @@ start_new_case() { //////////////////////////////////////////////////////////////////// // Function: DCSwitch::SwitchFields::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// DCSwitch::SwitchFields:: SwitchFields(const string &name) : @@ -654,7 +654,7 @@ SwitchFields(const string &name) : //////////////////////////////////////////////////////////////////// // Function: DCSwitch::SwitchFields::Destructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// DCSwitch::SwitchFields:: ~SwitchFields() { @@ -690,7 +690,7 @@ add_field(DCField *field) { if (!field->get_name().empty()) { bool inserted = _fields_by_name.insert (FieldsByName::value_type(field->get_name(), field)).second; - + if (!inserted) { return false; } @@ -738,11 +738,11 @@ do_check_match_switch_case(const DCSwitch::SwitchFields *other) const { return true; } - + //////////////////////////////////////////////////////////////////// // Function: DCSwitch::SwitchFields::output // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void DCSwitch::SwitchFields:: output(ostream &out, bool brief) const { @@ -758,11 +758,11 @@ output(ostream &out, bool brief) const { } out << "break; "; } - + //////////////////////////////////////////////////////////////////// // Function: DCSwitch::SwitchFields::write // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void DCSwitch::SwitchFields:: write(ostream &out, bool brief, int indent_level) const { @@ -797,7 +797,7 @@ do_check_match(const DCPackerInterface *) const { //////////////////////////////////////////////////////////////////// // Function: DCSwitch::SwitchCase::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// DCSwitch::SwitchCase:: SwitchCase(const string &value, DCSwitch::SwitchFields *fields) : @@ -809,7 +809,7 @@ SwitchCase(const string &value, DCSwitch::SwitchFields *fields) : //////////////////////////////////////////////////////////////////// // Function: DCSwitch::SwitchCase::Destructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// DCSwitch::SwitchCase:: ~SwitchCase() { diff --git a/direct/src/dcparser/dcSwitchParameter.h b/direct/src/dcparser/dcSwitchParameter.h index 9d3c4e0a6b..53d86796df 100644 --- a/direct/src/dcparser/dcSwitchParameter.h +++ b/direct/src/dcparser/dcSwitchParameter.h @@ -1,4 +1,4 @@ -// Filename: dcClassParameter.h +// Filename: dcSwitchParameter.h // Created by: drose (29Jun04) // //////////////////////////////////////////////////////////////////// @@ -44,7 +44,7 @@ public: const DCPackerInterface *apply_switch(const char *value_data, size_t length) const; - virtual void output_instance(ostream &out, bool brief, const string &prename, + virtual void output_instance(ostream &out, bool brief, const string &prename, const string &name, const string &postname) const; virtual void write_instance(ostream &out, bool brief, int indent_level, const string &prename, const string &name, diff --git a/direct/src/dcparser/dcTypedef.cxx b/direct/src/dcparser/dcTypedef.cxx index e67af8301b..7f75377152 100644 --- a/direct/src/dcparser/dcTypedef.cxx +++ b/direct/src/dcparser/dcTypedef.cxx @@ -146,10 +146,10 @@ set_number(int number) { } //////////////////////////////////////////////////////////////////// -// Function : DCTypedef::output -// Access : Public, Virtual -// Description : Write a string representation of this instance to -// . +// Function: DCTypedef::output +// Access: Public, Virtual +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void DCTypedef:: output(ostream &out, bool brief) const { @@ -160,7 +160,7 @@ output(ostream &out, bool brief) const { //////////////////////////////////////////////////////////////////// // Function: DCTypedef::write // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void DCTypedef:: write(ostream &out, bool brief, int indent_level) const { diff --git a/direct/src/directbase/ppython.cxx b/direct/src/directbase/ppython.cxx index d29a2c8831..176116715d 100644 --- a/direct/src/directbase/ppython.cxx +++ b/direct/src/directbase/ppython.cxx @@ -1,11 +1,11 @@ -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // This is a little wrapper to make it easy to run a python // program from the command line. Basically, it just interfaces // to the Python API and imports the module that was specified // by the IMPORT_MODULE preprocessor definition when it was compiled. // -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// #include "dtoolbase.h" diff --git a/direct/src/directd/directd.h b/direct/src/directd/directd.h index d4937f28ae..4add16a399 100644 --- a/direct/src/directd/directd.h +++ b/direct/src/directd/directd.h @@ -29,45 +29,48 @@ typedef int HANDLE; #endif //] -// Description: DirectD is a client/server app for starting panda/direct. -// -// Usage: -// Start a directd server on each of the machines you -// which to start panda on. -// -// Start a directd client on the controlling machine or -// import ShowBaseGlobal with the xxxxx flag in your -// Configrc. The client will connect each of the servers -// in the xxxxx list in your Configrc. -// -// There are two API groups in this class, they are: -// -// listen_to() -// client_ready() or tell_server() -// wait_for_servers() -// server_ready() -// -// and: -// -// connect_to() -// send_command() -// disconnect_from() -// -// The second group was from a more general implementation -// of DirectD. The first group summarizes the main intents -// of DirectD. -// Both groups are presented in order chronologically by their -// intended usage. -// The first group will probably provide everthing needed for -// DirectD. +//////////////////////////////////////////////////////////////////// +// Class : DirectD +// Description : DirectD is a client/server app for starting panda/direct. +// +// Usage: +// Start a directd server on each of the machines you +// which to start panda on. +// +// Start a directd client on the controlling machine or +// import ShowBaseGlobal with the xxxxx flag in your +// Configrc. The client will connect each of the servers +// in the xxxxx list in your Configrc. +// +// There are two API groups in this class, they are: +// +// listen_to() +// client_ready() or tell_server() +// wait_for_servers() +// server_ready() +// +// and: +// +// connect_to() +// send_command() +// disconnect_from() +// +// The second group was from a more general implementation +// of DirectD. The first group summarizes the main intents +// of DirectD. +// Both groups are presented in order chronologically by their +// intended usage. +// The first group will probably provide everthing needed for +// DirectD. +//////////////////////////////////////////////////////////////////// class EXPCL_DIRECT DirectD { PUBLISHED: DirectD(); ~DirectD(); - + // Description: Call listen_to in the server. // port is a rendezvous port. - // + // // backlog refers to how many connections can queue up // before you handle them. Consider setting backlog to // the count you send to wait_for_servers(); or higher. @@ -84,7 +87,7 @@ PUBLISHED: // Description: Tell the server to do the command cmd. // cmd is one of the following: - // "k[]" Kill the most recent application + // "k[]" Kill the most recent application // started with client_ready() or "!". // Or kill the nth most recent or 'a' for All. // E.g. "k", "k0", "k2", "ka". @@ -99,31 +102,31 @@ PUBLISHED: // Description: Call this function from the client after // calling client_ready() calls. - // + // // Call listen_to(port) prior to calling // wait_for_servers() (or better yet, prior // to calling client_ready()). - // + // // timeout_ms defaults to two minutes. bool wait_for_servers(int count, int timeout_ms=2*60*1000); // Description: Call this function from the server when // import ShowbaseGlobal is nearly finished. int server_ready(const string& client_host, int port); - + // Description: Call connect_to from client for each server. // returns the port number of the connection (which // is different from the rendezvous port used in the // second argument). The return value can be used // for the port arguemnt in disconnect_from(). int connect_to(const string& server_host, int port); - + // Description: This is the counterpart to connect_to(). Pass // the same server_host as for connect_to(), but pass // the return value from connect_to() for the port, // not the port passed to connect_to(). void disconnect_from(const string& server_host, int port); - + // Description: Send the same command string to all current // connections. void send_command(const string& cmd); @@ -134,7 +137,7 @@ protected: void kill_all(); virtual void handle_command(const string& cmd); void handle_datagram(NetDatagram& datagram); - void send_one_message(const string& host_name, + void send_one_message(const string& host_name, int port, const string& message); QueuedConnectionManager _cm; @@ -143,7 +146,7 @@ protected: QueuedConnectionListener _listener; // Start of old stuff: - // This is used to switch to the original method of + // This is used to switch to the original method of // starting applications. It can be used on old systems // that don't support job objects. Eventually this stuff // should be removed. @@ -156,7 +159,7 @@ protected: ConnectionSet _connections; HANDLE _jobObject; bool _shutdown; - + void check_for_new_clients(); void check_for_datagrams(); void check_for_lost_connection(); diff --git a/direct/src/directdServer/directdClient.h b/direct/src/directdServer/directdClient.h index 0fbf82c28f..b6923218dd 100644 --- a/direct/src/directdServer/directdClient.h +++ b/direct/src/directdServer/directdClient.h @@ -14,7 +14,10 @@ #include "directd.h" -// Description: DirectDClient is a test app for DriectDServer. +//////////////////////////////////////////////////////////////////// +// Class : DirectDClient +// Description : DirectDClient is a test app for DirectDServer. +//////////////////////////////////////////////////////////////////// class DirectDClient: public DirectD { public: DirectDClient(); @@ -25,4 +28,3 @@ public: protected: void cli_command(const string& cmd); }; - diff --git a/direct/src/directdServer/directdServer.h b/direct/src/directdServer/directdServer.h index 2dd29f8525..9c1752a83f 100644 --- a/direct/src/directdServer/directdServer.h +++ b/direct/src/directdServer/directdServer.h @@ -15,18 +15,21 @@ #include "queuedConnectionReader.h" #include "directd.h" -// Description: Start a directdServer on each of the machines you -// which to start panda on. -// -// Start a directdClient on the controlling machine -// or import ShowBaseGlobal with the xxxxx flag in -// your Configrc. The client will connact each of -// the servers in the xxxxx list in your Configrc. +//////////////////////////////////////////////////////////////////// +// Class : DirectDServer +// Description : Start a directdServer on each of the machines you +// which to start panda on. +// +// Start a directdClient on the controlling machine +// or import ShowBaseGlobal with the xxxxx flag in +// your Configrc. The client will connact each of +// the servers in the xxxxx list in your Configrc. +//////////////////////////////////////////////////////////////////// class DirectDServer: public DirectD { public: DirectDServer(); ~DirectDServer(); - + void run_server(int port); protected: diff --git a/direct/src/motiontrail/cMotionTrail.cxx b/direct/src/motiontrail/cMotionTrail.cxx index 5d5e7173ce..9cb163e36c 100644 --- a/direct/src/motiontrail/cMotionTrail.cxx +++ b/direct/src/motiontrail/cMotionTrail.cxx @@ -1,4 +1,4 @@ -// Filename: cMotionTrail.h +// Filename: cMotionTrail.cxx // Created by: aignacio (29Jan07) // //////////////////////////////////////////////////////////////////// @@ -30,7 +30,7 @@ CMotionTrail ( ) { _active = true; _enable = true; - + _pause = false; _pause_time = 0.0f; @@ -63,7 +63,7 @@ CMotionTrail ( ) { // real-time data _vertex_index = 0; _vertex_data = 0; - _triangles = 0; + _triangles = 0; _vertex_array = 0; } @@ -132,7 +132,7 @@ add_vertex (LVector4 *vertex, LVector4 *start_color, LVector4 *end_color, PN_std motion_trail_vertex._start_color = *start_color; motion_trail_vertex._end_color = *end_color; motion_trail_vertex._v = v; - + motion_trail_vertex._nurbs_curve_evaluator = new NurbsCurveEvaluator ( ); _vertex_list.push_back (motion_trail_vertex); @@ -143,23 +143,23 @@ add_vertex (LVector4 *vertex, LVector4 *start_color, LVector4 *end_color, PN_std // Access: Published // Description: Set motion trail parameters. // -// sampling_time = Can be used to specify a lower -// sampling rate than the frame rate. Use 0.0 with -// nurbs. +// sampling_time = Can be used to specify a lower +// sampling rate than the frame rate. Use 0.0 with +// nurbs. // -// time_window = a component for the "length" of the -// motion trail. The motion trail length = +// time_window = a component for the "length" of the +// motion trail. The motion trail length = // time_window * velocity of the object. // // use_texture = texture option on/off. // -// calculate_relative_matrix = calculate relative +// calculate_relative_matrix = calculate relative // matrix on/off. // // use_nurbs = nurbs option on/off // -// resolution_distance = the distance used to -// determine the number of geometry samples. +// resolution_distance = the distance used to +// determine the number of geometry samples. // samples = motion trail length / resolution_distance. // Applicable only if nurbs is on. //////////////////////////////////////////////////////////////////// @@ -183,7 +183,7 @@ int CMotionTrail:: check_for_update (PN_stdfloat current_time) { int state; - + state = false; if ((current_time - _last_update_time) >= _sampling_time) { state = true; @@ -208,14 +208,14 @@ PN_stdfloat one_minus_x (PN_stdfloat x) { //////////////////////////////////////////////////////////////////// // Function: CMotionTrail::begin_geometry // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void CMotionTrail:: begin_geometry ( ) { const GeomVertexFormat *format; - _vertex_index = 0; + _vertex_index = 0; if (_use_texture) { format = GeomVertexFormat::get_v3c4t2 ( ); } @@ -236,7 +236,7 @@ begin_geometry ( ) { if (_use_texture) { _texture_writer = GeomVertexWriter (_vertex_data, "texcoord"); } - + _triangles = new GeomTriangles (Geom::UH_static); } @@ -325,16 +325,16 @@ add_geometry_quad (LVector4 &v0, LVector4 &v1, LVector4 &v2, LVector4 &v3, LVect //////////////////////////////////////////////////////////////////// // Function: CMotionTrail::end_geometry // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// -void CMotionTrail::end_geometry ( ) { +void CMotionTrail::end_geometry ( ) { static CPT(RenderState) state; if (state == (RenderState *)NULL) { state = RenderState::make(ColorAttrib::make_vertex()); } PT(Geom) geometry; - + geometry = new Geom (_vertex_data); geometry -> add_primitive (_triangles); @@ -354,14 +354,14 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) { int debug; int total_frames; - + debug = false; total_frames = _frame_list.size ( ); if (total_frames >= 1) { FrameList::iterator frame_iterator; CMotionTrailFrame motion_trail_frame; - + frame_iterator = _frame_list.begin ( ); motion_trail_frame = *frame_iterator; if (*transform == motion_trail_frame._transform) { @@ -380,7 +380,7 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) { color_scale = _color_scale; if (_fade) { PN_stdfloat elapsed_time; - + elapsed_time = current_time - _fade_start_time; if (elapsed_time < 0.0) { elapsed_time = 0.0; @@ -398,20 +398,20 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) { // remove expired frames PN_stdfloat minimum_time; - + minimum_time = current_time - _time_window; - + CMotionTrailFrame motion_trail_frame; - + while (!_frame_list.empty()) { motion_trail_frame = _frame_list.back(); if (motion_trail_frame._time >= minimum_time) { break; } - + _frame_list.pop_back ( ); } - + // add new frame to beginning of list { CMotionTrailFrame motion_trail_frame; @@ -435,21 +435,21 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) { PN_stdfloat delta_time; CMotionTrailFrame last_motion_trail_frame; - VertexList::iterator vertex_iterator; + VertexList::iterator vertex_iterator; // convert vertex list to vertex array int index = 0; _vertex_array = new CMotionTrailVertex [total_vertices]; - for (vertex_iterator = _vertex_list.begin ( ); vertex_iterator != _vertex_list.end ( ); vertex_iterator++) { - _vertex_array [index] = *vertex_iterator; + for (vertex_iterator = _vertex_list.begin ( ); vertex_iterator != _vertex_list.end ( ); vertex_iterator++) { + _vertex_array [index] = *vertex_iterator; index++; } - + // begin geometry this -> begin_geometry ( ); total_segments = total_frames - 1; - + last_motion_trail_frame = _frame_list.back(); minimum_time = last_motion_trail_frame._time; delta_time = current_time - minimum_time; @@ -460,10 +460,10 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) { } if (_use_nurbs && (total_frames >= 5)) { - + // nurbs version int total_vertex_segments; - PN_stdfloat total_distance; + PN_stdfloat total_distance; LVector3 vector; LVector4 v; LVector4 v0; @@ -479,19 +479,19 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) { CMotionTrailVertex *motion_trail_vertex; PT(NurbsCurveEvaluator) nurbs_curve_evaluator; - for (index = 0; index < total_vertices; index++) { + for (index = 0; index < total_vertices; index++) { motion_trail_vertex = &_vertex_array [index]; nurbs_curve_evaluator = motion_trail_vertex -> _nurbs_curve_evaluator; nurbs_curve_evaluator -> set_order (4); nurbs_curve_evaluator -> reset (total_segments); } } - + // add vertices to each NurbsCurveEvaluator int segment_index; CMotionTrailFrame motion_trail_frame_start; CMotionTrailFrame motion_trail_frame_end; - + segment_index = 0; FrameList::iterator frame_iterator; @@ -549,13 +549,13 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) { segment_index += 1; } - + // evaluate NurbsCurveEvaluator for each vertex PT(NurbsCurveResult) *nurbs_curve_result_array; - + nurbs_curve_result_array = new PT(NurbsCurveResult) [total_vertices]; for (index = 0; index < total_vertices; index++) { - + CMotionTrailVertex *motion_trail_vertex; PT(NurbsCurveEvaluator) nurbs_curve_evaluator; PT(NurbsCurveResult) nurbs_curve_result; @@ -576,10 +576,10 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) { printf ("nurbs_start_t %f, nurbs_end_t %f \n", nurbs_start_t, nurbs_end_t); } } - - // create quads from NurbsCurveResult + + // create quads from NurbsCurveResult PN_stdfloat total_curve_segments; - + total_curve_segments = (total_distance / _resolution_distance); if (total_curve_segments < total_segments) { total_curve_segments = total_segments; @@ -607,8 +607,8 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) { PN_stdfloat curve_segment_index; curve_segment_index = 0.0; - while (curve_segment_index < total_curve_segments) { - + while (curve_segment_index < total_curve_segments) { + PN_stdfloat st; PN_stdfloat et; PN_stdfloat start_t; @@ -708,7 +708,7 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) { for (index = 0; index < total_vertices; index++) { nurbs_curve_result_array [index] = 0; } - + delete[] nurbs_curve_result_array; } else { @@ -717,7 +717,7 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) { int segment_index; int vertex_segment_index; int total_vertex_segments; - + PN_stdfloat st; PN_stdfloat et; PN_stdfloat start_t; @@ -745,12 +745,12 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) { CMotionTrailFrame motion_trail_frame_start; CMotionTrailFrame motion_trail_frame_end; - + segment_index = 0; FrameList::iterator frame_iterator; frame_iterator = _frame_list.begin ( ); while (segment_index < total_segments) { - + CMotionTrailVertex *motion_trail_vertex_start; CMotionTrailVertex *motion_trail_vertex_end; @@ -796,7 +796,7 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) { t2.set (et, motion_trail_vertex_start -> _v); while (vertex_segment_index < total_vertex_segments) { - + motion_trail_vertex_start = &_vertex_array [vertex_segment_index]; motion_trail_vertex_end = &_vertex_array [vertex_segment_index + 1]; @@ -829,11 +829,11 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) { } segment_index += 1; - } + } } // end geometry - this -> end_geometry ( ); + this -> end_geometry ( ); delete[] _vertex_array; _vertex_array = 0; diff --git a/direct/src/motiontrail/config_motiontrail.h b/direct/src/motiontrail/config_motiontrail.h index 64de86db3d..09215deda5 100644 --- a/direct/src/motiontrail/config_motiontrail.h +++ b/direct/src/motiontrail/config_motiontrail.h @@ -1,4 +1,4 @@ -// Filename: config_interval.h +// Filename: config_motiontrail.h // Created by: drose (27Aug02) // //////////////////////////////////////////////////////////////////// diff --git a/direct/src/plugin/find_root_dir_assist.mm b/direct/src/plugin/find_root_dir_assist.mm index ef1b3abc20..fb43c845d7 100644 --- a/direct/src/plugin/find_root_dir_assist.mm +++ b/direct/src/plugin/find_root_dir_assist.mm @@ -1,4 +1,4 @@ -// Filename: filename_assist.mm +// Filename: find_root_dir_assist.mm // Created by: drose (13Apr09) // //////////////////////////////////////////////////////////////////// @@ -23,7 +23,7 @@ // Function: NSString_to_cpp_string // Description: Copy the Objective-C string to a C++ string. //////////////////////////////////////////////////////////////////// -static string +static string NSString_to_cpp_string(NSString *str) { size_t length = [str length]; string result; @@ -36,44 +36,44 @@ NSString_to_cpp_string(NSString *str) { //////////////////////////////////////////////////////////////////// // Function: call_NSSearchPathForDirectories -// Description: +// Description: //////////////////////////////////////////////////////////////////// -static string +static string call_NSSearchPathForDirectories(NSSearchPathDirectory dirkey, NSSearchPathDomainMask domain) { // Ensure that Carbon has been initialized, and that we have an // auto-release pool. NSApplicationLoad(); - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSArray *paths = NSSearchPathForDirectoriesInDomains(dirkey, domain, YES); string result; if ([paths count] != 0) { result = NSString_to_cpp_string([paths objectAtIndex:0]); } - [pool release]; + [pool release]; return result; } //////////////////////////////////////////////////////////////////// // Function: get_osx_home_directory -// Description: +// Description: //////////////////////////////////////////////////////////////////// static string get_osx_home_directory() { NSApplicationLoad(); - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSString *dir = NSHomeDirectory(); string result = NSString_to_cpp_string(dir); - [pool release]; + [pool release]; return result; } //////////////////////////////////////////////////////////////////// // Function: find_osx_root_dir -// Description: +// Description: //////////////////////////////////////////////////////////////////// string find_osx_root_dir() { diff --git a/direct/src/plugin/p3dAuthSession.cxx b/direct/src/plugin/p3dAuthSession.cxx index 177ffc7c0a..8fe825f853 100644 --- a/direct/src/plugin/p3dAuthSession.cxx +++ b/direct/src/plugin/p3dAuthSession.cxx @@ -1,4 +1,4 @@ -// Filename: P3DAuthSession.cxx +// Filename: p3dAuthSession.cxx // Created by: drose (17Sep09) // //////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ //////////////////////////////////////////////////////////////////// // Function: P3DAuthSession::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// P3DAuthSession:: P3DAuthSession(P3DInstance *inst) : @@ -62,7 +62,7 @@ P3DAuthSession(P3DInstance *inst) : } if (inst->_mf_reader.get_num_signatures() > 0) { - const P3DMultifileReader::CertChain &cert_chain = + const P3DMultifileReader::CertChain &cert_chain = inst->_mf_reader.get_signature(0); if (cert_chain.size() > 0) { @@ -87,7 +87,7 @@ P3DAuthSession(P3DInstance *inst) : //////////////////////////////////////////////////////////////////// // Function: P3DAuthSession::Destructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// P3DAuthSession:: ~P3DAuthSession() { @@ -130,7 +130,7 @@ shutdown(bool send_message) { int status; waitpid(_p3dcert_pid, &status, WNOHANG); #endif // _WIN32 - + _p3dcert_running = false; } _p3dcert_started = false; @@ -264,7 +264,7 @@ start_p3dcert() { _p3dcert_started = true; _p3dcert_running = true; - + spawn_wait_thread(); } @@ -343,13 +343,13 @@ wt_thread_run() { } _p3dcert_pid = -1; _p3dcert_running = false; - + nout << "p3dcert process has successfully stopped.\n"; if (WIFEXITED(status)) { nout << " exited normally, status = " << WEXITSTATUS(status) << "\n"; } else if (WIFSIGNALED(status)) { - nout << " signalled by " << WTERMSIG(status) << ", core = " + nout << " signalled by " << WTERMSIG(status) << ", core = " << WCOREDUMP(status) << "\n"; } else if (WIFSTOPPED(status)) { nout << " stopped by " << WSTOPSIG(status) << "\n"; @@ -383,7 +383,7 @@ win_create_process() { STARTUPINFO startup_info; ZeroMemory(&startup_info, sizeof(startup_info)); - startup_info.cb = sizeof(startup_info); + startup_info.cb = sizeof(startup_info); // Make sure the initial window is *shown* for this graphical app. startup_info.wShowWindow = SW_SHOW; @@ -394,7 +394,7 @@ win_create_process() { // Construct the command-line string, containing the quoted // command-line arguments. ostringstream stream; - stream << "\"" << _p3dcert_exe << "\" \"" + stream << "\"" << _p3dcert_exe << "\" \"" << _cert_filename->get_filename() << "\" \"" << _cert_dir << "\""; // I'm not sure why CreateProcess wants a non-const char pointer for @@ -410,10 +410,10 @@ win_create_process() { // from CreateProcessW(). Something about the way wx parses the // command-line parameters? Well, whatever, we don't really need // the Unicode form anyway. - PROCESS_INFORMATION process_info; + PROCESS_INFORMATION process_info; BOOL result = CreateProcess (_p3dcert_exe.c_str(), command_line, NULL, NULL, TRUE, - 0, (void *)_env.c_str(), + 0, (void *)_env.c_str(), start_dir_cstr, &startup_info, &process_info); bool started_program = (result != 0); diff --git a/direct/src/plugin/p3dAuthSession.h b/direct/src/plugin/p3dAuthSession.h index bc0efda82d..b653e4780d 100644 --- a/direct/src/plugin/p3dAuthSession.h +++ b/direct/src/plugin/p3dAuthSession.h @@ -1,4 +1,4 @@ -// Filename: P3DAuthSession.h +// Filename: p3dAuthSession.h // Created by: drose (17Sep09) // //////////////////////////////////////////////////////////////////// diff --git a/direct/src/plugin/p3dCert_strings.cxx b/direct/src/plugin/p3dCert_strings.cxx index 307c9b7f44..d29bc9c00a 100644 --- a/direct/src/plugin/p3dCert_strings.cxx +++ b/direct/src/plugin/p3dCert_strings.cxx @@ -1,4 +1,4 @@ -// Filename: p3dCert_strings.h +// Filename: p3dCert_strings.cxx // Created by: rdb (25Mar15) // //////////////////////////////////////////////////////////////////// diff --git a/direct/src/plugin/p3dCert_wx.cxx b/direct/src/plugin/p3dCert_wx.cxx index 8111adc13d..fa3d63292f 100644 --- a/direct/src/plugin/p3dCert_wx.cxx +++ b/direct/src/plugin/p3dCert_wx.cxx @@ -1,4 +1,4 @@ -// Filename: p3dCert.cxx +// Filename: p3dCert_wx.cxx // Created by: drose (11Sep09) // //////////////////////////////////////////////////////////////////// diff --git a/direct/src/plugin/p3dCert_wx.h b/direct/src/plugin/p3dCert_wx.h index af3800e04c..94e2a4bd7b 100644 --- a/direct/src/plugin/p3dCert_wx.h +++ b/direct/src/plugin/p3dCert_wx.h @@ -1,4 +1,4 @@ -// Filename: p3dCert.h +// Filename: p3dCert_wx.h // Created by: drose (11Sep09) // //////////////////////////////////////////////////////////////////// diff --git a/direct/src/plugin_activex/P3DActiveX.cpp b/direct/src/plugin_activex/P3DActiveX.cpp index dcfe6ce8b3..fa752bf7d7 100644 --- a/direct/src/plugin_activex/P3DActiveX.cpp +++ b/direct/src/plugin_activex/P3DActiveX.cpp @@ -1,5 +1,3 @@ -// P3DActiveX.cpp : Implementation of CP3DActiveXApp and DLL registration. - // Filename: P3DActiveX.cpp // Created by: atrestman (14Sept09) // @@ -14,6 +12,8 @@ // //////////////////////////////////////////////////////////////////// +// P3DActiveX.cpp : Implementation of CP3DActiveXApp and DLL registration. + #include "stdafx.h" #include "P3DActiveX.h" @@ -38,23 +38,23 @@ const WORD _wVerMinor = 0; // Id taken from IMPLEMENT_OLECREATE_EX function in xxxCtrl.cpp - + const CATID CLSID_SafeItem = { 0x924b4927, 0xd3ba, 0x41ea, 0x9f, 0x7e, 0x8a, 0x89, 0x19, 0x4a, 0xb3, 0xac }; - + // HRESULT CreateComponentCategory - Used to register ActiveX control as safe - + HRESULT CreateComponentCategory(CATID catid, WCHAR *catDescription) { ICatRegister *pcr = NULL ; HRESULT hr = S_OK ; - - hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, + + hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr); if (FAILED(hr)) return hr; - + // Make sure the HKCR\Component Categories\{..catid...} // key is registered. @@ -83,13 +83,13 @@ HRESULT CreateComponentCategory(CATID catid, WCHAR *catDescription) { len = 127; } - } + } else { // TODO: Write an error handler; } - // The second parameter of StringCchCopy is 128 because you need + // The second parameter of StringCchCopy is 128 because you need // room for a NULL-terminator. @@ -97,25 +97,25 @@ HRESULT CreateComponentCategory(CATID catid, WCHAR *catDescription) // Make sure the description is null terminated. catinfo.szDescription[len + 1] = '\0'; - + hr = pcr->RegisterCategories(1, &catinfo); pcr->Release(); - + return hr; } - + // HRESULT RegisterCLSIDInCategory - // Register your component categories information - + HRESULT RegisterCLSIDInCategory(REFCLSID clsid, CATID catid) { // Register your component categories information. ICatRegister *pcr = NULL ; HRESULT hr = S_OK ; - hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, + hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr); if (SUCCEEDED(hr)) { @@ -125,22 +125,22 @@ HRESULT RegisterCLSIDInCategory(REFCLSID clsid, CATID catid) rgcatid[0] = catid; hr = pcr->RegisterClassImplCategories(clsid, 1, rgcatid); } - + if (pcr != NULL) pcr->Release(); - + return hr; } - + // HRESULT UnRegisterCLSIDInCategory - Remove entries from the registry - + HRESULT UnRegisterCLSIDInCategory(REFCLSID clsid, CATID catid) { ICatRegister *pcr = NULL ; HRESULT hr = S_OK ; - - hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, + + hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr); if (SUCCEEDED(hr)) { @@ -150,10 +150,10 @@ HRESULT UnRegisterCLSIDInCategory(REFCLSID clsid, CATID catid) rgcatid[0] = catid; hr = pcr->UnRegisterClassImplCategories(clsid, 1, rgcatid); } - + if (pcr != NULL) pcr->Release(); - + return hr; } @@ -195,41 +195,41 @@ STDAPI DllRegisterServer(void) { HRESULT hr; // HResult used by Safety Functions - + AFX_MANAGE_STATE(_afxModuleAddrThis); - + if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid)) return ResultFromScode(SELFREG_E_TYPELIB); - + if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE)) return ResultFromScode(SELFREG_E_CLASS); - + // Mark the control as safe for initializing. - - hr = CreateComponentCategory(CATID_SafeForInitializing, + + hr = CreateComponentCategory(CATID_SafeForInitializing, L"Controls safely initializable from persistent data!"); if (FAILED(hr)) return hr; - - hr = RegisterCLSIDInCategory(CLSID_SafeItem, + + hr = RegisterCLSIDInCategory(CLSID_SafeItem, CATID_SafeForInitializing); if (FAILED(hr)) return hr; - + // Mark the control as safe for scripting. - - hr = CreateComponentCategory(CATID_SafeForScripting, + + hr = CreateComponentCategory(CATID_SafeForScripting, L"Controls safely scriptable!"); if (FAILED(hr)) return hr; - - hr = RegisterCLSIDInCategory(CLSID_SafeItem, + + hr = RegisterCLSIDInCategory(CLSID_SafeItem, CATID_SafeForScripting); if (FAILED(hr)) return hr; - + return NOERROR; } @@ -241,26 +241,26 @@ STDAPI DllUnregisterServer(void) { HRESULT hr; // HResult used by Safety Functions - + AFX_MANAGE_STATE(_afxModuleAddrThis); - + // Remove entries from the registry. - hr = UnRegisterCLSIDInCategory(CLSID_SafeItem, + hr = UnRegisterCLSIDInCategory(CLSID_SafeItem, CATID_SafeForInitializing); if (FAILED(hr)) return hr; - - hr = UnRegisterCLSIDInCategory(CLSID_SafeItem, + + hr = UnRegisterCLSIDInCategory(CLSID_SafeItem, CATID_SafeForScripting); if (FAILED(hr)) return hr; - + if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor)) return ResultFromScode(SELFREG_E_TYPELIB); - + if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE)) return ResultFromScode(SELFREG_E_CLASS); - + return NOERROR; } diff --git a/direct/src/plugin_activex/P3DActiveX.h b/direct/src/plugin_activex/P3DActiveX.h index 074addbac8..f17228dc5d 100644 --- a/direct/src/plugin_activex/P3DActiveX.h +++ b/direct/src/plugin_activex/P3DActiveX.h @@ -1,7 +1,3 @@ -#pragma once - -// P3DActiveX.h : main header file for P3DActiveX.DLL - // Filename: P3DActiveX.h // Created by: atrestman (14Sept09) // @@ -16,6 +12,10 @@ // //////////////////////////////////////////////////////////////////// +#pragma once + +// P3DActiveX.h : main header file for P3DActiveX.DLL + #if !defined( __AFXCTL_H__ ) #error include 'afxctl.h' before including this file #endif diff --git a/direct/src/plugin_activex/P3DActiveXCtrl.cpp b/direct/src/plugin_activex/P3DActiveXCtrl.cpp index 046c10c6b4..6567e31063 100644 --- a/direct/src/plugin_activex/P3DActiveXCtrl.cpp +++ b/direct/src/plugin_activex/P3DActiveXCtrl.cpp @@ -1,5 +1,3 @@ -// P3DActiveXCtrl.cpp : Implementation of the CP3DActiveXCtrl ActiveX Control class. - // Filename: P3DActiveXCtrl.cpp // Created by: atrestman (14Sept09) // @@ -14,6 +12,8 @@ // //////////////////////////////////////////////////////////////////// +// P3DActiveXCtrl.cpp : Implementation of the CP3DActiveXCtrl ActiveX Control class. + #include "stdafx.h" #include "P3DActiveX.h" #include "P3DActiveXCtrl.h" @@ -159,7 +159,7 @@ BOOL CP3DActiveXCtrl::CP3DActiveXCtrlFactory::UpdateRegistry(BOOL bRegister) // CP3DActiveXCtrl::CP3DActiveXCtrl - Constructor -CP3DActiveXCtrl::CP3DActiveXCtrl() : m_instance( *this ), m_pPandaObject( NULL ) +CP3DActiveXCtrl::CP3DActiveXCtrl() : m_instance( *this ), m_pPandaObject( NULL ) { InitializeIIDs(&IID_DP3DActiveX, &IID_DP3DActiveXEvents); // TODO: Initialize your control's instance data here. @@ -194,7 +194,7 @@ void CP3DActiveXCtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInv { _state = S_loading; // The first time we get the Draw message, we know we're - // sufficiently set up to start downloading the instance. + // sufficiently set up to start downloading the instance. m_instance.read_tokens(); get_twirl_bitmaps(); @@ -261,20 +261,20 @@ void CP3DActiveXCtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInv // using to paint CDC dcMemory; dcMemory.CreateCompatibleDC(pdc); - + // Select the bitmap into the in-memory DC dcMemory.SelectObject(&_twirl_bitmaps[step]); - + // Find a centerpoint for the bitmap in the client area CRect rect; GetClientRect(&rect); int nX = rect.left + (rect.Width() - twirl_width) / 2; int nY = rect.top + (rect.Height() - twirl_height) / 2; - + // Copy the bits from the in-memory DC into the on-screen DC to // actually do the painting. Use the centerpoint we computed for // the target offset. - pdc->BitBlt(nX, nY, twirl_width, twirl_height, &dcMemory, + pdc->BitBlt(nX, nY, twirl_width, twirl_height, &dcMemory, 0, 0, SRCCOPY); } } @@ -286,10 +286,10 @@ void CP3DActiveXCtrl::OnClose( DWORD dwSaveOption ) // Make sure the init thread has finished. if (_state == S_loading) { nout << "Waiting for thread stop\n" << flush; - ::WaitForSingleObject( _init_not_running.m_hObject, INFINITE ); + ::WaitForSingleObject( _init_not_running.m_hObject, INFINITE ); nout << "Done waiting for thread stop\n" << flush; } - + COleControl::OnClose( dwSaveOption ); } @@ -302,7 +302,7 @@ void CP3DActiveXCtrl::DoPropExchange(CPropExchange* pPX) COleControl::DoPropExchange(pPX); // TODO: Call PX_ functions for each persistent custom property. - + ExchangeProperties( pPX ); } @@ -384,21 +384,21 @@ int CP3DActiveXCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) { return ( error = -1 ); } - CComPtr pOleContainer; - HRESULT hr = m_spClientSite->GetContainer( &pOleContainer ); + CComPtr pOleContainer; + HRESULT hr = m_spClientSite->GetContainer( &pOleContainer ); if ( FAILED( hr ) || !pOleContainer ) { return ( error = -1 ); } - CComPtr pHtml2Doc; - hr = pOleContainer->QueryInterface( IID_IHTMLDocument, ( void** )&pHtml2Doc ); - if ( FAILED( hr ) || !pHtml2Doc ) + CComPtr pHtml2Doc; + hr = pOleContainer->QueryInterface( IID_IHTMLDocument, ( void** )&pHtml2Doc ); + if ( FAILED( hr ) || !pHtml2Doc ) { return ( error = -1 ); } BSTR url; hr = pHtml2Doc->get_URL( &url ); - if ( FAILED( hr ) || !url ) + if ( FAILED( hr ) || !url ) { return ( error = -1 ); } @@ -422,10 +422,10 @@ int CP3DActiveXCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) if ( collectionLength < 1 ) { // javascript engine was not specified on the page. - // hence we need to initialize it by infusing javascript + // hence we need to initialize it by infusing javascript // element tags - CComPtr spHtmlElement; + CComPtr spHtmlElement; hr = pHtml2Doc->createElement( CComBSTR( "script" ), &spHtmlElement ); if ( SUCCEEDED( hr ) && spHtmlElement ) { @@ -443,7 +443,7 @@ int CP3DActiveXCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) CComPtr newNode; hr = spHtmlDomNode->appendChild( spElementDomNode, &newNode ); } - } + } } } } @@ -594,7 +594,7 @@ get_twirl_bitmaps() { for (int step = 0; step < twirl_num_steps + 1; ++step) { get_twirl_data(twirl_data, twirl_size, step, - m_instance._fgcolor_r, m_instance._fgcolor_g, m_instance._fgcolor_b, + m_instance._fgcolor_r, m_instance._fgcolor_g, m_instance._fgcolor_b, m_instance._bgcolor_r, m_instance._bgcolor_g, m_instance._bgcolor_b); // Expand out the RGB channels into RGBA. diff --git a/direct/src/plugin_activex/P3DActiveXPropPage.cpp b/direct/src/plugin_activex/P3DActiveXPropPage.cpp index 371af860f2..7fba377fbb 100644 --- a/direct/src/plugin_activex/P3DActiveXPropPage.cpp +++ b/direct/src/plugin_activex/P3DActiveXPropPage.cpp @@ -1,5 +1,3 @@ -// P3DActiveXPropPage.cpp : Implementation of the CP3DActiveXPropPage property page class. - // Filename: P3DActiveXPropPage.cpp // Created by: atrestman (14Sept09) // @@ -14,6 +12,8 @@ // //////////////////////////////////////////////////////////////////// +// P3DActiveXPropPage.cpp : Implementation of the CP3DActiveXPropPage property page class. + #include "stdafx.h" #include "P3DActiveX.h" #include "P3DActiveXPropPage.h" diff --git a/dtool/metalibs/dtool/dtool.cxx b/dtool/metalibs/dtool/dtool.cxx index 2d2060f286..16d0918ca6 100644 --- a/dtool/metalibs/dtool/dtool.cxx +++ b/dtool/metalibs/dtool/dtool.cxx @@ -1,7 +1,7 @@ -// Filename: dtool.C +// Filename: dtool.cxx // Created by: drose (15May00) -// -///////////////////////////////////////////////////////////////////// +// +//////////////////////////////////////////////////////////////////// // This is a dummy file whose sole purpose is to give the compiler // something to compile when making libdtool.so in NO_DEFER mode, diff --git a/dtool/src/cppparser/cppArrayType.h b/dtool/src/cppparser/cppArrayType.h index e8badc5b89..25f7786fc9 100644 --- a/dtool/src/cppparser/cppArrayType.h +++ b/dtool/src/cppparser/cppArrayType.h @@ -21,7 +21,7 @@ class CPPExpression; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPArrayType // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppBison.yxx b/dtool/src/cppparser/cppBison.yxx index d4597eb40e..d66913450b 100644 --- a/dtool/src/cppparser/cppBison.yxx +++ b/dtool/src/cppparser/cppBison.yxx @@ -1,4 +1,4 @@ -// Filename: cppBison.y +// Filename: cppBison.yxx // Created by: drose (16Jan99) // //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppClassTemplateParameter.h b/dtool/src/cppparser/cppClassTemplateParameter.h index 75fcaaeba9..c4bc892222 100644 --- a/dtool/src/cppparser/cppClassTemplateParameter.h +++ b/dtool/src/cppparser/cppClassTemplateParameter.h @@ -21,7 +21,7 @@ class CPPIdentifier; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPClassTemplateParameter // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppCommentBlock.h b/dtool/src/cppparser/cppCommentBlock.h index d04f653134..839b0639e6 100644 --- a/dtool/src/cppparser/cppCommentBlock.h +++ b/dtool/src/cppparser/cppCommentBlock.h @@ -21,7 +21,7 @@ #include -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPCommentBlock // Description : This represents a comment appearing in the source // code. The CPPPreprocessor collects these, and saves diff --git a/dtool/src/cppparser/cppConstType.h b/dtool/src/cppparser/cppConstType.h index c3d79e8663..339043ea3d 100644 --- a/dtool/src/cppparser/cppConstType.h +++ b/dtool/src/cppparser/cppConstType.h @@ -19,7 +19,7 @@ #include "cppType.h" -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPConstType // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppDeclaration.h b/dtool/src/cppparser/cppDeclaration.h index db15f1ee2a..b0f5afa10a 100644 --- a/dtool/src/cppparser/cppDeclaration.h +++ b/dtool/src/cppparser/cppDeclaration.h @@ -55,7 +55,7 @@ class CPPScope; class CPPTemplateScope; class CPPPreprocessor; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPDeclaration // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppEnumType.h b/dtool/src/cppparser/cppEnumType.h index 6fd9b395af..7b63f475c6 100644 --- a/dtool/src/cppparser/cppEnumType.h +++ b/dtool/src/cppparser/cppEnumType.h @@ -26,7 +26,7 @@ class CPPInstance; class CPPScope; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPEnumType // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppExpression.h b/dtool/src/cppparser/cppExpression.h index 187aed85ca..aebf5b2566 100644 --- a/dtool/src/cppparser/cppExpression.h +++ b/dtool/src/cppparser/cppExpression.h @@ -24,7 +24,7 @@ class CPPType; class CPPPreprocessor; class CPPFunctionGroup; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPExpression // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppExpressionParser.h b/dtool/src/cppparser/cppExpressionParser.h index 918135d85a..f726850d39 100644 --- a/dtool/src/cppparser/cppExpressionParser.h +++ b/dtool/src/cppparser/cppExpressionParser.h @@ -22,7 +22,7 @@ class CPPExpression; class CPPScope; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPExpressionParser // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppExtensionType.h b/dtool/src/cppparser/cppExtensionType.h index eeff66ec85..7d1bbe2298 100644 --- a/dtool/src/cppparser/cppExtensionType.h +++ b/dtool/src/cppparser/cppExtensionType.h @@ -23,7 +23,7 @@ class CPPScope; class CPPIdentifier; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPExtensionType // Description : Base class of enum, class, struct, and union types. // An instance of the base class (instead of one of diff --git a/dtool/src/cppparser/cppFile.h b/dtool/src/cppparser/cppFile.h index fde2209465..20ec4ba6d9 100644 --- a/dtool/src/cppparser/cppFile.h +++ b/dtool/src/cppparser/cppFile.h @@ -18,7 +18,7 @@ #include "dtoolbase.h" #include "filename.h" -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPFile // Description : This defines a source file (typically a C++ header // file) that is parsed by the CPPParser. Each diff --git a/dtool/src/cppparser/cppFunctionGroup.h b/dtool/src/cppparser/cppFunctionGroup.h index 82faf1cb72..3a9e4ad8df 100644 --- a/dtool/src/cppparser/cppFunctionGroup.h +++ b/dtool/src/cppparser/cppFunctionGroup.h @@ -21,7 +21,7 @@ class CPPInstance; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPFunctionGroup // Description : This class is simply a container for one or more // CPPInstances for functions of the same name. It's diff --git a/dtool/src/cppparser/cppFunctionType.h b/dtool/src/cppparser/cppFunctionType.h index 37360a80a7..84e65e4444 100644 --- a/dtool/src/cppparser/cppFunctionType.h +++ b/dtool/src/cppparser/cppFunctionType.h @@ -22,7 +22,7 @@ class CPPParameterList; class CPPIdentifier; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPFunctionType // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppIdentifier.h b/dtool/src/cppparser/cppIdentifier.h index ef94910445..964db5bb43 100644 --- a/dtool/src/cppparser/cppIdentifier.h +++ b/dtool/src/cppparser/cppIdentifier.h @@ -30,7 +30,7 @@ class CPPType; class CPPPreprocessor; class CPPTemplateParameterList; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPIdentifier // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppInstance.h b/dtool/src/cppparser/cppInstance.h index 3ea50ebee6..34b95db33b 100644 --- a/dtool/src/cppparser/cppInstance.h +++ b/dtool/src/cppparser/cppInstance.h @@ -27,7 +27,7 @@ class CPPParameterList; class CPPScope; class CPPExpression; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPInstance // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppInstanceIdentifier.h b/dtool/src/cppparser/cppInstanceIdentifier.h index 3efe9fc1b3..afef5b675d 100644 --- a/dtool/src/cppparser/cppInstanceIdentifier.h +++ b/dtool/src/cppparser/cppInstanceIdentifier.h @@ -42,7 +42,7 @@ enum CPPInstanceIdentifierType { IIT_initializer, }; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPInstanceIdentifier // Description : This class is used in parser.y to build up a variable // instance definition. An instance is something like diff --git a/dtool/src/cppparser/cppMakeProperty.h b/dtool/src/cppparser/cppMakeProperty.h index 7c627749a4..2beac20ec4 100644 --- a/dtool/src/cppparser/cppMakeProperty.h +++ b/dtool/src/cppparser/cppMakeProperty.h @@ -20,7 +20,7 @@ #include "cppDeclaration.h" #include "cppIdentifier.h" -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPMakeProperty // Description : This is a MAKE_PROPERTY() declaration appearing // within a class body. It means to generate a property diff --git a/dtool/src/cppparser/cppMakeSeq.h b/dtool/src/cppparser/cppMakeSeq.h index e5eb414f11..ad4e493e83 100644 --- a/dtool/src/cppparser/cppMakeSeq.h +++ b/dtool/src/cppparser/cppMakeSeq.h @@ -21,7 +21,7 @@ #include "cppIdentifier.h" #include "cppFunctionGroup.h" -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPMakeSeq // Description : This is a MAKE_SEQ() declaration appearing within a // class body. It means to generate a sequence method diff --git a/dtool/src/cppparser/cppManifest.h b/dtool/src/cppparser/cppManifest.h index 3510fa14fe..662776d2d9 100644 --- a/dtool/src/cppparser/cppManifest.h +++ b/dtool/src/cppparser/cppManifest.h @@ -26,7 +26,7 @@ class CPPExpression; class CPPType; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPManifest // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppNamespace.h b/dtool/src/cppparser/cppNamespace.h index 16a6f3d304..fe0848358d 100644 --- a/dtool/src/cppparser/cppNamespace.h +++ b/dtool/src/cppparser/cppNamespace.h @@ -22,7 +22,7 @@ class CPPIdentifier; class CPPScope; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPNamespace // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppParameterList.h b/dtool/src/cppparser/cppParameterList.h index f1e21c7924..bbe6ae53bf 100644 --- a/dtool/src/cppparser/cppParameterList.h +++ b/dtool/src/cppparser/cppParameterList.h @@ -24,7 +24,7 @@ class CPPInstance; class CPPScope; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPParameterList // Description : A list of formal parameters for a function // declaration. diff --git a/dtool/src/cppparser/cppParser.h b/dtool/src/cppparser/cppParser.h index d768fc18f0..dbfd6a4574 100644 --- a/dtool/src/cppparser/cppParser.h +++ b/dtool/src/cppparser/cppParser.h @@ -23,7 +23,7 @@ #include -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPParser // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppPointerType.h b/dtool/src/cppparser/cppPointerType.h index 770fd1449f..7882305ff3 100644 --- a/dtool/src/cppparser/cppPointerType.h +++ b/dtool/src/cppparser/cppPointerType.h @@ -19,7 +19,7 @@ #include "cppType.h" -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPPointerType // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppPreprocessor.h b/dtool/src/cppparser/cppPreprocessor.h index 6ad18c1bba..bf1170d145 100644 --- a/dtool/src/cppparser/cppPreprocessor.h +++ b/dtool/src/cppparser/cppPreprocessor.h @@ -35,7 +35,7 @@ class CPPExpression; //#define CPP_VERBOSE_LEX -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPPreprocessor // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppReferenceType.h b/dtool/src/cppparser/cppReferenceType.h index f1470ae936..501eb9e828 100644 --- a/dtool/src/cppparser/cppReferenceType.h +++ b/dtool/src/cppparser/cppReferenceType.h @@ -19,7 +19,7 @@ #include "cppType.h" -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPReferenceType // Description : Either an lvalue- or rvalue-reference. //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppScope.h b/dtool/src/cppparser/cppScope.h index e7bccbd7fe..6b7cd1feaa 100644 --- a/dtool/src/cppparser/cppScope.h +++ b/dtool/src/cppparser/cppScope.h @@ -43,7 +43,7 @@ class CPPPreprocessor; class CPPNameComponent; struct cppyyltype; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPScope // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppSimpleType.h b/dtool/src/cppparser/cppSimpleType.h index 73012ef1d0..51b2806005 100644 --- a/dtool/src/cppparser/cppSimpleType.h +++ b/dtool/src/cppparser/cppSimpleType.h @@ -19,7 +19,7 @@ #include "cppType.h" -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPSimpleType // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppStructType.h b/dtool/src/cppparser/cppStructType.h index a08ecb6c56..2d7df19526 100644 --- a/dtool/src/cppparser/cppStructType.h +++ b/dtool/src/cppparser/cppStructType.h @@ -28,7 +28,7 @@ class CPPScope; class CPPTypeProxy; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPStructType // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppTBDType.h b/dtool/src/cppparser/cppTBDType.h index 98fdf6c4d7..d854efb92f 100644 --- a/dtool/src/cppparser/cppTBDType.h +++ b/dtool/src/cppparser/cppTBDType.h @@ -21,7 +21,7 @@ class CPPIdentifier; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPTBDType // Description : This represents a type whose exact meaning is still // to-be-determined. It happens when a typename is diff --git a/dtool/src/cppparser/cppTemplateParameterList.h b/dtool/src/cppparser/cppTemplateParameterList.h index fa9a22f137..f06d959b9d 100644 --- a/dtool/src/cppparser/cppTemplateParameterList.h +++ b/dtool/src/cppparser/cppTemplateParameterList.h @@ -24,7 +24,7 @@ class CPPScope; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPTemplateParameterList // Description : This class serves to store the parameter list for a // template function or class, both for the formal diff --git a/dtool/src/cppparser/cppTemplateScope.h b/dtool/src/cppparser/cppTemplateScope.h index b8fa313e23..4a2ed8917f 100644 --- a/dtool/src/cppparser/cppTemplateScope.h +++ b/dtool/src/cppparser/cppTemplateScope.h @@ -20,7 +20,7 @@ #include "cppScope.h" #include "cppTemplateParameterList.h" -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPTemplateScope // Description : This is an implicit scope that is created following // the appearance of a "template" or diff --git a/dtool/src/cppparser/cppToken.h b/dtool/src/cppparser/cppToken.h index 8f442e683e..bf3001e996 100644 --- a/dtool/src/cppparser/cppToken.h +++ b/dtool/src/cppparser/cppToken.h @@ -19,7 +19,7 @@ #include "cppBisonDefs.h" -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPToken // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppType.h b/dtool/src/cppparser/cppType.h index 6992ac0890..19ed29211a 100644 --- a/dtool/src/cppparser/cppType.h +++ b/dtool/src/cppparser/cppType.h @@ -33,7 +33,7 @@ public: bool operator () (CPPType *a, CPPType *b) const; }; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPType // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppTypeDeclaration.h b/dtool/src/cppparser/cppTypeDeclaration.h index c3cff9a8b8..2a1639b607 100644 --- a/dtool/src/cppparser/cppTypeDeclaration.h +++ b/dtool/src/cppparser/cppTypeDeclaration.h @@ -19,7 +19,7 @@ #include "cppInstance.h" -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPTypeDeclaration // Description : A CPPTypeDeclaration is a special declaration that // represents the top-level declaration of a type in a diff --git a/dtool/src/cppparser/cppTypeParser.h b/dtool/src/cppparser/cppTypeParser.h index 48d616ffd4..fde4ad069c 100644 --- a/dtool/src/cppparser/cppTypeParser.h +++ b/dtool/src/cppparser/cppTypeParser.h @@ -22,7 +22,7 @@ class CPPType; class CPPScope; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPTypeParser // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppTypeProxy.h b/dtool/src/cppparser/cppTypeProxy.h index c49ad008a0..4182b48029 100644 --- a/dtool/src/cppparser/cppTypeProxy.h +++ b/dtool/src/cppparser/cppTypeProxy.h @@ -19,7 +19,7 @@ #include "cppType.h" -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPTypeProxy // Description : This is a special kind of type that is a placeholder // for some type, currently unknown, that will be filled diff --git a/dtool/src/cppparser/cppTypedefType.h b/dtool/src/cppparser/cppTypedefType.h index 97c4baab82..0fb46b2132 100644 --- a/dtool/src/cppparser/cppTypedefType.h +++ b/dtool/src/cppparser/cppTypedefType.h @@ -21,7 +21,7 @@ class CPPIdentifier; class CPPInstanceIdentifier; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPTypedefType // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppUsing.h b/dtool/src/cppparser/cppUsing.h index afa41c3872..25227f9fb0 100644 --- a/dtool/src/cppparser/cppUsing.h +++ b/dtool/src/cppparser/cppUsing.h @@ -22,7 +22,7 @@ class CPPIdentifier; class CPPScope; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : CPPUsing // Description : //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/dtoolbase/addHash.I b/dtool/src/dtoolbase/addHash.I index 87918b639e..7a7e28570c 100644 --- a/dtool/src/dtoolbase/addHash.I +++ b/dtool/src/dtoolbase/addHash.I @@ -1,4 +1,4 @@ -// Filename: add_hash.I +// Filename: addHash.I // Created by: drose (01Sep06) // //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/dtoolbase/memoryHook.cxx b/dtool/src/dtoolbase/memoryHook.cxx index b132ed5754..743a0cd013 100644 --- a/dtool/src/dtoolbase/memoryHook.cxx +++ b/dtool/src/dtoolbase/memoryHook.cxx @@ -40,14 +40,14 @@ #if defined(USE_MEMORY_DLMALLOC) -///////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // Memory manager: DLMALLOC // // This is Doug Lea's memory manager. It is very fast, but it is not // thread-safe. However, we provide thread locking within MemoryHook. // -///////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// #define USE_DL_PREFIX 1 #define NO_MALLINFO 1 @@ -71,7 +71,7 @@ // the system library. It also doesn't appear to be thread-safe on // OSX. -///////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // Memory manager: PTMALLOC2 // @@ -81,7 +81,7 @@ // thread-safety constructs take a certain amount of CPU time), but // it's still much faster than the windows allocator. // -///////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// #define USE_DL_PREFIX 1 #define NO_MALLINFO 1 @@ -97,14 +97,14 @@ #else -///////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // Memory manager: MALLOC // // This option uses the built-in system allocator. This is a good // choice on linux, but it's a terrible choice on windows. // -///////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// #define call_malloc malloc #define call_realloc realloc @@ -116,7 +116,7 @@ //////////////////////////////////////////////////////////////////// // Function: MemoryHook::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// MemoryHook:: MemoryHook() { @@ -147,7 +147,7 @@ MemoryHook() { //////////////////////////////////////////////////////////////////// // Function: MemoryHook::Copy Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// MemoryHook:: MemoryHook(const MemoryHook ©) : @@ -169,7 +169,7 @@ MemoryHook(const MemoryHook ©) : //////////////////////////////////////////////////////////////////// // Function: MemoryHook::Destructor // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// MemoryHook:: ~MemoryHook() { @@ -215,7 +215,7 @@ heap_alloc_single(size_t size) { // In the DO_MEMORY_USAGE case, we want to track the total size of // allocated bytes on the heap. AtomicAdjust::add(_total_heap_single_size, (AtomicAdjust::Integer)size); - if ((size_t)AtomicAdjust::get(_total_heap_single_size) + + if ((size_t)AtomicAdjust::get(_total_heap_single_size) + (size_t)AtomicAdjust::get(_total_heap_array_size) > _max_heap_size) { overflow_heap_size(); @@ -291,7 +291,7 @@ heap_alloc_array(size_t size) { // In the DO_MEMORY_USAGE case, we want to track the total size of // allocated bytes on the heap. AtomicAdjust::add(_total_heap_array_size, (AtomicAdjust::Integer)size); - if ((size_t)AtomicAdjust::get(_total_heap_single_size) + + if ((size_t)AtomicAdjust::get(_total_heap_single_size) + (size_t)AtomicAdjust::get(_total_heap_array_size) > _max_heap_size) { overflow_heap_size(); @@ -332,7 +332,7 @@ heap_realloc_array(void *ptr, size_t size) { while (alloc1 == (void *)NULL) { alloc_fail(inflated_size); - + // Recover the original pointer. alloc1 = alloc; @@ -457,7 +457,7 @@ mmap_alloc(size_t size, bool allow_exec) { cerr << "Couldn't allocate memory page of size " << size << ": "; PVOID buffer; - DWORD length = + DWORD length = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, (LPTSTR)&buffer, 0, NULL); if (length != 0) { @@ -506,7 +506,7 @@ mmap_free(void *ptr, size_t size) { #ifdef WIN32 VirtualFree(ptr, 0, MEM_RELEASE); -#else +#else munmap(ptr, size); #endif } @@ -547,7 +547,7 @@ get_deleted_chain(size_t buffer_size) { chain = new DeletedBufferChain(buffer_size); _deleted_chains.insert(DeletedChains::value_type(buffer_size, chain)); } - + _lock.release(); return chain; } diff --git a/dtool/src/dtoolbase/typeRegistry.cxx b/dtool/src/dtoolbase/typeRegistry.cxx index 16d64830ee..6d9e1757cd 100644 --- a/dtool/src/dtoolbase/typeRegistry.cxx +++ b/dtool/src/dtoolbase/typeRegistry.cxx @@ -247,7 +247,7 @@ find_type(const string &name) const { // id number (as returned by TypeHandle::get_index()). // Returns its TypeHandle if it exists, or // TypeHandle::none() if there is no such type. -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// TypeHandle TypeRegistry:: find_type_by_id(int id) const { if (id < 0 ||id >= (int)_handle_registry.size()) { @@ -774,7 +774,7 @@ look_up_invalid(TypeHandle handle, TypedObject *object) const { //////////////////////////////////////////////////////////////////// // Function: get_best_parent_from_Set // Access: Private -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// extern "C" int get_best_parent_from_Set(int id, const std::set &this_set) { // most common case.. diff --git a/dtool/src/dtoolbase/typeRegistry.h b/dtool/src/dtoolbase/typeRegistry.h index 85e071bf0d..e687a7a9ea 100644 --- a/dtool/src/dtoolbase/typeRegistry.h +++ b/dtool/src/dtoolbase/typeRegistry.h @@ -117,7 +117,6 @@ private: friend class TypeHandle; }; -/////////////////////////////////////////// // Helper function to allow for "C" interaction into the type system extern "C" EXPCL_DTOOL int get_best_parent_from_Set(int id, const std::set &this_set); diff --git a/dtool/src/dtoolutil/dSearchPath.h b/dtool/src/dtoolutil/dSearchPath.h index 3ae3fe6ac7..edc9f1c3ef 100644 --- a/dtool/src/dtoolutil/dSearchPath.h +++ b/dtool/src/dtoolutil/dSearchPath.h @@ -20,7 +20,7 @@ #include "filename.h" #include "pvector.h" -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : DSearchPath // Description : This class stores a list of directories that can be // searched, in order, to locate a particular file. It diff --git a/dtool/src/dtoolutil/filename.cxx b/dtool/src/dtoolutil/filename.cxx index c2d57d0499..f6cf299c77 100644 --- a/dtool/src/dtoolutil/filename.cxx +++ b/dtool/src/dtoolutil/filename.cxx @@ -94,8 +94,8 @@ extern "C" void cygwin_conv_to_posix_path(const char *path, char *posix); // thing is, like everything else, to graft the reference to the // remote hostname into the one global filesystem, with something like // /hosts/hostname/path/to/file. We observe the Unix convention for -// internal names used in Panda; this makes operations like -// Filename::get_dirname() simpler and more internally consistent. +// internal names used in Panda; this makes operations +// like Filename::get_dirname() simpler and more internally consistent. // This string hard-defines the prefix that we use internally to // indicate that the next directory component name should be treated @@ -105,8 +105,8 @@ extern "C" void cygwin_conv_to_posix_path(const char *path, char *posix); // created in order to read the first config file). Windows purists // might be tempted to define this to a double slash so that internal // Panda filenames more closely resemble their Windows counterparts. -// That might actually work, but it will cause problems with -// Filename::standardize(). +// That might actually work, but it will cause problems +// with Filename::standardize(). // We use const char * instead of string to avoid static-init ordering // issues. @@ -212,7 +212,7 @@ convert_pathname(const string &unix_style_pathname) { unix_style_pathname.substr(0, hosts_prefix_length) == hosts_prefix) { // A filename like /hosts/fooby gets turned into \\fooby. windows_pathname = "\\\\" + front_to_back_slash(unix_style_pathname.substr(hosts_prefix_length)); - + } else { // It starts with a slash, but the first part is not a single // letter. @@ -335,7 +335,7 @@ from_os_specific(const string &os_specific, Filename::Type type) { const string &panda_root = get_panda_root(); // If the initial prefix is the same as panda_root, remove it. - if (!panda_root.empty() && panda_root != string("\\") && + if (!panda_root.empty() && panda_root != string("\\") && panda_root.length() < result.length()) { bool matches = true; size_t p; @@ -1080,7 +1080,7 @@ make_canonical() { // The root directory is a special case. return true; } - + #ifndef WIN32 // Use realpath in order to resolve symlinks properly char newpath [PATH_MAX + 1]; @@ -1130,7 +1130,7 @@ make_true_case() { // First, we have to convert it to its short name, then back to its // long name--that seems to be the trick to force Windows to throw // away the case we give it and get the actual file case. - + wchar_t short_name[MAX_PATH + 1]; DWORD l = GetShortPathNameW(os_specific.c_str(), short_name, MAX_PATH + 1); if (l == 0) { @@ -1142,7 +1142,7 @@ make_true_case() { // the specified length if the short_name length wasn't enough--but also // according to the Windows docs, MAX_PATH will always be enough. assert(l < MAX_PATH + 1); - + wchar_t long_name[MAX_PATH + 1]; l = GetLongPathNameW(short_name, long_name, MAX_PATH + 1); if (l == 0) { @@ -1202,14 +1202,14 @@ to_os_specific() const { Filename standard(*this); standard.standardize(); -#ifdef IS_OSX +#ifdef IS_OSX if (get_type() == T_dso) { std::string workname = standard.get_fullpath(); size_t dot = workname.rfind('.'); if (dot != string::npos) { if (workname.substr(dot) == ".so") { string dyLibBase = workname.substr(0, dot)+".dylib"; - return dyLibBase; + return dyLibBase; } } } @@ -1287,7 +1287,7 @@ to_os_short_name() const { #ifdef WIN32 wstring os_specific = to_os_specific_w(); - + wchar_t short_name[MAX_PATH + 1]; DWORD l = GetShortPathNameW(os_specific.c_str(), short_name, MAX_PATH + 1); if (l == 0) { @@ -1324,7 +1324,7 @@ to_os_long_name() const { #ifdef WIN32 wstring os_specific = to_os_specific_w(); - + wchar_t long_name[MAX_PATH + 1]; DWORD l = GetLongPathNameW(os_specific.c_str(), long_name, MAX_PATH + 1); if (l == 0) { @@ -1582,7 +1582,7 @@ compare_timestamps(const Filename &other, } // !other_exists assert(!other_exists); - + // This file exists, the other one doesn't. return other_missing_is_old ? 1 : -1; } @@ -2473,7 +2473,7 @@ touch() const { CloseHandle(fhandle); return false; } - + if (!SetFileTime(fhandle, NULL, NULL, &ftnow)) { CloseHandle(fhandle); return false; @@ -2689,10 +2689,10 @@ copy_to(const Filename &other) const { if (!other_filename.open_write(out)) { return false; } - + static const size_t buffer_size = 4096; char buffer[buffer_size]; - + in.read(buffer, buffer_size); size_t count = in.gcount(); while (count != 0) { @@ -2903,12 +2903,12 @@ get_hash() const { // atomic_read_contents(). //////////////////////////////////////////////////////////////////// bool Filename:: -atomic_compare_and_exchange_contents(string &orig_contents, - const string &old_contents, +atomic_compare_and_exchange_contents(string &orig_contents, + const string &old_contents, const string &new_contents) const { #ifdef WIN32_VC wstring os_specific = to_os_specific_w(); - HANDLE hfile = CreateFileW(os_specific.c_str(), GENERIC_READ | GENERIC_WRITE, + HANDLE hfile = CreateFileW(os_specific.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); while (hfile == INVALID_HANDLE_VALUE) { @@ -2916,18 +2916,18 @@ atomic_compare_and_exchange_contents(string &orig_contents, if (error == ERROR_SHARING_VIOLATION) { // If the file is locked by another process, yield and try again. Sleep(0); - hfile = CreateFileW(os_specific.c_str(), GENERIC_READ | GENERIC_WRITE, + hfile = CreateFileW(os_specific.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); } else { - cerr << "Couldn't open file: " << os_specific + cerr << "Couldn't open file: " << os_specific << ", error " << error << "\n"; return false; } } if (hfile == INVALID_HANDLE_VALUE) { - cerr << "Couldn't open file: " << os_specific + cerr << "Couldn't open file: " << os_specific << ", error " << GetLastError() << "\n"; return false; } @@ -2939,7 +2939,7 @@ atomic_compare_and_exchange_contents(string &orig_contents, DWORD bytes_read; if (!ReadFile(hfile, buf, buf_size, &bytes_read, NULL)) { - cerr << "Error reading file: " << os_specific + cerr << "Error reading file: " << os_specific << ", error " << GetLastError() << "\n"; CloseHandle(hfile); return false; @@ -2948,7 +2948,7 @@ atomic_compare_and_exchange_contents(string &orig_contents, orig_contents += string(buf, bytes_read); if (!ReadFile(hfile, buf, buf_size, &bytes_read, NULL)) { - cerr << "Error reading file: " << os_specific + cerr << "Error reading file: " << os_specific << ", error " << GetLastError() << "\n"; CloseHandle(hfile); return false; @@ -2962,7 +2962,7 @@ atomic_compare_and_exchange_contents(string &orig_contents, DWORD bytes_written; if (!WriteFile(hfile, new_contents.data(), new_contents.size(), &bytes_written, NULL)) { - cerr << "Error writing file: " << os_specific + cerr << "Error writing file: " << os_specific << ", error " << GetLastError() << "\n"; CloseHandle(hfile); return false; @@ -2994,7 +2994,7 @@ atomic_compare_and_exchange_contents(string &orig_contents, close(fd); return false; } - + ssize_t bytes_read = read(fd, buf, buf_size); while (bytes_read > 0) { orig_contents += string(buf, bytes_read); @@ -3023,7 +3023,7 @@ atomic_compare_and_exchange_contents(string &orig_contents, perror(os_specific.c_str()); return false; } - + return match; #endif // WIN32_VC } @@ -3049,7 +3049,7 @@ bool Filename:: atomic_read_contents(string &contents) const { #ifdef WIN32_VC wstring os_specific = to_os_specific_w(); - HANDLE hfile = CreateFileW(os_specific.c_str(), GENERIC_READ, + HANDLE hfile = CreateFileW(os_specific.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); while (hfile == INVALID_HANDLE_VALUE) { @@ -3057,11 +3057,11 @@ atomic_read_contents(string &contents) const { if (error == ERROR_SHARING_VIOLATION) { // If the file is locked by another process, yield and try again. Sleep(0); - hfile = CreateFileW(os_specific.c_str(), GENERIC_READ, + hfile = CreateFileW(os_specific.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, NULL); + FILE_ATTRIBUTE_NORMAL, NULL); } else { - cerr << "Couldn't open file: " << os_specific + cerr << "Couldn't open file: " << os_specific << ", error " << error << "\n"; return false; } @@ -3074,7 +3074,7 @@ atomic_read_contents(string &contents) const { DWORD bytes_read; if (!ReadFile(hfile, buf, buf_size, &bytes_read, NULL)) { - cerr << "Error reading file: " << os_specific + cerr << "Error reading file: " << os_specific << ", error " << GetLastError() << "\n"; CloseHandle(hfile); return false; @@ -3083,7 +3083,7 @@ atomic_read_contents(string &contents) const { contents += string(buf, bytes_read); if (!ReadFile(hfile, buf, buf_size, &bytes_read, NULL)) { - cerr << "Error reading file: " << os_specific + cerr << "Error reading file: " << os_specific << ", error " << GetLastError() << "\n"; CloseHandle(hfile); return false; @@ -3115,7 +3115,7 @@ atomic_read_contents(string &contents) const { close(fd); return false; } - + ssize_t bytes_read = read(fd, buf, buf_size); while (bytes_read > 0) { contents += string(buf, bytes_read); @@ -3247,7 +3247,7 @@ locate_hash() { if (_hash_end == string::npos) { _hash_end = string::npos; _hash_start = string::npos; - + } else { _hash_start = _hash_end; ++_hash_end; @@ -3367,13 +3367,13 @@ r_make_canonical(const Filename &cwd) { // the directory above. Filename dir(get_dirname()); - + if (dir.empty()) { // No dirname means the file is in this directory. set_dirname(cwd); return true; } - + if (!dir.r_make_canonical(cwd)) { return false; } diff --git a/dtool/src/dtoolutil/test_touch.cxx b/dtool/src/dtoolutil/test_touch.cxx index 29d5671e53..eb78d4694b 100644 --- a/dtool/src/dtoolutil/test_touch.cxx +++ b/dtool/src/dtoolutil/test_touch.cxx @@ -1,4 +1,4 @@ -// Filename: test_pfstream.cxx +// Filename: test_touch.cxx // Created by: drose (04Nov02) // //////////////////////////////////////////////////////////////////// @@ -15,7 +15,7 @@ #include "dtoolbase.h" #include "filename.h" -int +int main(int argc, char *argv[]) { if (argc < 2) { cout << "test_touch filename [filename ... ]\n"; diff --git a/dtool/src/interrogate/functionRemap.cxx b/dtool/src/interrogate/functionRemap.cxx index eaeb70fb78..c1f5f51c8b 100644 --- a/dtool/src/interrogate/functionRemap.cxx +++ b/dtool/src/interrogate/functionRemap.cxx @@ -975,9 +975,6 @@ setup_properties(const InterrogateFunction &ifunc, InterfaceMaker *interface_mak return true; } -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// std::string make_safe_name(const std::string &name) { return InterrogateBuilder::clean_identifier(name); /* diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 18f96deec8..2ccb936ed2 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -45,17 +45,16 @@ extern std::string EXPORT_IMPORT_PREFIX; #define CLASS_PREFIX "Dtool_" -///////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Name Remapper... // Snagged from ffi py code.... -///////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// struct RenameSet { const char *_from; const char *_to; int function_type; }; -/////////////////////////////////////////////////////////////////////////////////////// RenameSet methodRenameDictionary[] = { { "operator ==" , "__eq__", 0 }, { "operator !=" , "__ne__", 0 }, @@ -108,14 +107,11 @@ RenameSet methodRenameDictionary[] = { { NULL, NULL, -1 } }; -/////////////////////////////////////////////////////////////////////////////////////// RenameSet classRenameDictionary[] = { // No longer used, now empty. { NULL, NULL, -1 } }; -/////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////// const char *pythonKeywords[] = { "and", "as", @@ -152,7 +148,6 @@ const char *pythonKeywords[] = { NULL }; -/////////////////////////////////////////////////////////////////////////////////////// std::string checkKeyword(std::string &cppName) { for (int x = 0; pythonKeywords[x] != NULL; x++) { @@ -163,8 +158,6 @@ checkKeyword(std::string &cppName) { return cppName; } -/////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////// std::string classNameFromCppName(const std::string &cppName, bool mangle) { if (!mangle_names) { @@ -220,8 +213,6 @@ classNameFromCppName(const std::string &cppName, bool mangle) { return className; } -/////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////// std::string methodNameFromCppName(const std::string &cppName, const std::string &className, bool mangle) { if (!mangle_names) { @@ -671,8 +662,6 @@ write_function_slot(ostream &out, int indent_level, const SlottedFunctions &slot } } -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// void InterfaceMakerPythonNative:: get_valid_child_classes(std::map &answer, CPPStructType *inclass, const std::string &upcast_seed, bool can_downcast) { if (inclass == NULL) { @@ -713,10 +702,9 @@ get_valid_child_classes(std::map &answer, CPPStructTyp } } -/////////////////////////////////////////////////////////////////////////////// -// Function : write_python_instance -// -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: write_python_instance +//////////////////////////////////////////////////////////////////// void InterfaceMakerPythonNative:: write_python_instance(ostream &out, int indent_level, const string &return_expr, bool owns_memory, const InterrogateType &itype, bool is_const) { @@ -911,12 +899,11 @@ write_prototypes(ostream &out_code, ostream *out_h) { } } -///////////////////////////////////////////////////////////////////////////////////////////// -// Function : write_prototypes_class_external -// -// Description : Output enough enformation to a declartion of a externally +//////////////////////////////////////////////////////////////////// +// Function: write_prototypes_class_external +// Description: Output enough enformation to a declartion of a externally // generated dtool type object -///////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// void InterfaceMakerPythonNative:: write_prototypes_class_external(ostream &out, Object *obj) { std::string class_name = make_safe_name(obj->_itype.get_scoped_name()); @@ -934,10 +921,9 @@ write_prototypes_class_external(ostream &out, Object *obj) { out << "Define_Module_Class_Forward(" << _def->module_name << ", " << class_name << ", " << class_name << "_localtype, " << classNameFromCppName(preferred_name, false) << ");\n"; } -///////////////////////////////////////// //////////////////////////////////////////////////// -// Function : write_prototypes_class -// -///////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: write_prototypes_class +//////////////////////////////////////////////////////////////////// void InterfaceMakerPythonNative:: write_prototypes_class(ostream &out_code, ostream *out_h, Object *obj) { std::string ClassName = make_safe_name(obj->_itype.get_scoped_name()); @@ -1143,11 +1129,10 @@ write_class_details(ostream &out, Object *obj) { } } -//////////////////////////////////////////////////////////// -/// Function : write_class_declarations +//////////////////////////////////////////////////////////////////// +// Function: write_class_declarations // -// -//////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// void InterfaceMakerPythonNative:: write_class_declarations(ostream &out, ostream *out_h, Object *obj) { const InterrogateType &itype = obj->_itype; @@ -1269,9 +1254,9 @@ write_sub_module(ostream &out, Object *obj) { } } -///////////////////////////////////////////////////////////////////////////// -// Function : write_module_support -///////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: write_module_support +//////////////////////////////////////////////////////////////////// void InterfaceMakerPythonNative:: write_module_support(ostream &out, ostream *out_h, InterrogateModuleDef *def) { out << "//********************************************************************\n"; @@ -1458,9 +1443,9 @@ write_module_support(ostream &out, ostream *out_h, InterrogateModuleDef *def) { } } -///////////////////////////////////////////////////////////////////////////// -///// Function : write_module -///////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: write_module +//////////////////////////////////////////////////////////////////// void InterfaceMakerPythonNative:: write_module(ostream &out, ostream *out_h, InterrogateModuleDef *def) { InterfaceMakerPython::write_module(out, out_h, def); @@ -1511,9 +1496,9 @@ write_module(ostream &out, ostream *out_h, InterrogateModuleDef *def) { << "#endif\n" << "\n"; } -///////////////////////////////////////////////////////////////////////////////////////////// -// Function :write_module_class -///////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: write_module_class +//////////////////////////////////////////////////////////////////// void InterfaceMakerPythonNative:: write_module_class(ostream &out, Object *obj) { bool has_local_repr = false; @@ -3221,9 +3206,10 @@ write_prototype_for(ostream &out, InterfaceMaker::Function *func) { std::string fname = "PyObject *" + func->_name + "(PyObject *self, PyObject *args)"; write_prototype_for_name(out, func, fname); } - -//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// +// Function: InterfaceMakerPythonNative::write_prototype_for_name +// Access: Private +// Description: //////////////////////////////////////////////////////////////////// void InterfaceMakerPythonNative:: write_prototype_for_name(ostream &out, InterfaceMaker::Function *func, const std::string &function_namename) { @@ -3925,7 +3911,7 @@ write_coerce_constructor(ostream &out, Object *obj, bool is_const) { // special default handling mechanism. Or something. // // Please don't hate me. -///////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// int InterfaceMakerPythonNative:: collapse_default_remaps(std::map > &map_sets, int max_required_args) { @@ -4046,11 +4032,10 @@ abort_iteration: return max_required_args; } -//////////////////////////////////////////////////////// -// Function : GetParnetDepth -// +//////////////////////////////////////////////////////////////////// +// Function: GetParnetDepth // Support Function used to Sort the name based overrides.. For know must be complex to simple -//////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// int get_type_sort(CPPType *type) { int answer = 0; // printf(" %s\n",type->get_local_name().c_str()); @@ -4112,9 +4097,9 @@ int get_type_sort(CPPType *type) { return answer; } -//////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // The Core sort function for remap calling orders.. -////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// bool RemapCompareLess(FunctionRemap *in1, FunctionRemap *in2) { assert(in1 != NULL); assert(in2 != NULL); @@ -6702,11 +6687,10 @@ generate_wrappers() { } } -////////////////////////////////////////////// -// Function :is_cpp_type_legal -// +//////////////////////////////////////////////////////////////////// +// Function: is_cpp_type_legal // is the cpp object supported by by the dtool_py interface.. -////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// bool InterfaceMakerPythonNative:: is_cpp_type_legal(CPPType *in_ctype) { if (in_ctype == NULL) { @@ -6750,10 +6734,9 @@ is_cpp_type_legal(CPPType *in_ctype) { return false; } -////////////////////////////////////////////// -// Function :isExportThisRun -// -////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: isExportThisRun +//////////////////////////////////////////////////////////////////// bool InterfaceMakerPythonNative:: isExportThisRun(CPPType *ctype) { if (builder.in_forcetype(ctype->get_local_name(&parser))) { @@ -6771,9 +6754,9 @@ isExportThisRun(CPPType *ctype) { return false; } -////////////////////////////////////////////// -// Function : isExportThisRun -///////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: isExportThisRun +//////////////////////////////////////////////////////////////////// bool InterfaceMakerPythonNative:: isExportThisRun(Function *func) { if (func == NULL || !is_function_legal(func)) { @@ -6789,9 +6772,9 @@ isExportThisRun(Function *func) { return false; } -////////////////////////////////////////////// -// Function : is_remap_legal -////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: is_remap_legal +//////////////////////////////////////////////////////////////////// bool InterfaceMakerPythonNative:: is_remap_legal(FunctionRemap *remap) { if (remap == NULL) { @@ -6829,11 +6812,11 @@ is_remap_legal(FunctionRemap *remap) { return true; } -////////////////////////////////////////////// -// Function : has_coerce_constructor +//////////////////////////////////////////////////////////////////// +// Function: has_coerce_constructor // Returns 1 if coerce constructor // returns const, 2 if non-const. -////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// int InterfaceMakerPythonNative:: has_coerce_constructor(CPPStructType *type) { if (type == NULL) { @@ -6896,9 +6879,9 @@ has_coerce_constructor(CPPStructType *type) { return result; } -////////////////////////////////////////////// -// Function : is_remap_coercion_possible -////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: is_remap_coercion_possible +//////////////////////////////////////////////////////////////////// bool InterfaceMakerPythonNative:: is_remap_coercion_possible(FunctionRemap *remap) { if (remap == NULL) { @@ -6933,9 +6916,9 @@ is_remap_coercion_possible(FunctionRemap *remap) { return false; } -//////////////////////////////////////////////////////////////////////// -// Function : is_function_legal -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: is_function_legal +//////////////////////////////////////////////////////////////////// bool InterfaceMakerPythonNative:: is_function_legal(Function *func) { Function::Remaps::const_iterator ri; @@ -6952,9 +6935,9 @@ is_function_legal(Function *func) { return false; } -//////////////////////////////////////////////////////// -// Function : IsRunTimeTyped -/////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: IsRunTimeTyped +//////////////////////////////////////////////////////////////////// bool InterfaceMakerPythonNative:: IsRunTimeTyped(const InterrogateType &itype) { TypeIndex ptype_id = itype.get_outer_class(); @@ -6972,11 +6955,10 @@ IsRunTimeTyped(const InterrogateType &itype) { return false; } -////////////////////////////////////////////////////////// -// Function : DoesInheritFromIsClass -// +//////////////////////////////////////////////////////////////////// +// Function: DoesInheritFromIsClass // Helper function to check cpp class inharatience.. -/////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// bool InterfaceMakerPythonNative:: DoesInheritFromIsClass(const CPPStructType *inclass, const std::string &name) { if (inclass == NULL) { @@ -7005,11 +6987,10 @@ DoesInheritFromIsClass(const CPPStructType *inclass, const std::string &name) { return false; } -//////////////////////////////////////////////////////////////////////////////////////////// -// Function : HasAGetClassTypeFunction -// +//////////////////////////////////////////////////////////////////// +// Function: HasAGetClassTypeFunction // does the class have a supportable GetClassType which returns a TypeHandle. -////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// bool InterfaceMakerPythonNative:: HasAGetClassTypeFunction(CPPType *type) { while (type->get_subtype() == CPPDeclaration::ST_typedef) { diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.h b/dtool/src/interrogate/interfaceMakerPythonNative.h index 42b5a58759..a66b6d9fcc 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.h +++ b/dtool/src/interrogate/interfaceMakerPythonNative.h @@ -1,4 +1,4 @@ -// Filename: InterfaceMakerPythonNative.h +// Filename: interfaceMakerPythonNative.h //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE diff --git a/dtool/src/interrogatedb/extension.h b/dtool/src/interrogatedb/extension.h index 57728f98bf..b8aa8b8183 100644 --- a/dtool/src/interrogatedb/extension.h +++ b/dtool/src/interrogatedb/extension.h @@ -17,7 +17,7 @@ #include "dtoolbase.h" -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : ExtensionBase // Description : This is where all extensions should derive from. // It defines the _self and _this members that can @@ -40,8 +40,8 @@ class EXPCL_INTERROGATEDB Extension : public ExtensionBase { }; //////////////////////////////////////////////////////////////////// -// Function : invoke_extension -// Description : Creates a new extension object for the given +// Function: invoke_extension +// Description: Creates a new extension object for the given // pointer that can then be used to call extension // methods, as follows: // invoke_extension((MyClass) *ptr).method() @@ -55,8 +55,8 @@ invoke_extension(T *ptr) { } //////////////////////////////////////////////////////////////////// -// Function : invoke_extension -// Description : The const version of the above function. +// Function: invoke_extension +// Description: The const version of the above function. //////////////////////////////////////////////////////////////////// template inline const Extension diff --git a/dtool/src/interrogatedb/interrogateElement.I b/dtool/src/interrogatedb/interrogateElement.I index 14e7dcaac8..02cbe95c3e 100644 --- a/dtool/src/interrogatedb/interrogateElement.I +++ b/dtool/src/interrogatedb/interrogateElement.I @@ -14,7 +14,7 @@ //////////////////////////////////////////////////////////////////// -// Element: InterrogateElement::Constructor +// Function: InterrogateElement::Constructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -31,7 +31,7 @@ InterrogateElement(InterrogateModuleDef *def) : } //////////////////////////////////////////////////////////////////// -// Element: InterrogateElement::Copy Constructor +// Function: InterrogateElement::Copy Constructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -41,7 +41,7 @@ InterrogateElement(const InterrogateElement ©) { } //////////////////////////////////////////////////////////////////// -// Element: InterrogateElement::Copy Assignment Operator +// Function: InterrogateElement::Copy Assignment Operator // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -111,7 +111,7 @@ get_comment() const { } //////////////////////////////////////////////////////////////////// -// Element: InterrogateElement::get_type +// Function: InterrogateElement::get_type // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -121,7 +121,7 @@ get_type() const { } //////////////////////////////////////////////////////////////////// -// Element: InterrogateElement::has_getter +// Function: InterrogateElement::has_getter // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -131,7 +131,7 @@ has_getter() const { } //////////////////////////////////////////////////////////////////// -// Element: InterrogateElement::get_getter +// Function: InterrogateElement::get_getter // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -141,7 +141,7 @@ get_getter() const { } //////////////////////////////////////////////////////////////////// -// Element: InterrogateElement::has_setter +// Function: InterrogateElement::has_setter // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -151,7 +151,7 @@ has_setter() const { } //////////////////////////////////////////////////////////////////// -// Element: InterrogateElement::get_setter +// Function: InterrogateElement::get_setter // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -161,7 +161,7 @@ get_setter() const { } //////////////////////////////////////////////////////////////////// -// Element: InterrogateElement::has_has_function +// Function: InterrogateElement::has_has_function // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -171,7 +171,7 @@ has_has_function() const { } //////////////////////////////////////////////////////////////////// -// Element: InterrogateElement::get_has_function +// Function: InterrogateElement::get_has_function // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -181,7 +181,7 @@ get_has_function() const { } //////////////////////////////////////////////////////////////////// -// Element: InterrogateElement::has_clear_function +// Function: InterrogateElement::has_clear_function // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -191,7 +191,7 @@ has_clear_function() const { } //////////////////////////////////////////////////////////////////// -// Element: InterrogateElement::get_clear_function +// Function: InterrogateElement::get_clear_function // Access: Public // Description: //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogatedb/interrogateMakeSeq.I b/dtool/src/interrogatedb/interrogateMakeSeq.I index b26b7fa864..3a44cc8688 100644 --- a/dtool/src/interrogatedb/interrogateMakeSeq.I +++ b/dtool/src/interrogatedb/interrogateMakeSeq.I @@ -13,9 +13,8 @@ //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// -// MakeSeq: InterrogateMakeSeq::Constructor +// Function: InterrogateMakeSeq::Constructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -28,7 +27,7 @@ InterrogateMakeSeq(InterrogateModuleDef *def) : } //////////////////////////////////////////////////////////////////// -// MakeSeq: InterrogateMakeSeq::Copy Constructor +// Function: InterrogateMakeSeq::Copy Constructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -38,7 +37,7 @@ InterrogateMakeSeq(const InterrogateMakeSeq ©) { } //////////////////////////////////////////////////////////////////// -// MakeSeq: InterrogateMakeSeq::Copy Assignment Operator +// Function: InterrogateMakeSeq::Copy Assignment Operator // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -92,7 +91,7 @@ get_comment() const { } //////////////////////////////////////////////////////////////////// -// Element: InterrogateMakeSeq::get_length_getter +// Function: InterrogateMakeSeq::get_length_getter // Access: Public // Description: //////////////////////////////////////////////////////////////////// @@ -102,7 +101,7 @@ get_length_getter() const { } //////////////////////////////////////////////////////////////////// -// Element: InterrogateMakeSeq::get_element_getter +// Function: InterrogateMakeSeq::get_element_getter // Access: Public // Description: //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogatedb/interrogate_interface.h b/dtool/src/interrogatedb/interrogate_interface.h index 104fbd75a6..47fe98cd98 100644 --- a/dtool/src/interrogatedb/interrogate_interface.h +++ b/dtool/src/interrogatedb/interrogate_interface.h @@ -91,11 +91,11 @@ EXPCL_INTERROGATEDB void interrogate_add_search_directory(const char *dirname); EXPCL_INTERROGATEDB void interrogate_add_search_path(const char *pathstring); EXPCL_INTERROGATEDB bool interrogate_error_flag(); -////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // Manifest Symbols // -////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // These correspond to #define constants that appear in the C code. // (These are only the manifest constants--those #define's that take @@ -126,11 +126,11 @@ EXPCL_INTERROGATEDB bool interrogate_manifest_has_int_value(ManifestIndex manife EXPCL_INTERROGATEDB int interrogate_manifest_get_int_value(ManifestIndex manifest); -////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // Data Elements // -////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // These correspond to data members of a class, or global data // elements. Interrogate automatically generates a getter function @@ -158,22 +158,22 @@ EXPCL_INTERROGATEDB FunctionIndex interrogate_element_getter(ElementIndex elemen EXPCL_INTERROGATEDB bool interrogate_element_has_setter(ElementIndex element); EXPCL_INTERROGATEDB FunctionIndex interrogate_element_setter(ElementIndex element); -////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // Global Data // -////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // This is the list of global data elements. EXPCL_INTERROGATEDB int interrogate_number_of_globals(); EXPCL_INTERROGATEDB ElementIndex interrogate_get_global(int n); -////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // Functions // -////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // There is a unique FunctionIndex associated with each of the // functions that interrogate knows about. This includes member @@ -252,11 +252,11 @@ EXPCL_INTERROGATEDB FunctionWrapperIndex interrogate_function_c_wrapper(Function EXPCL_INTERROGATEDB int interrogate_function_number_of_python_wrappers(FunctionIndex function); EXPCL_INTERROGATEDB FunctionWrapperIndex interrogate_function_python_wrapper(FunctionIndex function, int n); -////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // Function wrappers // -////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // These define the way to call a given function. Depending on the // parameters supplied to interrogate, a function wrapper may be able @@ -351,11 +351,11 @@ EXPCL_INTERROGATEDB const char *interrogate_wrapper_unique_name(FunctionWrapperI // interrogate database. EXPCL_INTERROGATEDB FunctionWrapperIndex interrogate_get_wrapper_by_unique_name(const char *unique_name); -////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // MakeSeqs // -////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // These are special synthesized methods that iterate through a list. // They are generated in C++ code via the MAKE_SEQ macro. The normal @@ -373,11 +373,11 @@ EXPCL_INTERROGATEDB const char *interrogate_make_seq_num_name(MakeSeqIndex make_ EXPCL_INTERROGATEDB const char *interrogate_make_seq_element_name(MakeSeqIndex make_seq); -////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // Types // -////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // These are all the types that interrogate knows about. This // includes atomic types like ints and floats, type wrappers like diff --git a/dtool/src/interrogatedb/py_panda.cxx b/dtool/src/interrogatedb/py_panda.cxx index 508219aecf..c51cdd8024 100644 --- a/dtool/src/interrogatedb/py_panda.cxx +++ b/dtool/src/interrogatedb/py_panda.cxx @@ -52,13 +52,12 @@ bool DtoolCanThisBeAPandaInstance(PyObject *self) { return false; } -//////////////////////////////////////////////////////////////////////// -// Function : DTOOL_Call_ExtractThisPointerForType -// +//////////////////////////////////////////////////////////////////// +// Function: DTOOL_Call_ExtractThisPointerForType // These are the wrappers that allow for down and upcast from type .. // needed by the Dtool py interface.. Be very careful if you muck with these // as the generated code depends on how this is set up.. -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// void DTOOL_Call_ExtractThisPointerForType(PyObject *self, Dtool_PyTypedObject *classdef, void **answer) { if (DtoolCanThisBeAPandaInstance(self)) { *answer = ((Dtool_PyInstDef *)self)->_My_Type->_Dtool_UpcastInterface(self, classdef); @@ -376,12 +375,11 @@ PyObject *_Dtool_Return(PyObject *value) { return value; } -//////////////////////////////////////////////////////////////////////// -// Function : DTool_CreatePyInstanceTyped -// +//////////////////////////////////////////////////////////////////// +// Function: DTool_CreatePyInstanceTyped // this function relies on the behavior of typed objects in the panda system. // -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// PyObject *DTool_CreatePyInstanceTyped(void *local_this_in, Dtool_PyTypedObject &known_class_type, bool memory_rules, bool is_const, int type_index) { // We can't do the NULL check here like in DTool_CreatePyInstance, since // the caller will have to get the type index to pass to this function @@ -389,23 +387,15 @@ PyObject *DTool_CreatePyInstanceTyped(void *local_this_in, Dtool_PyTypedObject & // really NULL for whatever reason. nassertr(local_this_in != NULL, NULL); - ///////////////////////////////////////////////////// // IF the class is possibly a run time typed object - ///////////////////////////////////////////////////// if (type_index > 0) { - ///////////////////////////////////////////////////// // get best fit class... - ///////////////////////////////////////////////////// Dtool_PyTypedObject *target_class = Dtool_RuntimeTypeDtoolType(type_index); if (target_class != NULL) { - ///////////////////////////////////////////////////// // cast to the type... - ////////////////////////////////////////////////////// void *new_local_this = target_class->_Dtool_DowncastInterface(local_this_in, &known_class_type); if (new_local_this != NULL) { - ///////////////////////////////////////////// // ask class to allocate an instance.. - ///////////////////////////////////////////// Dtool_PyInstDef *self = (Dtool_PyInstDef *) target_class->_PyType.tp_new(&target_class->_PyType, NULL, NULL); if (self != NULL) { self->_ptr_to_object = new_local_this; @@ -419,10 +409,8 @@ PyObject *DTool_CreatePyInstanceTyped(void *local_this_in, Dtool_PyTypedObject & } } - ///////////////////////////////////////////////////// // if we get this far .. just wrap the thing in the known type ?? // better than aborting...I guess.... - ///////////////////////////////////////////////////// Dtool_PyInstDef *self = (Dtool_PyInstDef *) known_class_type._PyType.tp_new(&known_class_type._PyType, NULL, NULL); if (self != NULL) { self->_ptr_to_object = local_this_in; @@ -434,10 +422,10 @@ PyObject *DTool_CreatePyInstanceTyped(void *local_this_in, Dtool_PyTypedObject & return (PyObject *)self; } -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // DTool_CreatePyInstance .. wrapper function to finalize the existance of a general // dtool py instance.. -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// PyObject *DTool_CreatePyInstance(void *local_this, Dtool_PyTypedObject &in_classdef, bool memory_rules, bool is_const) { if (local_this == NULL) { // This is actually a very common case, so let's allow this, but return @@ -457,9 +445,9 @@ PyObject *DTool_CreatePyInstance(void *local_this, Dtool_PyTypedObject &in_class return (PyObject *)self; } -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// /// Th Finalizer for simple instances.. -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// int DTool_PyInit_Finalize(PyObject *self, void *local_this, Dtool_PyTypedObject *type, bool memory_rules, bool is_const) { // lets put some code in here that checks to see the memory is properly configured.. // prior to my call .. @@ -471,11 +459,11 @@ int DTool_PyInit_Finalize(PyObject *self, void *local_this, Dtool_PyTypedObject return 0; } -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // A helper function to glue method definition together .. that can not be done // at code generation time because of multiple generation passes in interrogate.. // -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// void Dtool_Accum_MethDefs(PyMethodDef in[], MethodDefmap &themap) { for (; in->ml_name != NULL; in++) { if (themap.find(in->ml_name) == themap.end()) { @@ -484,13 +472,13 @@ void Dtool_Accum_MethDefs(PyMethodDef in[], MethodDefmap &themap) { } } -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // ** HACK ** alert.. // // Need to keep a runtime type dictionary ... that is forward declared of typed object. // We rely on the fact that typed objects are uniquly defined by an integer. // -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// void RegisterNamedClass(const string &name, Dtool_PyTypedObject &otype) { pair result = @@ -573,8 +561,6 @@ LookupRuntimeTypedClass(TypeHandle handle) { } } -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// Dtool_PyTypedObject *Dtool_RuntimeTypeDtoolType(int type) { RuntimeTypeMap::iterator di = runtime_type_map.find(type); if (di != runtime_type_map.end()) { @@ -589,7 +575,6 @@ Dtool_PyTypedObject *Dtool_RuntimeTypeDtoolType(int type) { return NULL; } -/////////////////////////////////////////////////////////////////////////////// #if PY_MAJOR_VERSION >= 3 PyObject *Dtool_PyModuleInitHelper(LibraryDef *defs[], PyModuleDef *module_def) { #else @@ -700,14 +685,14 @@ PyObject *Dtool_PyModuleInitHelper(LibraryDef *defs[], const char *modulename) { return module; } -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// /// HACK.... Be careful // // Dtool_BorrowThisReference // This function can be used to grab the "THIS" pointer from an object and use it // Required to support historical inheritance in the form of "is this instance of".. // -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// PyObject *Dtool_BorrowThisReference(PyObject *self, PyObject *args) { PyObject *from_in = NULL; PyObject *to_in = NULL; @@ -736,9 +721,9 @@ PyObject *Dtool_BorrowThisReference(PyObject *self, PyObject *args) { return (PyObject *) NULL; } -////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // We do expose a dictionay for dtool classes .. this should be removed at some point.. -////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// PyObject *Dtool_AddToDictionary(PyObject *self1, PyObject *args) { PyObject *self; PyObject *subject; @@ -758,7 +743,7 @@ PyObject *Dtool_AddToDictionary(PyObject *self1, PyObject *args) { return Py_None; } -/////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// Py_hash_t DTOOL_PyObject_HashPointer(PyObject *self) { if (self != NULL && DtoolCanThisBeAPandaInstance(self)) { Dtool_PyInstDef * pyself = (Dtool_PyInstDef *) self; diff --git a/dtool/src/interrogatedb/py_panda.h b/dtool/src/interrogatedb/py_panda.h index ca2a894123..5e34a73287 100644 --- a/dtool/src/interrogatedb/py_panda.h +++ b/dtool/src/interrogatedb/py_panda.h @@ -1,5 +1,3 @@ -#ifndef PY_PANDA_H_ -#define PY_PANDA_H_ // Filename: py_panda.h //////////////////////////////////////////////////////////////////// // @@ -11,19 +9,10 @@ // with this source code in a file named "LICENSE." // //////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////////// -// Too do list .. -// We need a better dispatcher for the functions.. The behavior today is -// try one till it works or you run out of possibilities.. This is anything but optimal -// for performance and is treading on thin ice for function python or c++ will -// course there types to other types. -// -// The linking step will produce allot of warnings -// warning LNK4049: locally defined symbol.. -// -// Get a second coder to review this file and the generated code .. -// -////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef PY_PANDA_H_ +#define PY_PANDA_H_ + #include #include #include @@ -149,9 +138,9 @@ typedef long Py_hash_t; using namespace std; -/////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // this is tempory .. untill this is glued better into the panda build system -/////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// #if defined(_WIN32) && !defined(LINK_ALL_STATIC) #define EXPORT_THIS __declspec(dllexport) @@ -160,14 +149,12 @@ using namespace std; #define EXPORT_THIS #define IMPORT_THIS extern #endif -/////////////////////////////////////////////////////////////////////////////////// struct Dtool_PyTypedObject; typedef std::map RuntimeTypeMap; typedef std::set RuntimeTypeSet; typedef std::map NamedTypeMap; -////////////////////////////////////////////////////////// // used to stamp dtool instance.. #define PY_PANDA_SIGNATURE 0xbeaf typedef void *(*UpcastFunction)(PyObject *,Dtool_PyTypedObject *); @@ -179,9 +166,9 @@ typedef void (*ModuleClassInitFunction)(PyObject *module); //inline void Dtool_Deallocate_General(PyObject * self); //inline int DTOOL_PyObject_Compare(PyObject *v1, PyObject *v2); // -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // THIS IS THE INSTANCE CONTAINER FOR ALL panda py objects.... -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// struct Dtool_PyInstDef { PyObject_HEAD @@ -204,14 +191,14 @@ struct Dtool_PyInstDef { bool _is_const; }; -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // A Offset Dictionary Defining How to read the Above Object.. -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// extern EXPCL_INTERROGATEDB PyMemberDef standard_type_members[]; -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // The Class Definition Structor For a Dtool python type. -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// struct Dtool_PyTypedObject { // Standard Python Features.. PyTypeObject _PyType; @@ -233,9 +220,9 @@ struct Dtool_PyTypedObject { #define Define_Dtool_Class(MODULE_NAME, CLASS_NAME, PUBLIC_NAME) \ extern Dtool_PyTypedObject Dtool_##CLASS_NAME; -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // More Macro(s) to Implement class functions.. Usually used if C++ needs type information -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// #define Define_Dtool_new(CLASS_NAME,CNAME)\ static PyObject *Dtool_new_##CLASS_NAME(PyTypeObject *type, PyObject *args, PyObject *kwds) {\ (void) args; (void) kwds;\ @@ -251,9 +238,9 @@ static PyObject *Dtool_new_##CLASS_NAME(PyTypeObject *type, PyObject *args, PyOb //((Dtool_PyInstDef *)self)->_memory_rules = false;\ //((Dtool_PyInstDef *)self)->_is_const = false;\ -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// /// Delete functions.. -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// #ifdef NDEBUG #define Define_Dtool_FreeInstance_Private(CLASS_NAME,CNAME)\ static void Dtool_FreeInstance_##CLASS_NAME(PyObject *self) {\ @@ -298,18 +285,18 @@ static void Dtool_FreeInstance_##CLASS_NAME(PyObject *self) {\ Py_TYPE(self)->tp_free(self);\ } -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// /// Simple Recognition Functions.. -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// EXPCL_INTERROGATEDB bool DtoolCanThisBeAPandaInstance(PyObject *self); -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // ** HACK ** allert.. // // Need to keep a runtime type dictionary ... that is forward declared of typed object. // We rely on the fact that typed objects are uniquly defined by an integer. // -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// EXPCL_INTERROGATEDB void RegisterNamedClass(const string &name, Dtool_PyTypedObject &otype); EXPCL_INTERROGATEDB void RegisterRuntimeTypedClass(Dtool_PyTypedObject &otype); @@ -317,18 +304,15 @@ EXPCL_INTERROGATEDB void RegisterRuntimeTypedClass(Dtool_PyTypedObject &otype); EXPCL_INTERROGATEDB Dtool_PyTypedObject *LookupNamedClass(const string &name); EXPCL_INTERROGATEDB Dtool_PyTypedObject *LookupRuntimeTypedClass(TypeHandle handle); -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// EXPCL_INTERROGATEDB Dtool_PyTypedObject *Dtool_RuntimeTypeDtoolType(int type); -//////////////////////////////////////////////////////////////////////// -// Function : DTOOL_Call_ExtractThisPointerForType -// +//////////////////////////////////////////////////////////////////// +// Function: DTOOL_Call_ExtractThisPointerForType // These are the wrappers that allow for down and upcast from type .. // needed by the Dtool py interface.. Be very careful if you muck // with these as the generated code depends on how this is set // up.. -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// EXPCL_INTERROGATEDB void DTOOL_Call_ExtractThisPointerForType(PyObject *self, Dtool_PyTypedObject *classdef, void **answer); EXPCL_INTERROGATEDB void *DTOOL_Call_GetPointerThisClass(PyObject *self, Dtool_PyTypedObject *classdef, int param, const string &function_name, bool const_ok, bool report_errors); @@ -387,18 +371,17 @@ EXPCL_INTERROGATEDB PyObject *_Dtool_Return(PyObject *value); #define Dtool_Return(value) _Dtool_Return(value) #endif -//////////////////////////////////////////////////////////////////////// -// Function : DTool_CreatePyInstanceTyped -// +//////////////////////////////////////////////////////////////////// +// Function: DTool_CreatePyInstanceTyped // this function relies on the behavior of typed objects in the panda system. // -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// EXPCL_INTERROGATEDB PyObject *DTool_CreatePyInstanceTyped(void *local_this_in, Dtool_PyTypedObject &known_class_type, bool memory_rules, bool is_const, int RunTimeType); -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // DTool_CreatePyInstance .. wrapper function to finalize the existance of a general // dtool py instance.. -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// EXPCL_INTERROGATEDB PyObject *DTool_CreatePyInstance(void *local_this, Dtool_PyTypedObject &in_classdef, bool memory_rules, bool is_const); // These template methods allow use when the Dtool_PyTypedObject is not known. @@ -427,11 +410,11 @@ template INLINE PyObject *DTool_CreatePyInstanceTyped(T *obj, bool memo return DTool_CreatePyInstanceTyped((void*) obj, *known_class, memory_rules, false, obj->get_type().get_index()); } -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Macro(s) class definition .. Used to allocate storage and // init some values for a Dtool Py Type object. -///////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// + //struct Dtool_PyTypedObject Dtool_##CLASS_NAME; #define Define_Module_Class_Internal(MODULE_NAME,CLASS_NAME,CNAME)\ @@ -439,56 +422,51 @@ extern struct Dtool_PyTypedObject Dtool_##CLASS_NAME;\ static int Dtool_Init_##CLASS_NAME(PyObject *self, PyObject *args, PyObject *kwds);\ static PyObject *Dtool_new_##CLASS_NAME(PyTypeObject *type, PyObject *args, PyObject *kwds); -/////////////////////////////////////////////////////////////////////////////// #define Define_Module_Class(MODULE_NAME,CLASS_NAME,CNAME,PUBLIC_NAME)\ Define_Module_Class_Internal(MODULE_NAME,CLASS_NAME,CNAME)\ Define_Dtool_new(CLASS_NAME,CNAME)\ Define_Dtool_FreeInstance(CLASS_NAME,CNAME)\ Define_Dtool_Class(MODULE_NAME,CLASS_NAME,PUBLIC_NAME) -/////////////////////////////////////////////////////////////////////////////// #define Define_Module_Class_Private(MODULE_NAME,CLASS_NAME,CNAME,PUBLIC_NAME)\ Define_Module_Class_Internal(MODULE_NAME,CLASS_NAME,CNAME)\ Define_Dtool_new(CLASS_NAME,CNAME)\ Define_Dtool_FreeInstance_Private(CLASS_NAME,CNAME)\ Define_Dtool_Class(MODULE_NAME,CLASS_NAME,PUBLIC_NAME) -/////////////////////////////////////////////////////////////////////////////// #define Define_Module_ClassRef_Private(MODULE_NAME,CLASS_NAME,CNAME,PUBLIC_NAME)\ Define_Module_Class_Internal(MODULE_NAME,CLASS_NAME,CNAME)\ Define_Dtool_new(CLASS_NAME,CNAME)\ Define_Dtool_FreeInstance_Private(CLASS_NAME,CNAME)\ Define_Dtool_Class(MODULE_NAME,CLASS_NAME,PUBLIC_NAME) -/////////////////////////////////////////////////////////////////////////////// #define Define_Module_ClassRef(MODULE_NAME,CLASS_NAME,CNAME,PUBLIC_NAME)\ Define_Module_Class_Internal(MODULE_NAME,CLASS_NAME,CNAME)\ Define_Dtool_new(CLASS_NAME,CNAME)\ Define_Dtool_FreeInstanceRef(CLASS_NAME,CNAME)\ Define_Dtool_Class(MODULE_NAME,CLASS_NAME,PUBLIC_NAME) -/////////////////////////////////////////////////////////////////////////////// -/// Th Finalizer for simple instances.. -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +/// The finalizer for simple instances. +//////////////////////////////////////////////////////////////////// EXPCL_INTERROGATEDB int DTool_PyInit_Finalize(PyObject *self, void *This, Dtool_PyTypedObject *type, bool memory_rules, bool is_const); -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// /// A heler function to glu methed definition together .. that can not be done at // code generation time becouse of multiple generation passes in interigate.. // -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// typedef std::map MethodDefmap; EXPCL_INTERROGATEDB void Dtool_Accum_MethDefs(PyMethodDef in[], MethodDefmap &themap); -/////////////////////////////////////////////////////////////////////////////// -//// We need a way to runtime merge compile units into a python "Module" .. this is done with the -/// fallowing structors and code.. along with the support of interigate_module -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// We need a way to runtime merge compile units into a python "Module" .. this is done with the +// fallowing structors and code.. along with the support of interigate_module +//////////////////////////////////////////////////////////////////// struct LibraryDef { PyMethodDef *_methods; }; -/////////////////////////////////////////////////////////////////////////////// #if PY_MAJOR_VERSION >= 3 EXPCL_INTERROGATEDB PyObject *Dtool_PyModuleInitHelper(LibraryDef *defs[], PyModuleDef *module_def); @@ -496,22 +474,22 @@ EXPCL_INTERROGATEDB PyObject *Dtool_PyModuleInitHelper(LibraryDef *defs[], PyMod EXPCL_INTERROGATEDB PyObject *Dtool_PyModuleInitHelper(LibraryDef *defs[], const char *modulename); #endif -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// /// HACK.... Be carefull // // Dtool_BorrowThisReference // This function can be used to grab the "THIS" pointer from an object and use it // Required to support fom historical inharatence in the for of "is this instance of".. // -/////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// EXPCL_INTERROGATEDB PyObject *Dtool_BorrowThisReference(PyObject *self, PyObject *args); -////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // We do expose a dictionay for dtool classes .. this should be removed at some point.. -////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// EXPCL_INTERROGATEDB PyObject *Dtool_AddToDictionary(PyObject *self1, PyObject *args); -/////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// EXPCL_INTERROGATEDB Py_hash_t DTOOL_PyObject_HashPointer(PyObject *obj); diff --git a/dtool/src/parser-inc/Cg/cgGL.h b/dtool/src/parser-inc/Cg/cgGL.h index cfc0bd0a68..187b79ce59 100644 --- a/dtool/src/parser-inc/Cg/cgGL.h +++ b/dtool/src/parser-inc/Cg/cgGL.h @@ -1,4 +1,4 @@ -// Filename: cgGl.h +// Filename: cgGL.h // Created by: sshodhan(22Jul04) // //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/parser-inc/Max.h b/dtool/src/parser-inc/Max.h index 58b536f175..4bd9ecc225 100644 --- a/dtool/src/parser-inc/Max.h +++ b/dtool/src/parser-inc/Max.h @@ -1,4 +1,4 @@ -// Filename: zlib.h +// Filename: Max.h // Created by: drose (14Sep00) // //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/parser-inc/iparamb2.h b/dtool/src/parser-inc/iparamb2.h index e55c73521c..9aff73387a 100644 --- a/dtool/src/parser-inc/iparamb2.h +++ b/dtool/src/parser-inc/iparamb2.h @@ -1,4 +1,4 @@ -// Filename: zlib.h +// Filename: iparamb2.h // Created by: drose (14Sep00) // //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/parser-inc/iparamm2.h b/dtool/src/parser-inc/iparamm2.h index 7feac3da50..02549f67cd 100644 --- a/dtool/src/parser-inc/iparamm2.h +++ b/dtool/src/parser-inc/iparamm2.h @@ -1,4 +1,4 @@ -// Filename: zlib.h +// Filename: iparamm2.h // Created by: drose (14Sep00) // //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/parser-inc/iskin.h b/dtool/src/parser-inc/iskin.h index 39dc785729..f2de948bdf 100644 --- a/dtool/src/parser-inc/iskin.h +++ b/dtool/src/parser-inc/iskin.h @@ -1,4 +1,4 @@ -// Filename: zlib.h +// Filename: iskin.h // Created by: drose (14Sep00) // //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/parser-inc/istdplug.h b/dtool/src/parser-inc/istdplug.h index d63654d732..626cd405fb 100644 --- a/dtool/src/parser-inc/istdplug.h +++ b/dtool/src/parser-inc/istdplug.h @@ -1,4 +1,4 @@ -// Filename: zlib.h +// Filename: istdplug.h // Created by: drose (14Sep00) // //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/parser-inc/phyexp.h b/dtool/src/parser-inc/phyexp.h index 386983946e..3162791316 100644 --- a/dtool/src/parser-inc/phyexp.h +++ b/dtool/src/parser-inc/phyexp.h @@ -1,4 +1,4 @@ -// Filename: zlib.h +// Filename: phyexp.h // Created by: drose (14Sep00) // //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/parser-inc/stdmat.h b/dtool/src/parser-inc/stdmat.h index 227f5683e4..4ec892dd35 100644 --- a/dtool/src/parser-inc/stdmat.h +++ b/dtool/src/parser-inc/stdmat.h @@ -1,4 +1,4 @@ -// Filename: zlib.h +// Filename: stdmat.h // Created by: drose (14Sep00) // //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/prc/androidLogStream.h b/dtool/src/prc/androidLogStream.h index dbe7f1f25b..1ca3438978 100644 --- a/dtool/src/prc/androidLogStream.h +++ b/dtool/src/prc/androidLogStream.h @@ -27,7 +27,7 @@ // Class : AndroidLogStream // Description : This is a type of ostream that writes each line // to the Android log. -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class AndroidLogStream : public ostream { private: class AndroidLogStreamBuf : public streambuf { diff --git a/dtool/src/prc/nativeNumericData.I b/dtool/src/prc/nativeNumericData.I index c8cddd9a4b..a59380344f 100644 --- a/dtool/src/prc/nativeNumericData.I +++ b/dtool/src/prc/nativeNumericData.I @@ -66,10 +66,10 @@ get_data() const { return _source; } -///////////////////// -// this is for a intel compile .. it is native format and it is +//////////////////////////////////////////////////////////////////// +// this is for a intel compile .. it is native format and it is // readable off word boundries -///////////////////////// +//////////////////////////////////////////////////////////////////// inline void TS_SetVal1(const PN_int8 * src, PN_int8 *dst) { *dst = *src; @@ -91,13 +91,13 @@ inline void TS_SetVal8(const char * src, char *dst) } template inline type TS_GetInteger(type &val,const char * _src) -{ +{ val = *(reinterpret_cast (_src)); return val; } template inline type TS_GetIntegerIncPtr(type &val,char *& _src) -{ +{ val = *(reinterpret_cast (_src)); _src+= sizeof(type); return val; @@ -114,6 +114,6 @@ template inline void TS_AddInteger(type val, char * _dst) *(reinterpret_cast (_dst)) = val; } -#define TS_GetDirect(TT,SS) *((TT *)(SS)) -#define TS_GetDirectIncPtr(TT,SS) { _ptr += sizeof(TT); return *((TT *)(SS -sizeof(TT))); } +#define TS_GetDirect(TT,SS) *((TT *)(SS)) +#define TS_GetDirectIncPtr(TT,SS) { _ptr += sizeof(TT); return *((TT *)(SS -sizeof(TT))); } diff --git a/dtool/src/prc/pnotify.I b/dtool/src/prc/pnotify.I index 06919b8ae8..287a5495f4 100644 --- a/dtool/src/prc/pnotify.I +++ b/dtool/src/prc/pnotify.I @@ -1,4 +1,4 @@ -// Filename: notify.I +// Filename: pnotify.I // Created by: drose (28Feb00) // //////////////////////////////////////////////////////////////////// diff --git a/panda/metalibs/pandadx9/pandadx9.cxx b/panda/metalibs/pandadx9/pandadx9.cxx index 7c3e72bdaa..ae4b747769 100644 --- a/panda/metalibs/pandadx9/pandadx9.cxx +++ b/panda/metalibs/pandadx9/pandadx9.cxx @@ -1,6 +1,6 @@ -// Filename: pandadx.cxx +// Filename: pandadx9.cxx // Created by: masad (15Jan04) -// +// //////////////////////////////////////////////////////////////////// #include "pandadx9.h" diff --git a/panda/metalibs/pandadx9/pandadx9.h b/panda/metalibs/pandadx9/pandadx9.h index 42c7b8799c..be3e7db827 100644 --- a/panda/metalibs/pandadx9/pandadx9.h +++ b/panda/metalibs/pandadx9/pandadx9.h @@ -1,6 +1,6 @@ -// Filename: pandadx.h +// Filename: pandadx9.h // Created by: masad (15Jan04) -// +// //////////////////////////////////////////////////////////////////// #ifndef PANDADX9_H diff --git a/panda/metalibs/pandaegg/pandaeggnopg.cxx b/panda/metalibs/pandaegg/pandaeggnopg.cxx index 52903433e5..3461574f91 100644 --- a/panda/metalibs/pandaegg/pandaeggnopg.cxx +++ b/panda/metalibs/pandaegg/pandaeggnopg.cxx @@ -1,6 +1,6 @@ -// Filename: pandaegg.cxx +// Filename: pandaeggnopg.cxx // Created by: drose (16May00) -// +// //////////////////////////////////////////////////////////////////// #include "pandaegg.h" diff --git a/panda/metalibs/pandagles2/pandagles2.h b/panda/metalibs/pandagles2/pandagles2.h index dbac54b9ed..d661c9d870 100644 --- a/panda/metalibs/pandagles2/pandagles2.h +++ b/panda/metalibs/pandagles2/pandagles2.h @@ -1,4 +1,4 @@ -// Filename: pandagles.h +// Filename: pandagles2.h // Created by: pro-rsoft (16Jun09) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/audio/filterProperties.I b/panda/src/audio/filterProperties.I index 7e5cbbfd66..51f1171540 100644 --- a/panda/src/audio/filterProperties.I +++ b/panda/src/audio/filterProperties.I @@ -14,9 +14,9 @@ //////////////////////////////////////////////////////////////////// -// Function: FilterProperties::clear -// Access: Published -// Description: Removes all DSP postprocessing. +// Function: FilterProperties::clear +// Access: Published +// Description: Removes all DSP postprocessing. //////////////////////////////////////////////////////////////////// INLINE void FilterProperties:: clear() { @@ -24,9 +24,9 @@ clear() { } //////////////////////////////////////////////////////////////////// -// Function: FilterProperties::apply_lowpass -// Access: Published -// Description: Add a lowpass filter to the end of the DSP chain. +// Function: FilterProperties::apply_lowpass +// Access: Published +// Description: Add a lowpass filter to the end of the DSP chain. //////////////////////////////////////////////////////////////////// INLINE void FilterProperties:: add_lowpass(PN_stdfloat cutoff_freq, PN_stdfloat resonance_q) { @@ -34,9 +34,9 @@ add_lowpass(PN_stdfloat cutoff_freq, PN_stdfloat resonance_q) { } //////////////////////////////////////////////////////////////////// -// Function: FilterProperties::add_highpass -// Access: Published -// Description: Add a highpass filter to the end of the DSP chain. +// Function: FilterProperties::add_highpass +// Access: Published +// Description: Add a highpass filter to the end of the DSP chain. //////////////////////////////////////////////////////////////////// INLINE void FilterProperties:: add_highpass(PN_stdfloat cutoff_freq, PN_stdfloat resonance_q) { @@ -44,9 +44,9 @@ add_highpass(PN_stdfloat cutoff_freq, PN_stdfloat resonance_q) { } //////////////////////////////////////////////////////////////////// -// Function: FilterProperties::add_echo -// Access: Published -// Description: Add a echo filter to the end of the DSP chain. +// Function: FilterProperties::add_echo +// Access: Published +// Description: Add a echo filter to the end of the DSP chain. //////////////////////////////////////////////////////////////////// INLINE void FilterProperties:: add_echo(PN_stdfloat drymix, PN_stdfloat wetmix, PN_stdfloat delay, PN_stdfloat decayratio) { @@ -54,9 +54,9 @@ add_echo(PN_stdfloat drymix, PN_stdfloat wetmix, PN_stdfloat delay, PN_stdfloat } //////////////////////////////////////////////////////////////////// -// Function: FilterProperties::add_flange -// Access: Published -// Description: Add a flange filter to the end of the DSP chain. +// Function: FilterProperties::add_flange +// Access: Published +// Description: Add a flange filter to the end of the DSP chain. //////////////////////////////////////////////////////////////////// INLINE void FilterProperties:: add_flange(PN_stdfloat drymix, PN_stdfloat wetmix, PN_stdfloat depth, PN_stdfloat rate) { @@ -64,9 +64,9 @@ add_flange(PN_stdfloat drymix, PN_stdfloat wetmix, PN_stdfloat depth, PN_stdfloa } //////////////////////////////////////////////////////////////////// -// Function: FilterProperties::add_distort -// Access: Published -// Description: Add a distort filter to the end of the DSP chain. +// Function: FilterProperties::add_distort +// Access: Published +// Description: Add a distort filter to the end of the DSP chain. //////////////////////////////////////////////////////////////////// INLINE void FilterProperties:: add_distort(PN_stdfloat level) { @@ -74,9 +74,9 @@ add_distort(PN_stdfloat level) { } //////////////////////////////////////////////////////////////////// -// Function: FilterProperties::add_normalize -// Access: Published -// Description: Add a normalize filter to the end of the DSP chain. +// Function: FilterProperties::add_normalize +// Access: Published +// Description: Add a normalize filter to the end of the DSP chain. //////////////////////////////////////////////////////////////////// INLINE void FilterProperties:: add_normalize(PN_stdfloat fadetime, PN_stdfloat threshold, PN_stdfloat maxamp) { @@ -84,9 +84,9 @@ add_normalize(PN_stdfloat fadetime, PN_stdfloat threshold, PN_stdfloat maxamp) { } //////////////////////////////////////////////////////////////////// -// Function: FilterProperties::add_parameq -// Access: Published -// Description: Add a parameq filter to the end of the DSP chain. +// Function: FilterProperties::add_parameq +// Access: Published +// Description: Add a parameq filter to the end of the DSP chain. //////////////////////////////////////////////////////////////////// INLINE void FilterProperties:: add_parameq(PN_stdfloat center_freq, PN_stdfloat bandwidth, PN_stdfloat gain) { @@ -94,9 +94,9 @@ add_parameq(PN_stdfloat center_freq, PN_stdfloat bandwidth, PN_stdfloat gain) { } //////////////////////////////////////////////////////////////////// -// Function: FilterProperties::add_pitchshift -// Access: Published -// Description: Add a pitchshift filter to the end of the DSP chain. +// Function: FilterProperties::add_pitchshift +// Access: Published +// Description: Add a pitchshift filter to the end of the DSP chain. //////////////////////////////////////////////////////////////////// INLINE void FilterProperties:: add_pitchshift(PN_stdfloat pitch, PN_stdfloat fftsize, PN_stdfloat overlap) { @@ -104,9 +104,9 @@ add_pitchshift(PN_stdfloat pitch, PN_stdfloat fftsize, PN_stdfloat overlap) { } //////////////////////////////////////////////////////////////////// -// Function: FilterProperties::add_chorus -// Access: Published -// Description: Add a chorus filter to the end of the DSP chain. +// Function: FilterProperties::add_chorus +// Access: Published +// Description: Add a chorus filter to the end of the DSP chain. //////////////////////////////////////////////////////////////////// INLINE void FilterProperties:: add_chorus(PN_stdfloat drymix, PN_stdfloat wet1, PN_stdfloat wet2, PN_stdfloat wet3, PN_stdfloat delay, PN_stdfloat rate, PN_stdfloat depth) { @@ -114,9 +114,9 @@ add_chorus(PN_stdfloat drymix, PN_stdfloat wet1, PN_stdfloat wet2, PN_stdfloat w } //////////////////////////////////////////////////////////////////// -// Function: FilterProperties::add_sfxreverb -// Access: Published -// Description: Add a reverb filter to the end of the DSP chain. +// Function: FilterProperties::add_sfxreverb +// Access: Published +// Description: Add a reverb filter to the end of the DSP chain. //////////////////////////////////////////////////////////////////// INLINE void FilterProperties:: add_sfxreverb(PN_stdfloat drylevel, PN_stdfloat room, PN_stdfloat roomhf, PN_stdfloat decaytime, @@ -128,9 +128,9 @@ add_sfxreverb(PN_stdfloat drylevel, PN_stdfloat room, PN_stdfloat roomhf, PN_std } //////////////////////////////////////////////////////////////////// -// Function: FilterProperties::add_compress -// Access: Published -// Description: Add a compress filter to the end of the DSP chain. +// Function: FilterProperties::add_compress +// Access: Published +// Description: Add a compress filter to the end of the DSP chain. //////////////////////////////////////////////////////////////////// INLINE void FilterProperties:: add_compress(PN_stdfloat threshold, PN_stdfloat attack, PN_stdfloat release, PN_stdfloat gainmakeup) { @@ -138,9 +138,9 @@ add_compress(PN_stdfloat threshold, PN_stdfloat attack, PN_stdfloat release, PN_ } //////////////////////////////////////////////////////////////////// -// Function: FilterProperties::get_config -// Access: Published -// Description: Intended for use by AudioManager and AudioSound +// Function: FilterProperties::get_config +// Access: Published +// Description: Intended for use by AudioManager and AudioSound // implementations: allows access to the config vector. //////////////////////////////////////////////////////////////////// INLINE const FilterProperties::ConfigVector &FilterProperties:: diff --git a/panda/src/audiotraits/config_fmodAudio.cxx b/panda/src/audiotraits/config_fmodAudio.cxx index 0f0c1cf700..b5c111a59a 100644 --- a/panda/src/audiotraits/config_fmodAudio.cxx +++ b/panda/src/audiotraits/config_fmodAudio.cxx @@ -66,7 +66,7 @@ init_libFmodAudio() { // Description: This function is called when the dynamic library is // loaded; it should return the Create_AudioManager // function appropriate to create a FmodAudioManager. -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// Create_AudioManager_proc * get_audio_manager_func_fmod_audio() { init_libFmodAudio(); diff --git a/panda/src/audiotraits/config_milesAudio.cxx b/panda/src/audiotraits/config_milesAudio.cxx index ea87b4a2a5..3da1bcc119 100644 --- a/panda/src/audiotraits/config_milesAudio.cxx +++ b/panda/src/audiotraits/config_milesAudio.cxx @@ -93,7 +93,7 @@ init_libMilesAudio() { // Description: This function is called when the dynamic library is // loaded; it should return the Create_AudioManager // function appropriate to create a MilesAudioManager. -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// Create_AudioManager_proc * get_audio_manager_func_miles_audio() { init_libMilesAudio(); diff --git a/panda/src/audiotraits/config_openalAudio.cxx b/panda/src/audiotraits/config_openalAudio.cxx index fe8cc6e128..94508743a7 100644 --- a/panda/src/audiotraits/config_openalAudio.cxx +++ b/panda/src/audiotraits/config_openalAudio.cxx @@ -47,7 +47,7 @@ init_libOpenALAudio() { if (initialized) { return; } - + initialized = true; OpenALAudioManager::init_type(); OpenALAudioSound::init_type(); @@ -63,7 +63,7 @@ init_libOpenALAudio() { // Description: This function is called when the dynamic library is // loaded; it should return the Create_AudioManager // function appropriate to create an OpenALAudioManager. -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// Create_AudioManager_proc * get_audio_manager_func_openal_audio() { init_libOpenALAudio(); diff --git a/panda/src/audiotraits/fmodAudioManager.cxx b/panda/src/audiotraits/fmodAudioManager.cxx index 3a6a4a82e4..7864917970 100644 --- a/panda/src/audiotraits/fmodAudioManager.cxx +++ b/panda/src/audiotraits/fmodAudioManager.cxx @@ -38,14 +38,14 @@ TypeHandle FmodAudioManager::_type_handle; ReMutex FmodAudioManager::_lock; -FMOD::System *FmodAudioManager::_system; +FMOD::System *FmodAudioManager::_system; pset FmodAudioManager::_all_managers; bool FmodAudioManager::_system_is_valid = false; -// This sets the distance factor for 3D audio to use feet. +// This sets the distance factor for 3D audio to use feet. // FMOD uses meters by default. // Since Panda use feet we need to compensate for that with a factor of 3.28 // @@ -81,7 +81,7 @@ AudioManager *Create_FmodAudioManager() { //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// FmodAudioManager:: FmodAudioManager() { @@ -92,7 +92,7 @@ FmodAudioManager() { unsigned int version; _all_managers.insert(this); - + //Init 3D attributes _position.x = 0; _position.y = 0; @@ -124,7 +124,7 @@ FmodAudioManager() { // Let check the Version of FMOD to make sure the Headers and Libraries are correct. result = _system->getVersion(&version); fmod_audio_errcheck("_system->getVersion()", result); - + if (version < FMOD_VERSION){ audio_error("You are using an old version of FMOD. This program requires:" << FMOD_VERSION); } @@ -194,7 +194,7 @@ FmodAudioManager() { //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::Destructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// FmodAudioManager:: ~FmodAudioManager() { @@ -219,8 +219,8 @@ FmodAudioManager:: //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::is_valid // Access: Public -// Description: This just check to make sure the FMOD System is -// up and running correctly. +// Description: This just check to make sure the FMOD System is +// up and running correctly. //////////////////////////////////////////////////////////////////// bool FmodAudioManager:: is_valid() { @@ -358,7 +358,7 @@ make_dsp(const FilterProperties::FilterConfig &conf) { } dsp->setUserData(USER_DSP_MAGIC); - + return dsp; } @@ -415,8 +415,8 @@ update_dsp_chain(FMOD::DSP *head, FilterProperties *config) { // Access: Public // Description: Configure the global DSP filter chain. // -// FMOD has a relatively powerful DSP -// implementation. It is likely that most +// FMOD has a relatively powerful DSP +// implementation. It is likely that most // configurations will be supported. //////////////////////////////////////////////////////////////////// bool FmodAudioManager:: @@ -443,7 +443,7 @@ get_sound(const string &file_name, bool positional, int) { ReMutexHolder holder(_lock); //Needed so People use Panda's Generic UNIX Style Paths for Filename. //path.to_os_specific() converts it back to the proper OS version later on. - + Filename path = file_name; VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); @@ -522,21 +522,21 @@ getSpeakerSetup() { // Function: FmodAudioManager::setSpeakerSetup() // Access: Published // Description: This is to set up FMOD to use a MultiChannel Setup. -// This method is pretty much useless. -// To set a speaker setup in FMOD for Surround Sound, -// stereo, or whatever you have to set the SpeakerMode -// BEFORE you Initialize FMOD. -// Since Panda Inits the FmodAudioManager right when you -// Start it up, you are never given an oppertunity to call -// this function. -// That is why I stuck a BOOL in the CONFIG.PRC file, whichs -// lets you flag if you want to use a Multichannel or not. -// That will set the speaker setup when an instance of this -// class is constructed. -// Still I put this here as a measure of good faith, since you -// can query the speaker setup after everything in Init. -// Also, maybe someone will completely hack Panda someday, in which -// one can init or re-init the AudioManagers after Panda is running. +// This method is pretty much useless. +// To set a speaker setup in FMOD for Surround Sound, +// stereo, or whatever you have to set the SpeakerMode +// BEFORE you Initialize FMOD. +// Since Panda Inits the FmodAudioManager right when you +// Start it up, you are never given an oppertunity to call +// this function. +// That is why I stuck a BOOL in the CONFIG.PRC file, whichs +// lets you flag if you want to use a Multichannel or not. +// That will set the speaker setup when an instance of this +// class is constructed. +// Still I put this here as a measure of good faith, since you +// can query the speaker setup after everything in Init. +// Also, maybe someone will completely hack Panda someday, in which +// one can init or re-init the AudioManagers after Panda is running. //////////////////////////////////////////////////////////////////// void FmodAudioManager:: setSpeakerSetup(AudioManager::SpeakerModeCategory cat) { @@ -607,8 +607,8 @@ set_active(bool active) { _active = active; // Tell our AudioSounds to adjust: - for (SoundSet::iterator i = _all_sounds.begin(); - i != _all_sounds.end(); + for (SoundSet::iterator i = _all_sounds.begin(); + i != _all_sounds.end(); ++i) { (*i)->set_active(_active); } @@ -618,7 +618,7 @@ set_active(bool active) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::get_active() // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// bool FmodAudioManager:: get_active() const { @@ -662,16 +662,16 @@ update() { // Function: FmodAudioManager::audio_3d_set_listener_attributes // Access: Public // Description: Set position of the "ear" that picks up 3d sounds -// NOW LISTEN UP!!! THIS IS IMPORTANT! -// Both Panda3D and FMOD use a left handed coordinate system. -// But there is a major difference! -// In Panda3D the Y-Axis is going into the Screen and the Z-Axis is going up. -// In FMOD the Y-Axis is going up and the Z-Axis is going into the screen. -// The solution is simple, we just flip the Y and Z axis, as we move coordinates -// from Panda to FMOD and back. -// What does did mean to average Panda user? Nothing, they shouldn't notice anyway. -// But if you decide to do any 3D audio work in here you have to keep it in mind. -// I told you, so you can't say I didn't. +// NOW LISTEN UP!!! THIS IS IMPORTANT! +// Both Panda3D and FMOD use a left handed coordinate system. +// But there is a major difference! +// In Panda3D the Y-Axis is going into the Screen and the Z-Axis is going up. +// In FMOD the Y-Axis is going up and the Z-Axis is going into the screen. +// The solution is simple, we just flip the Y and Z axis, as we move coordinates +// from Panda to FMOD and back. +// What does did mean to average Panda user? Nothing, they shouldn't notice anyway. +// But if you decide to do any 3D audio work in here you have to keep it in mind. +// I told you, so you can't say I didn't. //////////////////////////////////////////////////////////////////// void FmodAudioManager:: audio_3d_set_listener_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx, PN_stdfloat vy, PN_stdfloat vz, PN_stdfloat fx, PN_stdfloat fy, PN_stdfloat fz, PN_stdfloat ux, PN_stdfloat uy, PN_stdfloat uz) { @@ -679,10 +679,10 @@ audio_3d_set_listener_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, audio_debug("FmodAudioManager::audio_3d_set_listener_attributes()"); FMOD_RESULT result; - + _position.x = px; _position.y = pz; - _position.z = py; + _position.z = py; _velocity.x = vx; _velocity.y = vz; @@ -695,7 +695,7 @@ audio_3d_set_listener_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, _up.x = ux; _up.y = uz; _up.z = uy; - + result = _system->set3DListenerAttributes( 0, &_position, &_velocity, &_forward, &_up); fmod_audio_errcheck("_system->set3DListenerAttributes()", result); @@ -723,7 +723,7 @@ void FmodAudioManager:: audio_3d_set_distance_factor(PN_stdfloat factor) { ReMutexHolder holder(_lock); audio_debug( "FmodAudioManager::audio_3d_set_distance_factor( factor= " << factor << ")" ); - + FMOD_RESULT result; _distance_factor = factor; @@ -750,7 +750,7 @@ audio_3d_get_distance_factor() const { //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::audio_3d_set_doppler_factor // Access: Public -// Description: Exaggerates or diminishes the Doppler effect. +// Description: Exaggerates or diminishes the Doppler effect. // Defaults to 1.0 //////////////////////////////////////////////////////////////////// void FmodAudioManager:: @@ -770,7 +770,7 @@ audio_3d_set_doppler_factor(PN_stdfloat factor) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::audio_3d_get_doppler_factor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// PN_stdfloat FmodAudioManager:: audio_3d_get_doppler_factor() const { @@ -802,7 +802,7 @@ audio_3d_set_drop_off_factor(PN_stdfloat factor) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::audio_3d_get_drop_off_factor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// PN_stdfloat FmodAudioManager:: audio_3d_get_drop_off_factor() const { @@ -850,7 +850,7 @@ reduce_sounds_playing_to(unsigned int count) { // Function: FmodAudioManager::uncache_sound // Access: Public // Description: NOT USED FOR FMOD-EX!!! -// Clears a sound out of the sound cache. +// Clears a sound out of the sound cache. //////////////////////////////////////////////////////////////////// void FmodAudioManager:: uncache_sound(const string& file_name) { @@ -863,19 +863,19 @@ uncache_sound(const string& file_name) { // Function: FmodAudioManager::clear_cache // Access: Public // Description: NOT USED FOR FMOD-EX!!! -// Clear out the sound cache. +// Clear out the sound cache. //////////////////////////////////////////////////////////////////// void FmodAudioManager:: clear_cache() { audio_debug("FmodAudioManager::clear_cache()"); - + } //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::set_cache_limit // Access: Public // Description: NOT USED FOR FMOD-EX!!! -// Set the number of sounds that the cache can hold. +// Set the number of sounds that the cache can hold. //////////////////////////////////////////////////////////////////// void FmodAudioManager:: set_cache_limit(unsigned int count) { @@ -887,7 +887,7 @@ set_cache_limit(unsigned int count) { // Function: FmodAudioManager::get_cache_limit // Access: Public // Description: NOT USED FOR FMOD-EX!!! -// Gets the number of sounds that the cache can hold. +// Gets the number of sounds that the cache can hold. //////////////////////////////////////////////////////////////////// unsigned int FmodAudioManager:: get_cache_limit() const { diff --git a/panda/src/audiotraits/fmodAudioManager.h b/panda/src/audiotraits/fmodAudioManager.h index d43933dc4c..52d6e224c7 100644 --- a/panda/src/audiotraits/fmodAudioManager.h +++ b/panda/src/audiotraits/fmodAudioManager.h @@ -99,7 +99,7 @@ class EXPCL_FMOD_AUDIO FmodAudioManager : public AudioManager { virtual PT(AudioSound) get_sound(const string&, bool positional = false, int mode=SM_heuristic); virtual PT(AudioSound) get_sound(MovieAudio *, bool positional = false, int mode=SM_heuristic); - + virtual int getSpeakerSetup(); virtual void setSpeakerSetup(SpeakerModeCategory cat); @@ -114,7 +114,7 @@ class EXPCL_FMOD_AUDIO FmodAudioManager : public AudioManager { virtual void stop_all_sounds(); virtual void update(); - + // This controls the "set of ears" that listens to 3D spacialized sound // px, py, pz are position coordinates. Can be 0.0f to ignore. // vx, vy, vz are a velocity vector in UNITS PER SECOND (default: meters). @@ -122,7 +122,7 @@ class EXPCL_FMOD_AUDIO FmodAudioManager : public AudioManager { // ux, uy and uz are the respective components of a unit up-vector // These changes will NOT be invoked until audio_3d_update() is called. virtual void audio_3d_set_listener_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, - PN_stdfloat vx, PN_stdfloat xy, PN_stdfloat xz, + PN_stdfloat vx, PN_stdfloat xy, PN_stdfloat xz, PN_stdfloat fx, PN_stdfloat fy, PN_stdfloat fz, PN_stdfloat ux, PN_stdfloat uy, PN_stdfloat uz); @@ -131,7 +131,7 @@ class EXPCL_FMOD_AUDIO FmodAudioManager : public AudioManager { PN_stdfloat *vx, PN_stdfloat *vy, PN_stdfloat *vz, PN_stdfloat *fx, PN_stdfloat *fy, PN_stdfloat *fz, PN_stdfloat *ux, PN_stdfloat *uy, PN_stdfloat *uz); - + // Control the "relative distance factor" for 3D spacialized audio. Default is 1.0 // Fmod uses meters internally, so give a float in Units-per meter // Don't know what Miles uses. @@ -167,7 +167,7 @@ private: FMOD::DSP *make_dsp(const FilterProperties::FilterConfig &conf); void update_dsp_chain(FMOD::DSP *head, FilterProperties *config); virtual bool configure_filters(FilterProperties *config); - + private: // This global lock protects all access to FMod library interfaces. static ReMutex _lock; @@ -191,19 +191,19 @@ private: // DLS info for MIDI files string _dlsname; FMOD_CREATESOUNDEXINFO _midi_info; - + bool _is_valid; bool _active; - + // The set of all sounds. Needed only to implement stop_all_sounds. typedef pset SoundSet; SoundSet _all_sounds; FMOD_OUTPUTTYPE _saved_outputtype; - //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// //These are needed for Panda's Pointer System. DO NOT ERASE! - //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// public: static TypeHandle get_class_type() { @@ -217,16 +217,16 @@ private: return get_class_type(); } virtual TypeHandle force_init_type() { - init_type(); + init_type(); return get_class_type(); } private: static TypeHandle _type_handle; - //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// //DONE - //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// }; diff --git a/panda/src/audiotraits/fmodAudioSound.cxx b/panda/src/audiotraits/fmodAudioSound.cxx index 4b9446f38d..6747cdebd6 100644 --- a/panda/src/audiotraits/fmodAudioSound.cxx +++ b/panda/src/audiotraits/fmodAudioSound.cxx @@ -32,14 +32,14 @@ TypeHandle FmodAudioSound::_type_handle; //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::FmodAudioSound -// Access: public +// Access: Public // Description: Constructor // All sound will DEFAULT load as a 2D sound unless // otherwise specified. //////////////////////////////////////////////////////////////////// FmodAudioSound:: -FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { +FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { ReMutexHolder holder(FmodAudioManager::_lock); audio_debug("FmodAudioSound::FmodAudioSound() Creating new sound, filename: " << file_name ); @@ -91,11 +91,11 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { bool preload = (fmod_audio_preload_threshold < 0) || (file->get_file_size() < fmod_audio_preload_threshold); int flags = FMOD_SOFTWARE; flags |= positional ? FMOD_3D : FMOD_2D; - + FMOD_CREATESOUNDEXINFO sound_info; memset(&sound_info, 0, sizeof(sound_info)); sound_info.cbsize = sizeof(sound_info); - + string ext = downcase(_file_name.get_extension()); if (ext == "mid") { // Get the MIDI parameters. @@ -104,10 +104,10 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { audio_debug("Using DLS file " << sound_info.dlsname); } } - + const char *name_or_data = _file_name.c_str(); string os_filename; - + pvector mem_buffer; SubfileInfo info; if (preload) { @@ -139,7 +139,7 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { flags |= FMOD_CREATESTREAM; if (fmodAudio_cat.is_debug()) { fmodAudio_cat.debug() - << "Streaming " << _file_name << " from disk (" << name_or_data + << "Streaming " << _file_name << " from disk (" << name_or_data << ", " << sound_info.fileoffset << ", " << sound_info.length << ")\n"; } @@ -167,14 +167,14 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { << "Cannot stream " << _file_name << "; file is not literally on disk.\n"; #endif } - - result = + + result = _manager->_system->createSound(name_or_data, flags, &sound_info, &_sound); } - + if (result != FMOD_OK) { audio_error("createSound(" << _file_name << "): " << FMOD_ErrorString(result)); - + // We couldn't load the sound file. Create a blank sound record // instead. FMOD_CREATESOUNDEXINFO sound_info; @@ -196,12 +196,12 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { // consistently. Override it. _sound->setLoopCount(1); _sound->setMode(FMOD_LOOP_OFF); - + //This is just to collect the defaults of the sound, so we don't //Have to query FMOD everytime for the info. //It is also important we get the '_sampleFrequency' variable here, for the //'set_play_rate()' and 'get_play_rate()' methods later; - + result = _sound->getDefaults( &_sampleFrequency, &_volume , &_balance, &_priority); fmod_audio_errcheck("_sound->getDefaults()", result); } @@ -209,7 +209,7 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::~FmodAudioSound -// Access: public +// Access: Public // Description: DESTRUCTOR!!! //////////////////////////////////////////////////////////////////// FmodAudioSound:: @@ -228,7 +228,7 @@ FmodAudioSound:: //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound:: play -// Access: public +// Access: Public // Description: Plays a sound. //////////////////////////////////////////////////////////////////// void FmodAudioSound:: @@ -238,7 +238,7 @@ play() { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::stop -// Access: public +// Access: Public // Description: Stop a sound //////////////////////////////////////////////////////////////////// void FmodAudioSound:: @@ -262,7 +262,7 @@ stop() { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::set_loop -// Access: public +// Access: Public // Description: Turns looping on and off //////////////////////////////////////////////////////////////////// void FmodAudioSound:: @@ -276,7 +276,7 @@ set_loop(bool loop) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::get_loop -// Access: public +// Access: Public // Description: Returns whether looping is on or off //////////////////////////////////////////////////////////////////// bool FmodAudioSound:: @@ -290,12 +290,12 @@ get_loop() const { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::set_loop_count -// Access: public -// Description: -// Panda uses 0 to mean loop forever. -// Fmod uses negative numbers to mean loop forever. -// (0 means don't loop, 1 means play twice, etc. -// We must convert! +// Access: Public +// Description: +// Panda uses 0 to mean loop forever. +// Fmod uses negative numbers to mean loop forever. +// (0 means don't loop, 1 means play twice, etc. +// We must convert! //////////////////////////////////////////////////////////////////// void FmodAudioSound:: set_loop_count(unsigned long loop_count) { @@ -308,12 +308,12 @@ set_loop_count(unsigned long loop_count) { if (loop_count == 0) { result = _sound->setLoopCount( -1 ); fmod_audio_errcheck("_sound->setLoopCount()", result); - result =_sound->setMode(FMOD_LOOP_NORMAL); + result =_sound->setMode(FMOD_LOOP_NORMAL); fmod_audio_errcheck("_sound->setMode()", result); } else if (loop_count == 1) { result = _sound->setLoopCount( 1 ); fmod_audio_errcheck("_sound->setLoopCount()", result); - result =_sound->setMode(FMOD_LOOP_OFF); + result =_sound->setMode(FMOD_LOOP_OFF); fmod_audio_errcheck("_sound->setMode()", result); } else { result = _sound->setLoopCount( loop_count ); @@ -327,7 +327,7 @@ set_loop_count(unsigned long loop_count) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::get_loop_count -// Access: public +// Access: Public // Description: Return how many times a sound will loop. //////////////////////////////////////////////////////////////////// unsigned long FmodAudioSound:: @@ -348,7 +348,7 @@ get_loop_count() const { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::set_time -// Access: public +// Access: Public // Description: Sets the time at which the next play() operation will // begin. If we are already playing, skips to that time // immediatey. @@ -366,7 +366,7 @@ set_time(PN_stdfloat start_time) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::get_time -// Access: public +// Access: Public // Description: Gets the play position within the sound //////////////////////////////////////////////////////////////////// PN_stdfloat FmodAudioSound:: @@ -384,13 +384,13 @@ get_time() const { return 0.0f; } fmod_audio_errcheck("_channel->getPosition()", result); - + return ((double)current_time) / 1000.0; } //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::set_volume(PN_stdfloat vol) -// Access: public +// Access: Public // Description: 0.0 to 1.0 scale of volume converted to Fmod's // internal 0.0 to 255.0 scale. //////////////////////////////////////////////////////////////////// @@ -403,7 +403,7 @@ set_volume(PN_stdfloat vol) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::get_volume -// Access: public +// Access: Public // Description: Gets the current volume of a sound. 1 is Max. O is Min. //////////////////////////////////////////////////////////////////// PN_stdfloat FmodAudioSound:: @@ -425,9 +425,9 @@ start_playing() { _paused = true; return; } - + int startTime = (int)(_start_time * 1000); - + if (_channel != 0) { // try backing up current sound. result = _channel->setPosition( startTime , FMOD_TIMEUNIT_MS ); @@ -445,7 +445,7 @@ start_playing() { } } } - + if (_channel == 0) { result = _manager->_system->playSound(FMOD_CHANNEL_FREE, _sound, true, &_channel); fmod_audio_errcheck("_system->playSound()", result); @@ -466,7 +466,7 @@ start_playing() { result = _channel->setPaused(false); fmod_audio_errcheck("_channel->setPaused()", result); - + _self_ref = this; } } @@ -493,7 +493,7 @@ set_volume_on_channel() { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::set_balance(PN_stdfloat bal) -// Access: public +// Access: Public // Description: -1.0 to 1.0 scale //////////////////////////////////////////////////////////////////// void FmodAudioSound:: @@ -505,10 +505,10 @@ set_balance(PN_stdfloat bal) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::get_balance -// Access: public -// Description: -1.0 to 1.0 scale -// -1 should be all the way left. -// 1 is all the way to the right. +// Access: Public +// Description: -1.0 to 1.0 scale +// -1 should be all the way left. +// 1 is all the way to the right. //////////////////////////////////////////////////////////////////// PN_stdfloat FmodAudioSound:: get_balance() const { @@ -517,13 +517,13 @@ get_balance() const { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::set_play_rate(PN_stdfloat rate) -// Access: public +// Access: Public // Description: Sets the speed at which a sound plays back. -// The rate is a multiple of the sound, normal playback speed. -// IE 2 would play back 2 times fast, 3 would play 3 times, and so on. -// This can also be set to a negative number so a sound plays backwards. -// But rememeber if the sound is not playing, you must set the -// sound's time to its end to hear a song play backwards. +// The rate is a multiple of the sound, normal playback speed. +// IE 2 would play back 2 times fast, 3 would play 3 times, and so on. +// This can also be set to a negative number so a sound plays backwards. +// But rememeber if the sound is not playing, you must set the +// sound's time to its end to hear a song play backwards. //////////////////////////////////////////////////////////////////// void FmodAudioSound:: set_play_rate(PN_stdfloat rate) { @@ -534,8 +534,8 @@ set_play_rate(PN_stdfloat rate) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::get_play_rate -// Access: public -// Description: +// Access: Public +// Description: //////////////////////////////////////////////////////////////////// PN_stdfloat FmodAudioSound:: get_play_rate() const { @@ -544,7 +544,7 @@ get_play_rate() const { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::set_play_rate_on_channel() -// Access: public +// Access: Public // Description: Set the play rate on a prepared Sound channel. //////////////////////////////////////////////////////////////////// void FmodAudioSound:: @@ -552,7 +552,7 @@ set_play_rate_on_channel() { ReMutexHolder holder(FmodAudioManager::_lock); FMOD_RESULT result; PN_stdfloat frequency = _sampleFrequency * _playrate; - + if (_channel != 0) { result = _channel->setFrequency( frequency ); if (result == FMOD_ERR_INVALID_HANDLE || result == FMOD_ERR_CHANNEL_STOLEN) { @@ -565,7 +565,7 @@ set_play_rate_on_channel() { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::get_name -// Access: public +// Access: Public // Description: Get name of sound file //////////////////////////////////////////////////////////////////// const string& FmodAudioSound:: @@ -575,9 +575,9 @@ get_name() const { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::length -// Access: public +// Access: Public // Description: Get length -// FMOD returns the time in MS so we have to convert to seconds. +// FMOD returns the time in MS so we have to convert to seconds. //////////////////////////////////////////////////////////////////// PN_stdfloat FmodAudioSound:: length() const { @@ -593,18 +593,18 @@ length() const { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::set_3d_attributes -// Access: public +// Access: Public // Description: Set position and velocity of this sound -// NOW LISTEN UP!!! THIS IS IMPORTANT! -// Both Panda3D and FMOD use a left handed coordinate system. -// But there is a major difference! -// In Panda3D the Y-Axis is going into the Screen and the Z-Axis is going up. -// In FMOD the Y-Axis is going up and the Z-Axis is going into the screen. -// The solution is simple, we just flip the Y and Z axis, as we move coordinates -// from Panda to FMOD and back. -// What does did mean to average Panda user? Nothing, they shouldn't notice anyway. -// But if you decide to do any 3D audio work in here you have to keep it in mind. -// I told you, so you can't say I didn't. +// NOW LISTEN UP!!! THIS IS IMPORTANT! +// Both Panda3D and FMOD use a left handed coordinate system. +// But there is a major difference! +// In Panda3D the Y-Axis is going into the Screen and the Z-Axis is going up. +// In FMOD the Y-Axis is going up and the Z-Axis is going into the screen. +// The solution is simple, we just flip the Y and Z axis, as we move coordinates +// from Panda to FMOD and back. +// What does did mean to average Panda user? Nothing, they shouldn't notice anyway. +// But if you decide to do any 3D audio work in here you have to keep it in mind. +// I told you, so you can't say I didn't. //////////////////////////////////////////////////////////////////// void FmodAudioSound:: set_3d_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx, PN_stdfloat vy, PN_stdfloat vz) { @@ -612,7 +612,7 @@ set_3d_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx _location.x = px; _location.y = pz; _location.z = py; - + _velocity.x = vx; _velocity.y = vz; _velocity.z = vy; @@ -622,8 +622,8 @@ set_3d_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::set_3d_attributes_on_channel -// Access: public -// Description: +// Access: Public +// Description: //////////////////////////////////////////////////////////////////// void FmodAudioSound:: set_3d_attributes_on_channel() { @@ -633,7 +633,7 @@ set_3d_attributes_on_channel() { result = _sound->getMode(&soundMode); fmod_audio_errcheck("_sound->getMode()", result); - + if ((_channel != 0) && (soundMode & FMOD_3D)) { result = _channel->set3DAttributes( &_location, &_velocity ); if (result == FMOD_ERR_INVALID_HANDLE || result == FMOD_ERR_CHANNEL_STOLEN) { @@ -646,9 +646,9 @@ set_3d_attributes_on_channel() { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::get_3d_attributes -// Access: public +// Access: Public // Description: Get position and velocity of this sound -// Currently unimplemented. Get the attributes of the attached object. +// Currently unimplemented. Get the attributes of the attached object. //////////////////////////////////////////////////////////////////// void FmodAudioSound:: get_3d_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat *pz, PN_stdfloat *vx, PN_stdfloat *vy, PN_stdfloat *vz) { @@ -657,7 +657,7 @@ get_3d_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat *pz, PN_stdfloat //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::set_3d_min_distance -// Access: public +// Access: Public // Description: Set the distance that this sound begins to fall off. Also // affects the rate it falls off. //////////////////////////////////////////////////////////////////// @@ -674,7 +674,7 @@ set_3d_min_distance(PN_stdfloat dist) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::get_3d_min_distance -// Access: public +// Access: Public // Description: Get the distance that this sound begins to fall off //////////////////////////////////////////////////////////////////// PN_stdfloat FmodAudioSound:: @@ -684,7 +684,7 @@ get_3d_min_distance() const { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::set_3d_max_distance -// Access: public +// Access: Public // Description: Set the distance that this sound stops falling off //////////////////////////////////////////////////////////////////// void FmodAudioSound:: @@ -700,7 +700,7 @@ set_3d_max_distance(PN_stdfloat dist) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::get_3d_max_distance -// Access: public +// Access: Public // Description: Get the distance that this sound stops falling off //////////////////////////////////////////////////////////////////// PN_stdfloat FmodAudioSound:: @@ -713,11 +713,11 @@ get_3d_max_distance() const { // Access: Published // Description: In Multichannel Speaker systems [like Surround]. // -// Speakers which don't exist in some systems will simply be ignored. -// But I haven't been able to test this yet, so I am jsut letting you know. +// Speakers which don't exist in some systems will simply be ignored. +// But I haven't been able to test this yet, so I am jsut letting you know. // -// BTW This will also work in Stereo speaker systems, but since -// PANDA/FMOD has a balance [pan] function what is the point? +// BTW This will also work in Stereo speaker systems, but since +// PANDA/FMOD has a balance [pan] function what is the point? //////////////////////////////////////////////////////////////////// PN_stdfloat FmodAudioSound:: get_speaker_mix(AudioManager::SpeakerId speaker) { @@ -732,7 +732,7 @@ get_speaker_mix(AudioManager::SpeakerId speaker) { float center; float sub; float backleft; - float backright; + float backright; float sideleft; float sideright; @@ -787,12 +787,12 @@ set_speaker_mix(PN_stdfloat frontleft, PN_stdfloat frontright, PN_stdfloat cente // Function: FmodAudioSound::set_speaker_mix_or_balance_on_channel // Access: Private // Description: This is simply a safety catch. -// If you are using a Stero speaker setup Panda will only pay attention -// to 'set_balance()' command when setting speaker balances. -// Other wise it will use 'set_speaker_mix'. -// I put this in, because other wise you end up with a sitation, -// where 'set_speaker_mix()' or 'set_balace()' will override any -// previous speaker balance setups. It all depends on which was called last. +// If you are using a Stero speaker setup Panda will only pay attention +// to 'set_balance()' command when setting speaker balances. +// Other wise it will use 'set_speaker_mix'. +// I put this in, because other wise you end up with a sitation, +// where 'set_speaker_mix()' or 'set_balace()' will override any +// previous speaker balance setups. It all depends on which was called last. //////////////////////////////////////////////////////////////////// void FmodAudioSound:: set_speaker_mix_or_balance_on_channel() { @@ -814,7 +814,7 @@ set_speaker_mix_or_balance_on_channel() { _mix[AudioManager::SPK_backleft], _mix[AudioManager::SPK_backright], _mix[AudioManager::SPK_sideleft], - _mix[AudioManager::SPK_sideright] + _mix[AudioManager::SPK_sideright] ); } if (result == FMOD_ERR_INVALID_HANDLE || result == FMOD_ERR_CHANNEL_STOLEN) { @@ -829,8 +829,8 @@ set_speaker_mix_or_balance_on_channel() { // Function: FmodAudioSound::get_priority // Access: Published // Description: Sets the priority of a sound. -// This is what FMOD uses to determine is a sound will -// play if all the other real channels have been used up. +// This is what FMOD uses to determine is a sound will +// play if all the other real channels have been used up. //////////////////////////////////////////////////////////////////// int FmodAudioSound:: get_priority() { @@ -842,7 +842,7 @@ get_priority() { // Function: FmodAudioSound::set_priority(int priority) // Access: Published // Description: Sets the Sound Priority [Whether is will be played -// over other sound when real audio channels become short. +// over other sound when real audio channels become short. //////////////////////////////////////////////////////////////////// void FmodAudioSound:: set_priority(int priority) { @@ -860,7 +860,7 @@ set_priority(int priority) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::status -// Access: public +// Access: Public // Description: Get status of the sound. //////////////////////////////////////////////////////////////////// AudioSound::SoundStatus FmodAudioSound:: @@ -883,7 +883,7 @@ status() const { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::set_active -// Access: public +// Access: Public // Description: Sets whether the sound is marked "active". By // default, the active flag true for all sounds. If the // active flag is set to false for any particular sound, @@ -918,8 +918,8 @@ set_active(bool active) { //////////////////////////////////////////////////////////////////// -// Function: FmodAudioSound::get_active -// Access: public +// Function: FmodAudioSound::get_active +// Access: Public // Description: Returns whether the sound has been marked "active". //////////////////////////////////////////////////////////////////// bool FmodAudioSound:: @@ -929,7 +929,7 @@ get_active() const { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::finished -// Access: public +// Access: Public // Description: Not implemented. //////////////////////////////////////////////////////////////////// void FmodAudioSound:: @@ -939,10 +939,10 @@ finished() { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::set_finished_event -// Access: public +// Access: Public // Description: NOT USED ANYMORE!!! -// Assign a string for the finished event to be referenced -// by in python by an accept method +// Assign a string for the finished event to be referenced +// by in python by an accept method // //////////////////////////////////////////////////////////////////// void FmodAudioSound:: @@ -952,11 +952,11 @@ set_finished_event(const string& event) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::get_finished_event -// Access: public +// Access: Public // Description:NOT USED ANYMORE!!! -// Return the string the finished event is referenced by +// Return the string the finished event is referenced by +// // -// //////////////////////////////////////////////////////////////////// const string& FmodAudioSound:: get_finished_event() const { @@ -971,9 +971,9 @@ get_finished_event() const { // reference count of the associated FmodAudioSound. //////////////////////////////////////////////////////////////////// FMOD_RESULT F_CALLBACK FmodAudioSound:: -sound_end_callback(FMOD_CHANNEL * channel, - FMOD_CHANNEL_CALLBACKTYPE type, - void *commanddata1, +sound_end_callback(FMOD_CHANNEL * channel, + FMOD_CHANNEL_CALLBACKTYPE type, + void *commanddata1, void *commanddata2) { // Fortunately, this callback is made synchronously rather than // asynchronously (it is triggered during System::update()), so we @@ -1081,7 +1081,7 @@ read_callback(void *handle, void *buffer, unsigned int size_bytes, return FMOD_OK; } } - + //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::seek_callback // Access: Private, Static diff --git a/panda/src/audiotraits/fmodAudioSound.h b/panda/src/audiotraits/fmodAudioSound.h index 5be8e97b03..774fcaecce 100644 --- a/panda/src/audiotraits/fmodAudioSound.h +++ b/panda/src/audiotraits/fmodAudioSound.h @@ -159,7 +159,7 @@ class EXPCL_FMOD_AUDIO FmodAudioSound : public AudioSound { Filename _file_name; - float _volume; + float _volume; float _balance; float _playrate; int _priority; @@ -203,29 +203,29 @@ class EXPCL_FMOD_AUDIO FmodAudioSound : public AudioSound { PT(FmodAudioSound) _self_ref; static FMOD_RESULT F_CALLBACK - sound_end_callback(FMOD_CHANNEL * channel, - FMOD_CHANNEL_CALLBACKTYPE type, - void *commanddata1, + sound_end_callback(FMOD_CHANNEL * channel, + FMOD_CHANNEL_CALLBACKTYPE type, + void *commanddata1, void *commanddata2); - static FMOD_RESULT F_CALLBACK + static FMOD_RESULT F_CALLBACK open_callback(const char *name, int unicode, unsigned int *file_size, void **handle, void **user_data); - static FMOD_RESULT F_CALLBACK + static FMOD_RESULT F_CALLBACK close_callback(void *handle, void *user_data); - static FMOD_RESULT F_CALLBACK + static FMOD_RESULT F_CALLBACK read_callback(void *handle, void *buffer, unsigned int size_bytes, unsigned int *bytes_read, void *user_data); - - static FMOD_RESULT F_CALLBACK - seek_callback(void *handle, unsigned int pos, void *user_data); - - //////////////////////////////////////////////////////////// + static FMOD_RESULT F_CALLBACK + seek_callback(void *handle, unsigned int pos, void *user_data); + + +//////////////////////////////////////////////////////////////////// //These are needed for Panda's Pointer System. DO NOT ERASE! - //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// public: static TypeHandle get_class_type() { @@ -246,9 +246,9 @@ class EXPCL_FMOD_AUDIO FmodAudioSound : public AudioSound { private: static TypeHandle _type_handle; - //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// //DONE - //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// }; #include "fmodAudioSound.I" diff --git a/panda/src/audiotraits/milesAudioSample.cxx b/panda/src/audiotraits/milesAudioSample.cxx index 1efd7b2720..42245b70b6 100644 --- a/panda/src/audiotraits/milesAudioSample.cxx +++ b/panda/src/audiotraits/milesAudioSample.cxx @@ -37,7 +37,7 @@ TypeHandle MilesAudioSample::_type_handle; // MilesAudioManager. //////////////////////////////////////////////////////////////////// MilesAudioSample:: -MilesAudioSample(MilesAudioManager *manager, MilesAudioManager::SoundData *sd, +MilesAudioSample(MilesAudioManager *manager, MilesAudioManager::SoundData *sd, const string &file_name) : MilesAudioSound(manager, file_name), _sd(sd) @@ -54,7 +54,7 @@ MilesAudioSample(MilesAudioManager *manager, MilesAudioManager::SoundData *sd, //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::Destructor // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// MilesAudioSample:: ~MilesAudioSample() { @@ -66,7 +66,7 @@ MilesAudioSample:: //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::play // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void MilesAudioSample:: play() { @@ -82,12 +82,12 @@ play() { nassertv(_sample == 0); GlobalMilesManager *mgr = GlobalMilesManager::get_global_ptr(); - if (!mgr->get_sample(_sample, _sample_index, this)){ + if (!mgr->get_sample(_sample, _sample_index, this)){ milesAudio_cat.warning() << "Could not play " << _file_name << ": too many open samples\n"; _sample = 0; } else { - AIL_set_named_sample_file(_sample, _sd->_basename.c_str(), + AIL_set_named_sample_file(_sample, _sd->_basename.c_str(), &_sd->_raw_data[0], _sd->_raw_data.size(), 0); _original_playback_rate = AIL_sample_playback_rate(_sample); @@ -105,7 +105,7 @@ play() { AIL_start_sample(_sample); } } - + _got_start_time = false; } } else { @@ -118,7 +118,7 @@ play() { //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::stop // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void MilesAudioSample:: stop() { @@ -136,7 +136,7 @@ stop() { // someone calls play on an inactive sound(). // it fixes audio bug, I don't understand the reasoning of the above comment - _paused = false; + _paused = false; if (_sample != 0) { AIL_end_sample(_sample); @@ -152,7 +152,7 @@ stop() { //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::get_time // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// PN_stdfloat MilesAudioSample:: get_time() const { @@ -173,7 +173,7 @@ get_time() const { //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::set_volume // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void MilesAudioSample:: set_volume(PN_stdfloat volume) { @@ -188,15 +188,15 @@ set_volume(PN_stdfloat volume) { if (_sample != 0) { volume *= _manager->get_volume(); - + // Change to Miles volume, range 0 to 1.0: F32 milesVolume = volume; milesVolume = min(milesVolume, 1.0f); milesVolume = max(milesVolume, 0.0f); - + // Convert balance of -1.0..1.0 to 0-1.0: F32 milesBalance = (F32)((_balance + 1.0f) * 0.5f); - + AIL_set_sample_volume_pan(_sample, milesVolume, milesBalance); } } @@ -204,7 +204,7 @@ set_volume(PN_stdfloat volume) { //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::set_balance // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void MilesAudioSample:: set_balance(PN_stdfloat balance_right) { @@ -218,7 +218,7 @@ set_balance(PN_stdfloat balance_right) { //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::set_play_rate // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void MilesAudioSample:: set_play_rate(PN_stdfloat play_rate) { @@ -240,7 +240,7 @@ set_play_rate(PN_stdfloat play_rate) { //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::length // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// PN_stdfloat MilesAudioSample:: length() const { @@ -250,7 +250,7 @@ length() const { //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::status // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// AudioSound::SoundStatus MilesAudioSample:: status() const { @@ -294,7 +294,7 @@ cleanup() { //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::output // Access: Published, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void MilesAudioSample:: output(ostream &out) const { @@ -306,7 +306,7 @@ output(ostream &out) const { //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::set_3d_attributes -// Access: public +// Access: Public // Description: Set position and velocity of this sound. Note that // Y and Z are switched to translate from Miles's // coordinate system. @@ -324,7 +324,7 @@ void MilesAudioSample::set_3d_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdf //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::get_3d_attributes -// Access: public +// Access: Public // Description: Get position and velocity of this sound. //////////////////////////////////////////////////////////////////// void MilesAudioSample::get_3d_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat *pz, PN_stdfloat *vx, PN_stdfloat *vy, PN_stdfloat *vz) { @@ -347,7 +347,7 @@ void MilesAudioSample::get_3d_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_st //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::set_3d_min_distance -// Access: public +// Access: Public // Description: Set the distance that this sound begins to fall // off. With Miles's default falloff behavior, when // the distance between the sound and the listener is @@ -362,7 +362,7 @@ void MilesAudioSample::set_3d_min_distance(PN_stdfloat dist) { float max_dist; int auto_3D_wet_atten; AIL_sample_3D_distances(_sample, &max_dist, NULL, &auto_3D_wet_atten); - + AIL_set_sample_3D_distances(_sample, max_dist, dist, auto_3D_wet_atten); } else { audio_warning("_sample == 0 in MilesAudioSample::set_3d_min_distance()."); @@ -371,7 +371,7 @@ void MilesAudioSample::set_3d_min_distance(PN_stdfloat dist) { //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::get_3d_min_distance -// Access: public +// Access: Public // Description: Get the distance that this sound begins to fall off. //////////////////////////////////////////////////////////////////// PN_stdfloat MilesAudioSample::get_3d_min_distance() const { @@ -389,7 +389,7 @@ PN_stdfloat MilesAudioSample::get_3d_min_distance() const { //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::set_3d_max_distance -// Access: public +// Access: Public // Description: Set the distance at which this sound is clipped to // silence. Note that this value does not affect // the rate at which the sound falls off, but only @@ -404,7 +404,7 @@ void MilesAudioSample::set_3d_max_distance(PN_stdfloat dist) { float min_dist; int auto_3D_wet_atten; AIL_sample_3D_distances(_sample, NULL, &min_dist, &auto_3D_wet_atten); - + AIL_set_sample_3D_distances(_sample, dist, min_dist, auto_3D_wet_atten); } else { audio_warning("_sample == 0 in MilesAudioSample::set_3d_max_distance()."); @@ -413,7 +413,7 @@ void MilesAudioSample::set_3d_max_distance(PN_stdfloat dist) { //////////////////////////////////////////////////////////////////// // Function: MilesAudioSample::get_3d_max_distance -// Access: public +// Access: Public // Description: Get the distance at which this sound is clipped to // silence. //////////////////////////////////////////////////////////////////// @@ -446,25 +446,25 @@ PN_stdfloat MilesAudioSample::get_3d_max_distance() const { // The order in which speakers appear in the array for // standard speaker setups is defined to be: // -// FRONT_LEFT -// FRONT_RIGHT -// FRONT_CENTER +// FRONT_LEFT +// FRONT_RIGHT +// FRONT_CENTER // LOW_FREQUENCY (sub woofer) -// BACK_LEFT -// BACK_RIGHT -// FRONT_LEFT_OF_CENTER -// FRONT_RIGHT_OF_CENTER -// BACK_CENTER -// SIDE_LEFT -// SIDE_RIGHT -// TOP_CENTER -// TOP_FRONT_LEFT -// TOP_FRONT_CENTER -// TOP_FRONT_RIGHT -// TOP_BACK_LEFT -// TOP_BACK_CENTER -// TOP_BACK_RIGHT -// +// BACK_LEFT +// BACK_RIGHT +// FRONT_LEFT_OF_CENTER +// FRONT_RIGHT_OF_CENTER +// BACK_CENTER +// SIDE_LEFT +// SIDE_RIGHT +// TOP_CENTER +// TOP_FRONT_LEFT +// TOP_FRONT_CENTER +// TOP_FRONT_RIGHT +// TOP_BACK_LEFT +// TOP_BACK_CENTER +// TOP_BACK_RIGHT +// //////////////////////////////////////////////////////////////////// PN_stdfloat MilesAudioSample:: get_speaker_level(int index) { @@ -505,25 +505,25 @@ get_speaker_level(int index) { // The order in which speakers appear in the array for // standard speaker setups is defined to be: // -// FRONT_LEFT -// FRONT_RIGHT -// FRONT_CENTER +// FRONT_LEFT +// FRONT_RIGHT +// FRONT_CENTER // LOW_FREQUENCY (sub woofer) -// BACK_LEFT -// BACK_RIGHT -// FRONT_LEFT_OF_CENTER -// FRONT_RIGHT_OF_CENTER -// BACK_CENTER -// SIDE_LEFT -// SIDE_RIGHT -// TOP_CENTER -// TOP_FRONT_LEFT -// TOP_FRONT_CENTER -// TOP_FRONT_RIGHT -// TOP_BACK_LEFT -// TOP_BACK_CENTER -// TOP_BACK_RIGHT -// +// BACK_LEFT +// BACK_RIGHT +// FRONT_LEFT_OF_CENTER +// FRONT_RIGHT_OF_CENTER +// BACK_CENTER +// SIDE_LEFT +// SIDE_RIGHT +// TOP_CENTER +// TOP_FRONT_LEFT +// TOP_FRONT_CENTER +// TOP_FRONT_RIGHT +// TOP_BACK_LEFT +// TOP_BACK_CENTER +// TOP_BACK_RIGHT +// //////////////////////////////////////////////////////////////////// void MilesAudioSample:: set_speaker_levels(PN_stdfloat level1, PN_stdfloat level2, PN_stdfloat level3, PN_stdfloat level4, PN_stdfloat level5, PN_stdfloat level6, PN_stdfloat level7, PN_stdfloat level8, PN_stdfloat level9) { @@ -604,11 +604,11 @@ do_set_time(PN_stdfloat time) { PN_stdfloat max_time = length(); if (time > max_time) { milesAudio_cat.warning() - << "set_time(" << time << ") requested for sound of length " + << "set_time(" << time << ") requested for sound of length " << max_time << "\n"; time = max_time; } - + S32 time_ms = (S32)(1000.0f * time); AIL_set_sample_ms_position(_sample, time_ms); } diff --git a/panda/src/audiotraits/openalAudioManager.cxx b/panda/src/audiotraits/openalAudioManager.cxx index b5138a345b..0ef5eface0 100644 --- a/panda/src/audiotraits/openalAudioManager.cxx +++ b/panda/src/audiotraits/openalAudioManager.cxx @@ -83,7 +83,7 @@ AudioManager *Create_OpenALAudioManager() { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// OpenALAudioManager:: OpenALAudioManager() { @@ -204,7 +204,7 @@ OpenALAudioManager() { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::Destructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// OpenALAudioManager:: ~OpenALAudioManager() { @@ -330,8 +330,8 @@ select_audio_device() { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::make_current // Access: Private -// Description: This makes this manager's OpenAL context the -// current context. Needed before any parameter sets. +// Description: This makes this manager's OpenAL context the +// current context. Needed before any parameter sets. //////////////////////////////////////////////////////////////////// void OpenALAudioManager:: make_current() const { @@ -406,10 +406,10 @@ OpenALAudioManager::SoundData *OpenALAudioManager:: get_sound_data(MovieAudio *movie, int mode) { ReMutexHolder holder(_lock); const Filename &path = movie->get_filename(); - + // Search for an already-cached sample or an already-opened stream. if (!path.empty()) { - + if (mode != SM_stream) { SampleCache::iterator lsmi=_sample_cache.find(path); if (lsmi != _sample_cache.end()) { @@ -430,18 +430,18 @@ get_sound_data(MovieAudio *movie, int mode) { } } } - + PT(MovieAudioCursor) stream = movie->open(); if (stream == 0) { audio_error("Cannot open file: "<_client_count = 1; sd->_manager = this; @@ -484,7 +484,7 @@ get_sound_data(MovieAudio *movie, int mode) { audio_debug(path.get_basename() << ": loading as stream"); sd->_stream = stream; } - + return sd; } @@ -499,9 +499,9 @@ get_sound(MovieAudio *sound, bool positional, int mode) { if(!is_valid()) { return get_null_sound(); } - PT(OpenALAudioSound) oas = + PT(OpenALAudioSound) oas = new OpenALAudioSound(this, sound, positional, mode); - + _all_sounds.insert(oas); PT(AudioSound) res = (AudioSound*)(OpenALAudioSound*)oas; return res; @@ -518,21 +518,21 @@ get_sound(const string &file_name, bool positional, int mode) { if(!is_valid()) { return get_null_sound(); } - + Filename path = file_name; VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); vfs->resolve_filename(path, get_model_path()); - + if (path.empty()) { audio_error("get_sound - invalid filename"); return NULL; } PT(MovieAudio) mva = MovieAudio::get(path); - - PT(OpenALAudioSound) oas = + + PT(OpenALAudioSound) oas = new OpenALAudioSound(this, mva, positional, mode); - + _all_sounds.insert(oas); PT(AudioSound) res = (AudioSound*)(OpenALAudioSound*)oas; return res; @@ -550,7 +550,7 @@ uncache_sound(const string& file_name) { ReMutexHolder holder(_lock); assert(is_valid()); Filename path = file_name; - + VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); vfs->resolve_filename(path, get_model_path()); @@ -615,8 +615,8 @@ release_sound(OpenALAudioSound* audioSound) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::set_volume(PN_stdfloat volume) // Access: Public -// Description: -// Sets listener gain +// Description: +// Sets listener gain //////////////////////////////////////////////////////////////////// void OpenALAudioManager::set_volume(PN_stdfloat volume) { ReMutexHolder holder(_lock); @@ -629,7 +629,7 @@ void OpenALAudioManager::set_volume(PN_stdfloat volume) { (**i).set_volume((**i).get_volume()); } - /* + /* // this was neat alternative to the above look // when we had a seperate context for each manager make_current(); @@ -643,8 +643,8 @@ void OpenALAudioManager::set_volume(PN_stdfloat volume) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::get_volume() // Access: Public -// Description: -// Gets listener gain +// Description: +// Gets listener gain //////////////////////////////////////////////////////////////////// PN_stdfloat OpenALAudioManager:: get_volume() const { @@ -701,7 +701,7 @@ set_active(bool active) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::get_active() // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// bool OpenALAudioManager:: get_active() const { @@ -712,23 +712,23 @@ get_active() const { // Function: OpenALAudioManager::audio_3d_set_listener_attributes // Access: Public // Description: Set position of the "ear" that picks up 3d sounds -// NOW LISTEN UP!!! THIS IS IMPORTANT! -// Both Panda3D and OpenAL use a right handed coordinate system. -// But there is a major difference! -// In Panda3D the Y-Axis is going into the Screen and the Z-Axis is going up. -// In OpenAL the Y-Axis is going up and the Z-Axis is coming out of the screen. -// The solution is simple, we just flip the Y and Z axis and negate the Z, as we move coordinates -// from Panda to OpenAL and back. -// What does did mean to average Panda user? Nothing, they shouldn't notice anyway. -// But if you decide to do any 3D audio work in here you have to keep it in mind. -// I told you, so you can't say I didn't. +// NOW LISTEN UP!!! THIS IS IMPORTANT! +// Both Panda3D and OpenAL use a right handed coordinate system. +// But there is a major difference! +// In Panda3D the Y-Axis is going into the Screen and the Z-Axis is going up. +// In OpenAL the Y-Axis is going up and the Z-Axis is coming out of the screen. +// The solution is simple, we just flip the Y and Z axis and negate the Z, as we move coordinates +// from Panda to OpenAL and back. +// What does did mean to average Panda user? Nothing, they shouldn't notice anyway. +// But if you decide to do any 3D audio work in here you have to keep it in mind. +// I told you, so you can't say I didn't. //////////////////////////////////////////////////////////////////// void OpenALAudioManager:: audio_3d_set_listener_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx, PN_stdfloat vy, PN_stdfloat vz, PN_stdfloat fx, PN_stdfloat fy, PN_stdfloat fz, PN_stdfloat ux, PN_stdfloat uy, PN_stdfloat uz) { ReMutexHolder holder(_lock); _position[0] = px; _position[1] = pz; - _position[2] = -py; + _position[2] = -py; _velocity[0] = vx; _velocity[1] = vz; @@ -741,8 +741,8 @@ audio_3d_set_listener_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, _forward_up[3] = ux; _forward_up[4] = uz; _forward_up[5] = -uy; - - + + make_current(); alGetError(); // clear errors @@ -773,7 +773,7 @@ audio_3d_get_listener_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat * *fx = _forward_up[0]; *fy = -_forward_up[2]; *fz = _forward_up[1]; - + *ux = _forward_up[3]; *uy = -_forward_up[5]; *uz = _forward_up[4]; @@ -830,7 +830,7 @@ audio_3d_get_distance_factor() const { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::audio_3d_set_doppler_factor // Access: Public -// Description: Exaggerates or diminishes the Doppler effect. +// Description: Exaggerates or diminishes the Doppler effect. // Defaults to 1.0 //////////////////////////////////////////////////////////////////// void OpenALAudioManager:: @@ -839,7 +839,7 @@ audio_3d_set_doppler_factor(PN_stdfloat factor) { _doppler_factor = factor; make_current(); - + alGetError(); // clear errors alDopplerFactor(_doppler_factor); al_audio_errcheck("alDopplerFactor()"); @@ -848,7 +848,7 @@ audio_3d_set_doppler_factor(PN_stdfloat factor) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::audio_3d_get_doppler_factor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// PN_stdfloat OpenALAudioManager:: audio_3d_get_doppler_factor() const { @@ -875,7 +875,7 @@ audio_3d_set_drop_off_factor(PN_stdfloat factor) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::audio_3d_get_drop_off_factor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// PN_stdfloat OpenALAudioManager:: audio_3d_get_drop_off_factor() const { @@ -884,7 +884,7 @@ audio_3d_get_drop_off_factor() const { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::starting_sound -// Access: +// Access: // Description: Inform the manager that a sound is about to play. // The manager will add this sound to the table of // sounds that are playing, and will allocate a source @@ -894,7 +894,7 @@ void OpenALAudioManager:: starting_sound(OpenALAudioSound* audio) { ReMutexHolder holder(_lock); ALuint source=0; - + // If the sound already has a source, we don't need to do anything. if (audio->_source) { return; @@ -906,7 +906,7 @@ starting_sound(OpenALAudioSound* audio) { if (_concurrent_sound_limit) { reduce_sounds_playing_to(_concurrent_sound_limit-1); // because we're about to add one } - + // get a source from the source pool or create a new source if (_al_sources->empty()) { make_current(); @@ -927,15 +927,15 @@ starting_sound(OpenALAudioSound* audio) { } audio->_source = source; - + if (source) _sounds_playing.insert(audio); } //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::stopping_sound -// Access: -// Description: Inform the manager that a sound is finished or +// Access: +// Description: Inform the manager that a sound is finished or // someone called stop on the sound (this should not // be called if a sound is only paused). //////////////////////////////////////////////////////////////////// @@ -952,7 +952,7 @@ stopping_sound(OpenALAudioSound* audio) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::set_concurrent_sound_limit // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void OpenALAudioManager:: set_concurrent_sound_limit(unsigned int limit) { @@ -964,7 +964,7 @@ set_concurrent_sound_limit(unsigned int limit) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::get_concurrent_sound_limit // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// unsigned int OpenALAudioManager:: get_concurrent_sound_limit() const { @@ -974,7 +974,7 @@ get_concurrent_sound_limit() const { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::reduce_sounds_playing_to // Access: Private -// Description: +// Description: //////////////////////////////////////////////////////////////////// void OpenALAudioManager:: reduce_sounds_playing_to(unsigned int count) { @@ -987,7 +987,7 @@ reduce_sounds_playing_to(unsigned int count) { SoundsPlaying::iterator sound = _sounds_playing.begin(); assert(sound != _sounds_playing.end()); // When the user stops a sound, there is still a PT in the - // user's hand. When we stop a sound here, however, + // user's hand. When we stop a sound here, however, // this can remove the last PT. This can cause an ugly // recursion where stop calls the destructor, and the // destructor calls stop. To avoid this, we create @@ -1019,7 +1019,7 @@ update() { // See if any of our playing sounds have ended // we must first collect a seperate list of finished sounds and then - // iterated over those again calling their finished method. We + // iterated over those again calling their finished method. We // can't call finished() within a loop iterating over _sounds_playing // since finished() modifies _sounds_playing SoundsPlaying sounds_finished; @@ -1038,7 +1038,7 @@ update() { sounds_finished.insert(*i); } } - + i=sounds_finished.begin(); for (; i!=sounds_finished.end(); ++i) { (**i).finished(); @@ -1061,15 +1061,15 @@ cleanup() { } stop_all_sounds(); - + AllSounds sounds(_all_sounds); AllSounds::iterator ai; for (ai = sounds.begin(); ai != sounds.end(); ++ai) { (*ai)->cleanup(); } - + clear_cache(); - + nassertv(_active_managers > 0); --_active_managers; @@ -1093,7 +1093,7 @@ cleanup() { alcGetError(_device); // clear errors alcMakeContextCurrent(NULL); alc_audio_errcheck("alcMakeContextCurrent(NULL)",_device); - + alcDestroyContext(_context); alc_audio_errcheck("alcDestroyContext(_context)",_device); _context = NULL; @@ -1115,7 +1115,7 @@ cleanup() { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::SoundData::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// OpenALAudioManager::SoundData:: SoundData() : @@ -1133,7 +1133,7 @@ SoundData() : //////////////////////////////////////////////////////////////////// // Function: OpenALAudioManager::SoundData::Destructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// OpenALAudioManager::SoundData:: ~SoundData() { diff --git a/panda/src/audiotraits/openalAudioManager.h b/panda/src/audiotraits/openalAudioManager.h index 3923f43a2e..25d49605c7 100644 --- a/panda/src/audiotraits/openalAudioManager.h +++ b/panda/src/audiotraits/openalAudioManager.h @@ -217,9 +217,9 @@ private: ALfloat _velocity[3]; ALfloat _forward_up[6]; - //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// //These are needed for Panda's Pointer System. DO NOT ERASE! - //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// public: static TypeHandle get_class_type() { @@ -240,9 +240,9 @@ private: private: static TypeHandle _type_handle; - //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// //DONE - //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// }; diff --git a/panda/src/audiotraits/openalAudioSound.I b/panda/src/audiotraits/openalAudioSound.I index b04dc99137..f2d9649917 100644 --- a/panda/src/audiotraits/openalAudioSound.I +++ b/panda/src/audiotraits/openalAudioSound.I @@ -14,7 +14,7 @@ //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::set_calibrated_clock -// Access: public +// Access: Public // Description: Sets the sound's calibrated clock. // // OpenAL is not very accurate at reporting how much @@ -36,7 +36,7 @@ set_calibrated_clock(double rtc, double t, double accel) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::get_calibrated_clock -// Access: public +// Access: Public // Description: Returns the value of the calibrated clock. //////////////////////////////////////////////////////////////////// INLINE double OpenALAudioSound:: diff --git a/panda/src/audiotraits/openalAudioSound.cxx b/panda/src/audiotraits/openalAudioSound.cxx index ac8be7715d..e620a65718 100644 --- a/panda/src/audiotraits/openalAudioSound.cxx +++ b/panda/src/audiotraits/openalAudioSound.cxx @@ -91,7 +91,7 @@ OpenALAudioSound(OpenALAudioManager* manager, //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::Destructor -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// OpenALAudioSound:: @@ -124,7 +124,7 @@ cleanup() { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::play -// Access: public +// Access: Public // Description: Plays a sound. //////////////////////////////////////////////////////////////////// void OpenALAudioSound:: @@ -199,7 +199,7 @@ play() { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::stop -// Access: public +// Access: Public // Description: Stop a sound //////////////////////////////////////////////////////////////////// void OpenALAudioSound:: @@ -246,7 +246,7 @@ finished() { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::set_loop -// Access: public +// Access: Public // Description: Turns looping on and off //////////////////////////////////////////////////////////////////// void OpenALAudioSound:: @@ -257,7 +257,7 @@ set_loop(bool loop) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::get_loop -// Access: public +// Access: Public // Description: Returns whether looping is on or off //////////////////////////////////////////////////////////////////// bool OpenALAudioSound:: @@ -267,7 +267,7 @@ get_loop() const { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::set_loop_count -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// void OpenALAudioSound:: @@ -283,7 +283,7 @@ set_loop_count(unsigned long loop_count) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::get_loop_count -// Access: public +// Access: Public // Description: Return how many times a sound will loop. //////////////////////////////////////////////////////////////////// unsigned long OpenALAudioSound:: @@ -293,7 +293,7 @@ get_loop_count() const { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::restart_stalled_audio -// Access: public +// Access: Public // Description: When streaming audio, the computer is supposed to // keep OpenAL's queue full. However, there are times // when the computer is running slow and the queue @@ -318,7 +318,7 @@ restart_stalled_audio() { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::queue_buffer -// Access: public +// Access: Public // Description: Pushes a buffer into the source queue. //////////////////////////////////////////////////////////////////// void OpenALAudioSound:: @@ -343,7 +343,7 @@ queue_buffer(ALuint buffer, int samples, int loop_index, double time_offset) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::make_buffer -// Access: public +// Access: Public // Description: Creates an OpenAL buffer object. //////////////////////////////////////////////////////////////////// ALuint OpenALAudioSound:: @@ -376,7 +376,7 @@ make_buffer(int samples, int channels, int rate, unsigned char *data) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::read_stream_data -// Access: public +// Access: Public // Description: Fills a buffer with data from the stream. // Returns the number of samples stored in the buffer. //////////////////////////////////////////////////////////////////// @@ -427,7 +427,7 @@ read_stream_data(int bytelen, unsigned char *buffer) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::correct_calibrated_clock -// Access: public +// Access: Public // Description: Compares the specified time to the value of the // calibrated clock, and adjusts the calibrated // clock speed to make it closer to the target value. @@ -465,7 +465,7 @@ correct_calibrated_clock(double rtc, double t) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::pull_used_buffers -// Access: public +// Access: Public // Description: Pulls any used buffers out of OpenAL's queue. //////////////////////////////////////////////////////////////////// void OpenALAudioSound:: @@ -499,7 +499,7 @@ pull_used_buffers() { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::push_fresh_buffers -// Access: public +// Access: Public // Description: Pushes fresh buffers into OpenAL's queue until // the queue is "full" (ie, has plenty of data). //////////////////////////////////////////////////////////////////// @@ -543,7 +543,7 @@ push_fresh_buffers() { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::set_time -// Access: public +// Access: Public // Description: The next time you call play, the sound will // start from the specified offset. //////////////////////////////////////////////////////////////////// @@ -555,7 +555,7 @@ set_time(PN_stdfloat time) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::get_time -// Access: public +// Access: Public // Description: Gets the play position within the sound //////////////////////////////////////////////////////////////////// PN_stdfloat OpenALAudioSound:: @@ -587,7 +587,7 @@ cache_time(double rtc) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::set_volume(PN_stdfloat vol) -// Access: public +// Access: Public // Description: 0.0 to 1.0 scale of volume converted to Fmod's // internal 0.0 to 255.0 scale. //////////////////////////////////////////////////////////////////// @@ -607,7 +607,7 @@ set_volume(PN_stdfloat volume) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::get_volume -// Access: public +// Access: Public // Description: Gets the current volume of a sound. 1 is Max. O is Min. //////////////////////////////////////////////////////////////////// PN_stdfloat OpenALAudioSound:: @@ -617,7 +617,7 @@ get_volume() const { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::set_balance(PN_stdfloat bal) -// Access: public +// Access: Public // Description: -1.0 to 1.0 scale //////////////////////////////////////////////////////////////////// void OpenALAudioSound:: @@ -627,10 +627,10 @@ set_balance(PN_stdfloat balance_right) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::get_balance -// Access: public +// Access: Public // Description: -1.0 to 1.0 scale -// -1 should be all the way left. -// 1 is all the way to the right. +// -1 should be all the way left. +// 1 is all the way to the right. //////////////////////////////////////////////////////////////////// PN_stdfloat OpenALAudioSound:: get_balance() const { @@ -640,10 +640,10 @@ get_balance() const { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::set_play_rate(PN_stdfloat rate) -// Access: public +// Access: Public // Description: Sets the speed at which a sound plays back. -// The rate is a multiple of the sound, normal playback speed. -// IE 2 would play back 2 times fast, 3 would play 3 times, and so on. +// The rate is a multiple of the sound, normal playback speed. +// IE 2 would play back 2 times fast, 3 would play 3 times, and so on. //////////////////////////////////////////////////////////////////// void OpenALAudioSound:: set_play_rate(PN_stdfloat play_rate) { @@ -656,7 +656,7 @@ set_play_rate(PN_stdfloat play_rate) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::get_play_rate -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// PN_stdfloat OpenALAudioSound:: @@ -666,7 +666,7 @@ get_play_rate() const { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::length -// Access: public +// Access: Public // Description: Get length //////////////////////////////////////////////////////////////////// PN_stdfloat OpenALAudioSound:: @@ -676,7 +676,7 @@ length() const { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::set_3d_attributes -// Access: public +// Access: Public // Description: Set position and velocity of this sound // // Both Panda3D and OpenAL use a right handed @@ -714,9 +714,9 @@ set_3d_attributes(PN_stdfloat px, PN_stdfloat py, PN_stdfloat pz, PN_stdfloat vx //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::get_3d_attributes -// Access: public +// Access: Public // Description: Get position and velocity of this sound -// Currently unimplemented. Get the attributes of the attached object. +// Currently unimplemented. Get the attributes of the attached object. //////////////////////////////////////////////////////////////////// void OpenALAudioSound:: get_3d_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat *pz, PN_stdfloat *vx, PN_stdfloat *vy, PN_stdfloat *vz) { @@ -732,7 +732,7 @@ get_3d_attributes(PN_stdfloat *px, PN_stdfloat *py, PN_stdfloat *pz, PN_stdfloat //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::set_3d_min_distance -// Access: public +// Access: Public // Description: Set the distance that this sound begins to fall off. Also // affects the rate it falls off. //////////////////////////////////////////////////////////////////// @@ -752,7 +752,7 @@ set_3d_min_distance(PN_stdfloat dist) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::get_3d_min_distance -// Access: public +// Access: Public // Description: Get the distance that this sound begins to fall off //////////////////////////////////////////////////////////////////// PN_stdfloat OpenALAudioSound:: @@ -762,7 +762,7 @@ get_3d_min_distance() const { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::set_3d_max_distance -// Access: public +// Access: Public // Description: Set the distance that this sound stops falling off //////////////////////////////////////////////////////////////////// void OpenALAudioSound:: @@ -781,7 +781,7 @@ set_3d_max_distance(PN_stdfloat dist) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::get_3d_max_distance -// Access: public +// Access: Public // Description: Get the distance that this sound stops falling off //////////////////////////////////////////////////////////////////// PN_stdfloat OpenALAudioSound:: @@ -791,7 +791,7 @@ get_3d_max_distance() const { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::set_3d_drop_off_factor -// Access: public +// Access: Public // Description: Control the effect distance has on audability. // Defaults to 1.0 //////////////////////////////////////////////////////////////////// @@ -811,7 +811,7 @@ set_3d_drop_off_factor(PN_stdfloat factor) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::get_3d_drop_off_factor -// Access: public +// Access: Public // Description: Control the effect distance has on audability. // Defaults to 1.0 //////////////////////////////////////////////////////////////////// @@ -822,7 +822,7 @@ get_3d_drop_off_factor() const { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::set_active -// Access: public +// Access: Public // Description: Sets whether the sound is marked "active". By // default, the active flag true for all sounds. If the // active flag is set to false for any particular sound, @@ -856,7 +856,7 @@ set_active(bool active) { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::get_active -// Access: public +// Access: Public // Description: Returns whether the sound has been marked "active". //////////////////////////////////////////////////////////////////// bool OpenALAudioSound:: @@ -886,7 +886,7 @@ get_finished_event() const { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::get_name -// Access: public +// Access: Public // Description: Get name of sound file //////////////////////////////////////////////////////////////////// const string& OpenALAudioSound:: @@ -896,7 +896,7 @@ get_name() const { //////////////////////////////////////////////////////////////////// // Function: OpenALAudioSound::status -// Access: public +// Access: Public // Description: Get status of the sound. // // This returns the status as of the diff --git a/panda/src/audiotraits/openalAudioSound.h b/panda/src/audiotraits/openalAudioSound.h index 7a18db21d4..e3cdcdc304 100644 --- a/panda/src/audiotraits/openalAudioSound.h +++ b/panda/src/audiotraits/openalAudioSound.h @@ -113,7 +113,7 @@ public: void finished(); private: - OpenALAudioSound(OpenALAudioManager* manager, + OpenALAudioSound(OpenALAudioManager* manager, MovieAudio *movie, bool positional, int mode); @@ -202,7 +202,7 @@ private: bool _active; bool _paused; - public: +public: static TypeHandle get_class_type() { return _type_handle; } @@ -218,12 +218,8 @@ private: return get_class_type(); } - private: +private: static TypeHandle _type_handle; - - //////////////////////////////////////////////////////////// - //DONE - //////////////////////////////////////////////////////////// }; #include "openalAudioSound.I" diff --git a/panda/src/awesomium/AwMouseAndKeyboard.h b/panda/src/awesomium/AwMouseAndKeyboard.h index a66e42f9f4..9a02fd18c2 100644 --- a/panda/src/awesomium/AwMouseAndKeyboard.h +++ b/panda/src/awesomium/AwMouseAndKeyboard.h @@ -1,4 +1,4 @@ -// Filename: awWebCore.h +// Filename: AwMouseAndKeyboard.h // Created by: rurbino (12Oct09) // //////////////////////////////////////////////////////////////////// @@ -27,7 +27,7 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDAAWESOMIUM AwMouseAndKeyboard : public DataNode { //member data data -protected: +protected: // inputs adn output indices... initialized in constructor int _button_events_input; int _button_events_output; diff --git a/panda/src/awesomium/awWebView.h b/panda/src/awesomium/awWebView.h index a2b5568c90..dd48d1bbb9 100644 --- a/panda/src/awesomium/awWebView.h +++ b/panda/src/awesomium/awWebView.h @@ -1,4 +1,4 @@ -// Filename: awWebCore.h +// Filename: awWebView.h // Created by: rurbino (12Oct09) // //////////////////////////////////////////////////////////////////// @@ -30,7 +30,7 @@ class EXPCL_PANDAAWESOMIUM AwWebView : public TypedReferenceCount{ PUBLISHED: /** - * Mouse button enumerations, used with WebView::injectMouseDown + * Mouse button enumerations, used with WebView::injectMouseDown * and WebView::injectMouseUp */ enum MouseButton { @@ -44,7 +44,7 @@ PUBLISHED: */ struct Rect { int x, y, width, height; - + Rect(); Rect(int x, int y, int width, int height); bool isEmpty() const; @@ -53,24 +53,24 @@ PUBLISHED: PUBLISHED: AwWebView(Awesomium::WebView * webView); - + virtual ~AwWebView(); - + INLINE void destroy(void); - + INLINE void setListener(Awesomium::WebViewListener * listener); INLINE Awesomium::WebViewListener* getListener(); - + // VC7 linker doesn't like wstring from VS2008, hence using the all regular string version void loadURL2(const string& url, const string& frameName ="", const string& username="" , const string& password=""); - + // VC7 linker doesn't like wstring from VS2008, hence using the all regular string version void loadHTML2(const std::string& html, const std::string& frameName = ""); - + // VC7 linker doesn't like wstring from VS2008, hence using the all regular string version void loadFile2(const std::string& file, const std::string& frameName = "" ); - + INLINE void goToHistoryOffset(int offset); // VC7 linker doesn't like wstring from VS2008, hence using the all regular string version @@ -101,7 +101,7 @@ PUBLISHED: } INLINE void injectKeyEvent(bool press, int modifiers, int windowsCode, int nativeCode=0); - + private: Awesomium::WebView * _myWebView; diff --git a/panda/src/awesomium/awWebViewListener.cxx b/panda/src/awesomium/awWebViewListener.cxx index 42ad5fa969..9f0456af99 100644 --- a/panda/src/awesomium/awWebViewListener.cxx +++ b/panda/src/awesomium/awWebViewListener.cxx @@ -1,4 +1,4 @@ -// Filename: awWebView.cxx +// Filename: awWebViewListener.cxx // Created by: rurbino (12Oct09) // //////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ TypeHandle AwWebViewListener::_type_handle; AwWebViewListener:: -AwWebViewListener() { +AwWebViewListener() { awesomium_cat.info() << "constructing WebViewListner" ; } @@ -44,7 +44,7 @@ void AwWebViewListener::onFinishLoading() { */ void AwWebViewListener::onCallback(const std::string& name, const Awesomium::JSArguments& args) { } - + /** * This event is fired when a page title is received. * @@ -72,7 +72,7 @@ void AwWebViewListener::onChangeKeyboardFocus(bool isFocused) { } /** - * This event is fired when the target URL has changed. This is usually the result of + * This event is fired when the target URL has changed. This is usually the result of * hovering over a link on the page. * * @param url The updated target URL (or empty if the target URL is cleared). diff --git a/panda/src/bullet/bulletBaseCharacterControllerNode.cxx b/panda/src/bullet/bulletBaseCharacterControllerNode.cxx index d226bd89fd..b2dfbf8a1c 100644 --- a/panda/src/bullet/bulletBaseCharacterControllerNode.cxx +++ b/panda/src/bullet/bulletBaseCharacterControllerNode.cxx @@ -30,9 +30,9 @@ BulletBaseCharacterControllerNode(const char *name) : PandaNode(name) { //////////////////////////////////////////////////////////////////// // Function: BulletBaseCharacterControllerNode::get_legal_collide_mask -// Access: Public, virtual +// Access: Public, Virtual // Description: Returns the subset of CollideMask bits that may be -// set for this particular type of PandaNode. For +// set for this particular type of PandaNode. For // CharacterControllerNodes this returns all bits on. //////////////////////////////////////////////////////////////////// CollideMask BulletBaseCharacterControllerNode:: diff --git a/panda/src/bullet/bulletBodyNode.cxx b/panda/src/bullet/bulletBodyNode.cxx index e159e81e90..12e6bb96cd 100644 --- a/panda/src/bullet/bulletBodyNode.cxx +++ b/panda/src/bullet/bulletBodyNode.cxx @@ -41,9 +41,9 @@ BulletBodyNode(const char *name) : PandaNode(name) { //////////////////////////////////////////////////////////////////// // Function: BulletBodyNode::get_legal_collide_mask -// Access: Public, virtual +// Access: Public, Virtual // Description: Returns the subset of CollideMask bits that may be -// set for this particular type of PandaNode. For +// set for this particular type of PandaNode. For // BodyNodes this returns all bits on. //////////////////////////////////////////////////////////////////// CollideMask BulletBodyNode:: @@ -146,7 +146,7 @@ safe_to_flatten_below() const { //////////////////////////////////////////////////////////////////// // Function: BulletBodyNode::output // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void BulletBodyNode:: output(ostream &out) const { @@ -201,7 +201,7 @@ add_shape(BulletShape *bullet_shape, const TransformState *ts) { next = shape; } else { - // After adding the shape we will have a total of one shape, without + // After adding the shape we will have a total of one shape, without // local transform. We can set the shape directly. next = new btCompoundShape(); ((btCompoundShape *)next)->addChildShape(trans, shape); @@ -297,7 +297,7 @@ remove_shape(BulletShape *shape) { nassertv(compound->getNumChildShapes() == 1); - // The compound is no longer required if the remaining shape + // The compound is no longer required if the remaining shape // has no transform btTransform trans = compound->getChildTransform(0); if (is_identity(trans)) { @@ -332,7 +332,7 @@ is_identity(btTransform &trans) { btVector3 null(0, 0, 0); - return (trans.getOrigin() == null + return (trans.getOrigin() == null && trans.getRotation().getAxis() == null); } @@ -685,8 +685,8 @@ add_shapes_from_collision_solids(CollisionNode *cnode) { // Description: This method enforces an update of the Bullet // transform, that is copies the scene graph transform // to the Bullet transform. -// This is achieved by alling the protected PandaNode -// hook 'transform_changed'. +// This is achieved by alling the protected PandaNode +// hook 'transform_changed'. //////////////////////////////////////////////////////////////////// void BulletBodyNode:: set_transform_dirty() { diff --git a/panda/src/bullet/bulletContactCallbacks.h b/panda/src/bullet/bulletContactCallbacks.h index 0f6150c965..6d31543916 100644 --- a/panda/src/bullet/bulletContactCallbacks.h +++ b/panda/src/bullet/bulletContactCallbacks.h @@ -34,7 +34,7 @@ struct UserPersitentData { //////////////////////////////////////////////////////////////////// // Function: contact_added_callback -// Description: +// Description: //////////////////////////////////////////////////////////////////// static bool contact_added_callback(btManifoldPoint &cp, @@ -97,7 +97,7 @@ contact_added_callback(btManifoldPoint &cp, //////////////////////////////////////////////////////////////////// // Function: contact_processed_callback -// Description: +// Description: //////////////////////////////////////////////////////////////////// static bool contact_processed_callback(btManifoldPoint &cp, @@ -123,7 +123,7 @@ contact_processed_callback(btManifoldPoint &cp, //////////////////////////////////////////////////////////////////// // Function: contact_destroyed_callback -// Description: +// Description: //////////////////////////////////////////////////////////////////// static bool contact_destroyed_callback(void *userPersistentData) { diff --git a/panda/src/bullet/bulletWorld.cxx b/panda/src/bullet/bulletWorld.cxx index bee0b72f39..0951ef6115 100644 --- a/panda/src/bullet/bulletWorld.cxx +++ b/panda/src/bullet/bulletWorld.cxx @@ -210,7 +210,7 @@ do_physics(PN_stdfloat dt, int max_substeps, PN_stdfloat stepsize) { //////////////////////////////////////////////////////////////////// // Function: BulletWorld::sync_p2b // Access: Private -// Description: +// Description: //////////////////////////////////////////////////////////////////// void BulletWorld:: sync_p2b(PN_stdfloat dt, int num_substeps) { @@ -235,7 +235,7 @@ sync_p2b(PN_stdfloat dt, int num_substeps) { //////////////////////////////////////////////////////////////////// // Function: BulletWorld::sync_b2p // Access: Private -// Description: +// Description: //////////////////////////////////////////////////////////////////// void BulletWorld:: sync_b2p() { @@ -444,15 +444,15 @@ attach_ghost(BulletGhostNode *node) { // TODO group/filter settings... /* -enum CollisionFilterGroups { - DefaultFilter = 1, - StaticFilter = 2, - KinematicFilter = 4, - DebrisFilter = 8, - SensorTrigger = 16, - CharacterFilter = 32, - AllFilter = -1 -} +enum CollisionFilterGroups { + DefaultFilter = 1, + StaticFilter = 2, + KinematicFilter = 4, + DebrisFilter = 8, + SensorTrigger = 16, + CharacterFilter = 32, + AllFilter = -1 +} */ short group = btBroadphaseProxy::SensorTrigger; @@ -518,7 +518,7 @@ attach_character(BulletBaseCharacterControllerNode *node) { if (found == _characters.end()) { _characters.push_back(node); - + _world->addCollisionObject(node->get_ghost(), btBroadphaseProxy::CharacterFilter, btBroadphaseProxy::StaticFilter|btBroadphaseProxy::DefaultFilter); @@ -713,7 +713,7 @@ sweep_test_closest(BulletShape *shape, const TransformState &from_ts, const Tran BulletClosestHitSweepResult cb(from_pos, to_pos, mask); _world->convexSweepTest(convex, from_trans, to_trans, cb, penetration); - return cb; + return cb; } //////////////////////////////////////////////////////////////////// @@ -804,7 +804,7 @@ contact_test_pair(PandaNode *node0, PandaNode *node1) const { //////////////////////////////////////////////////////////////////// // Function: BulletWorld::get_manifold // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// BulletPersistentManifold *BulletWorld:: get_manifold(int idx) const { @@ -818,7 +818,7 @@ get_manifold(int idx) const { //////////////////////////////////////////////////////////////////// // Function: BulletWorld::get_collision_object // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// btCollisionObject *BulletWorld:: get_collision_object(PandaNode *node) { @@ -842,7 +842,7 @@ get_collision_object(PandaNode *node) { //////////////////////////////////////////////////////////////////// // Function: BulletWorld::set_group_collision_flag // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void BulletWorld:: set_group_collision_flag(unsigned int group1, unsigned int group2, bool enable) { @@ -858,7 +858,7 @@ set_group_collision_flag(unsigned int group1, unsigned int group2, bool enable) //////////////////////////////////////////////////////////////////// // Function: BulletWorld::get_group_collision_flag // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// bool BulletWorld:: get_group_collision_flag(unsigned int group1, unsigned int group2) const { @@ -921,7 +921,7 @@ clear_tick_callback() { _world->setInternalTickCallback(NULL); } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: BulletWorld::tick_callback // Access: Private // Description: @@ -1088,7 +1088,7 @@ operator >> (istream &in, BulletWorld::BroadphaseAlgorithm &algorithm) { } else if (word == "aabb") { algorithm = BulletWorld::BA_dynamic_aabb_tree; - } + } else { bullet_cat.error() << "Invalid BulletWorld::BroadphaseAlgorithm: " << word << "\n"; @@ -1130,7 +1130,7 @@ operator >> (istream &in, BulletWorld::FilterAlgorithm &algorithm) { } else if (word == "groups-mask") { algorithm = BulletWorld::FA_groups_mask; - } + } else if (word == "callback") { algorithm = BulletWorld::FA_callback; } diff --git a/panda/src/bullet/bullet_utils.cxx b/panda/src/bullet/bullet_utils.cxx index 521ea4a4b8..a4ae140993 100644 --- a/panda/src/bullet/bullet_utils.cxx +++ b/panda/src/bullet/bullet_utils.cxx @@ -1,4 +1,4 @@ -// Filename: bullet_utils.h +// Filename: bullet_utils.cxx // Created by: enn0x (23Jan10) // //////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ //////////////////////////////////////////////////////////////////// // Function: LVecBase3_to_btVector3 -// Description: +// Description: //////////////////////////////////////////////////////////////////// btVector3 LVecBase3_to_btVector3(const LVecBase3 &v) { @@ -29,7 +29,7 @@ btVector3 LVecBase3_to_btVector3(const LVecBase3 &v) { //////////////////////////////////////////////////////////////////// // Function: btVector3_to_LVecBase3 -// Description: +// Description: //////////////////////////////////////////////////////////////////// LVecBase3 btVector3_to_LVecBase3(const btVector3 &v) { @@ -40,7 +40,7 @@ LVecBase3 btVector3_to_LVecBase3(const btVector3 &v) { //////////////////////////////////////////////////////////////////// // Function: btVector3_to_LVector3 -// Description: +// Description: //////////////////////////////////////////////////////////////////// LVector3 btVector3_to_LVector3(const btVector3 &v) { @@ -51,7 +51,7 @@ LVector3 btVector3_to_LVector3(const btVector3 &v) { //////////////////////////////////////////////////////////////////// // Function: btVector3_to_LPoint3 -// Description: +// Description: //////////////////////////////////////////////////////////////////// LPoint3 btVector3_to_LPoint3(const btVector3 &p) { @@ -62,7 +62,7 @@ LPoint3 btVector3_to_LPoint3(const btVector3 &p) { //////////////////////////////////////////////////////////////////// // Function: LMatrix3_to_btMatrix3x3 -// Description: +// Description: //////////////////////////////////////////////////////////////////// btMatrix3x3 LMatrix3_to_btMatrix3x3(const LMatrix3 &m) { @@ -73,7 +73,7 @@ btMatrix3x3 LMatrix3_to_btMatrix3x3(const LMatrix3 &m) { //////////////////////////////////////////////////////////////////// // Function: btMatrix3x3_to_LMatrix3 -// Description: +// Description: //////////////////////////////////////////////////////////////////// LMatrix3 btMatrix3x3_to_LMatrix3(const btMatrix3x3 &m) { @@ -86,7 +86,7 @@ LMatrix3 btMatrix3x3_to_LMatrix3(const btMatrix3x3 &m) { //////////////////////////////////////////////////////////////////// // Function: LQuaternion_to_btQuat -// Description: +// Description: //////////////////////////////////////////////////////////////////// btQuaternion LQuaternion_to_btQuat(const LQuaternion &q) { @@ -98,7 +98,7 @@ btQuaternion LQuaternion_to_btQuat(const LQuaternion &q) { //////////////////////////////////////////////////////////////////// // Function: btQuat_to_LQuaternion -// Description: +// Description: //////////////////////////////////////////////////////////////////// LQuaternion btQuat_to_LQuaternion(const btQuaternion &q) { @@ -110,7 +110,7 @@ LQuaternion btQuat_to_LQuaternion(const btQuaternion &q) { //////////////////////////////////////////////////////////////////// // Function: LMatrix4_to_btTrans -// Description: +// Description: //////////////////////////////////////////////////////////////////// btTransform LMatrix4_to_btTrans(const LMatrix4 &m) { @@ -125,7 +125,7 @@ btTransform LMatrix4_to_btTrans(const LMatrix4 &m) { //////////////////////////////////////////////////////////////////// // Function: btTrans_to_LMatrix4 -// Description: +// Description: //////////////////////////////////////////////////////////////////// LMatrix4 btTrans_to_LMatrix4(const btTransform &trans) { @@ -137,7 +137,7 @@ LMatrix4 btTrans_to_LMatrix4(const btTransform &trans) { //////////////////////////////////////////////////////////////////// // Function: btTrans_to_TransformState -// Description: +// Description: //////////////////////////////////////////////////////////////////// CPT(TransformState) btTrans_to_TransformState(const btTransform &trans, const LVecBase3 &scale) { @@ -149,7 +149,7 @@ CPT(TransformState) btTrans_to_TransformState(const btTransform &trans, const LV //////////////////////////////////////////////////////////////////// // Function: TransformState_to_btTrans -// Description: +// Description: //////////////////////////////////////////////////////////////////// btTransform TransformState_to_btTrans(CPT(TransformState) ts) { @@ -168,7 +168,7 @@ btTransform TransformState_to_btTrans(CPT(TransformState) ts) { //////////////////////////////////////////////////////////////////// // Function: get_default_up_axis -// Description: +// Description: //////////////////////////////////////////////////////////////////// BulletUpAxis get_default_up_axis() { @@ -189,7 +189,7 @@ BulletUpAxis get_default_up_axis() { //////////////////////////////////////////////////////////////////// // Function: get_node_transform -// Description: +// Description: //////////////////////////////////////////////////////////////////// void get_node_transform(btTransform &trans, PandaNode *node) { diff --git a/panda/src/chan/animChannelMatrixDynamic.cxx b/panda/src/chan/animChannelMatrixDynamic.cxx index a41fc3f99c..8046fa2dcc 100644 --- a/panda/src/chan/animChannelMatrixDynamic.cxx +++ b/panda/src/chan/animChannelMatrixDynamic.cxx @@ -29,7 +29,7 @@ TypeHandle AnimChannelMatrixDynamic::_type_handle; // Function: AnimChannelMatrixDynamic::Constructor // Access: Protected // Description: For use only with the bam reader. -///////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// AnimChannelMatrixDynamic:: AnimChannelMatrixDynamic() { } @@ -43,7 +43,7 @@ AnimChannelMatrixDynamic() { // called by make_copy() only. //////////////////////////////////////////////////////////////////// AnimChannelMatrixDynamic:: -AnimChannelMatrixDynamic(AnimGroup *parent, const AnimChannelMatrixDynamic ©) : +AnimChannelMatrixDynamic(AnimGroup *parent, const AnimChannelMatrixDynamic ©) : AnimChannelMatrix(parent, copy), _value_node(copy._value_node), _value(copy._value), @@ -58,7 +58,7 @@ AnimChannelMatrixDynamic(AnimGroup *parent, const AnimChannelMatrixDynamic © //////////////////////////////////////////////////////////////////// AnimChannelMatrixDynamic:: AnimChannelMatrixDynamic(const string &name) - : AnimChannelMatrix(name) + : AnimChannelMatrix(name) { _value = TransformState::make_identity(); _last_value = NULL; // This is impossible; thus, has_changed() will diff --git a/panda/src/chan/animChannelMatrixXfmTable.cxx b/panda/src/chan/animChannelMatrixXfmTable.cxx index 3d39945ee8..3e0fd730c5 100644 --- a/panda/src/chan/animChannelMatrixXfmTable.cxx +++ b/panda/src/chan/animChannelMatrixXfmTable.cxx @@ -32,7 +32,7 @@ TypeHandle AnimChannelMatrixXfmTable::_type_handle; // Function: AnimChannelMatrixXfmTable::Constructor // Access: Protected // Description: Used only for bam loader. -///////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// AnimChannelMatrixXfmTable:: AnimChannelMatrixXfmTable() { for (int i = 0; i < num_matrix_components; i++) { @@ -49,7 +49,7 @@ AnimChannelMatrixXfmTable() { // called by make_copy() only. //////////////////////////////////////////////////////////////////// AnimChannelMatrixXfmTable:: -AnimChannelMatrixXfmTable(AnimGroup *parent, const AnimChannelMatrixXfmTable ©) : +AnimChannelMatrixXfmTable(AnimGroup *parent, const AnimChannelMatrixXfmTable ©) : AnimChannelMatrix(parent, copy) { for (int i = 0; i < num_matrix_components; i++) { @@ -64,7 +64,7 @@ AnimChannelMatrixXfmTable(AnimGroup *parent, const AnimChannelMatrixXfmTable &co //////////////////////////////////////////////////////////////////// AnimChannelMatrixXfmTable:: AnimChannelMatrixXfmTable(AnimGroup *parent, const string &name) - : AnimChannelMatrix(parent, name) + : AnimChannelMatrix(parent, name) { for (int i = 0; i < num_matrix_components; i++) { _tables[i] = CPTA_stdfloat(get_class_type()); @@ -74,8 +74,8 @@ AnimChannelMatrixXfmTable(AnimGroup *parent, const string &name) //////////////////////////////////////////////////////////////////// // Function: AnimChannelMatrixXfmTable::Destructor // Access: Public, Virtual -// Description: -///////////////////////////////////////////////////////////// +// Description: +//////////////////////////////////////////////////////////////////// AnimChannelMatrixXfmTable:: ~AnimChannelMatrixXfmTable() { } @@ -90,7 +90,7 @@ AnimChannelMatrixXfmTable:: // frame number. //////////////////////////////////////////////////////////////////// bool AnimChannelMatrixXfmTable:: -has_changed(int last_frame, double last_frac, +has_changed(int last_frame, double last_frac, int this_frame, double this_frac) { if (last_frame != this_frame) { for (int i = 0; i < num_matrix_components; i++) { diff --git a/panda/src/cocoadisplay/config_cocoadisplay.mm b/panda/src/cocoadisplay/config_cocoadisplay.mm index f3a59a242b..f61a3237a5 100644 --- a/panda/src/cocoadisplay/config_cocoadisplay.mm +++ b/panda/src/cocoadisplay/config_cocoadisplay.mm @@ -1,4 +1,4 @@ -// Filename: config_cocoadisplay.cxx +// Filename: config_cocoadisplay.mm // Created by: rdb (17May12) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/collada/load_collada_file.cxx b/panda/src/collada/load_collada_file.cxx index f0386c363d..969be7040c 100644 --- a/panda/src/collada/load_collada_file.cxx +++ b/panda/src/collada/load_collada_file.cxx @@ -1,4 +1,4 @@ -// Filename: load_dae_file.cxx +// Filename: load_collada_file.cxx // Created by: rdb (16Mar11) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/collide/collisionBox.h b/panda/src/collide/collisionBox.h index 12db41697c..6ea9f0468d 100644 --- a/panda/src/collide/collisionBox.h +++ b/panda/src/collide/collisionBox.h @@ -1,6 +1,5 @@ - // Filename: collisionBox.h -// Created by: amith tudur( 31Jul09 ) +// Created by: amith tudur (31Jul09) // //////////////////////////////////////////////////////////////////// // @@ -29,7 +28,7 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_COLLIDE CollisionBox : public CollisionSolid { PUBLISHED: - INLINE CollisionBox(const LPoint3 ¢er, + INLINE CollisionBox(const LPoint3 ¢er, PN_stdfloat x, PN_stdfloat y, PN_stdfloat z); INLINE CollisionBox(const LPoint3 &min, const LPoint3 &max); @@ -84,7 +83,7 @@ protected: test_intersection_from_segment(const CollisionEntry &entry) const; virtual PT(CollisionEntry) test_intersection_from_box(const CollisionEntry &entry) const; - + virtual void fill_viz_geom(); private: @@ -94,9 +93,9 @@ private: PN_stdfloat _x, _y, _z, _radius; LPoint3 _vertex[8]; // Each of the Eight Vertices of the Box LPlane _planes[6]; //Points to each of the six sides of the Box - + static const int plane_def[6][4]; - + static PStatCollector _volume_pcollector; static PStatCollector _test_pcollector; @@ -107,7 +106,7 @@ private: static PN_stdfloat dist_to_line_segment(const LPoint2 &p, const LPoint2 &f, const LPoint2 &t, const LVector2 &v); - + public: class PointDef { public: @@ -141,7 +140,7 @@ public: private: Points _points[6]; // one set of points for each of the six planes that make up the box - LMatrix4 _to_2d_mat[6]; + LMatrix4 _to_2d_mat[6]; public: INLINE Points get_plane_points( int n ); diff --git a/panda/src/collide/collisionFloorMesh.cxx b/panda/src/collide/collisionFloorMesh.cxx index 63dbfd8eca..84953f42d5 100644 --- a/panda/src/collide/collisionFloorMesh.cxx +++ b/panda/src/collide/collisionFloorMesh.cxx @@ -1,4 +1,4 @@ -// Filename: collisionPlane.cxx +// Filename: collisionFloorMesh.cxx // Created by: drose (25Apr00) // //////////////////////////////////////////////////////////////////// @@ -67,7 +67,7 @@ xform(const LMatrix4 &mat) { LPoint3 v1 = _vertices[tri.p1]; LPoint3 v2 = _vertices[tri.p2]; LPoint3 v3 = _vertices[tri.p3]; - + tri.min_x=min(min(v1[0],v2[0]),v3[0]); tri.max_x=max(max(v1[0],v2[0]),v3[0]); tri.min_y=min(min(v1[1],v2[1]),v3[1]); @@ -143,7 +143,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { const CollisionRay *ray; DCAST_INTO_R(ray, entry.get_from(), 0); LPoint3 from_origin = ray->get_origin() * entry.get_wrt_mat(); - + double fx = from_origin[0]; double fy = from_origin[1]; @@ -154,7 +154,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { if (fx < tri.min_x || fx >= tri.max_x || fy < tri.min_y || fy >= tri.max_y) { continue; } - + //okay, there's a good chance we'll be colliding LPoint3 p0 = _vertices[tri.p1]; LPoint3 p1 = _vertices[tri.p2]; @@ -167,31 +167,31 @@ test_intersection_from_ray(const CollisionEntry &entry) const { e0x = fx - p0x; e0y = fy - p0y; e1x = p1[0] - p0x; e1y = p1[1] - p0y; e2x = p2[0] - p0x; e2y = p2[1] - p0y; - if (e1x == 0.0) { - if (e2x == 0.0) continue; + if (e1x == 0.0) { + if (e2x == 0.0) continue; u = e0x / e2x; - if (u < 0.0 || u > 1.0) continue; + if (u < 0.0 || u > 1.0) continue; if (e1y == 0) continue; v = (e0y - (e2y * u)) / e1y; - if (v < 0.0) continue; + if (v < 0.0) continue; } else { PN_stdfloat d = (e2y * e1x) - (e2x * e1y); - if (d == 0.0) continue; + if (d == 0.0) continue; u = ((e0y * e1x) - (e0x * e1y)) / d; if (u < 0.0 || u > 1.0) continue; v = (e0x - (e2x * u)) / e1x; if (v < 0.0) continue; } - if (u + v <= 0.0 || u + v > 1.0) continue; + if (u + v <= 0.0 || u + v > 1.0) continue; //we collided!! PN_stdfloat mag = u + v; PN_stdfloat p0z = p0[2]; - + PN_stdfloat uz = (p2[2] - p0z) * mag; PN_stdfloat vz = (p1[2] - p0z) * mag; PN_stdfloat finalz = p0z + vz + (((uz - vz) * u) / (u + v)); - PT(CollisionEntry) new_entry = new CollisionEntry(entry); - + PT(CollisionEntry) new_entry = new CollisionEntry(entry); + new_entry->set_surface_normal(LPoint3(0, 0, 1)); new_entry->set_surface_point(LPoint3(fx, fy, finalz)); return new_entry; @@ -203,17 +203,17 @@ test_intersection_from_ray(const CollisionEntry &entry) const { //////////////////////////////////////////////////////////////////// // Function: CollisionFloorMesh::test_intersection_from_sphere // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// PT(CollisionEntry) CollisionFloorMesh:: test_intersection_from_sphere(const CollisionEntry &entry) const { const CollisionSphere *sphere; DCAST_INTO_R(sphere, entry.get_from(), 0); LPoint3 from_origin = sphere->get_center() * entry.get_wrt_mat(); - + double fx = from_origin[0]; double fy = from_origin[1]; - + PN_stdfloat fz = PN_stdfloat(from_origin[2]); PN_stdfloat rad = sphere->get_radius(); CollisionFloorMesh::Triangles::const_iterator ti; @@ -223,7 +223,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { if (fx < tri.min_x || fx >= tri.max_x || fy < tri.min_y || fy >= tri.max_y) { continue; } - + //okay, there's a good chance we'll be colliding LPoint3 p0 = _vertices[tri.p1]; LPoint3 p1 = _vertices[tri.p2]; @@ -236,34 +236,34 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { e0x = fx - p0x; e0y = fy - p0y; e1x = p1[0] - p0x; e1y = p1[1] - p0y; e2x = p2[0] - p0x; e2y = p2[1] - p0y; - if (e1x == 0.0) { - if (e2x == 0.0) continue; + if (e1x == 0.0) { + if (e2x == 0.0) continue; u = e0x / e2x; - if (u < 0.0 || u > 1.0) continue; + if (u < 0.0 || u > 1.0) continue; if (e1y == 0) continue; v = (e0y - (e2y * u)) / e1y; - if (v < 0.0) continue; + if (v < 0.0) continue; } else { PN_stdfloat d = (e2y * e1x) - (e2x * e1y); - if (d == 0.0) continue; + if (d == 0.0) continue; u = ((e0y * e1x) - (e0x * e1y)) / d; if (u < 0.0 || u > 1.0) continue; v = (e0x - (e2x * u)) / e1x; if (v < 0.0) continue; } - if (u + v <= 0.0 || u + v > 1.0) continue; + if (u + v <= 0.0 || u + v > 1.0) continue; //we collided!! PN_stdfloat mag = u + v; PN_stdfloat p0z = p0[2]; - + PN_stdfloat uz = (p2[2] - p0z) * mag; PN_stdfloat vz = (p1[2] - p0z) * mag; PN_stdfloat finalz = p0z+vz+(((uz - vz) *u)/(u+v)); PN_stdfloat dz = fz - finalz; - if(dz > rad) + if(dz > rad) return NULL; - PT(CollisionEntry) new_entry = new CollisionEntry(entry); - + PT(CollisionEntry) new_entry = new CollisionEntry(entry); + new_entry->set_surface_normal(LPoint3(0, 0, 1)); new_entry->set_surface_point(LPoint3(fx, fy, finalz)); return new_entry; @@ -290,7 +290,7 @@ fill_viz_geom() { ("collision", GeomVertexFormat::get_v3(), Geom::UH_static); GeomVertexWriter vertex(vdata, InternalName::get_vertex()); - + PT(GeomTriangles) mesh = new GeomTriangles(Geom::UH_static); PT(GeomLinestrips) wire = new GeomLinestrips(Geom::UH_static); @@ -300,7 +300,7 @@ fill_viz_geom() { LPoint3 vert = *vi; vertex.add_data3(vert); } - for (ti = _triangles.begin(); ti != _triangles.end(); ++ti) { + for (ti = _triangles.begin(); ti != _triangles.end(); ++ti) { CollisionFloorMesh::TriangleIndices tri = *ti; mesh->add_vertex(tri.p1); mesh->add_vertex(tri.p2); @@ -312,16 +312,16 @@ fill_viz_geom() { wire->close_primitive(); mesh->close_primitive(); } - + PT(Geom) geom = new Geom(vdata); PT(Geom) geom2 = new Geom(vdata); geom->add_primitive(mesh); geom2->add_primitive(wire); _viz_geom->add_geom(geom, ((CollisionFloorMesh *)this)->get_solid_viz_state()); _viz_geom->add_geom(geom2, ((CollisionFloorMesh *)this)->get_wireframe_viz_state()); - - _bounds_viz_geom->add_geom(geom, get_solid_bounds_viz_state()); - _bounds_viz_geom->add_geom(geom2, get_wireframe_bounds_viz_state()); + + _bounds_viz_geom->add_geom(geom, get_solid_bounds_viz_state()); + _bounds_viz_geom->add_geom(geom2, get_wireframe_bounds_viz_state()); } //////////////////////////////////////////////////////////////////// @@ -401,7 +401,7 @@ fillin(DatagramIterator& scan, BamReader* manager) tri.p1 = scan.get_uint32(); tri.p2 = scan.get_uint32(); tri.p3 = scan.get_uint32(); - + tri.min_x=scan.get_stdfloat(); tri.max_x=scan.get_stdfloat(); tri.min_y=scan.get_stdfloat(); @@ -466,6 +466,6 @@ add_triangle(unsigned int pointA, unsigned int pointB, unsigned int pointC) { tri.max_x=max(max(v1[0],v2[0]),v3[0]); tri.min_y=min(min(v1[1],v2[1]),v3[1]); tri.max_y=max(max(v1[1],v2[1]),v3[1]); - + _triangles.push_back(tri); } diff --git a/panda/src/collide/collisionHandlerGravity.I b/panda/src/collide/collisionHandlerGravity.I index a82771b3de..7c61954c5e 100644 --- a/panda/src/collide/collisionHandlerGravity.I +++ b/panda/src/collide/collisionHandlerGravity.I @@ -1,4 +1,4 @@ -// Filename: CollisionHandlerGravity.I +// Filename: collisionHandlerGravity.I // Created by: drose (16Mar02) // //////////////////////////////////////////////////////////////////// @@ -104,9 +104,9 @@ get_impact_velocity() const { } //////////////////////////////////////////////////////////////////// -// Function : CollisionHandlerGravity::get_contact_normal -// Access : Public -// Description : +// Function: CollisionHandlerGravity::get_contact_normal +// Access: Public +// Description: //////////////////////////////////////////////////////////////////// INLINE const LVector3 &CollisionHandlerGravity:: get_contact_normal() const { diff --git a/panda/src/collide/collisionHandlerGravity.cxx b/panda/src/collide/collisionHandlerGravity.cxx index 3fbeaf2c4b..6d7cf943c1 100644 --- a/panda/src/collide/collisionHandlerGravity.cxx +++ b/panda/src/collide/collisionHandlerGravity.cxx @@ -1,4 +1,4 @@ -// Filename: CollisionHandlerGravity.cxx +// Filename: collisionHandlerGravity.cxx // Created by: drose (16Mar02) // //////////////////////////////////////////////////////////////////// @@ -51,13 +51,7 @@ CollisionHandlerGravity:: //////////////////////////////////////////////////////////////////// // Function: CollisionHandlerGravity::set_highest_collision // Access: Protected -// Description: -// -// -// -// -// -// +// Description: //////////////////////////////////////////////////////////////////// #define OLD_COLLISION_HANDLER_GRAVITY 0 #if OLD_COLLISION_HANDLER_GRAVITY @@ -67,7 +61,7 @@ set_highest_collision(const NodePath &target_node_path, const NodePath &from_nod bool got_max = false; PN_stdfloat max_height = 0.0f; CollisionEntry *highest = NULL; - + Entries::const_iterator ei; for (ei = entries.begin(); ei != entries.end(); ++ei) { CollisionEntry *entry = (*ei); @@ -108,7 +102,7 @@ set_highest_collision(const NodePath &target_node_path, const NodePath &from_nod // Add only the one that we're impacting with: add_entry(highest); } - + return max_height; } #else @@ -176,7 +170,7 @@ set_highest_collision(const NodePath &target_node_path, const NodePath &from_nod highest->write(cout, 2); cout<get_into()->is_of_type(CollisionPlane::get_class_type())) { @@ -208,7 +202,7 @@ set_highest_collision(const NodePath &target_node_path, const NodePath &from_nod } else { _contact_normal = highest->get_surface_normal(from_node_path); } - + return max_height; } #endif @@ -276,7 +270,7 @@ handle_entries() { adjust = max(adjust, gravity_adjust); } _current_velocity -= _gravity * dt; - // Record the airborne height in case someone else needs it: + // Record the airborne height in case someone else needs it: _airborne_height = -(max_height + _offset) + adjust; assert(_airborne_height >= -0.001f); } @@ -315,7 +309,7 @@ handle_entries() { //////////////////////////////////////////////////////////////////// // Function: CollisionHandlerGravity::apply_linear_force // Access: Protected, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void CollisionHandlerGravity:: apply_linear_force(ColliderDef &def, const LVector3 &force) { diff --git a/panda/src/collide/collisionHandlerGravity.h b/panda/src/collide/collisionHandlerGravity.h index 6f57899c1c..f3c0b69839 100644 --- a/panda/src/collide/collisionHandlerGravity.h +++ b/panda/src/collide/collisionHandlerGravity.h @@ -1,4 +1,4 @@ -// Filename: CollisionHandlerGravity.h +// Filename: collisionHandlerGravity.h // Created by: drose (16Mar02) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/collide/collisionHandlerHighestEvent.cxx b/panda/src/collide/collisionHandlerHighestEvent.cxx index 912ee90fd9..145f6687ae 100644 --- a/panda/src/collide/collisionHandlerHighestEvent.cxx +++ b/panda/src/collide/collisionHandlerHighestEvent.cxx @@ -1,4 +1,4 @@ -// Filename: collisionHandlerEvent.cxx +// Filename: collisionHandlerHighestEvent.cxx // Created by: drose (16Mar02) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/collide/collisionHandlerHighestEvent.h b/panda/src/collide/collisionHandlerHighestEvent.h index 37beed36b4..e3a5d43d25 100644 --- a/panda/src/collide/collisionHandlerHighestEvent.h +++ b/panda/src/collide/collisionHandlerHighestEvent.h @@ -1,4 +1,4 @@ -// Filename: collisionHandlerEvent.h +// Filename: collisionHandlerHighestEvent.h // Created by: drose (16Mar02) // //////////////////////////////////////////////////////////////////// @@ -38,13 +38,13 @@ PUBLISHED: CollisionHandlerHighestEvent(); public: - virtual void begin_group(); + virtual void begin_group(); virtual void add_entry(CollisionEntry *entry); - virtual bool end_group(); + virtual bool end_group(); private: double _collider_distance; PT(CollisionEntry) _closest_collider; - + public: static TypeHandle get_class_type() { diff --git a/panda/src/collide/collisionHandlerPusher.cxx b/panda/src/collide/collisionHandlerPusher.cxx index a87cfb99fe..3b4ac34068 100644 --- a/panda/src/collide/collisionHandlerPusher.cxx +++ b/panda/src/collide/collisionHandlerPusher.cxx @@ -22,7 +22,7 @@ TypeHandle CollisionHandlerPusher::_type_handle; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : ShoveData // Description : The ShoveData class is used within // CollisionHandlerPusher::handle_entries(), to track @@ -134,8 +134,8 @@ handle_entries() { sd._length = (surface_point - interior_point).length(); sd._valid = true; sd._entry = entry; - - #ifndef NDEBUG + + #ifndef NDEBUG if (collide_cat.is_debug()) { collide_cat.debug() << "Shove on " << from_node_path << " from " @@ -143,12 +143,12 @@ handle_entries() { << " times " << sd._length << "\n"; } #endif - + shoves.push_back(sd); } } } - + if (!shoves.empty()) { // Now we look for two shoves that are largely in the same // direction, so we can combine them into a single shove of @@ -168,7 +168,7 @@ handle_entries() { collide_cat.debug() << "Considering dot product " << d << "\n"; } - + if (d > 0.9) { // These two shoves are largely in the same direction; // save the larger of the two. @@ -222,7 +222,7 @@ handle_entries() { } } } - + // Now we can determine the net shove. LVector3 net_shove(0.0f, 0.0f, 0.0f); LVector3 force_normal(0.0f, 0.0f, 0.0f); @@ -234,21 +234,21 @@ handle_entries() { } } - #ifndef NDEBUG + #ifndef NDEBUG if (collide_cat.is_debug()) { collide_cat.debug() << "Net shove on " << from_node_path << " is: " << net_shove << "\n"; } #endif - + // This is the part where the node actually gets moved: CPT(TransformState) trans = def._target.get_transform(); LVecBase3 pos = trans->get_pos(); pos += net_shove * trans->get_mat(); def._target.set_transform(trans->set_pos(pos)); def.updated_transform(); - + // We call this to allow derived classes to do other // fix-ups as they see fit: apply_net_shove(def, net_shove, force_normal); @@ -268,7 +268,7 @@ handle_entries() { // some work with the ColliderDef and the force vector. //////////////////////////////////////////////////////////////////// void CollisionHandlerPusher:: -apply_net_shove(ColliderDef &def, const LVector3 &net_shove, +apply_net_shove(ColliderDef &def, const LVector3 &net_shove, const LVector3 &force_normal) { } diff --git a/panda/src/device/buttonNode.h b/panda/src/device/buttonNode.h index 43f04b954e..e5298a57ac 100644 --- a/panda/src/device/buttonNode.h +++ b/panda/src/device/buttonNode.h @@ -1,4 +1,4 @@ -// Filename: ButtonNode.h +// Filename: buttonNode.h // Created by: drose (12Mar02) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/device/clientBase.cxx b/panda/src/device/clientBase.cxx index e01c35766b..bf50c26d12 100644 --- a/panda/src/device/clientBase.cxx +++ b/panda/src/device/clientBase.cxx @@ -201,7 +201,7 @@ do_poll() { #ifdef OLD_HAVE_IPC //////////////////////////////////////////////////////////////////// // Function: ClientBase::st_callback -// Access: Private, static +// Access: Private, Static // Description: Call back function for thread (if thread has been // spawned). A call back function must be static, so // this merely calls the non-static member callback In diff --git a/panda/src/display/displayRegion.I b/panda/src/display/displayRegion.I index 23cbe092cc..8ff398ee0e 100644 --- a/panda/src/display/displayRegion.I +++ b/panda/src/display/displayRegion.I @@ -38,7 +38,7 @@ get_lens_index() const { return cdata->_lens_index; } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: DisplayRegion::get_num_regions // Access: Published // Description: Returns the number of regions, see set_num_regions. @@ -49,7 +49,7 @@ get_num_regions() const { return cdata->_regions.size(); } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: DisplayRegion::set_num_regions // Access: Published // Description: Sets the number of regions that this DisplayRegion @@ -66,7 +66,7 @@ set_num_regions(int i) { cdata->_regions.resize(i); } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: DisplayRegion::get_dimensions // Access: Published // Description: Retrieves the coordinates of the DisplayRegion's @@ -78,7 +78,7 @@ get_dimensions(PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t) c get_dimensions(0, l, r, b, t); } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: DisplayRegion::get_dimensions // Access: Published // Description: Retrieves the coordinates of the DisplayRegion's @@ -95,7 +95,7 @@ get_dimensions(int i, PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloa t = region._dimensions[3]; } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: DisplayRegion::get_dimensions // Access: Published // Description: Retrieves the coordinates of the DisplayRegion's @@ -137,8 +137,8 @@ get_right(int i) const { //////////////////////////////////////////////////////////////////// // Function: DisplayRegion::get_bottom // Access: Published -// Description: Retrieves the y coordinate of the bottom edge of -// the rectangle within its GraphicsOutput. This +// Description: Retrieves the y coordinate of the bottom edge of +// the rectangle within its GraphicsOutput. This // number will be in the range [0..1]. //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat DisplayRegion:: @@ -789,14 +789,14 @@ get_current_thread() const { //////////////////////////////////////////////////////////////////// // Function: DisplayRegionPipelineReader::is_any_clear_active // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE bool DisplayRegionPipelineReader:: is_any_clear_active() const { return _object->is_any_clear_active(); } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: DisplayRegionPipelineReader::get_num_regions // Access: Published // Description: Returns the number of regions, see set_num_regions. @@ -873,8 +873,8 @@ get_right(int i) const { //////////////////////////////////////////////////////////////////// // Function: DisplayRegionPipelineReader::get_bottom // Access: Public -// Description: Retrieves the y coordinate of the bottom edge of -// the rectangle within its GraphicsOutput. This +// Description: Retrieves the y coordinate of the bottom edge of +// the rectangle within its GraphicsOutput. This // number will be in the range [0..1]. //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat DisplayRegionPipelineReader:: diff --git a/panda/src/display/graphicsWindowProc.h b/panda/src/display/graphicsWindowProc.h index f8b8551d83..68dbeb1f76 100644 --- a/panda/src/display/graphicsWindowProc.h +++ b/panda/src/display/graphicsWindowProc.h @@ -1,4 +1,4 @@ -// Filename: graphicswindowProc.h +// Filename: graphicsWindowProc.h // Created by: Bei Yang (Mar 2010) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/display/graphicsWindow_ext.h b/panda/src/display/graphicsWindow_ext.h index c96ce3c445..3b14159f38 100644 --- a/panda/src/display/graphicsWindow_ext.h +++ b/panda/src/display/graphicsWindow_ext.h @@ -1,4 +1,4 @@ -// Filename: renderState_ext.h +// Filename: graphicsWindow_ext.h // Created by: CFSworks (11Oct14) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/display/pythonGraphicsWindowProc.cxx b/panda/src/display/pythonGraphicsWindowProc.cxx index 4e829d5c59..b4cdfeb828 100644 --- a/panda/src/display/pythonGraphicsWindowProc.cxx +++ b/panda/src/display/pythonGraphicsWindowProc.cxx @@ -1,4 +1,4 @@ -// Filename: customGraphicsWindowProc.cxx +// Filename: pythonGraphicsWindowProc.cxx // Created by: Walt Destler (May 2010) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/display/pythonGraphicsWindowProc.h b/panda/src/display/pythonGraphicsWindowProc.h index 5160ca6372..091307020e 100644 --- a/panda/src/display/pythonGraphicsWindowProc.h +++ b/panda/src/display/pythonGraphicsWindowProc.h @@ -1,4 +1,4 @@ -// Filename: customGgraphicswindowProc.h +// Filename: pythonGraphicsWindowProc.h // Created by: Walt Destler (May 2010) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/display/subprocessWindow.I b/panda/src/display/subprocessWindow.I index a7cff61c4e..940b8845cb 100644 --- a/panda/src/display/subprocessWindow.I +++ b/panda/src/display/subprocessWindow.I @@ -1,4 +1,4 @@ -// Filename: osxSubprocessWindow.I +// Filename: subprocessWindow.I // Created by: drose (11Jul09) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/downloader/chunkedStreamBuf.h b/panda/src/downloader/chunkedStreamBuf.h index 630bebc66d..a5c4b51d09 100644 --- a/panda/src/downloader/chunkedStreamBuf.h +++ b/panda/src/downloader/chunkedStreamBuf.h @@ -29,8 +29,8 @@ // Description : The streambuf object that implements // IChunkedStream. //////////////////////////////////////////////////////////////////// -// No need to export from DLL. class ChunkedStreamBuf : public streambuf { + // No need to export from DLL. public: ChunkedStreamBuf(); virtual ~ChunkedStreamBuf(); diff --git a/panda/src/downloader/downloadDb.h b/panda/src/downloader/downloadDb.h index 37fbcbfca4..1ef6ddcaec 100644 --- a/panda/src/downloader/downloadDb.h +++ b/panda/src/downloader/downloadDb.h @@ -33,9 +33,9 @@ typedef PN_stdfloat Phase; class Ramfile; /* -////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Database Format -////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// magic_number number_of_multifiles header_length multifile_name phase version size status num_files diff --git a/panda/src/dxgsg9/config_dxgsg9.h b/panda/src/dxgsg9/config_dxgsg9.h index d4bb3b10ac..df042f5682 100644 --- a/panda/src/dxgsg9/config_dxgsg9.h +++ b/panda/src/dxgsg9/config_dxgsg9.h @@ -1,4 +1,4 @@ -// Filename: config_dxgsg.h +// Filename: config_dxgsg9.h // Created by: drose (06Oct99) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/dxgsg9/dxGraphicsDevice9.cxx b/panda/src/dxgsg9/dxGraphicsDevice9.cxx index cd2088f5b7..e50a6bbda5 100644 --- a/panda/src/dxgsg9/dxGraphicsDevice9.cxx +++ b/panda/src/dxgsg9/dxGraphicsDevice9.cxx @@ -1,4 +1,4 @@ -// Filename: dxGraphicsDevice.cxx +// Filename: dxGraphicsDevice9.cxx // Created by: masad (22Jul03) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/dxgsg9/dxGraphicsDevice9.h b/panda/src/dxgsg9/dxGraphicsDevice9.h index a6735d5acc..3b0710617e 100644 --- a/panda/src/dxgsg9/dxGraphicsDevice9.h +++ b/panda/src/dxgsg9/dxGraphicsDevice9.h @@ -1,4 +1,4 @@ -// Filename: dxGraphicsDevice.h +// Filename: dxGraphicsDevice9.h // Created by: masad (22Jul03) // //////////////////////////////////////////////////////////////////// @@ -23,7 +23,7 @@ //////////////////////////////////////////////////////////////////// -// Class : DXGraphicsDevice9 +// Class : DXGraphicsDevice9 // Description : A GraphicsDevice necessary for multi-window rendering // in DX. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx index 71fa7eb934..acde3cf2d0 100644 --- a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx +++ b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx @@ -897,7 +897,7 @@ clear(DrawableRegion *clearable) { // Function: DXGraphicsStateGuardian9::prepare_display_region // Access: Public, Virtual // Description: Prepare a display region for rendering (set up -// scissor region and viewport) +// scissor region and viewport) //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian9:: prepare_display_region(DisplayRegionPipelineReader *dr) { diff --git a/panda/src/dxgsg9/dxShaderContext9.I b/panda/src/dxgsg9/dxShaderContext9.I index 0eced1b511..2566d8ff02 100644 --- a/panda/src/dxgsg9/dxShaderContext9.I +++ b/panda/src/dxgsg9/dxShaderContext9.I @@ -1,4 +1,4 @@ -// Filename: dxShaderContext9.i +// Filename: dxShaderContext9.I // Created by: aignacio (Jan06) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/dxgsg9/dxTextureContext9.cxx b/panda/src/dxgsg9/dxTextureContext9.cxx index d2175abeca..857d57978f 100644 --- a/panda/src/dxgsg9/dxTextureContext9.cxx +++ b/panda/src/dxgsg9/dxTextureContext9.cxx @@ -702,7 +702,7 @@ create_texture(DXScreenData &scrn) { << "; NeedLuminance: " << needs_luminance << endl; goto error_exit; - /////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// found_matching_format: // We found a suitable format that matches the texture's format. @@ -1706,7 +1706,7 @@ d3d_surface_to_texture(RECT &source_rect, IDirect3DSurface9 *d3d_surface, //////////////////////////////////////////////////////////////////// // Function: calculate_row_byte_length -// Access: Private, hidden +// Access: Private, Hidden // Description: local helper function, which calculates the // 'row_byte_length' or 'pitch' needed for calling // D3DXLoadSurfaceFromMemory. diff --git a/panda/src/dxgsg9/wdxGraphicsBuffer9.cxx b/panda/src/dxgsg9/wdxGraphicsBuffer9.cxx index 45c7f8a437..6101dd99ca 100644 --- a/panda/src/dxgsg9/wdxGraphicsBuffer9.cxx +++ b/panda/src/dxgsg9/wdxGraphicsBuffer9.cxx @@ -1,4 +1,4 @@ -// Filename: wdxGraphicsBuffer8.cxx +// Filename: wdxGraphicsBuffer9.cxx // Created by: drose (08Feb04) // //////////////////////////////////////////////////////////////////// @@ -57,7 +57,7 @@ wdxGraphicsBuffer9(GraphicsEngine *engine, GraphicsPipe *pipe, if (_debug) { cout << "+++++ wdxGraphicsBuffer9 constructor " << this << " " << this -> get_name ( ) << "\n"; } - + if (_gsg) { // save to GSG list to handle device lost issues DXGraphicsStateGuardian9 *dxgsg; @@ -95,7 +95,7 @@ wdxGraphicsBuffer9:: } // unshare shared depth buffer if any - this -> unshare_depth_buffer(); + this -> unshare_depth_buffer(); // unshare all buffers that are sharing this object's depth buffer { @@ -105,14 +105,14 @@ wdxGraphicsBuffer9:: graphics_buffer_iterator = _shared_depth_buffer_list.begin( ); while (graphics_buffer_iterator != _shared_depth_buffer_list.end( )) { graphics_buffer = (*graphics_buffer_iterator); - if (graphics_buffer) { + if (graphics_buffer) { // this call removes the entry from the list graphics_buffer -> unshare_depth_buffer(); - } + } graphics_buffer_iterator = _shared_depth_buffer_list.begin( ); } - } - + } + this -> close_buffer ( ); } @@ -187,7 +187,7 @@ bool wdxGraphicsBuffer9:: save_bitplanes() { HRESULT hr; DWORD render_target_index; - + render_target_index = 0; hr = _dxgsg -> _d3d_device -> GetRenderTarget (render_target_index, &_saved_color_buffer); @@ -195,7 +195,7 @@ save_bitplanes() { dxgsg9_cat.error ( ) << "GetRenderTarget " << D3DERRORSTRING(hr) FL; return false; } - + _saved_depth_buffer = 0; hr = _dxgsg -> _d3d_device -> GetDepthStencilSurface (&_saved_depth_buffer); if (hr == D3DERR_NOTFOUND) { @@ -223,7 +223,7 @@ restore_bitplanes() { HRESULT hr; DWORD render_target_index; - + render_target_index = 0; hr = dxgsg -> _d3d_device -> @@ -237,7 +237,7 @@ restore_bitplanes() { dxgsg9_cat.error ( ) << "SetDepthStencilSurface " << D3DERRORSTRING(hr) FL; } } - + // clear all render targets, except for the main render target for (int i = 1; i _d3d_device -> SetRenderTarget (i, NULL); @@ -355,7 +355,7 @@ rebuild_bitplanes() { _color_backing_store = NULL; } if (!_color_backing_store) { - hr = _dxgsg->_d3d_device->CreateRenderTarget(bitplane_x, bitplane_y, + hr = _dxgsg->_d3d_device->CreateRenderTarget(bitplane_x, bitplane_y, _saved_color_desc.Format, _saved_color_desc.MultiSampleType, _saved_color_desc.MultiSampleQuality, @@ -409,8 +409,8 @@ rebuild_bitplanes() { } bool release_depth; - - release_depth = true; + + release_depth = true; if (depth_tex_index < 0) { if (_shared_depth_buffer) { if (_shared_depth_buffer -> _depth_backing_store) { @@ -563,7 +563,7 @@ rebuild_bitplanes() { default: break; - } + } } // Decrement the reference counts on these surfaces. The refcounts @@ -578,7 +578,7 @@ rebuild_bitplanes() { depth_surf->Release(); } } - + return true; } @@ -595,7 +595,7 @@ void wdxGraphicsBuffer9:: select_target_tex_page(int page) { DWORD render_target_index; - + render_target_index = 0; _cube_map_index = page; @@ -706,7 +706,7 @@ select_target_tex_page(int page) { default: break; - } + } } } @@ -774,7 +774,7 @@ open_buffer() { //_gsg = _dxgsg; return false; } - + DCAST_INTO_R(_dxgsg, _gsg, false); if (!save_bitplanes()) { @@ -835,17 +835,17 @@ process_1_event() { //////////////////////////////////////////////////////////////////// // Function: wdxGraphicsBuffer9::share_depth_buffer -// Access: Published +// Access: Published // Description: Will attempt to use the depth buffer of the input -// graphics_output. The buffer sizes must be exactly -// the same. +// graphics_output. The buffer sizes must be exactly +// the same. //////////////////////////////////////////////////////////////////// bool wdxGraphicsBuffer9:: share_depth_buffer(GraphicsOutput *graphics_output) { bool state; wdxGraphicsBuffer9 *input_graphics_output; - + state = false; input_graphics_output = DCAST (wdxGraphicsBuffer9, graphics_output); if (this != input_graphics_output && input_graphics_output) { @@ -858,35 +858,35 @@ share_depth_buffer(GraphicsOutput *graphics_output) { } // check buffer sizes - if (this -> get_x_size() != input_graphics_output -> get_x_size()) { + if (this -> get_x_size() != input_graphics_output -> get_x_size()) { if (_debug) { printf ("ERROR: share_depth_buffer: non matching width \n"); } - state = false; + state = false; } - if (this -> get_y_size() != input_graphics_output -> get_y_size()) { + if (this -> get_y_size() != input_graphics_output -> get_y_size()) { if (_debug) { printf ("ERROR: share_depth_buffer: non matching height \n"); } - state = false; + state = false; } - if (state) { - // let the input GraphicsOutput know that there is an object - // sharing its depth buffer + if (state) { + // let the input GraphicsOutput know that there is an object + // sharing its depth buffer input_graphics_output -> register_shared_depth_buffer(this); _shared_depth_buffer = input_graphics_output; state = true; } } - + return state; } //////////////////////////////////////////////////////////////////// // Function: wdxGraphicsBuffer9::unshare_depth_buffer -// Access: Published +// Access: Published // Description: Discontinue sharing the depth buffer. //////////////////////////////////////////////////////////////////// void wdxGraphicsBuffer9:: @@ -895,10 +895,10 @@ unshare_depth_buffer() { if (_debug) { printf ("wdxGraphicsBuffer9 unshare_depth_buffer \n"); } - + // let the GraphicsOutput know that this object is no longer // sharing its depth buffer - _shared_depth_buffer -> unregister_shared_depth_buffer(this); + _shared_depth_buffer -> unregister_shared_depth_buffer(this); _shared_depth_buffer = 0; } } @@ -911,10 +911,10 @@ unshare_depth_buffer() { void wdxGraphicsBuffer9:: register_shared_depth_buffer(GraphicsOutput *graphics_output) { wdxGraphicsBuffer9 *input_graphics_output; - + input_graphics_output = DCAST (wdxGraphicsBuffer9, graphics_output); if (input_graphics_output) { - // add to list + // add to list _shared_depth_buffer_list.push_back(input_graphics_output); } } @@ -927,10 +927,10 @@ register_shared_depth_buffer(GraphicsOutput *graphics_output) { void wdxGraphicsBuffer9:: unregister_shared_depth_buffer(GraphicsOutput *graphics_output) { wdxGraphicsBuffer9 *input_graphics_output; - + input_graphics_output = DCAST (wdxGraphicsBuffer9, graphics_output); if (input_graphics_output) { - // remove from list + // remove from list _shared_depth_buffer_list.remove(input_graphics_output); } } diff --git a/panda/src/dxgsg9/wdxGraphicsPipe9.cxx b/panda/src/dxgsg9/wdxGraphicsPipe9.cxx index 0ea30da942..2bcfd8e336 100644 --- a/panda/src/dxgsg9/wdxGraphicsPipe9.cxx +++ b/panda/src/dxgsg9/wdxGraphicsPipe9.cxx @@ -431,7 +431,7 @@ dx7_driver_enum_callback(GUID *pGUID, TCHAR *strDesc, TCHAR *strName, return DDENUMRET_OK; } -////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: wdxGraphicsWindow9::find_best_depth_format // Access: Private // Description: diff --git a/panda/src/dxgsg9/wdxGraphicsWindow9.cxx b/panda/src/dxgsg9/wdxGraphicsWindow9.cxx index 76b6d080b4..dcf2699820 100644 --- a/panda/src/dxgsg9/wdxGraphicsWindow9.cxx +++ b/panda/src/dxgsg9/wdxGraphicsWindow9.cxx @@ -242,7 +242,7 @@ verify_window_sizes(int numsizes, int *dimen) { return num_valid_modes; } -////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: wdxGraphicsWindow::close_window // Access: Public // Description: Some cleanup is necessary for directx closeup of window. diff --git a/panda/src/egg/eggVertex.cxx b/panda/src/egg/eggVertex.cxx index d0d82502d3..29f2cdeeab 100644 --- a/panda/src/egg/eggVertex.cxx +++ b/panda/src/egg/eggVertex.cxx @@ -382,7 +382,7 @@ set_aux_obj(EggVertexAux *aux) { // Access: Published // Description: Removes the named UV coordinate pair from the vertex, // along with any UV morphs. -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// void EggVertex:: clear_uv(const string &name) { _uv_map.erase(EggVertexUV::filter_name(name)); @@ -392,7 +392,7 @@ clear_uv(const string &name) { // Function: EggVertex::clear_aux // Access: Published // Description: Removes the named auxiliary data from the vertex. -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// void EggVertex:: clear_aux(const string &name) { _aux_map.erase(name); @@ -408,7 +408,7 @@ clear_aux(const string &name) { // Both vertices need to be either in no pool, or in // the same pool. In the latter case, the new vertex // will be placed in that pool. -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// PT(EggVertex) EggVertex:: make_average(const EggVertex *first, const EggVertex *second) { PT(EggVertexPool) pool = first->get_pool(); @@ -518,7 +518,7 @@ make_average(const EggVertex *first, const EggVertex *second) { return middle; } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : GroupRefEntry // Description : A temporary class used in EggVertex::write(), below, // to hold the groups that reference each vertex prior diff --git a/panda/src/egg/eggVertexAux.cxx b/panda/src/egg/eggVertexAux.cxx index 9c6d91cc1b..1f839a21fd 100644 --- a/panda/src/egg/eggVertexAux.cxx +++ b/panda/src/egg/eggVertexAux.cxx @@ -71,7 +71,7 @@ EggVertexAux:: // Description: Creates a new EggVertexAux that contains the // averaged values of the two given objects. It is // an error if they don't have the same name. -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// PT(EggVertexAux) EggVertexAux:: make_average(const EggVertexAux *first, const EggVertexAux *second) { nassertr(first->get_name() == second->get_name(), NULL); diff --git a/panda/src/egg/eggVertexUV.cxx b/panda/src/egg/eggVertexUV.cxx index cb0a6961cc..7d1aac7e91 100644 --- a/panda/src/egg/eggVertexUV.cxx +++ b/panda/src/egg/eggVertexUV.cxx @@ -99,7 +99,7 @@ EggVertexUV:: // Description: Creates a new EggVertexUV that contains the // averaged values of the two given objects. It is // an error if they don't have the same name. -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// PT(EggVertexUV) EggVertexUV:: make_average(const EggVertexUV *first, const EggVertexUV *second) { nassertr(first->get_name() == second->get_name(), NULL); diff --git a/panda/src/egg/lexer.lxx b/panda/src/egg/lexer.lxx index aea73129b0..b5b5b7d713 100644 --- a/panda/src/egg/lexer.lxx +++ b/panda/src/egg/lexer.lxx @@ -1,7 +1,7 @@ /* -// Filename: lexer.l +// Filename: lexer.lxx // Created by: drose (16Jan99) -// +// //////////////////////////////////////////////////////////////////// */ @@ -28,8 +28,8 @@ static int yyinput(void); // declared by flex. // Static variables //////////////////////////////////////////////////////////////////// -// This mutex protects all of these global variables. -LightMutex egg_lock; +// This mutex protects all of these global variables. +LightMutex egg_lock; // We'll increment line_number and col_number as we parse the file, so // that we can report the position of an error. @@ -116,12 +116,12 @@ eggyyerror(const string &msg) { if (!egg_filename.empty()) { out << " in " << egg_filename; } - out + out << " at line " << line_number << ", column " << col_number << ":\n" << setiosflags(Notify::get_literal_flag()) << current_line << "\n"; - indent(out, col_number-1) - << "^\n" << msg << "\n\n" + indent(out, col_number-1) + << "^\n" << msg << "\n\n" << resetiosflags(Notify::get_literal_flag()) << flush; } error_count++; @@ -142,12 +142,12 @@ eggyywarning(const string &msg) { if (!egg_filename.empty()) { out << " in " << egg_filename; } - out + out << " at line " << line_number << ", column " << col_number << ":\n" << setiosflags(Notify::get_literal_flag()) << current_line << "\n"; - indent(out, col_number-1) - << "^\n" << msg << "\n\n" + indent(out, col_number-1) + << "^\n" << msg << "\n\n" << resetiosflags(Notify::get_literal_flag()) << flush; } warning_count++; @@ -263,7 +263,7 @@ eat_c_comment() { int col = col_number; int c, last_c; - + last_c = '\0'; c = read_char(line, col); while (c != EOF && !(last_c == '*' && c == '/')) { @@ -323,12 +323,12 @@ NUMERIC ([+-]?(([0-9]+[.]?)|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?) yyless(1); } -[ \t\r] { +[ \t\r] { // Eat whitespace. accept(); } -"//".* { +"//".* { // Eat C++-style comments. accept(); } @@ -336,12 +336,12 @@ NUMERIC ([+-]?(([0-9]+[.]?)|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?) "/*" { // Eat C-style comments. accept(); - eat_c_comment(); + eat_c_comment(); } [{}] { // Send curly braces as themselves. - accept(); + accept(); return eggyytext[0]; } @@ -690,69 +690,69 @@ NUMERIC ([+-]?(([0-9]+[.]?)|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?) -{NUMERIC} { +{NUMERIC} { // An integer or floating-point number. - accept(); - eggyylval._number = patof(eggyytext); + accept(); + eggyylval._number = patof(eggyytext); eggyylval._string = yytext; - return EGG_NUMBER; + return EGG_NUMBER; } {HEX} { // A hexadecimal integer number. - accept(); + accept(); eggyylval._ulong = strtoul(yytext+2, NULL, 16); eggyylval._string = yytext; - return EGG_ULONG; + return EGG_ULONG; } {BINARY} { // A binary integer number. - accept(); + accept(); eggyylval._ulong = strtoul(yytext+2, NULL, 2); eggyylval._string = yytext; - return EGG_ULONG; + return EGG_ULONG; } "nan"{HEX} { // not-a-number. These sometimes show up in egg files accidentally. - accept(); + accept(); memset(&eggyylval._number, 0, sizeof(eggyylval._number)); *(unsigned long *)&eggyylval._number = strtoul(yytext+3, NULL, 0); eggyylval._string = yytext; return EGG_NUMBER; } -"inf" { +"inf" { // infinity. As above. - accept(); + accept(); eggyylval._number = HUGE_VAL; eggyylval._string = yytext; - return EGG_NUMBER; + return EGG_NUMBER; } "-inf" { // minus infinity. As above. - accept(); + accept(); eggyylval._number = -HUGE_VAL; eggyylval._string = yytext; - return EGG_NUMBER; + return EGG_NUMBER; } -"1.#inf" { +"1.#inf" { // infinity, on Win32. As above. - accept(); + accept(); eggyylval._number = HUGE_VAL; eggyylval._string = yytext; - return EGG_NUMBER; + return EGG_NUMBER; } "-1.#inf" { // minus infinity, on Win32. As above. - accept(); + accept(); eggyylval._number = -HUGE_VAL; eggyylval._string = yytext; - return EGG_NUMBER; + return EGG_NUMBER; } @@ -763,7 +763,7 @@ NUMERIC ([+-]?(([0-9]+[.]?)|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?) return EGG_STRING; } -[^ \t\n\r{}"]+ { +[^ \t\n\r{}"]+ { // Unquoted string. accept(); eggyylval._string = yytext; diff --git a/panda/src/egg/parser.yxx b/panda/src/egg/parser.yxx index 5dbb8f743d..c07a859583 100644 --- a/panda/src/egg/parser.yxx +++ b/panda/src/egg/parser.yxx @@ -1,6 +1,6 @@ -// Filename: parser.y +// Filename: parser.yxx // Created by: drose (16Jan99) -// +// //////////////////////////////////////////////////////////////////// %{ @@ -128,7 +128,7 @@ egg_cleanup_parser() { eggyyerror("Undefined vertex pool " + pool->get_name()); } else { eggyyerror("Undefined vertices in pool " + pool->get_name()); - + egg_cat.error(false) << "Undefined vertex index numbers:"; EggVertexPool::const_iterator vi; @@ -139,7 +139,7 @@ egg_cleanup_parser() { << " " << vertex->get_index(); } } - egg_cat.error(false) + egg_cat.error(false) << "\n"; } } @@ -166,14 +166,14 @@ egg_cleanup_parser() { %token COORDSYSTEM CV DART %token DNORMAL DRGBA DUV DXYZ DCS DISTANCE DTREF %token DYNAMICVERTEXPOOL EXTERNAL_FILE -%token GROUP DEFAULTPOSE +%token GROUP DEFAULTPOSE %token JOINT KNOTS INCLUDE %token INSTANCE LINE LOOP MATERIAL MATRIX3 MATRIX4 MODEL MREF NORMAL %token NURBSCURVE NURBSSURFACE OBJECTTYPE ORDER %token OUTTANGENT PATCH POINTLIGHT POLYGON REF RGBA ROTATE ROTX ROTY ROTZ %token SANIM SCALAR SCALE SEQUENCE SHADING SWITCH SWITCHCONDITION %token TABLE TABLE_V TAG TANGENT TEXLIST TEXTURE TLENGTHS TRANSFORM TRANSLATE -%token TREF TRIANGLEFAN TRIANGLESTRIP +%token TREF TRIANGLEFAN TRIANGLESTRIP %token TRIM TXT UKNOTS UV AUX VKNOTS VERTEX VERTEXANIM %token VERTEXPOOL VERTEXREF %token XFMANIM XFMSANIM @@ -269,7 +269,7 @@ node: | external_reference | vertex_pool | group - | joint + | joint | instance | polygon | trianglefan @@ -655,7 +655,7 @@ texture_body: } } else if (cmp_nocase_uh(name, "depth_write") == 0) { - EggRenderMode::DepthWriteMode m = + EggRenderMode::DepthWriteMode m = EggRenderMode::string_depth_write_mode(strval); if (m == EggRenderMode::DWM_unspecified) { eggyywarning("Unknown depth-write mode " + strval); @@ -664,7 +664,7 @@ texture_body: } } else if (cmp_nocase_uh(name, "depth_test") == 0) { - EggRenderMode::DepthTestMode m = + EggRenderMode::DepthTestMode m = EggRenderMode::string_depth_test_mode(strval); if (m == EggRenderMode::DTM_unspecified) { eggyywarning("Unknown depth-test mode " + strval); @@ -673,7 +673,7 @@ texture_body: } } else if (cmp_nocase_uh(name, "visibility") == 0) { - EggRenderMode::VisibilityMode m = + EggRenderMode::VisibilityMode m = EggRenderMode::string_visibility_mode(strval); if (m == EggRenderMode::VM_unspecified) { eggyywarning("Unknown visibility mode " + strval); @@ -862,7 +862,7 @@ material_body: } } ; - + /* * external_reference @@ -1324,7 +1324,7 @@ group_body: } } else if (cmp_nocase_uh(name, "depth_write") == 0) { - EggRenderMode::DepthWriteMode m = + EggRenderMode::DepthWriteMode m = EggRenderMode::string_depth_write_mode(strval); if (m == EggRenderMode::DWM_unspecified) { eggyywarning("Unknown depth-write mode " + strval); @@ -1333,7 +1333,7 @@ group_body: } } else if (cmp_nocase_uh(name, "depth_test") == 0) { - EggRenderMode::DepthTestMode m = + EggRenderMode::DepthTestMode m = EggRenderMode::string_depth_test_mode(strval); if (m == EggRenderMode::DTM_unspecified) { eggyywarning("Unknown depth-test mode " + strval); @@ -1342,7 +1342,7 @@ group_body: } } else if (cmp_nocase_uh(name, "visibility") == 0) { - EggRenderMode::VisibilityMode m = + EggRenderMode::VisibilityMode m = EggRenderMode::string_visibility_mode(strval); if (m == EggRenderMode::VM_unspecified) { eggyywarning("Unknown visibility mode " + strval); @@ -1741,7 +1741,7 @@ matrix3: MATRIX3 '{' matrix3_body '}' ; -matrix3_body: +matrix3_body: empty | real real real real real real @@ -1758,12 +1758,12 @@ matrix4: MATRIX4 '{' matrix4_body '}' ; -matrix4_body: +matrix4_body: empty | real real real real - real real real real - real real real real - real real real real + real real real real + real real real real + real real real real { egg_top_transform->add_matrix4 (LMatrix4d($1, $2, $3, $4, @@ -1795,7 +1795,7 @@ group_vertex_ref: EggVertex *vertex = pool->get_forward_vertex(index); if (vertex == NULL) { ostringstream errmsg; - errmsg << "No vertex " << index << " in pool " << pool->get_name() + errmsg << "No vertex " << index << " in pool " << pool->get_name() << ends; eggyyerror(errmsg); } else { @@ -1824,7 +1824,7 @@ group_vertex_membership: string name = $3; double value = $<_number>5; double result = $1; - + if (cmp_nocase_uh(name, "membership") == 0) { result = value; } else { @@ -1856,12 +1856,12 @@ switchcondition: * */ switchcondition_body: - DISTANCE '{' real real VERTEX '{' real real real '}' '}' + DISTANCE '{' real real VERTEX '{' real real real '}' '}' { EggGroup *group = DCAST(EggGroup, egg_stack.back()); group->set_lod(EggSwitchConditionDistance($3, $4, LPoint3d($7, $8, $9))); } - | DISTANCE '{' real real real VERTEX '{' real real real '}' '}' + | DISTANCE '{' real real real VERTEX '{' real real real '}' '}' { EggGroup *group = DCAST(EggGroup, egg_stack.back()); group->set_lod(EggSwitchConditionDistance($3, $4, LPoint3d($8, $9, $10), $5)); @@ -2045,7 +2045,7 @@ primitive_component_body: */ primitive_body: empty - | primitive_body COMPONENT integer '{' + | primitive_body COMPONENT integer '{' { if (!egg_stack.back()->is_of_type(EggCompositePrimitive::get_class_type())) { eggyyerror("Not a composite primitive; components are not allowed here."); @@ -2079,7 +2079,7 @@ primitive_body: string name = $3; double value = $<_number>5; string strval = $<_string>5; - + if (cmp_nocase_uh(name, "alpha") == 0) { EggRenderMode::AlphaMode a = EggRenderMode::string_alpha_mode(strval); if (a == EggRenderMode::AM_unspecified) { @@ -2088,7 +2088,7 @@ primitive_body: primitive->set_alpha_mode(a); } } else if (cmp_nocase_uh(name, "depth_write") == 0) { - EggRenderMode::DepthWriteMode m = + EggRenderMode::DepthWriteMode m = EggRenderMode::string_depth_write_mode(strval); if (m == EggRenderMode::DWM_unspecified) { eggyywarning("Unknown depth-write mode " + strval); @@ -2097,7 +2097,7 @@ primitive_body: } } else if (cmp_nocase_uh(name, "depth_test") == 0) { - EggRenderMode::DepthTestMode m = + EggRenderMode::DepthTestMode m = EggRenderMode::string_depth_test_mode(strval); if (m == EggRenderMode::DTM_unspecified) { eggyywarning("Unknown depth-test mode " + strval); @@ -2106,7 +2106,7 @@ primitive_body: } } else if (cmp_nocase_uh(name, "visibility") == 0) { - EggRenderMode::VisibilityMode m = + EggRenderMode::VisibilityMode m = EggRenderMode::string_visibility_mode(strval); if (m == EggRenderMode::VM_unspecified) { eggyywarning("Unknown visibility mode " + strval); @@ -2172,7 +2172,7 @@ nurbs_surface_body: string name = $3; double value = $<_number>5; string strval = $<_string>5; - + if (cmp_nocase_uh(name, "alpha") == 0) { EggRenderMode::AlphaMode a = EggRenderMode::string_alpha_mode(strval); if (a == EggRenderMode::AM_unspecified) { @@ -2181,7 +2181,7 @@ nurbs_surface_body: primitive->set_alpha_mode(a); } } else if (cmp_nocase_uh(name, "depth_write") == 0) { - EggRenderMode::DepthWriteMode m = + EggRenderMode::DepthWriteMode m = EggRenderMode::string_depth_write_mode(strval); if (m == EggRenderMode::DWM_unspecified) { eggyywarning("Unknown depth-write mode " + strval); @@ -2190,7 +2190,7 @@ nurbs_surface_body: } } else if (cmp_nocase_uh(name, "depth_test") == 0) { - EggRenderMode::DepthTestMode m = + EggRenderMode::DepthTestMode m = EggRenderMode::string_depth_test_mode(strval); if (m == EggRenderMode::DTM_unspecified) { eggyywarning("Unknown depth-test mode " + strval); @@ -2199,7 +2199,7 @@ nurbs_surface_body: } } else if (cmp_nocase_uh(name, "visibility") == 0) { - EggRenderMode::VisibilityMode m = + EggRenderMode::VisibilityMode m = EggRenderMode::string_visibility_mode(strval); if (m == EggRenderMode::VM_unspecified) { eggyywarning("Unknown visibility mode " + strval); @@ -2248,7 +2248,7 @@ nurbs_curve_body: string name = $3; double value = $<_number>5; string strval = $<_string>5; - + if (cmp_nocase_uh(name, "alpha") == 0) { EggRenderMode::AlphaMode a = EggRenderMode::string_alpha_mode(strval); if (a == EggRenderMode::AM_unspecified) { @@ -2257,7 +2257,7 @@ nurbs_curve_body: primitive->set_alpha_mode(a); } } else if (cmp_nocase_uh(name, "depth_write") == 0) { - EggRenderMode::DepthWriteMode m = + EggRenderMode::DepthWriteMode m = EggRenderMode::string_depth_write_mode(strval); if (m == EggRenderMode::DWM_unspecified) { eggyywarning("Unknown depth-write mode " + strval); @@ -2266,7 +2266,7 @@ nurbs_curve_body: } } else if (cmp_nocase_uh(name, "depth_test") == 0) { - EggRenderMode::DepthTestMode m = + EggRenderMode::DepthTestMode m = EggRenderMode::string_depth_test_mode(strval); if (m == EggRenderMode::DTM_unspecified) { eggyywarning("Unknown depth-test mode " + strval); @@ -2275,7 +2275,7 @@ nurbs_curve_body: } } else if (cmp_nocase_uh(name, "visibility") == 0) { - EggRenderMode::VisibilityMode m = + EggRenderMode::VisibilityMode m = EggRenderMode::string_visibility_mode(strval); if (m == EggRenderMode::VM_unspecified) { eggyywarning("Unknown visibility mode " + strval); @@ -2298,7 +2298,7 @@ nurbs_curve_body: } else { primitive->set_curve_type(a); } - + } else { eggyywarning("Unknown scalar " + name); } @@ -2352,7 +2352,7 @@ primitive_texture_body: // The texture already existed. Use it. texture = (*vpi).second; if (filename != texture->get_filename()) { - eggyywarning(string("Using previous path: ") + + eggyywarning(string("Using previous path: ") + texture->get_filename().get_fullpath()); } } @@ -2475,7 +2475,7 @@ primitive_vertex_ref: EggVertex *vertex = pool->get_forward_vertex(index); if (vertex == NULL) { ostringstream errmsg; - errmsg << "No vertex " << index << " in pool " << pool->get_name() + errmsg << "No vertex " << index << " in pool " << pool->get_name() << ends; eggyyerror(errmsg); } else { @@ -2579,7 +2579,7 @@ nurbs_surface_trim_loop_body: EggNurbsSurface *nurbs = DCAST(EggNurbsSurface, egg_stack.back()); nassertr(!nurbs->_trims.empty(), 0); nassertr(!nurbs->_trims.back().empty(), 0); - EggNurbsCurve *curve = DCAST(EggNurbsCurve, $2); + EggNurbsCurve *curve = DCAST(EggNurbsCurve, $2); nurbs->_trims.back().back().push_back(curve); } ; @@ -2743,7 +2743,7 @@ sanim_body: | sanim_body TABLE_V '{' real_list '}' { DCAST(EggSAnimData, egg_stack.back())->set_data($4); -} +} ; /* @@ -2796,7 +2796,7 @@ xfmanim_body: | xfmanim_body TABLE_V '{' real_list '}' { DCAST(EggXfmAnimData, egg_stack.back())->set_data($4); -} +} ; /* @@ -2900,7 +2900,7 @@ anim_preload_body: /* * integer_list * - * enter: + * enter: * exit: returns a list of parsed integers. * */ @@ -2918,7 +2918,7 @@ integer_list: /* * real_list * - * enter: + * enter: * exit: returns a list of parsed reals. * */ @@ -2936,7 +2936,7 @@ real_list: /* * texture_name * - * enter: + * enter: * exit: Returns an EggTexture pointer, or NULL. * */ @@ -2957,7 +2957,7 @@ texture_name: /* * material_name * - * enter: + * enter: * exit: Returns an EggMaterial pointer, or NULL. * */ @@ -2978,7 +2978,7 @@ material_name: /* * vertex_pool_name * - * enter: + * enter: * exit: Returns an EggVertexPool pointer, or NULL. * */ @@ -3003,7 +3003,7 @@ vertex_pool_name: /* * group_name * - * enter: + * enter: * exit: Returns an EggGroup pointer, or NULL. * */ @@ -3024,7 +3024,7 @@ group_name: /* * required_name * - * enter: + * enter: * exit: Returns a nonempty string as the name of an EggObject. * */ @@ -3041,7 +3041,7 @@ required_name: /* * optional_name * - * enter: + * enter: * exit: Returns a possibly-empty string as the name of an EggObject. * */ @@ -3053,7 +3053,7 @@ optional_name: /* * required_string * - * enter: + * enter: * exit: Returns a nonempty string. * */ @@ -3069,7 +3069,7 @@ required_string: /* * optional_string * - * enter: + * enter: * exit: Returns a possibly-empty string. * */ @@ -3084,7 +3084,7 @@ optional_string: /* * string * - * enter: + * enter: * exit: Returns a nonempty string. This is different from required_string * in that the grammar requires it to be nonempty, so that: (a) * error messages are more obtuse, and (b) the grammar is less @@ -3106,7 +3106,7 @@ string: /* * repeated_string * - * enter: + * enter: * exit: Returns a possibly-empty string, which might consist of a number * of strings or numbers in a row, concatenated together with an * implicit newline between. @@ -3126,7 +3126,7 @@ repeated_string: /* * repeated_string_body * - * enter: + * enter: * exit: Returns a nonempty string, which might consist of a number * of strings or numbers in a row, concatenated together with an * implicit newline between. @@ -3146,7 +3146,7 @@ repeated_string_body: /* * real * - * enter: + * enter: * exit: Returns an integer or floating-pointer number. * */ @@ -3161,7 +3161,7 @@ real: /* * real_or_string * - * enter: + * enter: * exit: Returns a number as ($<_number>1) or as an unsigned long * ($<_ulong>1) or a string (as $<_string>1). * @@ -3191,7 +3191,7 @@ real_or_string: /* * integer * - * enter: + * enter: * exit: Returns an integer number (stored in a double value). * */ diff --git a/panda/src/event/throw_event.I b/panda/src/event/throw_event.I index 70a0d76ecb..7b9fa06edc 100644 --- a/panda/src/event/throw_event.I +++ b/panda/src/event/throw_event.I @@ -67,7 +67,7 @@ throw_event(const string &event_name, EventQueue::get_global_event_queue()->queue_event(event); } -//////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// INLINE void throw_event_directly(EventHandler& handler, diff --git a/panda/src/express/datagram.cxx b/panda/src/express/datagram.cxx index 677d91fe75..9af23acbe9 100644 --- a/panda/src/express/datagram.cxx +++ b/panda/src/express/datagram.cxx @@ -164,7 +164,7 @@ append_data(const void *data, size_t size) { // reallocate itself with *every* call to append_data! // _data.reserve(_data.size() + size); - _data.v().insert(_data.v().end(), (const unsigned char *)data, + _data.v().insert(_data.v().end(), (const unsigned char *)data, (const unsigned char *)data + size); } @@ -177,17 +177,17 @@ append_data(const void *data, size_t size) { void Datagram:: assign(const void *data, size_t size) { nassertv((int)size >= 0); - + _data = PTA_uchar::empty_array(0); _data.v().insert(_data.v().end(), (const unsigned char *)data, (const unsigned char *)data + size); } //////////////////////////////////////////////////////////////////// -// Function : Datagram::output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: Datagram::output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void Datagram:: output(ostream &out) const { @@ -197,10 +197,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : Datagram::write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: Datagram::write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void Datagram:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/express/datagramIterator.cxx b/panda/src/express/datagramIterator.cxx index b02f2a19dd..ed6910aae9 100644 --- a/panda/src/express/datagramIterator.cxx +++ b/panda/src/express/datagramIterator.cxx @@ -173,10 +173,10 @@ extract_bytes(unsigned char *into, size_t size) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void DatagramIterator:: output(ostream &out) const { @@ -186,10 +186,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void DatagramIterator:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/express/multifile.cxx b/panda/src/express/multifile.cxx index 519ba336ee..dd62271a02 100644 --- a/panda/src/express/multifile.cxx +++ b/panda/src/express/multifile.cxx @@ -114,7 +114,7 @@ Multifile() : "application), on the assumption that the files from a multifile must " "be loaded quickly, without paying the cost of an expensive hash on " "each subfile in order to decrypt it.")); - + _read = (IStreamWrapper *)NULL; _write = (ostream *)NULL; _offset = 0; @@ -468,10 +468,10 @@ set_scale_factor(size_t scale_factor) { // is replaced without examining its contents (but see // also update_subfile). // -// Filename::set_binary() or set_text() must have been -// called previously to specify the nature of the source -// file. If set_text() was called, the text flag will -// be set on the subfile. +// Either Filename:::set_binary() or set_text() must +// have been called previously to specify the nature of +// the source file. If set_text() was called, the text +// flag will be set on the subfile. // // Returns the subfile name on success (it might have // been modified slightly), or empty string on failure. @@ -499,7 +499,7 @@ add_subfile(const string &subfile_name, const Filename &filename, if (fname.is_text()) { subfile->_flags |= SF_text; } - + add_new_subfile(subfile, compression_level); } @@ -555,10 +555,10 @@ add_subfile(const string &subfile_name, istream *subfile_data, // replaced only if it is different; otherwise, the // multifile is left unchanged. // -// Filename::set_binary() or set_text() must have been -// called previously to specify the nature of the source -// file. If set_text() was called, the text flag will -// be set on the subfile. +// Either Filename:::set_binary() or set_text() must +// have been called previously to specify the nature of +// the source file. If set_text() was called, the text +// flag will be set on the subfile. //////////////////////////////////////////////////////////////////// string Multifile:: update_subfile(const string &subfile_name, const Filename &filename, @@ -962,10 +962,10 @@ add_signature(const Multifile::CertChain &cert_chain, EVP_PKEY *pkey) { if (!X509_check_private_key(cert_chain[0]._cert, pkey)) { express_cat.info() - << "Private key does not match certificate.\n"; + << "Private key does not match certificate.\n"; return false; } - + // Now encode that list of certs to a stream in DER form. stringstream der_stream; StreamWriter der_writer(der_stream); @@ -996,7 +996,7 @@ add_signature(const Multifile::CertChain &cert_chain, EVP_PKEY *pkey) { nassertr(_new_subfiles.empty(), false); _new_subfiles.push_back(subfile); bool result = flush(); - + delete subfile; return result; @@ -1088,7 +1088,7 @@ get_signature_subject_name(int n) const { // most meaningful part of the subject name. It returns // the emailAddress, if it is defined; otherwise, it // returns the commonName. - +// // See the comments in get_num_signatures(). //////////////////////////////////////////////////////////////////// string Multifile:: @@ -1123,7 +1123,7 @@ get_signature_friendly_name(int n) const { // these incomplete docs. BIO *mbio = BIO_new(BIO_s_mem()); ASN1_STRING_print_ex(mbio, data, ASN1_STRFLGS_RFC2253 & ~ASN1_STRFLGS_ESC_MSB); - + char *pp; long pp_size = BIO_get_mem_data(mbio, &pp); string name(pp, pp_size); @@ -1363,7 +1363,7 @@ flush() { _write->seekp(_next_index); nassertr(_next_index == _write->tellp(), false); - + // Ok, here we are at the end of the file. Write out the // recently-added subfiles here. First, count up the index size. for (pi = _new_subfiles.begin(); pi != _new_subfiles.end(); ++pi) { @@ -1374,7 +1374,7 @@ flush() { _next_index = pad_to_streampos(_next_index); nassertr(_next_index == _write->tellp(), false); } - + // Now we're at the end of the index. Write a 0 here to mark the // end. StreamWriter writer(_write, false); @@ -1408,7 +1408,7 @@ flush() { } nassertr(_next_index == _write->tellp(), false); } - + // Now go back and fill in the proper addresses for the data start. // We didn't do it in the first pass, because we don't really want // to keep all those file handles open, and so we didn't have to @@ -1427,7 +1427,7 @@ flush() { static const size_t timestamp_pos = _header_prefix.size() + _header_size + 2 + 2 + 4; _write->seekp(timestamp_pos); nassertr(!_write->fail(), false); - + StreamWriter writer(*_write); if (_record_timestamp) { writer.add_uint32(_timestamp); @@ -1530,7 +1530,7 @@ repack() { if (!open_read_write(orig_name)) { express_cat.info() - << "Unable to read newly repacked " << _multifile_name + << "Unable to read newly repacked " << _multifile_name << ".\n"; return false; } @@ -1898,7 +1898,7 @@ bool Multifile:: extract_subfile(int index, const Filename &filename) { nassertr(is_read_valid(), false); nassertr(index >= 0 && index < (int)_subfiles.size(), false); - + Filename fname = filename; if (multifile_always_binary) { fname.set_binary(); @@ -2033,7 +2033,7 @@ compare_subfile(int index, const Filename &filename) { // Check the file size. in2.seekg(0, ios::end); streampos file_size = in2.tellg(); - + if (file_size != (streampos)get_subfile_length(index)) { // The files have different sizes. close_read_subfile(in1); @@ -2047,7 +2047,7 @@ compare_subfile(int index, const Filename &filename) { int byte2 = in2.get(); while (!in1->fail() && !in1->eof() && !in2.fail() && !in2.eof()) { - if (byte1 != byte2) { + if (byte1 != byte2) { close_read_subfile(in1); return false; } @@ -2066,7 +2066,7 @@ compare_subfile(int index, const Filename &filename) { //////////////////////////////////////////////////////////////////// // Function: Multifile::output // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// void Multifile:: output(ostream &out) const { @@ -2116,12 +2116,12 @@ set_header_prefix(const string &header_prefix) { if (new_header_prefix[0] != '#') { new_header_prefix = string("#") + new_header_prefix; } - + // It must end with a newline. if (new_header_prefix[new_header_prefix.size() - 1] != '\n') { new_header_prefix += string("\n"); } - + // Embedded newlines must be followed by a hash mark. size_t newline = new_header_prefix.find('\n'); while (newline < new_header_prefix.size() - 1) { @@ -2137,8 +2137,8 @@ set_header_prefix(const string &header_prefix) { _needs_repack = true; } } - - + + //////////////////////////////////////////////////////////////////// // Function: Multifile::read_subfile // Access: Public @@ -2337,10 +2337,10 @@ open_read_subfile(Subfile *subfile) { // Return an ISubStream object that references into the open // Multifile istream. nassertr(subfile->_data_start != (streampos)0, NULL); - istream *stream = + istream *stream = new ISubStream(_read, _offset + subfile->_data_start, - _offset + subfile->_data_start + (streampos)subfile->_data_length); - + _offset + subfile->_data_start + (streampos)subfile->_data_length); + if ((subfile->_flags & SF_encrypted) != 0) { #ifndef HAVE_OPENSSL express_cat.error() @@ -2350,7 +2350,7 @@ open_read_subfile(Subfile *subfile) { #else // HAVE_OPENSSL // The subfile is encrypted. So actually, return an // IDecryptStream that wraps around the ISubStream. - IDecryptStream *wrapper = + IDecryptStream *wrapper = new IDecryptStream(stream, true, _encryption_password); stream = wrapper; @@ -2529,11 +2529,11 @@ read_index() { } if (_file_major_ver != _current_major_ver || - (_file_major_ver == _current_major_ver && + (_file_major_ver == _current_major_ver && _file_minor_ver > _current_minor_ver)) { express_cat.info() << _multifile_name << " has version " << _file_major_ver << "." - << _file_minor_ver << ", expecting version " + << _file_minor_ver << ", expecting version " << _current_major_ver << "." << _current_minor_ver << ".\n"; _read->release(); close(); @@ -2555,7 +2555,7 @@ read_index() { // Now read the index out. _next_index = read->tellg() - _offset; - _next_index = normalize_streampos(_next_index); + _next_index = normalize_streampos(_next_index); read->seekg(_next_index + _offset); _last_index = 0; _last_data_byte = 0; @@ -2623,7 +2623,7 @@ read_index() { size_t before_size = _subfiles.size(); _subfiles.sort(); size_t after_size = _subfiles.size(); - + // If these don't match, the same filename appeared twice in the // index, which shouldn't be possible. nassertr(before_size == after_size, true); @@ -2632,7 +2632,7 @@ read_index() { delete subfile; _read->release(); return true; -} +} //////////////////////////////////////////////////////////////////// // Function: Multifile::write_header @@ -2732,15 +2732,15 @@ check_signatures() { x509 = d2i_X509(NULL, &bp, bp_end - bp); } if (num_certs != 0 || x509 != NULL) { - express_cat.warning() + express_cat.warning() << "Extra data in signature record.\n"; } } - + if (!chain.empty()) { pkey = X509_get_pubkey(chain[0]._cert); } - + if (pkey != NULL) { EVP_MD_CTX *md_ctx; #ifdef SSL_097 @@ -2749,11 +2749,11 @@ check_signatures() { md_ctx = new EVP_MD_CTX; #endif EVP_VerifyInit(md_ctx, EVP_sha1()); - + nassertv(_read != NULL); _read->acquire(); istream *read = _read->get_istream(); - + // Read and hash the multifile contents, but only up till // _last_data_byte. read->seekg(_offset); @@ -2771,11 +2771,11 @@ check_signatures() { } nassertv(bytes_remaining == (streampos)0); _read->release(); - + // Now check that the signature matches the hash. - int verify_result = - EVP_VerifyFinal(md_ctx, - (unsigned char *)sig_string.data(), + int verify_result = + EVP_VerifyFinal(md_ctx, + (unsigned char *)sig_string.data(), sig_string.size(), pkey); if (verify_result == 1) { // The signature matches; save the certificate and its chain. @@ -2822,7 +2822,7 @@ read_index(istream &read, streampos fpos, Multifile *multifile) { _index_start = fpos; _index_length = 0; - + _data_start = multifile->word_to_streampos(reader.get_uint32()); _data_length = reader.get_uint32(); _flags = reader.get_uint16(); @@ -2908,7 +2908,7 @@ write_index(ostream &write, streampos fpos, Multifile *multifile) { size_t this_index_size = 4 + dg.get_length(); // Plus, we will write out the next index address first. - streampos next_index = fpos + (streampos)this_index_size; + streampos next_index = fpos + (streampos)this_index_size; Datagram idg; idg.add_uint32(multifile->streampos_to_word(next_index)); @@ -3086,7 +3086,7 @@ write_data(ostream &write, istream *read, streampos fpos, _uncompressed_length += 4 + sig_size; delete[] sig_data; - + #ifdef SSL_097 EVP_MD_CTX_destroy(md_ctx); #else @@ -3098,7 +3098,7 @@ write_data(ostream &write, istream *read, streampos fpos, // Finally, we can write out the data itself. static const size_t buffer_size = 4096; char buffer[buffer_size]; - + source->read(buffer, buffer_size); size_t count = source->gcount(); while (count != 0) { @@ -3183,7 +3183,7 @@ rewrite_index_flags(ostream &write) { size_t flags_pos = _index_start + (streampos)flags_offset; write.seekp(flags_pos); nassertv(!write.fail()); - + StreamWriter writer(write); writer.add_uint16(_flags); } diff --git a/panda/src/express/patchfile.cxx b/panda/src/express/patchfile.cxx index a4a36c1c15..4d20403df6 100644 --- a/panda/src/express/patchfile.cxx +++ b/panda/src/express/patchfile.cxx @@ -36,14 +36,13 @@ istream *Patchfile::_tar_istream = NULL; #endif // HAVE_TAR -//////////////////////////////////////////////////////////////////// - // this actually slows things down... //#define USE_MD5_FOR_HASHTABLE_INDEX_VALUES -// Patch File Format /////////////////////////////////////////////// -///// IF THIS CHANGES, UPDATE installerApplyPatch.cxx IN THE INSTALLER //////////////////////////////////////////////////////////////////// +// Patch File Format +// IF THIS CHANGES, UPDATE installerApplyPatch.cxx IN THE INSTALLER +// // [ HEADER ] // 4 bytes 0xfeebfaac ("magic number") // (older patch files have a magic number 0xfeebfaab, @@ -53,14 +52,15 @@ istream *Patchfile::_tar_istream = NULL; // 16 bytes MD5 of starting file (if version >= 1) // 4 bytes length of resulting patched file // 16 bytes MD5 of resultant patched file - +// // Note that MD5 hashes are written in the order observed by // HashVal::read_stream() and HashVal::write_stream(), which is not // the normal linear order. (Each group of four bytes is reversed.) +//////////////////////////////////////////////////////////////////// const int _v0_header_length = 4 + 4 + 16; const int _v1_header_length = 4 + 2 + 4 + 16 + 4 + 16; -// +//////////////////////////////////////////////////////////////////// // [ ADD/COPY pairs; repeated N times ] // 2 bytes AL = ADD length // AL bytes bytes to add @@ -74,7 +74,6 @@ const int _v1_header_length = 4 + 2 + 4 + 16 + 4 + 16; // 2 bytes zero-length ADD // 2 bytes zero-length COPY //////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// // Defines @@ -187,14 +186,13 @@ cleanup() { //////////////////////////////////////////////////////////////////// ///// PATCH FILE APPLY MEMBER FUNCTIONS -///// -//////////////////// + +//////////////////////////////////////////////////////////////////// ///// NOTE: this patch-application functionality unfortunately has to be ///// duplicated in the Installer. It is contained in the file ///// installerApplyPatch.cxx ///// PLEASE MAKE SURE THAT THAT FILE GETS UPDATED IF ANY OF THIS ///// LOGIC CHANGES! (i.e. if the patch file format changes) -//////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// @@ -326,7 +324,6 @@ run() { bytes_read = 0; while (bytes_read < buflen) { - /////////// // read # of ADD bytes nassertr(_buffer->get_length() >= (int)sizeof(ADD_length), false); ADD_length = patch_reader.get_uint16(); @@ -364,7 +361,6 @@ run() { bytes_left -= bytes_this_time; } - /////////// // read # of COPY bytes nassertr(_buffer->get_length() >= (int)sizeof(COPY_length), false); COPY_length = patch_reader.get_uint16(); @@ -584,9 +580,7 @@ internal_read_header(const Filename &patch_file) { return get_write_error(); } - ///////////// // read header, make sure the patch file is valid - StreamReader patch_reader(*_patch_stream); // check the magic number diff --git a/panda/src/express/virtualFileMountAndroidAsset.I b/panda/src/express/virtualFileMountAndroidAsset.I index 14a4e4e07c..ebc832a592 100644 --- a/panda/src/express/virtualFileMountAndroidAsset.I +++ b/panda/src/express/virtualFileMountAndroidAsset.I @@ -1,4 +1,4 @@ -// Filename: virtualFileMountAndroidAsset.cxx +// Filename: virtualFileMountAndroidAsset.I // Created by: rdb (21Jan13) // //////////////////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ //////////////////////////////////////////////////////////////////// // Function: VirtualFileMountAndroidAsset::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// VirtualFileMountAndroidAsset:: VirtualFileMountAndroidAsset(AAssetManager *mgr, const string &apk_path) : @@ -27,7 +27,7 @@ VirtualFileMountAndroidAsset(AAssetManager *mgr, const string &apk_path) : //////////////////////////////////////////////////////////////////// // Function: VirtualFileMountAndroidAsset::AssetStream::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE VirtualFileMountAndroidAsset::AssetStream:: AssetStream(AAsset *asset) : diff --git a/panda/src/express/virtualFileSystem.cxx b/panda/src/express/virtualFileSystem.cxx index 49c5b72ef6..746d2fd018 100644 --- a/panda/src/express/virtualFileSystem.cxx +++ b/panda/src/express/virtualFileSystem.cxx @@ -32,12 +32,12 @@ VirtualFileSystem *VirtualFileSystem::_global_ptr = NULL; //////////////////////////////////////////////////////////////////// // Function: VirtualFileSystem::Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// VirtualFileSystem:: VirtualFileSystem() : vfs_case_sensitive -("vfs-case-sensitive", +("vfs-case-sensitive", #ifdef NDEBUG false, // The default for a production build is not case-sensitive; // this avoids runtime overhead to verify case sensitivity. @@ -74,7 +74,7 @@ VirtualFileSystem() : //////////////////////////////////////////////////////////////////// // Function: VirtualFileSystem::Destructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// VirtualFileSystem:: ~VirtualFileSystem() { @@ -89,7 +89,7 @@ VirtualFileSystem:: //////////////////////////////////////////////////////////////////// bool VirtualFileSystem:: mount(Multifile *multifile, const Filename &mount_point, int flags) { - PT(VirtualFileMountMultifile) new_mount = + PT(VirtualFileMountMultifile) new_mount = new VirtualFileMountMultifile(multifile); return mount(new_mount, mount_point, flags); } @@ -115,14 +115,14 @@ mount(Multifile *multifile, const Filename &mount_point, int flags) { // be a virtual file already appearing within the vfs // filespace. However, it is possible to mount such a // file; see mount_loop() for this. -//// +// // Note that a mounted VirtualFileSystem directory is // fully case-sensitive, unlike the native Windows file // system, so you must refer to files within the virtual // file system with exactly the right case. //////////////////////////////////////////////////////////////////// bool VirtualFileSystem:: -mount(const Filename &physical_filename, const Filename &mount_point, +mount(const Filename &physical_filename, const Filename &mount_point, int flags, const string &password) { if (!physical_filename.exists()) { express_cat->warning() @@ -169,7 +169,7 @@ mount(const Filename &physical_filename, const Filename &mount_point, // recursively mounting a multifile like this. //////////////////////////////////////////////////////////////////// bool VirtualFileSystem:: -mount_loop(const Filename &virtual_filename, const Filename &mount_point, +mount_loop(const Filename &virtual_filename, const Filename &mount_point, int flags, const string &password) { PT(VirtualFile) file = get_file(virtual_filename, false); if (file == NULL) { @@ -237,7 +237,7 @@ unmount(Multifile *multifile) { (*wi) = mount; if (mount->is_exact_type(VirtualFileMountMultifile::get_class_type())) { - VirtualFileMountMultifile *mmount = + VirtualFileMountMultifile *mmount = DCAST(VirtualFileMountMultifile, mount); if (mmount->get_multifile() == multifile) { // Remove this one. Don't increment wi. @@ -282,7 +282,7 @@ unmount(const Filename &physical_filename) { (*wi) = mount; if (mount->is_exact_type(VirtualFileMountSystem::get_class_type())) { - VirtualFileMountSystem *smount = + VirtualFileMountSystem *smount = DCAST(VirtualFileMountSystem, mount); if (smount->get_physical_filename() == physical_filename) { // Remove this one. Don't increment wi. @@ -291,14 +291,14 @@ unmount(const Filename &physical_filename) { << "unmount " << *mount << " from " << mount->get_mount_point() << "\n"; } mount->_file_system = NULL; - + } else { // Don't remove this one. ++wi; } } else if (mount->is_exact_type(VirtualFileMountMultifile::get_class_type())) { - VirtualFileMountMultifile *mmount = + VirtualFileMountMultifile *mmount = DCAST(VirtualFileMountMultifile, mount); if (mmount->get_multifile()->get_multifile_name() == physical_filename) { // Remove this one. Don't increment wi. @@ -608,7 +608,7 @@ find_file(const Filename &filename, const DSearchPath &searchpath, int num_directories = searchpath.get_num_directories(); for (int i = 0; i < num_directories; ++i) { Filename match(searchpath.get_directory(i), filename); - if (searchpath.get_directory(i) == "." && + if (searchpath.get_directory(i) == "." && filename.is_fully_qualified()) { // A special case for the "." directory: to avoid prefixing an // endless stream of ./ in front of files, if the filename @@ -831,7 +831,7 @@ get_global_ptr() { init_libexpress(); _global_ptr = new VirtualFileSystem; - + // Set up the default mounts. First, there is always the root // mount. _global_ptr->mount("/", "/", 0); @@ -849,21 +849,21 @@ get_global_ptr() { string mount_desc = mounts.get_unique_value(i); // The vfs-mount syntax is: - + // vfs-mount system-filename mount-point [options] - + // The last two spaces mark the beginning of the mount point, // and of the options, respectively. There might be multiple // spaces in the system filename, which are part of the // filename. - + // The last space marks the beginning of the mount point. // Spaces before that are part of the system filename. size_t space = mount_desc.rfind(' '); if (space == string::npos) { express_cat.warning() << "No space in vfs-mount descriptor: " << mount_desc << "\n"; - + } else { string mount_point = mount_desc.substr(space + 1); while (space > 0 && isspace(mount_desc[space - 1])) { @@ -871,7 +871,7 @@ get_global_ptr() { } mount_desc = mount_desc.substr(0, space); string options; - + space = mount_desc.rfind(' '); if (space != string::npos) { // If there's another space, we have the optional options field. @@ -882,10 +882,10 @@ get_global_ptr() { } mount_desc = mount_desc.substr(0, space); } - + mount_desc = ExecutionEnvironment::expand_string(mount_desc); Filename physical_filename = Filename::from_os_specific(mount_desc); - + int flags; string password; parse_options(options, flags, password); @@ -899,7 +899,7 @@ get_global_ptr() { if (!vfs_mount_ramdisk.empty()) { string mount_point = vfs_mount_ramdisk; string options; - + size_t space = mount_point.rfind(' '); if (space != string::npos) { // If there's a space, we have the optional options field. @@ -909,7 +909,7 @@ get_global_ptr() { } mount_point = mount_point.substr(0, space); } - + int flags; string password; parse_options(options, flags, password); @@ -1114,7 +1114,7 @@ close_read_write_file(iostream *stream) { //////////////////////////////////////////////////////////////////// bool VirtualFileSystem:: atomic_compare_and_exchange_contents(const Filename &filename, string &orig_contents, - const string &old_contents, + const string &old_contents, const string &new_contents) { PT(VirtualFile) file = create_file(filename); if (file == NULL) { @@ -1157,7 +1157,7 @@ scan_mount_points(vector_string &names, const Filename &path) const { Mounts::const_iterator mi; for (mi = _mounts.begin(); mi != _mounts.end(); ++mi) { VirtualFileMount *mount = (*mi); - + string mount_point = mount->get_mount_point(); if (prefix.empty()) { // The indicated path is the root. Is the mount point on the @@ -1183,7 +1183,7 @@ scan_mount_points(vector_string &names, const Filename &path) const { } } - + //////////////////////////////////////////////////////////////////// // Function: VirtualFileSystem::parse_options // Access: Public, Static @@ -1205,7 +1205,7 @@ parse_options(const string &options, int &flags, string &password) { q = options.find(',', p); } parse_option(options.substr(p), flags, password); -} +} //////////////////////////////////////////////////////////////////// // Function: VirtualFileSystem::parse_option @@ -1313,13 +1313,13 @@ do_get_file(const Filename &filename, int open_flags) const { } } else if (mount_point.empty()) { // This is the root mount point; all files are in here. - if (consider_match(found_file, composite_file, mount, strpath, + if (consider_match(found_file, composite_file, mount, strpath, pathname, false, open_flags)) { return found_file; } #ifdef HAVE_ZLIB if (vfs_implicit_pz) { - if (consider_match(found_file, composite_file, mount, strpath_pz, + if (consider_match(found_file, composite_file, mount, strpath_pz, pathname, true, open_flags)) { return found_file; } @@ -1332,7 +1332,7 @@ do_get_file(const Filename &filename, int open_flags) const { // This pathname falls within this mount system. Filename local_filename = strpath.substr(mount_point.length() + 1); Filename local_filename_pz = strpath_pz.substr(mount_point.length() + 1); - if (consider_match(found_file, composite_file, mount, local_filename, + if (consider_match(found_file, composite_file, mount, local_filename, pathname, false, open_flags)) { return found_file; } @@ -1389,7 +1389,7 @@ consider_match(PT(VirtualFile) &found_file, VirtualFileComposite *&composite_fil VirtualFileMount *mount, const Filename &local_filename, const Filename &original_filename, bool implicit_pz_file, int open_flags) const { - PT(VirtualFile) vfile = + PT(VirtualFile) vfile = mount->make_virtual_file(local_filename, original_filename, false, open_flags); if (!vfile->has_file() && ((open_flags & OF_allow_nonexist) == 0)) { // Keep looking. @@ -1470,7 +1470,7 @@ consider_mount_mf(const Filename &filename) { } PT(Multifile) multifile = new Multifile; - + istream *stream = file->open_read_file(false); if (stream == (istream *)NULL) { // Couldn't read file. @@ -1490,7 +1490,7 @@ consider_mount_mf(const Filename &filename) { express_cat->info() << "Implicitly mounting " << dirname << "\n"; - PT(VirtualFileMountMultifile) new_mount = + PT(VirtualFileMountMultifile) new_mount = new VirtualFileMountMultifile(multifile); return do_mount(new_mount, dirname, MF_read_only); } diff --git a/panda/src/ffmpeg/ffmpegVirtualFile.cxx b/panda/src/ffmpeg/ffmpegVirtualFile.cxx index 5d0affbfcd..fd901a1ed3 100644 --- a/panda/src/ffmpeg/ffmpegVirtualFile.cxx +++ b/panda/src/ffmpeg/ffmpegVirtualFile.cxx @@ -30,8 +30,8 @@ extern "C" { //////////////////////////////////////////////////////////////////// // Function: FfmpegVirtualFile::Constructor // Access: Public -// Description: -///////////////////////////////p///////////////////////////////////// +// Description: +//////////////////////////////////////////////////////////////////// FfmpegVirtualFile:: FfmpegVirtualFile() : _io_context(NULL), @@ -45,7 +45,7 @@ FfmpegVirtualFile() : //////////////////////////////////////////////////////////////////// // Function: FfmpegVirtualFile::Destructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// FfmpegVirtualFile:: ~FfmpegVirtualFile() { diff --git a/panda/src/glstuff/glCgShaderContext_src.I b/panda/src/glstuff/glCgShaderContext_src.I index 376347a96e..308ca92e3a 100644 --- a/panda/src/glstuff/glCgShaderContext_src.I +++ b/panda/src/glstuff/glCgShaderContext_src.I @@ -1,4 +1,4 @@ -// Filename: glCgShaderContext_src.h +// Filename: glCgShaderContext_src.I // Created by: rdb (27Jun14) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/glstuff/glGeomContext_src.cxx b/panda/src/glstuff/glGeomContext_src.cxx index d9e6578bf8..0ecac4afaa 100644 --- a/panda/src/glstuff/glGeomContext_src.cxx +++ b/panda/src/glstuff/glGeomContext_src.cxx @@ -17,14 +17,14 @@ TypeHandle CLP(GeomContext)::_type_handle; //////////////////////////////////////////////////////////////////// // Function: CLP(GeomContext)::Destructor // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// CLP(GeomContext):: ~CLP(GeomContext)() { nassertv(_display_lists.empty()); } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: CLP(GeomContext)::get_display_list // Access: Public // Description: Looks up the display list index associated with the diff --git a/panda/src/glstuff/glShaderContext_src.I b/panda/src/glstuff/glShaderContext_src.I index d95671510f..3f5bc7132c 100644 --- a/panda/src/glstuff/glShaderContext_src.I +++ b/panda/src/glstuff/glShaderContext_src.I @@ -1,4 +1,4 @@ -// Filename: glShaderContext_src.h +// Filename: glShaderContext_src.I // Created by: jyelon (01Sep05) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/glstuff/glTextureContext_src.cxx b/panda/src/glstuff/glTextureContext_src.cxx index 3238ae5a30..c41116e33b 100644 --- a/panda/src/glstuff/glTextureContext_src.cxx +++ b/panda/src/glstuff/glTextureContext_src.cxx @@ -1,4 +1,4 @@ -// Filename: glTextureContext.cxx +// Filename: glTextureContext_src.cxx // Created by: drose (07Oct99) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/gobj/geomVertexArrayData_ext.cxx b/panda/src/gobj/geomVertexArrayData_ext.cxx index 04718f8770..bed312d86e 100644 --- a/panda/src/gobj/geomVertexArrayData_ext.cxx +++ b/panda/src/gobj/geomVertexArrayData_ext.cxx @@ -1,4 +1,4 @@ -// Filename: geomVertexArrayData_ext.I +// Filename: geomVertexArrayData_ext.cxx // Created by: rdb (05Sep13) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/gobj/geomVertexData.cxx b/panda/src/gobj/geomVertexData.cxx index f822fb6f07..25ff1d463b 100644 --- a/panda/src/gobj/geomVertexData.cxx +++ b/panda/src/gobj/geomVertexData.cxx @@ -1188,7 +1188,6 @@ transform_vertices(const LMatrix4 &mat, int begin_row, int end_row) { } //////////////////////////////////////////////////////////////////// - // Function: GeomVertexData::transform_vertices // Access: Published // Description: Applies the indicated transform matrix to all of the diff --git a/panda/src/gobj/internalName_ext.cxx b/panda/src/gobj/internalName_ext.cxx index dfdb8e8e36..f81e78fe98 100644 --- a/panda/src/gobj/internalName_ext.cxx +++ b/panda/src/gobj/internalName_ext.cxx @@ -1,4 +1,4 @@ -// Filename: internalName_ext.I +// Filename: internalName_ext.cxx // Created by: rdb (28Sep14) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/gobj/shader.I b/panda/src/gobj/shader.I index 4ab9611819..20d7831f32 100644 --- a/panda/src/gobj/shader.I +++ b/panda/src/gobj/shader.I @@ -165,8 +165,8 @@ set_cache_compiled_shader(bool flag) { } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderCapabilities Constructor -// Access: Public +// Function: Shader::ShaderCapabilities Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderCaps:: @@ -175,8 +175,8 @@ ShaderCaps() { } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderCapabilities::operator == -// Access: Public +// Function: Shader::ShaderCapabilities::operator == +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE bool Shader::ShaderCaps:: @@ -195,8 +195,8 @@ operator == (const ShaderCaps &other) const { } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -209,8 +209,8 @@ ShaderPtrData() : } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -224,8 +224,8 @@ ShaderPtrData(const PTA_float &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -239,8 +239,8 @@ ShaderPtrData(const PTA_LMatrix4f &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -254,8 +254,8 @@ ShaderPtrData(const PTA_LMatrix3f &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -269,8 +269,8 @@ ShaderPtrData(const PTA_LVecBase4f &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -284,8 +284,8 @@ ShaderPtrData(const PTA_LVecBase3f &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -299,8 +299,8 @@ ShaderPtrData(const PTA_LVecBase2f &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -317,8 +317,8 @@ ShaderPtrData(const LVecBase4f &vec) : } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -335,8 +335,8 @@ ShaderPtrData(const LVecBase3f &vec) : } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -353,8 +353,8 @@ ShaderPtrData(const LVecBase2f &vec) : } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -371,8 +371,8 @@ ShaderPtrData(const LMatrix4f &mat) : } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -389,8 +389,8 @@ ShaderPtrData(const LMatrix3f &mat) : } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -404,8 +404,8 @@ ShaderPtrData(const PTA_double &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -419,8 +419,8 @@ ShaderPtrData(const PTA_LMatrix4d &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -434,8 +434,8 @@ ShaderPtrData(const PTA_LMatrix3d &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -449,8 +449,8 @@ ShaderPtrData(const PTA_LVecBase4d &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -464,8 +464,8 @@ ShaderPtrData(const PTA_LVecBase3d &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -479,8 +479,8 @@ ShaderPtrData(const PTA_LVecBase2d &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -497,8 +497,8 @@ ShaderPtrData(const LVecBase4d &vec) : } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -515,8 +515,8 @@ ShaderPtrData(const LVecBase3d &vec) : } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -533,8 +533,8 @@ ShaderPtrData(const LVecBase2d &vec) : } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -551,8 +551,8 @@ ShaderPtrData(const LMatrix4d &mat) : } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -569,8 +569,8 @@ ShaderPtrData(const LMatrix3d &mat) : } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -584,8 +584,8 @@ ShaderPtrData(const PTA_int &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -599,8 +599,8 @@ ShaderPtrData(const PTA_LVecBase4i &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -614,8 +614,8 @@ ShaderPtrData(const PTA_LVecBase3i &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -629,8 +629,8 @@ ShaderPtrData(const PTA_LVecBase2i &ptr): } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -647,8 +647,8 @@ ShaderPtrData(const LVecBase4i &vec) : } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: @@ -665,8 +665,8 @@ ShaderPtrData(const LVecBase3i &vec) : } //////////////////////////////////////////////////////////////////// -// Function: Shader::ShaderPtrData Constructor -// Access: +// Function: Shader::ShaderPtrData Constructor +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE Shader::ShaderPtrData:: diff --git a/panda/src/gobj/shader.cxx b/panda/src/gobj/shader.cxx index e23f8a950a..ebac3dde33 100644 --- a/panda/src/gobj/shader.cxx +++ b/panda/src/gobj/shader.cxx @@ -2591,8 +2591,8 @@ check_modified() const { #ifdef HAVE_CG //////////////////////////////////////////////////////////////////// -// Function: Shader::cg_get_profile_from_header -// Access: Private +// Function: Shader::cg_get_profile_from_header +// Access: Private // Description: Determines the appropriate active shader profile settings // based on any profile directives stored within the shader header //////////////////////////////////////////////////////////////////// @@ -2866,11 +2866,11 @@ load_compute(ShaderLanguage lang, const Filename &fn) { return shader; } -////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: Shader::make // Access: Published, Static // Description: Loads the shader, using the string as shader body. -////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// PT(Shader) Shader:: make(const string &body, ShaderLanguage lang) { if (lang == SL_GLSL) { @@ -2934,11 +2934,11 @@ make(const string &body, ShaderLanguage lang) { return shader; } -////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: Shader::make // Access: Published, Static // Description: Loads the shader, using the strings as shader bodies. -////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// PT(Shader) Shader:: make(ShaderLanguage lang, const string &vertex, const string &fragment, const string &geometry, const string &tess_control, @@ -2985,11 +2985,11 @@ make(ShaderLanguage lang, const string &vertex, const string &fragment, return shader; } -////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: Shader::make_compute // Access: Published, Static // Description: Loads the compute shader from the given string. -////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// PT(Shader) Shader:: make_compute(ShaderLanguage lang, const string &body) { if (lang != SL_GLSL) { diff --git a/panda/src/gobj/timerQueryContext.I b/panda/src/gobj/timerQueryContext.I index be86483329..72b79b58e9 100644 --- a/panda/src/gobj/timerQueryContext.I +++ b/panda/src/gobj/timerQueryContext.I @@ -1,4 +1,4 @@ -// Filename: occlusionQueryContext.I +// Filename: timerQueryContext.I // Created by: rdb (22Aug14) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/grutil/meshDrawer2D.I b/panda/src/grutil/meshDrawer2D.I index 733286313d..742d87a2a1 100644 --- a/panda/src/grutil/meshDrawer2D.I +++ b/panda/src/grutil/meshDrawer2D.I @@ -1,4 +1,4 @@ -// Filename: meshDrawer.I +// Filename: meshDrawer2D.I // Created by: treeform (19dec08) // //////////////////////////////////////////////////////////////////// @@ -21,13 +21,13 @@ //////////////////////////////////////////////////////////////////// INLINE MeshDrawer2D:: MeshDrawer2D() { - _root = NodePath("MeshDrawer"); + _root = NodePath("MeshDrawer"); _bv = NULL; _vertex = NULL; _uv = NULL; _color = NULL; _budget = 5000; - + _clip_x = -1000000; _clip_y = -1000000; _clip_w = 1000000; @@ -121,18 +121,18 @@ quad_raw(const LVector3 &v1, const LVector4 &c1, const LVector2 &uv1, _vertex->add_data3(v4); _color->add_data4(c4); _uv->add_data2(uv4); - + _clear_index += 1; } INLINE void MeshDrawer2D:: -rectangle_raw(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h, - PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs, +rectangle_raw(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h, + PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs, const LVector4 &color ) { - - quad_raw( + + quad_raw( LVector3(x, 0, y), color, LVector2(u , v), LVector3(x, 0, y+h), color, LVector2(u , v+vs), LVector3(x+w, 0, y), color, LVector2(u+us, v), @@ -146,32 +146,32 @@ rectangle_raw(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h, // Description: Draws a 2d rectangle, that can be cliped //////////////////////////////////////////////////////////////////// INLINE void MeshDrawer2D:: -rectangle(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h, - PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs, +rectangle(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h, + PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs, const LVector4 &color ) { - - if( w == 0 && h == 0 ) return; // no size return + + if( w == 0 && h == 0 ) return; // no size return if (x > _clip_x+_clip_w) return; // we are left of the clip if (y > _clip_y+_clip_h) return; // we are above of the clip if (x+w < _clip_x) return; // we are right of the clip - if (y+h < _clip_y) return; // we are bellow clip - + if (y+h < _clip_y) return; // we are bellow clip + // the rectange fits but it might need to be cliped - + PN_stdfloat x_uv_ratio = us/w; PN_stdfloat y_uv_ratio = vs/h; PN_stdfloat dt = 0; - + if (x < _clip_x){ - // clip right + // clip right dt = _clip_x-x; x += dt; - w -= dt; + w -= dt; u += dt*x_uv_ratio; us -= dt*x_uv_ratio; - } - + } + if (y < _clip_y){ // clip bottom dt = _clip_y-y; @@ -180,23 +180,23 @@ rectangle(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h, v += dt*y_uv_ratio; vs -= dt*y_uv_ratio; } - + if (x+w > _clip_x+_clip_w){ - // clip left + // clip left dt = x+w - (_clip_x+_clip_w); w -= dt; us -= dt*x_uv_ratio; - } - + } + if (y+h > _clip_y+_clip_h){ - // clip top + // clip top dt = y+h - (_clip_y+_clip_h); - h -= dt; + h -= dt; vs -= dt*y_uv_ratio; } // we made it lets draw the quad rectangle_raw(x,y,w,h,u,v,us,vs,color); - + } diff --git a/panda/src/grutil/meshDrawer2D.cxx b/panda/src/grutil/meshDrawer2D.cxx index a96aa8837f..d6058f962e 100644 --- a/panda/src/grutil/meshDrawer2D.cxx +++ b/panda/src/grutil/meshDrawer2D.cxx @@ -1,4 +1,4 @@ -// Filename: MeshDrawer2D.cxx +// Filename: meshDrawer2D.cxx // Created by: treeform (19dec08) // //////////////////////////////////////////////////////////////////// @@ -49,28 +49,28 @@ void MeshDrawer2D::generator(int budget) { GeomVertexWriter *tuv = new GeomVertexWriter(_vdata, "texcoord"); GeomVertexWriter *tcolor = new GeomVertexWriter(_vdata, "color"); _prim = new GeomTriangles(Geom::UH_static); - + // iterate and fill _up a geom with random data so that it will // not be optimized out by panda3d system for(int i = 0; i < budget; i++) { for( int vert = 0; vert < 4; vert++) { - + LVector3 vec3 = LVector3(RANDF+10000,RANDF,RANDF); LVector4 vec4 = LVector4(RANDF,RANDF,RANDF,0); LVector2 vec2 = LVector2(RANDF,RANDF); - + tvertex->add_data3(vec3); tcolor->add_data4(vec4); tuv->add_data2(vec2); - + } - + _prim->add_vertices(i*4+0, i*4+1, i*4+2); _prim->close_primitive(); - + _prim->add_vertices(i*4+1, i*4+2, i*4+3); _prim->close_primitive(); - + } // create our node and attach it to this node path _geom = new Geom(_vdata); @@ -92,12 +92,12 @@ void MeshDrawer2D::generator(int budget) { // MeshDrawer2D::end() //////////////////////////////////////////////////////////////////// void MeshDrawer2D::begin() { - + // recreate our rewriters - if (_vertex != NULL) delete _vertex; + if (_vertex != NULL) delete _vertex; if (_uv != NULL) delete _uv; if (_color != NULL) delete _color; - + _vertex = new GeomVertexRewriter(_vdata, "vertex"); _uv = new GeomVertexRewriter(_vdata, "texcoord"); _color = new GeomVertexRewriter(_vdata, "color"); @@ -140,35 +140,35 @@ void MeshDrawer2D::end() { //////////////////////////////////////////////////////////////////// // Function: MeshDrawer2D::quad // Access: Published -// Description: Draws a tiled rectangle, size of tiles is in +// Description: Draws a tiled rectangle, size of tiles is in // us and vs //////////////////////////////////////////////////////////////////// void MeshDrawer2D:: -rectangle_tiled(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h, - PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs, +rectangle_tiled(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h, + PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs, const LVector4 &color ) { PN_stdfloat x_fit = w/us; PN_stdfloat y_fit = h/vs; PN_stdfloat x_pos = x; - + while (x_fit > 0){ PN_stdfloat y_pos = y; - y_fit = h/vs; + y_fit = h/vs; while (y_fit > 0){ - + PN_stdfloat fixed_us = us; PN_stdfloat fixed_vs = vs; - + // we are cuttin in the middle of a tile x direction if (x_fit < 1){ fixed_us = w; while (fixed_us > us){ fixed_us -= us; } - } - + } + // we are cuttin in the middel of a tile y directon if (y_fit < 1){ fixed_vs = h; @@ -176,24 +176,24 @@ rectangle_tiled(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h, fixed_vs -= vs; } } - + rectangle(x_pos,y_pos,fixed_us,fixed_vs,u,v,fixed_us,fixed_vs,color); - + y_pos += vs; y_fit -= 1; } x_pos += us; x_fit -= 1; } - - + + } //////////////////////////////////////////////////////////////////// // Function: MeshDrawer2D::quad // Access: Published -// Description: Draws a 2d rectangle, with borders and corders, +// Description: Draws a 2d rectangle, with borders and corders, // taken from the surrounding texture //////////////////////////////////////////////////////////////////// void MeshDrawer2D:: @@ -201,19 +201,19 @@ rectangle_border( PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h, PN_stdfloat r, PN_stdfloat t, PN_stdfloat l, PN_stdfloat b, PN_stdfloat tr, PN_stdfloat tt, PN_stdfloat tl, PN_stdfloat tb, - PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs, + PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs, const LVector4 &color){ - + rectangle(x,y,w,h,u,v,us,vs,color); // center - - // -------------- ----------------- ------ + + // -------------- ----------------- ------ rectangle(x, y+h, w, t, u, v+vs, us, tt, color); // N rectangle(x, y-b, w, b, u, v-tb, us, tb, color); // S - - + + rectangle(x-l, y, l, h, u-tl, v, tl, vs, color); // W rectangle(x+w, y, r, h, r, v, tr, vs, color); // E - + /* rectangle(x-l, y+h, l, t, u-tl, v, tl, tt, color); // NW rectangle(x-l, y-b, l, b, u-tl, v-tb, tl, tb, color); // SW @@ -225,7 +225,7 @@ rectangle_border( //////////////////////////////////////////////////////////////////// // Function: MeshDrawer2D::quad // Access: Published -// Description: Draws a 2d rectangle, with borders and corders, +// Description: Draws a 2d rectangle, with borders and corders, // taken from the surrounding texture //////////////////////////////////////////////////////////////////// void MeshDrawer2D:: @@ -233,11 +233,11 @@ rectangle_border_tiled( PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h, PN_stdfloat r, PN_stdfloat t, PN_stdfloat l, PN_stdfloat b, PN_stdfloat tr, PN_stdfloat tt, PN_stdfloat tl, PN_stdfloat tb, - PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs, + PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs, const LVector4 &color){ - + rectangle_tiled(x,y,w,h,u,v,us,vs,color); // center - + rectangle_tiled(x, y+h, w, t, u, v+t, us, t, color); // N rectangle_tiled(x, y-b, w, b, u, v-b, us, b, color); // S rectangle_tiled(x-l, y, l, h, u-l, v, l, vs, color); // W diff --git a/panda/src/grutil/movieTexture.cxx b/panda/src/grutil/movieTexture.cxx index 9ab38fe4c5..edfbe59065 100644 --- a/panda/src/grutil/movieTexture.cxx +++ b/panda/src/grutil/movieTexture.cxx @@ -34,11 +34,11 @@ TypeHandle MovieTexture::_type_handle; //////////////////////////////////////////////////////////////////// // Function: MovieTexture::Constructor // Access: Published -// Description: Creates a blank movie texture. Movies must be +// Description: Creates a blank movie texture. Movies must be // added using do_read_one or do_load_one. //////////////////////////////////////////////////////////////////// MovieTexture:: -MovieTexture(const string &name) : +MovieTexture(const string &name) : Texture(name) { } @@ -49,7 +49,7 @@ MovieTexture(const string &name) : // Description: Creates a texture playing the specified movie. //////////////////////////////////////////////////////////////////// MovieTexture:: -MovieTexture(MovieVideo *video) : +MovieTexture(MovieVideo *video) : Texture(video->get_name()) { Texture::CDWriter cdata_tex(Texture::_cycler, true); @@ -58,7 +58,7 @@ MovieTexture(MovieVideo *video) : //////////////////////////////////////////////////////////////////// // Function: MovieTexture::CData::Constructor -// Access: public +// Access: Public // Description: xxx //////////////////////////////////////////////////////////////////// MovieTexture::CData:: @@ -76,7 +76,7 @@ CData() : //////////////////////////////////////////////////////////////////// // Function: MovieTexture::CData::Copy Constructor -// Access: public +// Access: Public // Description: xxx //////////////////////////////////////////////////////////////////// MovieTexture::CData:: @@ -95,7 +95,7 @@ CData(const CData ©) : //////////////////////////////////////////////////////////////////// // Function: MovieTexture::CData::make_copy -// Access: public +// Access: Public // Description: xxx //////////////////////////////////////////////////////////////////// CycleData *MovieTexture::CData:: @@ -110,7 +110,7 @@ make_copy() const { // an existing MovieTexture. //////////////////////////////////////////////////////////////////// MovieTexture:: -MovieTexture(const MovieTexture ©) : +MovieTexture(const MovieTexture ©) : Texture(copy) { nassertv(false); @@ -201,15 +201,15 @@ do_recalculate_image_properties(CData *cdata, Texture::CData *cdata_tex, const L cdata->_video_length = len; do_adjust_this_size(cdata_tex, x_max, y_max, get_name(), true); - - do_reconsider_image_properties(cdata_tex, x_max, y_max, alpha?4:3, + + do_reconsider_image_properties(cdata_tex, x_max, y_max, alpha?4:3, T_unsigned_byte, cdata->_pages.size(), options); cdata_tex->_orig_file_x_size = cdata->_video_width; cdata_tex->_orig_file_y_size = cdata->_video_height; - do_set_pad_size(cdata_tex, - max(cdata_tex->_x_size - cdata_tex->_orig_file_x_size, 0), + do_set_pad_size(cdata_tex, + max(cdata_tex->_x_size - cdata_tex->_orig_file_x_size, 0), max(cdata_tex->_y_size - cdata_tex->_orig_file_y_size, 0), 0); } @@ -251,14 +251,14 @@ do_read_one(Texture::CData *cdata_tex, return false; } nassertr(z >= 0 && z < cdata_tex->_z_size * cdata_tex->_num_views, false); - + if (record != (BamCacheRecord *)NULL) { record->add_dependent_file(fullpath); } PT(MovieVideoCursor) color; PT(MovieVideoCursor) alpha; - + color = MovieVideo::get(fullpath)->open(); if (color == 0) { return false; @@ -269,7 +269,7 @@ do_read_one(Texture::CData *cdata_tex, return false; } } - + if (z == 0) { if (!has_name()) { set_name(fullpath.get_basename_wo_extension()); @@ -279,18 +279,18 @@ do_read_one(Texture::CData *cdata_tex, cdata_tex->_filename = fullpath; cdata_tex->_alpha_filename = alpha_fullpath; } - + cdata_tex->_fullpath = fullpath; cdata_tex->_alpha_fullpath = alpha_fullpath; } cdata_tex->_primary_file_num_channels = primary_file_num_channels; cdata_tex->_alpha_file_channel = alpha_file_channel; - + if (!do_load_one(cdata_tex, color, alpha, z, options)) { return false; } - + cdata_tex->_loaded_from_image = true; set_loop(true); play(); @@ -316,7 +316,7 @@ do_load_one(Texture::CData *cdata_tex, // padded textures. PTA_uchar image = make_ram_image(); memset(image.p(), 0, image.size()); - + return true; } @@ -366,7 +366,7 @@ has_cull_callback() const { //////////////////////////////////////////////////////////////////// // Function: MovieTexture::cull_callback // Access: Public, Virtual -// Description: This function will be called during the cull +// Description: This function will be called during the cull // traversal to update the MovieTexture. This update // consists of fetching the next video frame from the // underlying MovieVideo sources. The MovieVideo @@ -413,15 +413,15 @@ cull_callback(CullTraverser *, const CullTraverserData &) const { MovieVideoCursor *color = page._color; MovieVideoCursor *alpha = page._alpha; size_t i = pi - cdata->_pages.begin(); - + if (color != NULL && alpha != NULL) { color->apply_to_texture_rgb(page._cbuffer, (MovieTexture*)this, i); alpha->apply_to_texture_alpha(page._abuffer, (MovieTexture*)this, i, cdata_tex->_alpha_file_channel); - + } else if (color != NULL) { color->apply_to_texture(page._cbuffer, (MovieTexture*)this, i); } - + ((VideoPage &)page)._cbuffer.clear(); ((VideoPage &)page)._abuffer.clear(); } @@ -429,7 +429,7 @@ cull_callback(CullTraverser *, const CullTraverserData &) const { // Clear the cached offset so we can update the frame next time. ((CData *)cdata.p())->_has_offset = false; } - + return true; } @@ -441,7 +441,7 @@ cull_callback(CullTraverser *, const CullTraverserData &) const { // as a separate texture from the original, so it will // be duplicated in texture memory (and may be // independently modified if desired). -// +// // If the Texture is a MovieTexture, the resulting // duplicate may be animated independently of the // original. @@ -464,7 +464,7 @@ make_copy_impl() { // Description: Implements make_copy(). //////////////////////////////////////////////////////////////////// void MovieTexture:: -do_assign(CData *cdata, Texture::CData *cdata_tex, const MovieTexture *copy, +do_assign(CData *cdata, Texture::CData *cdata_tex, const MovieTexture *copy, const CData *cdata_copy, const Texture::CData *cdata_copy_tex) { Texture::do_assign(cdata_tex, copy, cdata_copy_tex); @@ -476,7 +476,7 @@ do_assign(CData *cdata, Texture::CData *cdata_tex, const MovieTexture *copy, color[i] = cdata_copy->_pages[i]._color; alpha[i] = cdata_copy->_pages[i]._alpha; } - + cdata->_pages.resize(color.size()); for (int i=0; i<(int)(color.size()); i++) { if (color[i]) { @@ -492,8 +492,8 @@ do_assign(CData *cdata, Texture::CData *cdata_tex, const MovieTexture *copy, //////////////////////////////////////////////////////////////////// // Function: MovieTexture::reload_ram_image // Access: Protected, Virtual -// Description: A MovieTexture must always keep its ram image, -// since there is no way to reload it from the +// Description: A MovieTexture must always keep its ram image, +// since there is no way to reload it from the // source MovieVideo. //////////////////////////////////////////////////////////////////// void MovieTexture:: @@ -505,8 +505,8 @@ do_reload_ram_image(Texture::CData *cdata, bool allow_compression) { //////////////////////////////////////////////////////////////////// // Function: MovieTexture::get_keep_ram_image // Access: Published, Virtual -// Description: A MovieTexture must always keep its ram image, -// since there is no way to reload it from the +// Description: A MovieTexture must always keep its ram image, +// since there is no way to reload it from the // source MovieVideo. //////////////////////////////////////////////////////////////////// bool MovieTexture:: @@ -623,8 +623,8 @@ set_time(double t) { // Description: Returns the current value of the movie's cursor. // If the movie's loop count is greater than one, then // its length is effectively multiplied for the -// purposes of this function. In other words, -// the return value will be in the range 0.0 +// purposes of this function. In other words, +// the return value will be in the range 0.0 // to (length * loopcount). //////////////////////////////////////////////////////////////////// double MovieTexture:: @@ -700,7 +700,7 @@ set_play_rate(double rate) { cdata->_clock -= (now * cdata->_play_rate); } else { cdata->_play_rate = rate; - } + } } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/iphone/config_iphone.h b/panda/src/iphone/config_iphone.h index 19773a668e..2d780baa7f 100644 --- a/panda/src/iphone/config_iphone.h +++ b/panda/src/iphone/config_iphone.h @@ -1,3 +1,6 @@ +// Filename: config_iphone.h +// Created by: drose (08Apr09) +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE diff --git a/panda/src/iphone/config_iphone.mm b/panda/src/iphone/config_iphone.mm index 5d43af569a..a059e1a1b2 100644 --- a/panda/src/iphone/config_iphone.mm +++ b/panda/src/iphone/config_iphone.mm @@ -1,4 +1,4 @@ -// Filename: config_iphone.cxx +// Filename: config_iphone.mm // Created by: drose (08Apr09) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/iphonedisplay/config_iphonedisplay.mm b/panda/src/iphonedisplay/config_iphonedisplay.mm index 204d88c19b..973f540a7d 100644 --- a/panda/src/iphonedisplay/config_iphonedisplay.mm +++ b/panda/src/iphonedisplay/config_iphonedisplay.mm @@ -1,4 +1,4 @@ -// Filename: config_iphonedisplay.cxx +// Filename: config_iphonedisplay.mm // Created by: drose (08Apr09) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/iphonedisplay/iPhoneGraphicsStateGuardian.mm b/panda/src/iphonedisplay/iPhoneGraphicsStateGuardian.mm index 2913fd3bfe..0db10a4ac5 100644 --- a/panda/src/iphonedisplay/iPhoneGraphicsStateGuardian.mm +++ b/panda/src/iphonedisplay/iPhoneGraphicsStateGuardian.mm @@ -1,4 +1,4 @@ -// Filename: iPhoneGraphicsStateGuardian.cxx +// Filename: iPhoneGraphicsStateGuardian.mm // Created by: drose (08Apr09) // //////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ TypeHandle IPhoneGraphicsStateGuardian::_type_handle; // not defined. //////////////////////////////////////////////////////////////////// void *IPhoneGraphicsStateGuardian:: -get_extension_func(const char *prefix, const char *name) { +get_extension_func(const char *prefix, const char *name) { return NULL; } diff --git a/panda/src/iphonedisplay/iPhoneGraphicsWindow.I b/panda/src/iphonedisplay/iPhoneGraphicsWindow.I index 95d8962103..5652892788 100644 --- a/panda/src/iphonedisplay/iPhoneGraphicsWindow.I +++ b/panda/src/iphonedisplay/iPhoneGraphicsWindow.I @@ -1,4 +1,4 @@ -// Filename: iPhoneGraphicsWindow.h +// Filename: iPhoneGraphicsWindow.I // Created by: drose (08Apr09) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/linmath/lorientation_src.I b/panda/src/linmath/lorientation_src.I index 0c108a0e52..4dd6044d90 100644 --- a/panda/src/linmath/lorientation_src.I +++ b/panda/src/linmath/lorientation_src.I @@ -14,7 +14,7 @@ //////////////////////////////////////////////////////////////////// // Function: LOrientation::Default Constructor -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LOrientation):: @@ -23,7 +23,7 @@ FLOATNAME(LOrientation)() { //////////////////////////////////////////////////////////////////// // Function: LOrientation::Copy Constructor -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LOrientation):: @@ -33,7 +33,7 @@ FLOATNAME(LOrientation)(const FLOATNAME(LQuaternion)& c) : //////////////////////////////////////////////////////////////////// // Function: LOrientation::Constructor -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LOrientation):: @@ -43,7 +43,7 @@ FLOATNAME(LOrientation)(FLOATTYPE r, FLOATTYPE i, FLOATTYPE j, FLOATTYPE k) : //////////////////////////////////////////////////////////////////// // Function: LOrientation::Constructor -// Access: public +// Access: Public // Description: vector + twist //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LOrientation):: @@ -60,7 +60,7 @@ FLOATNAME(LOrientation)(const FLOATNAME(LVector3) &point_at, FLOATTYPE twist) { //////////////////////////////////////////////////////////////////// // Function: LOrientation::Constructor -// Access: public +// Access: Public // Description: matrix3 //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LOrientation):: @@ -70,7 +70,7 @@ FLOATNAME(LOrientation)(const FLOATNAME(LMatrix3) &m) { //////////////////////////////////////////////////////////////////// // Function: LOrientation::Constructor -// Access: public +// Access: Public // Description: matrix4 //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LOrientation):: @@ -80,7 +80,7 @@ FLOATNAME(LOrientation)(const FLOATNAME(LMatrix4) &m) { //////////////////////////////////////////////////////////////////// // Function: LOrientation::operator * -// Access: public +// Access: Public // Description: Orientation * rotation = Orientation // Applies a rotation to an orientation. //////////////////////////////////////////////////////////////////// @@ -91,7 +91,7 @@ operator * (const FLOATNAME(LRotation) &other) const { //////////////////////////////////////////////////////////////////// // Function: LOrientation::operator * -// Access: public +// Access: Public // Description: Orientation * Orientation // This is a meaningless operation, and will always // simply return the rhs. diff --git a/panda/src/linmath/lorientation_src.h b/panda/src/linmath/lorientation_src.h index 9c92abbb1a..238398f2f1 100644 --- a/panda/src/linmath/lorientation_src.h +++ b/panda/src/linmath/lorientation_src.h @@ -14,10 +14,10 @@ class FLOATNAME(LRotation); -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : LOrientation // Description : This is a unit quaternion representing an orientation. -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class EXPCL_PANDA_LINMATH FLOATNAME(LOrientation) : public FLOATNAME(LQuaternion) { PUBLISHED: INLINE_LINMATH FLOATNAME(LOrientation)(); diff --git a/panda/src/linmath/lpoint2_ext.h b/panda/src/linmath/lpoint2_ext.h index c4a1a068e5..58a6e17429 100644 --- a/panda/src/linmath/lpoint2_ext.h +++ b/panda/src/linmath/lpoint2_ext.h @@ -1,4 +1,4 @@ -// Filename: lpoint2_ext.I +// Filename: lpoint2_ext.h // Created by: rdb (13Sep13) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/linmath/lpoint3_ext.h b/panda/src/linmath/lpoint3_ext.h index 5ba6d499c1..c526c01da6 100644 --- a/panda/src/linmath/lpoint3_ext.h +++ b/panda/src/linmath/lpoint3_ext.h @@ -1,4 +1,4 @@ -// Filename: lpoint3_ext.I +// Filename: lpoint3_ext.h // Created by: rdb (13Sep13) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/linmath/lpoint4_ext.h b/panda/src/linmath/lpoint4_ext.h index 31704152a4..d0aa4b3036 100644 --- a/panda/src/linmath/lpoint4_ext.h +++ b/panda/src/linmath/lpoint4_ext.h @@ -1,4 +1,4 @@ -// Filename: lpoint4_ext.I +// Filename: lpoint4_ext.h // Created by: rdb (13Sep13) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/linmath/lquaternion_src.I b/panda/src/linmath/lquaternion_src.I index 79ebf049f6..09bb734248 100644 --- a/panda/src/linmath/lquaternion_src.I +++ b/panda/src/linmath/lquaternion_src.I @@ -14,7 +14,7 @@ //////////////////////////////////////////////////////////////////// // Function: LQuaternion::Default Constructor -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LQuaternion):: @@ -23,7 +23,7 @@ FLOATNAME(LQuaternion)() { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::Copy Constructor -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LQuaternion):: @@ -34,7 +34,7 @@ FLOATNAME(LQuaternion)(const FLOATNAME(LVecBase4) ©) : //////////////////////////////////////////////////////////////////// // Function: LQuaternion::Copy Constructor -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LQuaternion):: @@ -44,7 +44,7 @@ FLOATNAME(LQuaternion)(FLOATTYPE r, const FLOATNAME(LVecBase3) ©) { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::Constructor -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LQuaternion):: @@ -175,7 +175,7 @@ operator / (FLOATTYPE scalar) const { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::Multiply Operator -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LQuaternion) FLOATNAME(LQuaternion):: @@ -185,7 +185,7 @@ operator *(const FLOATNAME(LQuaternion)& c) const { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::Multiply Assignment Operator -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LQuaternion)& FLOATNAME(LQuaternion):: @@ -196,7 +196,7 @@ operator *=(const FLOATNAME(LQuaternion)& c) { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::Multiply Operator -// Access: public +// Access: Public // Description: Quat * Matrix = matrix //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LQuaternion):: @@ -208,7 +208,7 @@ operator *(const FLOATNAME(LMatrix3) &m) { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::Multiply Operator -// Access: public +// Access: Public // Description: Quat * Matrix = matrix //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix4) FLOATNAME(LQuaternion):: @@ -227,7 +227,7 @@ operator *(const FLOATNAME(LMatrix4) &m) { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::almost_equal -// Access: public +// Access: Public // Description: Returns true if two quaternions are memberwise equal // within a default tolerance based on the numeric type. //////////////////////////////////////////////////////////////////// @@ -238,7 +238,7 @@ almost_equal(const FLOATNAME(LQuaternion) &other) const { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::almost_equal -// Access: public +// Access: Public // Description: Returns true if two quaternions are memberwise equal // within a specified tolerance. //////////////////////////////////////////////////////////////////// @@ -253,7 +253,7 @@ almost_equal(const FLOATNAME(LQuaternion) &other, //////////////////////////////////////////////////////////////////// // Function: LQuaternion::is_same_direction -// Access: public +// Access: Public // Description: Returns true if two quaternions represent the same // rotation within a default tolerance based on the // numeric type. @@ -265,19 +265,19 @@ is_same_direction(const FLOATNAME(LQuaternion) &other) const { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::almost_same_direction -// Access: public +// Access: Public // Description: Returns true if two quaternions represent the same // rotation within a specified tolerance. //////////////////////////////////////////////////////////////////// INLINE_LINMATH bool FLOATNAME(LQuaternion):: -almost_same_direction(const FLOATNAME(LQuaternion) &other, +almost_same_direction(const FLOATNAME(LQuaternion) &other, FLOATTYPE threshold) const { return ((*this) * invert(other)).is_almost_identity(threshold); } //////////////////////////////////////////////////////////////////// // Function: LQuaternion::output -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH void FLOATNAME(LQuaternion):: @@ -422,7 +422,7 @@ get_forward(CoordinateSystem cs) const { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::get_r -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATTYPE FLOATNAME(LQuaternion):: @@ -432,7 +432,7 @@ get_r() const { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::get_i -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATTYPE FLOATNAME(LQuaternion):: @@ -442,7 +442,7 @@ get_i() const { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::get_j -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATTYPE FLOATNAME(LQuaternion):: @@ -452,7 +452,7 @@ get_j() const { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::get_k -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATTYPE FLOATNAME(LQuaternion):: @@ -462,7 +462,7 @@ get_k() const { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::set_r -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH void FLOATNAME(LQuaternion):: @@ -472,7 +472,7 @@ set_r(FLOATTYPE r) { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::set_i -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH void FLOATNAME(LQuaternion):: @@ -482,7 +482,7 @@ set_i(FLOATTYPE i) { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::set_j -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH void FLOATNAME(LQuaternion):: @@ -492,7 +492,7 @@ set_j(FLOATTYPE j) { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::set_k -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH void FLOATNAME(LQuaternion):: @@ -502,7 +502,7 @@ set_k(FLOATTYPE k) { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::normalize -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH bool FLOATNAME(LQuaternion):: @@ -619,7 +619,7 @@ is_identity() const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH bool FLOATNAME(LQuaternion):: is_almost_identity(FLOATTYPE tolerance) const { - return (IS_THRESHOLD_EQUAL(_v(0), -1.0f, tolerance) || + return (IS_THRESHOLD_EQUAL(_v(0), -1.0f, tolerance) || IS_THRESHOLD_EQUAL(_v(0), 1.0f, tolerance)); } @@ -652,7 +652,7 @@ invert(const FLOATNAME(LQuaternion) &a) { //////////////////////////////////////////////////////////////////// // Function: operator *(Matrix3, Quat) -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix3) operator *(const FLOATNAME(LMatrix3) &m, @@ -665,7 +665,7 @@ INLINE_LINMATH FLOATNAME(LMatrix3) operator *(const FLOATNAME(LMatrix3) &m, //////////////////////////////////////////////////////////////////// // Function: operator *(Matrix4, Quat) -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix4) operator *(const FLOATNAME(LMatrix4) &m, diff --git a/panda/src/linmath/lquaternion_src.cxx b/panda/src/linmath/lquaternion_src.cxx index 992665cf00..22ccabd65f 100644 --- a/panda/src/linmath/lquaternion_src.cxx +++ b/panda/src/linmath/lquaternion_src.cxx @@ -1,5 +1,5 @@ // Filename: lquaternion_src.cxx -// Created by: +// Created by: // //////////////////////////////////////////////////////////////////// // @@ -23,7 +23,7 @@ const FLOATNAME(LQuaternion) FLOATNAME(LQuaternion)::_ident_quat = //////////////////////////////////////////////////////////////////// // Function: LQuaternion::pure_imaginary_quat -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// FLOATNAME(LQuaternion) FLOATNAME(LQuaternion):: @@ -76,7 +76,7 @@ extract_to_matrix(FLOATNAME(LMatrix4) &m) const { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::set_hpr -// Access: public +// Access: Public // Description: Sets the quaternion as the unit quaternion that // is equivalent to these Euler angles. // (from Real-time Rendering, p.49) @@ -126,7 +126,7 @@ set_hpr(const FLOATNAME(LVecBase3) &hpr, CoordinateSystem cs) { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::get_hpr -// Access: public +// Access: Public // Description: Extracts the equivalent Euler angles from the unit // quaternion. //////////////////////////////////////////////////////////////////// @@ -147,7 +147,7 @@ get_hpr(CoordinateSystem cs) const { FLOATTYPE s = (N == 0.0f) ? 0.0f : (2.0f / N); FLOATTYPE xs, ys, zs, wx, wy, wz, xx, xy, xz, yy, yz, zz, c1, c2, c3, c4; FLOATTYPE cr, sr, cp, sp, ch, sh; - + xs = _v(1) * s; ys = _v(2) * s; zs = _v(3) * s; wx = _v(0) * xs; wy = _v(0) * ys; wz = _v(0) * zs; xx = _v(1) * xs; xy = _v(1) * ys; xz = _v(1) * zs; @@ -156,7 +156,7 @@ get_hpr(CoordinateSystem cs) const { c2 = 1.0f - (xx + yy); c3 = 1.0f - (yy + zz); c4 = xy + wz; - + if (c1 == 0.0f) { // (roll = 0 or 180) or (pitch = +/- 90) if (c2 >= 0.0f) { hpr[2] = 0.0f; @@ -214,7 +214,7 @@ get_hpr(CoordinateSystem cs) const { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::set_from_matrix -// Access: public +// Access: Public // Description: Sets the quaternion according to the rotation // represented by the matrix. Originally we tried an // algorithm presented by Do-While Jones, but that @@ -298,7 +298,7 @@ set_from_matrix(const FLOATNAME(LMatrix3) &m) { //////////////////////////////////////////////////////////////////// // Function: LQuaternion::init_type -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// void FLOATNAME(LQuaternion):: diff --git a/panda/src/linmath/lrotation_src.I b/panda/src/linmath/lrotation_src.I index a7aab78ca5..2ff93ccda5 100644 --- a/panda/src/linmath/lrotation_src.I +++ b/panda/src/linmath/lrotation_src.I @@ -14,7 +14,7 @@ //////////////////////////////////////////////////////////////////// // Function: LRotation::Default Constructor -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LRotation):: @@ -23,7 +23,7 @@ FLOATNAME(LRotation)() { //////////////////////////////////////////////////////////////////// // Function: LRotation::Copy Constructor -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LRotation):: @@ -33,7 +33,7 @@ FLOATNAME(LRotation)(const FLOATNAME(LQuaternion) &c) : //////////////////////////////////////////////////////////////////// // Function: LRotation::Copy Constructor -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LRotation):: @@ -43,7 +43,7 @@ FLOATNAME(LRotation)(const FLOATNAME(LVecBase4) ©) : //////////////////////////////////////////////////////////////////// // Function: LRotation::Constructor -// Access: public +// Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LRotation):: @@ -53,7 +53,7 @@ FLOATNAME(LRotation)(FLOATTYPE r, FLOATTYPE i, FLOATTYPE j, FLOATTYPE k) : //////////////////////////////////////////////////////////////////// // Function: LRotation::Constructor -// Access: public +// Access: Public // Description: lmatrix3 //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LRotation):: @@ -63,7 +63,7 @@ FLOATNAME(LRotation)(const FLOATNAME(LMatrix3) &m) { //////////////////////////////////////////////////////////////////// // Function: LRotation::Constructor -// Access: public +// Access: Public // Description: lmatrix4 //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LRotation):: @@ -73,7 +73,7 @@ FLOATNAME(LRotation)(const FLOATNAME(LMatrix4) &m) { //////////////////////////////////////////////////////////////////// // Function: LRotation::Constructor -// Access: public +// Access: Public // Description: axis + angle (in degrees) //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LRotation):: @@ -90,7 +90,7 @@ FLOATNAME(LRotation)(const FLOATNAME(LVector3) &axis, FLOATTYPE angle) { //////////////////////////////////////////////////////////////////// // Function: LRotation::Constructor -// Access: public +// Access: Public // Description: Sets the rotation from the given Euler angles. //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LRotation):: @@ -120,7 +120,7 @@ operator / (FLOATTYPE scalar) const { //////////////////////////////////////////////////////////////////// // Function: LRotation::operator * -// Access: public +// Access: Public // Description: Rotation * Rotation = Rotation //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LRotation) FLOATNAME(LRotation):: @@ -130,7 +130,7 @@ operator * (const FLOATNAME(LRotation) &other) const { //////////////////////////////////////////////////////////////////// // Function: LRotation::operator * -// Access: public +// Access: Public // Description: Rotation * Orientation = Orientation // This is another meaningless operation, attempting // to apply an orientation to a rotation. diff --git a/panda/src/linmath/lrotation_src.h b/panda/src/linmath/lrotation_src.h index 374a0e17a1..3c21cc767e 100644 --- a/panda/src/linmath/lrotation_src.h +++ b/panda/src/linmath/lrotation_src.h @@ -12,10 +12,10 @@ // //////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : LRotation // Description : This is a unit quaternion representing a rotation. -//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class EXPCL_PANDA_LINMATH FLOATNAME(LRotation) : public FLOATNAME(LQuaternion) { PUBLISHED: INLINE_LINMATH FLOATNAME(LRotation)(); diff --git a/panda/src/linmath/lvecBase2_ext.h b/panda/src/linmath/lvecBase2_ext.h index 9e2e262596..c9e91d876a 100644 --- a/panda/src/linmath/lvecBase2_ext.h +++ b/panda/src/linmath/lvecBase2_ext.h @@ -1,4 +1,4 @@ -// Filename: lvecBase2_ext.I +// Filename: lvecBase2_ext.h // Created by: rdb (13Sep13) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/linmath/lvecBase3_ext.h b/panda/src/linmath/lvecBase3_ext.h index 26180bfb42..8fa47de8ee 100644 --- a/panda/src/linmath/lvecBase3_ext.h +++ b/panda/src/linmath/lvecBase3_ext.h @@ -1,4 +1,4 @@ -// Filename: lvecBase3_ext.I +// Filename: lvecBase3_ext.h // Created by: rdb (13Sep13) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/linmath/lvecBase4_ext.h b/panda/src/linmath/lvecBase4_ext.h index 5ece57435e..01e6186238 100644 --- a/panda/src/linmath/lvecBase4_ext.h +++ b/panda/src/linmath/lvecBase4_ext.h @@ -1,4 +1,4 @@ -// Filename: lvecBase4_ext.I +// Filename: lvecBase4_ext.h // Created by: rdb (13Sep13) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/linmath/lvector2_ext.h b/panda/src/linmath/lvector2_ext.h index 824b60a908..bed698e8f1 100644 --- a/panda/src/linmath/lvector2_ext.h +++ b/panda/src/linmath/lvector2_ext.h @@ -1,4 +1,4 @@ -// Filename: lvector2_ext.I +// Filename: lvector2_ext.h // Created by: rdb (13Sep13) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/linmath/lvector3_ext.h b/panda/src/linmath/lvector3_ext.h index 3423fc351e..3f135e1844 100644 --- a/panda/src/linmath/lvector3_ext.h +++ b/panda/src/linmath/lvector3_ext.h @@ -1,4 +1,4 @@ -// Filename: lvector3_ext.I +// Filename: lvector3_ext.h // Created by: rdb (13Sep13) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/linmath/lvector3_src.I b/panda/src/linmath/lvector3_src.I index 1144c14e07..ff047ff63e 100644 --- a/panda/src/linmath/lvector3_src.I +++ b/panda/src/linmath/lvector3_src.I @@ -259,7 +259,7 @@ angle_deg(const FLOATNAME(LVector3) &other) const { // normalized. //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATTYPE FLOATNAME(LVector3):: -signed_angle_rad(const FLOATNAME(LVector3) &other, +signed_angle_rad(const FLOATNAME(LVector3) &other, const FLOATNAME(LVector3) &ref) const { FLOATTYPE angle = angle_rad(other); if (cross(other).dot(ref) < 0.0f) { @@ -271,7 +271,7 @@ signed_angle_rad(const FLOATNAME(LVector3) &other, //////////////////////////////////////////////////////////////////// // Function: LVector::signed_angle_deg // Access: Published -// Description: Returns the signed angle between two vectors. +// Description: Returns the signed angle between two vectors. // The angle is positive if the rotation from this // vector to other is clockwise when looking in the // direction of the ref vector. @@ -435,7 +435,6 @@ back(CoordinateSystem cs) { // forward, and up components, in whatever way the // coordinate system represents that vector. //////////////////////////////////////////////////////////////////// -//INLINE_LINMATH FLOATNAME(LVector3) &FLOATNAME(LVector3):: INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LVector3):: rfu(FLOATTYPE right_v, FLOATTYPE fwd_v, FLOATTYPE up_v, CoordinateSystem cs) { diff --git a/panda/src/linmath/lvector4_ext.h b/panda/src/linmath/lvector4_ext.h index a7805a2ab5..0580432f6f 100644 --- a/panda/src/linmath/lvector4_ext.h +++ b/panda/src/linmath/lvector4_ext.h @@ -1,4 +1,4 @@ -// Filename: lvector4_ext.I +// Filename: lvector4_ext.h // Created by: rdb (13Sep13) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/movies/movieVideoCursor.cxx b/panda/src/movies/movieVideoCursor.cxx index 8129e7b898..2b800b9e26 100644 --- a/panda/src/movies/movieVideoCursor.cxx +++ b/panda/src/movies/movieVideoCursor.cxx @@ -1,4 +1,4 @@ -// Filename: movieVideo.cxx +// Filename: movieVideoCursor.cxx // Created by: jyelon (02Jul07) // //////////////////////////////////////////////////////////////////// @@ -51,12 +51,12 @@ MovieVideoCursor(MovieVideo *src) : //////////////////////////////////////////////////////////////////// // Function: MovieVideoCursor::Destructor // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// MovieVideoCursor:: ~MovieVideoCursor() { } - + //////////////////////////////////////////////////////////////////// // Function: MovieVideoCursor::setup_texture // Access: Published @@ -139,20 +139,20 @@ apply_to_texture(const Buffer *buffer, Texture *t, int page) { nassertv((t->get_num_components() == 3) || (t->get_num_components() == 4)); nassertv(t->get_component_width() == 1); nassertv(page < t->get_num_pages()); - + PTA_uchar img; { PStatTimer timer2(_copy_pcollector_ram); t->set_keep_ram_image(true); img = t->modify_ram_image(); } - + unsigned char *data = img.p() + page * t->get_expected_ram_page_size(); PStatTimer timer2(_copy_pcollector_copy); if (t->get_x_size() == size_x() && t->get_num_components() == get_num_components()) { memcpy(data, buffer->_block, size_x() * size_y() * get_num_components()); - + } else { unsigned char *p = buffer->_block; if (t->get_num_components() == get_num_components()) { @@ -207,9 +207,9 @@ apply_to_texture_alpha(const Buffer *buffer, Texture *t, int page, int alpha_src t->set_keep_ram_image(true); img = t->modify_ram_image(); } - + unsigned char *data = img.p() + page * t->get_expected_ram_page_size(); - + PStatTimer timer2(_copy_pcollector_copy); int src_width = get_num_components(); int src_stride = size_x() * src_width; @@ -256,16 +256,16 @@ apply_to_texture_rgb(const Buffer *buffer, Texture *t, int page) { nassertv(t->get_num_components() == 4); nassertv(t->get_component_width() == 1); nassertv(page < t->get_z_size()); - + PTA_uchar img; { PStatTimer timer2(_copy_pcollector_ram); t->set_keep_ram_image(true); img = t->modify_ram_image(); } - + unsigned char *data = img.p() + page * t->get_expected_ram_page_size(); - + PStatTimer timer2(_copy_pcollector_copy); int src_stride = size_x() * get_num_components(); int src_width = get_num_components(); @@ -354,7 +354,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { //////////////////////////////////////////////////////////////////// // Function: MovieVideoCursor::Buffer::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// MovieVideoCursor::Buffer:: Buffer(size_t block_size) : @@ -367,7 +367,7 @@ Buffer(size_t block_size) : //////////////////////////////////////////////////////////////////// // Function: MovieVideoCursor::Buffer::Destructor // Access: Published, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// MovieVideoCursor::Buffer:: ~Buffer() { diff --git a/panda/src/movies/vorbisAudio.I b/panda/src/movies/vorbisAudio.I index f03256aa47..36d22c0b7c 100644 --- a/panda/src/movies/vorbisAudio.I +++ b/panda/src/movies/vorbisAudio.I @@ -1,4 +1,4 @@ -// Filename: wavAudio.I +// Filename: vorbisAudio.I // Created by: rdb (23Aug13) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/movies/vorbisAudioCursor.I b/panda/src/movies/vorbisAudioCursor.I index 88afa719ff..45a77c7a57 100644 --- a/panda/src/movies/vorbisAudioCursor.I +++ b/panda/src/movies/vorbisAudioCursor.I @@ -1,4 +1,4 @@ -// Filename: wavAudioCursor.I +// Filename: vorbisAudioCursor.I // Created by: rdb (23Aug13) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/nativenet/buffered_datagramconnection.cxx b/panda/src/nativenet/buffered_datagramconnection.cxx index e19c4a1bb9..27fbada1f4 100644 --- a/panda/src/nativenet/buffered_datagramconnection.cxx +++ b/panda/src/nativenet/buffered_datagramconnection.cxx @@ -21,11 +21,8 @@ TypeHandle Buffered_DatagramConnection::_type_handle; //////////////////////////////////////////////////////////////////// -// Function name : Buffered_DatagramConnection::SendMessage -// Description : send the message -// -// Return type : bool -// Argument : DataGram &msg +// Function: Buffered_DatagramConnection::SendMessage +// Description: send the message //////////////////////////////////////////////////////////////////// bool Buffered_DatagramConnection:: SendMessage(const Datagram &msg) { diff --git a/panda/src/nativenet/buffered_datagramconnection.h b/panda/src/nativenet/buffered_datagramconnection.h index fb438d5cbb..3cfd6bff13 100644 --- a/panda/src/nativenet/buffered_datagramconnection.h +++ b/panda/src/nativenet/buffered_datagramconnection.h @@ -1,12 +1,12 @@ #ifndef __NONECLOCKING_CONNECTTION_H_ #define __NONECLOCKING_CONNECTTION_H_ //////////////////////////////////////////////////////////////////// -// +// // Ok here is the base behavior.. -// A message IO engin that is Smart enough to Do +// A message IO engin that is Smart enough to Do // // 1. Non Blocking Connect .. and Buffer the writes if needed -// 2. Handle 1 to N targets for the connection.. +// 2. Handle 1 to N targets for the connection.. // // 3. Handle Framing and Unframing properly .. // @@ -20,20 +20,20 @@ #include "buffered_datagramwriter.h" #include "config_nativenet.h" -//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // there are 3 states // // 1. Socket not even assigned,,,, // 2. Socket Assigned and trying to get a active connect open // 3. Socket is open and writable.. ( Fully powered up )... // -/////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class EXPCL_PANDA_NATIVENET Buffered_DatagramConnection : public Socket_TCP { private: struct AddressQueue : private pvector // this is used to do a round robin for addres to connect to .. - { - size_t _active_index; + { + size_t _active_index; INLINE AddressQueue() : _active_index(0) {} @@ -47,9 +47,9 @@ private: _active_index = 0; } - out = (*this)[_active_index++]; + out = (*this)[_active_index++]; return true; - } + } INLINE void clear() { pvector::clear(); @@ -67,17 +67,17 @@ private: }; protected: - // c++ upcalls for + // c++ upcalls for virtual void PostConnect(void) { }; virtual void NewWriteBuffer(void) { }; - /////////////////////////////////////////// + inline void ClearAll(void); inline bool SendMessageBufferOnly(Datagram &msg); // do not use this .. this is a way for the the COnnecting UPcall to drop messages in queue first.. PUBLISHED: inline bool GetMessage(Datagram &val); inline bool DoConnect(void); // all the real state magic is in here - inline bool IsConnected(void); + inline bool IsConnected(void); inline Buffered_DatagramConnection(int rbufsize, int wbufsize, int write_flush_point) ; virtual ~Buffered_DatagramConnection(void) ; // the reason thsi all exists @@ -85,7 +85,7 @@ PUBLISHED: inline bool Flush(void); inline void Reset(void); -// int WaitFor_Read_Error(const Socket_fdset & fd, const Time_Span & timeout); + //int WaitFor_Read_Error(const Socket_fdset & fd, const Time_Span & timeout); inline void WaitForNetworkReadEvent(PN_stdfloat MaxTime) { @@ -96,7 +96,6 @@ PUBLISHED: selector.WaitFor_Read_Error(fdset,waittime); } - // address queue stuff inline size_t AddressQueueSize() { return _Addresslist.size(); }; inline void AddAddress(Socket_Address &inadr); @@ -129,11 +128,8 @@ private: }; //////////////////////////////////////////////////////////////////// -// Function name : Buffered_DatagramConnection::ClearAll -// Description : used to do a full reset of buffers -// -// Return type : inline void -// Argument : void +// Function: Buffered_DatagramConnection::ClearAll +// Description: used to do a full reset of buffers //////////////////////////////////////////////////////////////////// inline void Buffered_DatagramConnection::ClearAll(void) { nativenet_cat.error() << "Buffered_DatagramConnection::ClearAll Starting Auto Reset\n"; @@ -145,47 +141,44 @@ inline void Buffered_DatagramConnection::ClearAll(void) { inline bool Buffered_DatagramConnection::DoConnect(void) { if(!_Addresslist.GetNext(_Adddress)) // lookup the proper value... return false; - + if(ActiveOpen(_Adddress,true) == true) { SetNoDelay(); SetNonBlocking(); // maybe should be blocking? NewWriteBuffer(); return true; } - + return false; - + } /* //////////////////////////////////////////////////////////////////// -// Function name : Buffered_DatagramConnection::DoConnect -// Description : This is the function thah does the conection for us -// -// Return type : inline bool -// Argument : void +// Function: Buffered_DatagramConnection::DoConnect +// Description: This is the function thah does the conection for us //////////////////////////////////////////////////////////////////// inline bool Buffered_DatagramConnection::DoConnect(void) { - if(Active() != true) { + if(Active() != true) { if(_LastConnectTry.Expired() != true) return true; - + if(!_Addresslist.GetNext(_Adddress)) // lookup the proper value... return false; - + if(ActiveOpen(_Adddress) == true) { _LastConnectTry.ReStart(); - _tryingToOpen = true; // set the flag indicating we are trying to open up + _tryingToOpen = true; // set the flag indicating we are trying to open up SetNonBlocking(); // maybe should be blocking? SetSendBufferSize(1024*50); // we need to hand tune these for the os we are using SetRecvBufferSize(1024*50); NewWriteBuffer(); return true; } - + return true; } - + if(_tryingToOpen) { // okay handle the i am connecting state.... Socket_fdset fdset; fdset.setForSocket(*this); @@ -194,42 +187,34 @@ inline bool Buffered_DatagramConnection::DoConnect(void) { _tryingToOpen = false; if(selector._error.IsSetFor(*this) == true) { // means we are in errorconnected. else writable ClearAll(); - return false; // error on connect + return false; // error on connect } PostConnect(); return true; // just got connected } return true; // still connecting - } + } return true; } */ //////////////////////////////////////////////////////////////////// -// Function name : Buffered_DatagramConnection::~Buffered_DatagramConnection -// Description : -// -// Return type : inline -// Argument : void +// Function: Buffered_DatagramConnection::~Buffered_DatagramConnection +// Description: //////////////////////////////////////////////////////////////////// -inline Buffered_DatagramConnection::~Buffered_DatagramConnection(void) +inline Buffered_DatagramConnection::~Buffered_DatagramConnection(void) { Close(); } //////////////////////////////////////////////////////////////////// -// Function name : Buffered_DatagramConnection::Buffered_DatagramConnection -// Description : -// -// Return type : inline -// Argument : bool do_blocking_writes -// Argument : int rbufsize -// Argument : int wbufsize +// Function: Buffered_DatagramConnection::Buffered_DatagramConnection +// Description: //////////////////////////////////////////////////////////////////// -inline Buffered_DatagramConnection::Buffered_DatagramConnection(int rbufsize, int wbufsize, int write_flush_point) - : _Writer(wbufsize,write_flush_point) , _Reader(rbufsize) +inline Buffered_DatagramConnection::Buffered_DatagramConnection(int rbufsize, int wbufsize, int write_flush_point) + : _Writer(wbufsize,write_flush_point) , _Reader(rbufsize) { - nativenet_cat.error() << "Buffered_DatagramConnection Constructor rbufsize = " << rbufsize + nativenet_cat.error() << "Buffered_DatagramConnection Constructor rbufsize = " << rbufsize << " wbufsize = " << wbufsize << " write_flush_point = " << write_flush_point << "\n"; } @@ -245,11 +230,8 @@ inline bool Buffered_DatagramConnection::SendMessageBufferOnly(Datagram &msg) } //////////////////////////////////////////////////////////////////// -// Function name : Buffered_DatagramConnection::Init -// Description : must be called to set value to the server -// -// Return type : inline void -// Argument : Socket_Address &inadr +// Function: Buffered_DatagramConnection::Init +// Description: must be called to set value to the server //////////////////////////////////////////////////////////////////// inline void Buffered_DatagramConnection::AddAddress(Socket_Address &inadr) { @@ -261,18 +243,12 @@ inline void Buffered_DatagramConnection::ClearAddresses(void) _Addresslist.clear(); } //////////////////////////////////////////////////////////////////// -// Function name : Buffered_DatagramConnection::GetMessage -// Description : read a message -// -// false means something bad happened.. -// -// -// Return type : inline bool -// Argument : Datagram &val +// Function: Buffered_DatagramConnection::GetMessage +// Description: Reads a message. Returns false on failure. //////////////////////////////////////////////////////////////////// inline bool Buffered_DatagramConnection::GetMessage(Datagram &val) { - if(IsConnected()) + if(IsConnected()) { int ans1 = _Reader.PumpMessageReader(val,*this); if(ans1 == 0) @@ -290,11 +266,8 @@ inline bool Buffered_DatagramConnection::GetMessage(Datagram &val) //////////////////////////////////////////////////////////////////// -// Function name : Buffered_DatagramConnection::Flush -// Description : flush all wrightes -// -// Return type : bool -// Argument : void +// Function: Buffered_DatagramConnection::Flush +// Description: Flush all writes. //////////////////////////////////////////////////////////////////// bool Buffered_DatagramConnection::Flush(void) { @@ -303,34 +276,28 @@ bool Buffered_DatagramConnection::Flush(void) int flush_resp = _Writer.FlushNoBlock(*this); if(flush_resp < 0) { - nativenet_cat.error() << "Buffered_DatagramConnection::Flush->Error On Flush [" <Error On Flush [" <Error ..Write--Out Buffer = " << _Writer.AmountBuffered() << "\n"; - ClearAll(); + ClearAll(); return false; } return true; } return false; } + //////////////////////////////////////////////////////////////////// -// Function name : Buffered_DatagramConnection::Reset -// Description : Reset -// -// Return type : void -// Argument : void +// Function: Buffered_DatagramConnection::Reset +// Description: Reset //////////////////////////////////////////////////////////////////// -inline void Buffered_DatagramConnection::Reset() -{ +inline void Buffered_DatagramConnection::Reset() { nativenet_cat.error() << "Buffered_DatagramConnection::Reset()\n"; ClearAll(); -}; - - -inline bool Buffered_DatagramConnection::IsConnected(void) { - return ( Active() == true ); } +inline bool Buffered_DatagramConnection::IsConnected(void) { + return (Active() == true); +} #endif //__NONECLOCKING_CONNECTTION_H_ - diff --git a/panda/src/nativenet/buffered_datagramreader.i b/panda/src/nativenet/buffered_datagramreader.I similarity index 53% rename from panda/src/nativenet/buffered_datagramreader.i rename to panda/src/nativenet/buffered_datagramreader.I index 4e4162433a..e8cb866c6d 100644 --- a/panda/src/nativenet/buffered_datagramreader.i +++ b/panda/src/nativenet/buffered_datagramreader.I @@ -1,49 +1,43 @@ //////////////////////////////////////////////////////////////////// -// Function name : Buffered_DatagramReader::GetMessageInplace -// Description : A function that will peal a core message of the input buffer -// -// Return type : inline bool -// Argument : CoreMessage &inmsg +// Function: Buffered_DatagramReader::GetMessageInplace +// Description: A function that will peal a core message of the input buffer +// //////////////////////////////////////////////////////////////////// inline bool Buffered_DatagramReader::GetMessageFromBuffer(Datagram &inmsg) { bool answer = false; - size_t DataAvail = FastAmountBeffered(); + size_t DataAvail = FastAmountBeffered(); if(DataAvail >= sizeof(short)) { char *ff = FastGetMessageHead(); - unsigned short len=GetUnsignedShort(ff); + unsigned short len=GetUnsignedShort(ff); len += sizeof(unsigned short); if(len <= DataAvail) { inmsg.assign(ff+2,len-2); - _StartPos += len; + _StartPos += len; answer = true; } } return answer; } //////////////////////////////////////////////////////////////////// -// Function name : Buffered_DatagramReader::Buffered_DatagramReader -// Description : constructore .. passes size up to ring buffer -// -// Return type : inline -// Argument : int in_size +// Function: Buffered_DatagramReader::Buffered_DatagramReader +// Description: constructore .. passes size up to ring buffer +// //////////////////////////////////////////////////////////////////// inline Buffered_DatagramReader::Buffered_DatagramReader(int in_size) : RingBuffer(in_size) -{ - +{ + } //////////////////////////////////////////////////////////////////// -// Function name : Buffered_DatagramReader::ReSet -// Description : Reaset all read content.. IE zero's out buffer... -// +// Function: Buffered_DatagramReader::ReSet +// Description: Reaset all read content.. IE zero's out buffer... +// // If you lose framing this will not help // -// Return type : inline void -// Argument : void //////////////////////////////////////////////////////////////////// -inline void Buffered_DatagramReader::ReSet(void) +inline void Buffered_DatagramReader::ReSet(void) { ResetContent(); } diff --git a/panda/src/nativenet/buffered_datagramreader.h b/panda/src/nativenet/buffered_datagramreader.h index 7866871da6..6627c78572 100644 --- a/panda/src/nativenet/buffered_datagramreader.h +++ b/panda/src/nativenet/buffered_datagramreader.h @@ -18,10 +18,10 @@ class Buffered_DatagramReader : protected RingBuffer inline bool GetMessageFromBuffer(Datagram &inmsg); public: inline Buffered_DatagramReader(int in_size = 8192) ; - inline void ReSet(void); + inline void ReSet(void); // - // SOCK_TYPE is used to allow for - // abstract socket type to be used .. + // SOCK_TYPE is used to allow for + // abstract socket type to be used .. // see socket_tcp and socket_ssl template < class SOCK_TYPE> @@ -29,7 +29,7 @@ public: { if(GetMessageFromBuffer(inmsg) == true) return 1; - int rp = ReadPump(sck); + int rp = ReadPump(sck); if(rp == 0) return 0; @@ -59,7 +59,7 @@ public: int gotbytes = sck.RecvData(ff,(int)readsize); if(gotbytes < 0) // some error { - //int er = GETERROR(); + //int er = GETERROR(); if(!sck.ErrorIs_WouldBlocking(gotbytes) ) { answer = -3; // hard error ? @@ -86,13 +86,12 @@ public: { answer = -2; nativenet_cat.error() << "buffered_datagram_reader:ReadPump Yeep! buffer has no room to read to -- " << sck.GetPeerName().get_ip_port().c_str() << "\nBufferAvaiable = " << readsize <<" AmountBuffered = " << AmountBuffered() << " BufferSize " << GetBufferSize() << "\n"; - } return answer; } }; -#include "buffered_datagramreader.i" +#include "buffered_datagramreader.I" #endif //__BUFFEREDREADER_GM_H__ diff --git a/panda/src/nativenet/buffered_datagramwriter.h b/panda/src/nativenet/buffered_datagramwriter.h index bead38c384..c33ef8e66d 100644 --- a/panda/src/nativenet/buffered_datagramwriter.h +++ b/panda/src/nativenet/buffered_datagramwriter.h @@ -3,17 +3,17 @@ #include "ringbuffer.h" //////////////////////////////////////////////////////////////////// -// Class : Buffered_DatagramWriter +// Class : Buffered_DatagramWriter // Description : This is the buffered writer.. it is used to buffer up -// Coremessages and arbitrary data.. +// Coremessages and arbitrary data.. // -// GmCoreMessage +// GmCoreMessage // // -// You must commit all rights to a socket with flush and -// flush may be called internall if the buffersize is about -// to overrun.. This class does guaranty no partial message -// rights at least to the TCP layer.. +// You must commit all rights to a socket with flush and +// flush may be called internall if the buffersize is about +// to overrun.. This class does guaranty no partial message +// rights at least to the TCP layer.. // //////////////////////////////////////////////////////////////////// class Buffered_DatagramWriter : public RingBuffer @@ -26,10 +26,10 @@ public: inline int AddData(const void * data, size_t len, Socket_TCP &sck); inline int AddData(const void * data, size_t len); // THE FUNCTIONS THAT TAKE A SOCKET NEED TO BE TEMPLATED TO WORK.. - + template < class SOCK_TYPE> int FlushNoBlock(SOCK_TYPE &sck) { // this is the ugly part - + int answer = 0; size_t Writesize = AmountBuffered(); @@ -56,10 +56,10 @@ public: inline int Flush(SOCK_TYPE &sck) { int answer = 0; size_t Writesize = AmountBuffered(); - + if(Writesize > 0) { int Writen = sck.SendData(GetMessageHead(),(int)Writesize); - + if(Writen > 0) { _StartPos += Writen; FullCompress(); @@ -71,63 +71,55 @@ public: answer = -1; } } - + return answer; }; }; -/////////////////////////////////////////////////////// -// Function name : Buffered_DatagramWriter::ReSet -// Description : used to clear the buffrers ... -// use of this in mid stream is a very bad thing as +//////////////////////////////////////////////////////////////////// +// Function: Buffered_DatagramWriter::ReSet +// Description: used to clear the buffrers ... +// use of this in mid stream is a very bad thing as // you can not guarany network writes are message alligned -// Return type : void -/////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// inline void Buffered_DatagramWriter::ReSet(void) { ResetContent(); } -//////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Buffered_DatagramWriter::Buffered_DatagramWriter // // -//////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// inline Buffered_DatagramWriter::Buffered_DatagramWriter( size_t in_size , int in_flush_point) : RingBuffer(in_size) { _flush_point = in_flush_point; } -////////////////////////////////////////////////////////////// -// Function name : Buffered_DatagramWriter::AddData -// Description : -// Return type : inline int -// Argument : const void * data -// Argument : int len -// Argument : Socket_TCP &sck -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Buffered_DatagramWriter::AddData +// Description: +//////////////////////////////////////////////////////////////////// inline int Buffered_DatagramWriter::AddData(const void * data, size_t len, Socket_TCP &sck) { int answer = 0; - + if(len > BufferAvailabe()) answer = Flush(sck); if(answer >= 0) answer = AddData(data,len); - - + + if(answer >= 0 && _flush_point != -1) if(_flush_point < (int)AmountBuffered()) if(Flush(sck) < 0) answer = -1; - + return answer; } -////////////////////////////////////////////////////////////// -// Function name : Buffered_DatagramWriter::AddData -// Description : -// Return type : inline int -// Argument : const char * data -// Argument : int len -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Buffered_DatagramWriter::AddData +// Description: +//////////////////////////////////////////////////////////////////// inline int Buffered_DatagramWriter::AddData(const void * data, size_t len) { int answer = -1; diff --git a/panda/src/nativenet/membuffer.I b/panda/src/nativenet/membuffer.I new file mode 100644 index 0000000000..e54d92d010 --- /dev/null +++ b/panda/src/nativenet/membuffer.I @@ -0,0 +1,140 @@ +#define MEMBUF_THRASH_SIZE 25 + +///////////////////////////////////////////////////////////// +// Function: MemBuffer::ClearBuffer +// Description: Releases all resources(Memory USed) is locally allocated +////////////////////////////////////////////////////////// +inline void MemBuffer:: +ClearBuffer(void) { + if (_BufferLocal == true) { + if (_Buffer != NULL) { + delete[] _Buffer; + } + + _Buffer = NULL; + } +} + +///////////////////////////////////////////////////////////// +// Function: MemBuffer::AllocBuffer +// Description: Locally allocate a new buffer +////////////////////////////////////////////////////////// +inline void MemBuffer:: +AllocBuffer(size_t len) { + _Buffer = new char[len]; + _BufferLocal = true; + _BufferLen = len; +} + +///////////////////////////////////////////////////////////// +// Function: MemBuffer::MemBuffer +// Description: default constructor +////////////////////////////////////////////////////////// +inline MemBuffer:: +MemBuffer(void) { + _Buffer = NULL; + _BufferLocal = false; + _BufferLen = 0; +} + +///////////////////////////////////////////////////////////// +// Function: MemBuffer::MemBuffer +// Description: Constructure to locall allocate a buffer +////////////////////////////////////////////////////////// +inline MemBuffer:: +MemBuffer(size_t len) { + AllocBuffer(len); +} + +///////////////////////////////////////////////////////////// +// Function: MemBuffer::MemBuffer +// Description: Constructure to use an external buffer +////////////////////////////////////////////////////////// +inline MemBuffer:: +MemBuffer(char *data, size_t len) { + _BufferLocal = false; + _BufferLen = len; + _Buffer = data; +} + +///////////////////////////////////////////////////////////// +// Function: MemBuffer::~MemBuffer +// Description: CLean UP a mess on Deletion +////////////////////////////////////////////////////////// +inline MemBuffer:: +~MemBuffer() { + ClearBuffer(); +} + +///////////////////////////////////////////////////////////// +// Function: MemBuffer::SetBuffer +// Description: Assigns a buffer +////////////////////////////////////////////////////////// +inline void MemBuffer:: +SetBuffer(char * data, size_t len) { + if (_BufferLocal == true) { + ClearBuffer(); + } + + _BufferLocal = false; + _BufferLen = len; + _Buffer = data; +} + +///////////////////////////////////////////////////////////// +// Function: MemBuffer::GrowBuffer +// Description: Grow a buffer is needed to get to a sertion size +// No care is made here to preserve convtent unlike a vector of chars +// +////////////////////////////////////////////////////////// +inline void MemBuffer:: +GrowBuffer(size_t new_len) { + if (new_len >= _BufferLen) { + size_t len = new_len + MEMBUF_THRASH_SIZE; + len = len +len; + + char *tmp = new char[len]; + + if (_Buffer != NULL) { + memcpy(tmp,_Buffer,_BufferLen); + } + + ClearBuffer(); + + _Buffer = tmp; + _BufferLocal = true; + _BufferLen = len; + } +} + +///////////////////////////////////////////////////////////// +// Function: MemBuffer::GetBufferSize +// Description: Access to the BUffer Size Information +////////////////////////////////////////////////////////// +inline size_t MemBuffer:: +GetBufferSize(void) const { + return _BufferLen; +} + +///////////////////////////////////////////////////////////// +// Function: MemBuffer::GetBuffer +// Description: Access to the actual BUffer +////////////////////////////////////////////////////////// +inline char *MemBuffer:: +GetBuffer(void) { + return _Buffer; +} + +inline const char *MemBuffer:: +GetBuffer(void) const { + return _Buffer; +} + +//////////////////////////////////////////////////////////////////// +// Function: MemBuffer::InBufferRange +// Description: +//////////////////////////////////////////////////////////////////// +inline bool MemBuffer:: +InBufferRange(char *inpos) { + return (inpos >= _Buffer && inpos <= (_Buffer + _BufferLen)); +} diff --git a/panda/src/nativenet/membuffer.h b/panda/src/nativenet/membuffer.h index d5a8fbff86..ffda6af026 100644 --- a/panda/src/nativenet/membuffer.h +++ b/panda/src/nativenet/membuffer.h @@ -1,44 +1,42 @@ #ifndef __MEMBUFFER_GM_H__ #define __MEMBUFFER_GM_H__ + // RHH //////////////////////////////////////////////////////////////////// -// Class : GmMemBuf -// Description : this a base class designed to be used to for items that will -// share portions of a memorty buufer and want to avoid copying the data -// -// Use if the class wants ot allow for refrence in place of data arrays.. -// ** be carefull could be dangerous ** -// -// GmCoreMessage -// GmRingBuffer +// Class : GmMemBuf +// Description : This a base class designed to be used to for items +// that will share portions of a memory buffer and +// want to avoid copying the data. // +// Use if the class wants to allow for reference in +// place of data arrays. +// ** be careful could be dangerous ** // +// GmCoreMessage +// GmRingBuffer //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_NATIVENET MemBuffer -{ +class EXPCL_PANDA_NATIVENET MemBuffer { public: - inline MemBuffer(void); - inline MemBuffer(size_t len); - inline MemBuffer(char * data, size_t len); - virtual ~MemBuffer(); - inline void SetBuffer(char * data, size_t len); - inline void GrowBuffer(size_t len); - inline size_t GetBufferSize(void ) const; - inline char * GetBuffer(void); - inline const char * GetBuffer(void) const; - inline bool InBufferRange(char * ); -protected: - bool _BufferLocal; // indicates responsibility of managment of the data - size_t _BufferLen; // the length of the data - char * _Buffer; // the data + inline MemBuffer(void); + inline MemBuffer(size_t len); + inline MemBuffer(char * data, size_t len); + virtual ~MemBuffer(); + inline void SetBuffer(char * data, size_t len); + inline void GrowBuffer(size_t len); + inline size_t GetBufferSize(void ) const; + inline char * GetBuffer(void); + inline const char * GetBuffer(void) const; + inline bool InBufferRange(char * ); - inline void ClearBuffer(void); - inline void AllocBuffer(size_t len); +protected: + bool _BufferLocal; // indicates responsibility of managment of the data + size_t _BufferLen; // the length of the data + char * _Buffer; // the data + + inline void ClearBuffer(void); + inline void AllocBuffer(size_t len); }; - -#include "membuffer.i" - +#include "membuffer.I" #endif //__MEMBUFFER_GM_H__ - diff --git a/panda/src/nativenet/membuffer.i b/panda/src/nativenet/membuffer.i deleted file mode 100644 index f2a3687c33..0000000000 --- a/panda/src/nativenet/membuffer.i +++ /dev/null @@ -1,155 +0,0 @@ -#define MEMBUF_THRASH_SIZE 25 - -///////////////////////////////////////////////////////////// -// Function name : MemBuffer::ClearBuffer -// Description : Releases all resources(Memory USed) is locally allocated -// Return type : inline void -// Argument : void -////////////////////////////////////////////////////////// -inline void MemBuffer::ClearBuffer(void) -{ - if(_BufferLocal == true) - { - if(_Buffer != NULL) - delete [] _Buffer; - - _Buffer = NULL; - } -} -///////////////////////////////////////////////////////////// -// Function name : MemBuffer::AllocBuffer -// Description : Locally allocate a new buffer -// Return type : inline void -// Argument : int len -////////////////////////////////////////////////////////// -inline void MemBuffer::AllocBuffer(size_t len) -{ - _Buffer = new char[len]; - _BufferLocal = true; - _BufferLen = len; -} - -///////////////////////////////////////////////////////////// -// Function name : MemBuffer::MemBuffer -// Description : default constructor -// Return type : -// Argument : void -////////////////////////////////////////////////////////// -inline MemBuffer::MemBuffer(void) -{ - _Buffer = NULL; - _BufferLocal = false; - _BufferLen = 0; -} -///////////////////////////////////////////////////////////// -// Function name : MemBuffer::MemBuffer -// Description : Constructure to locall allocate a buffer -// Return type : -// Argument : int len -////////////////////////////////////////////////////////// -inline MemBuffer::MemBuffer(size_t len) -{ - AllocBuffer(len); -} -///////////////////////////////////////////////////////////// -// Function name : MemBuffer::MemBuffer -// Description : Constructure to use an external buffer -// Return type : -// Argument : char * data -// Argument : int len -////////////////////////////////////////////////////////// -inline MemBuffer::MemBuffer(char * data, size_t len) -{ - _BufferLocal = false; - _BufferLen = len; - _Buffer = data; -} -///////////////////////////////////////////////////////////// -// Function name : MemBuffer::~MemBuffer -// Description : CLean UP a mess on Deletetion -// Return type : -////////////////////////////////////////////////////////// -inline MemBuffer::~MemBuffer() -{ - ClearBuffer(); -} -///////////////////////////////////////////////////////////// -// Function name : MemBuffer::SetBuffer -// Description : Assigne a buffer -// Return type : inline void -// Argument : char * data -// Argument : int len -////////////////////////////////////////////////////////// -inline void MemBuffer::SetBuffer(char * data, size_t len) -{ - if(_BufferLocal == true) - ClearBuffer(); - - _BufferLocal = false; - _BufferLen = len; - _Buffer = data; -} -///////////////////////////////////////////////////////////// -// Function name : MemBuffer::GrowBuffer -// Description : Grow a buffer is needed to get to a sertion size -// No care is made here to preserve convtent unlike a vector of chars -// -// Return type : inline void -// Argument : int len -////////////////////////////////////////////////////////// -inline void MemBuffer::GrowBuffer(size_t new_len) -{ - if(new_len >= _BufferLen) - { - size_t len = new_len + MEMBUF_THRASH_SIZE; - len = len +len; - - char * tmp = new char[len]; - - if(_Buffer != NULL) - memcpy(tmp,_Buffer,_BufferLen); - - ClearBuffer(); - - _Buffer = tmp; - _BufferLocal = true; - _BufferLen = len; - } -} -///////////////////////////////////////////////////////////// -// Function name : MemBuffer::GetBufferSize -// Description : Access to the BUffer Size Information -// Return type : inline int -// Argument : void -////////////////////////////////////////////////////////// -inline size_t MemBuffer::GetBufferSize(void ) const -{ - return _BufferLen; -}; -///////////////////////////////////////////////////////////// -// Function name : * MemBuffer::GetBuffer -// Description : Access to the actual BUffer -// Return type : inline char -// Argument : void -////////////////////////////////////////////////////////// -inline char * MemBuffer::GetBuffer(void) -{ - return _Buffer; -}; -inline const char * MemBuffer::GetBuffer(void) const -{ - return _Buffer; -}; - -//////////////////////////////////////////////////////////////////// -// Function name : MemBuffer::InBufferRange -// Description : -// -// Return type : inline bool -// Argument : char * inpos -//////////////////////////////////////////////////////////////////// -inline bool MemBuffer::InBufferRange(char * inpos) -{ - return (inpos >= _Buffer && inpos <= (_Buffer + _BufferLen)); -} - diff --git a/panda/src/nativenet/ringbuffer.i b/panda/src/nativenet/ringbuffer.I similarity index 55% rename from panda/src/nativenet/ringbuffer.i rename to panda/src/nativenet/ringbuffer.I index 96e8ac3770..d5e06f5318 100644 --- a/panda/src/nativenet/ringbuffer.i +++ b/panda/src/nativenet/ringbuffer.I @@ -1,29 +1,23 @@ ///////////////////////////////////////////////////////////// -// Function name : RingBuffer::GetMessageHead -// Description : This will get a pointer to the fist undelivered data in buffer -// Return type : char * -// Argument : void +// Function: RingBuffer::GetMessageHead +// Description: This will get a pointer to the fist undelivered data in buffer ////////////////////////////////////////////////////////// -inline char * RingBuffer::GetMessageHead(void) -{ +inline char * RingBuffer::GetMessageHead(void) +{ return _Buffer+_StartPos; } ///////////////////////////////////////////////////////////// -// Function name : RingBuffer::GetBufferOpen -// Description : This will get the first writabe section of the buffer space -// Return type : -// Argument : void +// Function: RingBuffer::GetBufferOpen +// Description: This will get the first writabe section of the buffer space ////////////////////////////////////////////////////////// -inline char * RingBuffer::GetBufferOpen(void) +inline char * RingBuffer::GetBufferOpen(void) { - return _Buffer+_EndPos; + return _Buffer+_EndPos; } ///////////////////////////////////////////////////////////// -// Function name : RingBuffer::ForceWindowSlide -// Description : Will force a compression of data // shift left to start position -// Return type : inline void -// Argument : void +// Function: RingBuffer::ForceWindowSlide +// Description: Will force a compression of data // shift left to start position ////////////////////////////////////////////////////////// inline void RingBuffer::ForceWindowSlide(void) { @@ -32,61 +26,51 @@ inline void RingBuffer::ForceWindowSlide(void) { memmove(_Buffer,GetMessageHead(),len); _StartPos = 0; - _EndPos = len; + _EndPos = len; } } ///////////////////////////////////////////////////////////// -// Function name : RingBuffer::AmountBuffered -// Description : Will report the number of unread chars in buffer -// Return type : int -// Argument : void +// Function: RingBuffer::AmountBuffered +// Description: Will report the number of unread chars in buffer ////////////////////////////////////////////////////////// -inline size_t RingBuffer::AmountBuffered(void) -{ - return _EndPos - _StartPos; +inline size_t RingBuffer::AmountBuffered(void) +{ + return _EndPos - _StartPos; } ///////////////////////////////////////////////////////////// -// Function name : RingBuffer::BufferAvailabe -// Description : Will report amount of data that is contiguas that can be writen at +// Function: RingBuffer::BufferAvailabe +// Description: Will report amount of data that is contiguas that can be writen at // the location returned by GetBufferOpen -// Return type : inline int -// Argument : void ////////////////////////////////////////////////////////// -inline size_t RingBuffer::BufferAvailabe(void) -{ - return GetBufferSize() - _EndPos; +inline size_t RingBuffer::BufferAvailabe(void) +{ + return GetBufferSize() - _EndPos; } ///////////////////////////////////////////////////////////// -// Function name : RingBuffer::ResetContent -// Description : Throw away all inread information -// Return type : void -// Argument : void +// Function: RingBuffer::ResetContent +// Description: Throw away all inread information ////////////////////////////////////////////////////////// -void RingBuffer::ResetContent(void) -{ - _StartPos = 0; - _EndPos = 0; +void RingBuffer::ResetContent(void) +{ + _StartPos = 0; + _EndPos = 0; } ///////////////////////////////////////////////////////////// -// Function name : RingBuffer::RingBuffer -// Description : -// Return type : inline -// Argument : int in_size +// Function: RingBuffer::RingBuffer +// Description: ////////////////////////////////////////////////////////// inline RingBuffer::RingBuffer(size_t in_size) : MemBuffer(in_size) -{ +{ _EndPos = 0; _StartPos = 0; } ///////////////////////////////////////////////////////////// -// Function name : RingBuffer::FullCompress -// Description : Force a compress of the data -// Return type : inline void -// Argument : void +// Function: RingBuffer::FullCompress +// Description: Force a compress of the data ////////////////////////////////////////////////////////// inline void RingBuffer::FullCompress(void) { @@ -95,20 +79,18 @@ inline void RingBuffer::FullCompress(void) _StartPos = 0; _EndPos = 0; } - else + else { ForceWindowSlide(); - } + } } ///////////////////////////////////////////////////////////// -// Function name : RingBuffer::Compress -// Description : Try and do a intelegent compress of the data space -// the algorithem is really stupid right know.. just say if i have +// Function: RingBuffer::Compress +// Description: Try and do a intelegent compress of the data space +// the algorithem is really stupid right know.. just say if i have // read past 1/2 my space do a compress...Im open for sugestions -// // -// Return type : inline void -// Argument : void +// ////////////////////////////////////////////////////////// inline void RingBuffer::Compress(void) { @@ -117,27 +99,24 @@ inline void RingBuffer::Compress(void) _StartPos = 0; _EndPos = 0; } - else if(_StartPos >= GetBufferSize() / 2) + else if(_StartPos >= GetBufferSize() / 2) { ForceWindowSlide(); - } + } } ///////////////////////////////////////////////////////////// -// Function name : RingBuffer::Put -// Description : Adds Data to a ring Buffer +// Function: RingBuffer::Put +// Description: Adds Data to a ring Buffer // Will do a compress if needed so pointers suplied by Get Call are no longer valide // -// Return type : inline bool -// Argument : char * data -// Argument : int len ////////////////////////////////////////////////////////// inline bool RingBuffer::Put(const char * data, size_t len) { bool answer = false; - + if(len > BufferAvailabe() ) Compress(); - + if(len <= BufferAvailabe() ) { memcpy(GetBufferOpen(),data,len); @@ -147,12 +126,9 @@ inline bool RingBuffer::Put(const char * data, size_t len) return answer; } //////////////////////////////////////////////////////////////////// -// Function name : RingBuffer::PutFast -// Description : -// -// Return type : inline bool -// Argument : const char * data -// Argument : int len +// Function: RingBuffer::PutFast +// Description: +// //////////////////////////////////////////////////////////////////// inline bool RingBuffer::PutFast(const char * data, size_t len) { @@ -163,18 +139,15 @@ inline bool RingBuffer::PutFast(const char * data, size_t len) } ///////////////////////////////////////////////////////////// -// Function name : RingBuffer::Get -// Description : will copy the data .. +// Function: RingBuffer::Get +// Description: will copy the data .. // false indicates not enogh data to read .. sorry... // -// Return type : inline bool -// Argument : char * data -// Argument : int len ////////////////////////////////////////////////////////// inline bool RingBuffer::Get(char * data, size_t len) { bool answer = false; - + if(len <= AmountBuffered() ) { memcpy(data,GetMessageHead(),len); diff --git a/panda/src/nativenet/ringbuffer.h b/panda/src/nativenet/ringbuffer.h index fe4de0b2b8..c7f4331b6e 100644 --- a/panda/src/nativenet/ringbuffer.h +++ b/panda/src/nativenet/ringbuffer.h @@ -1,47 +1,45 @@ #ifndef __RINGBUFFER_GM_H__ #define __RINGBUFFER_GM_H__ -//////////////////////////////////////////// + +#include "membuffer.h" // RHH //////////////////////////////////////////////////////////////////// -// Class : GmRingBuffer -// Description : This is an implemention of the membuffer with ring -// buffer interface on it.... +// Class : GmRingBuffer +// Description : This is an implemention of the membuffer with ring +// buffer interface on it. // -// Main target right know is base class for network -// stream buffering both input and output -// -// see BufferedReader_Gm -// BufferedWriter_Gm +// Main target right know is base class for network +// stream buffering both input and output // +// See also BufferedReader_Gm and BufferedWriter_Gm. //////////////////////////////////////////////////////////////////// -#include "membuffer.h" -class EXPCL_PANDA_NATIVENET RingBuffer : protected MemBuffer -{ +class EXPCL_PANDA_NATIVENET RingBuffer : protected MemBuffer { protected: - size_t _StartPos; - size_t _EndPos; - inline char * GetMessageHead(void); - inline char * GetBufferOpen(void); - inline void ForceWindowSlide(void); -#define FastGetMessageHead() (_Buffer+_StartPos) + size_t _StartPos; + size_t _EndPos; + inline char *GetMessageHead(void); + inline char *GetBufferOpen(void); + inline void ForceWindowSlide(void); + +#define FastGetMessageHead() (_Buffer + _StartPos) #define FastAmountBeffered() (_EndPos - _StartPos) -inline bool PutFast(const char * data, size_t len); + inline bool PutFast(const char * data, size_t len); public: - inline size_t AmountBuffered(void); - inline size_t BufferAvailabe(void); - inline void ResetContent(void); + inline size_t AmountBuffered(void); + inline size_t BufferAvailabe(void); + inline void ResetContent(void); - inline RingBuffer(size_t in_size = 4096); - inline void FullCompress(void); - inline void Compress(void); - inline bool Put(const char * data, size_t len); - inline bool Get(char * data, size_t len); + inline RingBuffer(size_t in_size = 4096); + inline void FullCompress(void); + inline void Compress(void); + inline bool Put(const char * data, size_t len); + inline bool Get(char * data, size_t len); }; -#include "ringbuffer.i" +#include "ringbuffer.I" #endif //__RINGBUFFER_GM_H__ diff --git a/panda/src/nativenet/socket_address.I b/panda/src/nativenet/socket_address.I index 40d10b9150..38d7222d45 100644 --- a/panda/src/nativenet/socket_address.I +++ b/panda/src/nativenet/socket_address.I @@ -13,17 +13,17 @@ //////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: Socket_Address::GetIPAdddressRaw // Access: Public // Description: Return a RAW sockaddr_in -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// INLINE unsigned long Socket_Address:: GetIPAddressRaw() const { return _addr.sin_addr.s_addr; } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: Socket_Address // Access: Published // Description: Constructor that lets us set a port value @@ -68,11 +68,11 @@ INLINE Socket_Address:: ~Socket_Address() { } -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: Socket_Address::operator == // Access: Published // Description: -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// INLINE bool Socket_Address:: operator == (const Socket_Address &in) const { return ((_addr.sin_family == in._addr.sin_family) && @@ -80,11 +80,11 @@ operator == (const Socket_Address &in) const { (_addr.sin_port == in._addr.sin_port)); } -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: Socket_Address::operator != // Access: Published // Description: -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// INLINE bool Socket_Address:: operator != (const Socket_Address &in) const { return ((_addr.sin_family != in._addr.sin_family) || @@ -212,11 +212,11 @@ set_host(const std::string &hostname, unsigned short port) { return true; } -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: Socket_Address::set_host // Access: Published // Description: -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// INLINE bool Socket_Address:: set_host(const std::string &hostname) { std::string::size_type pos = hostname.find(':'); @@ -230,11 +230,11 @@ set_host(const std::string &hostname) { return set_host(host, port_dig); } -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: Socket_Address::set_host // Access: Published // Description: -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// INLINE bool Socket_Address:: set_host(PN_uint32 in_hostname, unsigned short port) { memcpy(&_addr.sin_addr, &in_hostname, sizeof(in_hostname)); @@ -243,11 +243,11 @@ set_host(PN_uint32 in_hostname, unsigned short port) { return true; } -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: < // Access: Published // Description: -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// INLINE bool Socket_Address:: operator < (const Socket_Address &in) const { if (_addr.sin_port < in._addr.sin_port) @@ -265,11 +265,11 @@ operator < (const Socket_Address &in) const { return (_addr.sin_family < in._addr.sin_family); } -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: is_mcast_range // Access: Published // Description: True if the address is in the multicast range. -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// INLINE bool Socket_Address:: is_mcast_range(void) const { PN_uint32 address = ntohl(_addr.sin_addr.s_addr); diff --git a/panda/src/nativenet/socket_address.h b/panda/src/nativenet/socket_address.h index d177224cb5..45fe537918 100644 --- a/panda/src/nativenet/socket_address.h +++ b/panda/src/nativenet/socket_address.h @@ -5,13 +5,11 @@ #include "numeric_types.h" #include "socket_portable.h" -/////////////////////////////////// -// Class : Socket_Address -// -// Description: A simple place to store and munipulate tcp and port address for -// communication layer -// -////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Class : Socket_Address +// Description : A simple place to store and munipulate tcp and port +// address for communication layer +//////////////////////////////////////////////////////////////////// class EXPCL_PANDA_NATIVENET Socket_Address { public: typedef struct sockaddr_in AddressType; diff --git a/panda/src/nativenet/socket_base.h b/panda/src/nativenet/socket_base.h index 5521ceeda9..12cc93be36 100644 --- a/panda/src/nativenet/socket_base.h +++ b/panda/src/nativenet/socket_base.h @@ -1,9 +1,9 @@ #ifndef __SOCKET_BASE_H__ -#define __SOCKET_BASE_H__ +#define __SOCKET_BASE_H__ -//////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Quick way to get all the network code defined -//////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// #include "pandabase.h" #include "socket_portable.h" #include "socket_address.h" diff --git a/panda/src/nativenet/socket_fdset.h b/panda/src/nativenet/socket_fdset.h index 33e688a207..8ce80b4071 100644 --- a/panda/src/nativenet/socket_fdset.h +++ b/panda/src/nativenet/socket_fdset.h @@ -1,7 +1,7 @@ #ifndef __SOCKET_FDSET_H__ #define __SOCKET_FDSET_H__ -//////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // //rhh // This class needs to be broken into 2 classes: the gathering class and the processing functions. @@ -10,7 +10,7 @@ // Add a helper class socket_select. May want to totally separate the select and collect functionality // fits more with the normal Berkeley mind set... ** Not ** Should think about using POLL() on BSD-based systems // -////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// #include "pandabase.h" #include "numeric_types.h" #include "time_base.h" @@ -42,17 +42,16 @@ private: }; //////////////////////////////////////////////////////////////////// -// Function name : Socket_fdset::Socket_fdset -// Description : The constructor +// Function: Socket_fdset::Socket_fdset +// Description: The constructor //////////////////////////////////////////////////////////////////// -inline Socket_fdset::Socket_fdset() -{ +inline Socket_fdset::Socket_fdset() { clear(); } //////////////////////////////////////////////////////////////////// -// Function name : Socket_fdset::setForSocketNative -// Description : This does the physical manipulation of the set getting read for the base call +// Function: Socket_fdset::setForSocketNative +// Description: This does the physical manipulation of the set getting read for the base call //////////////////////////////////////////////////////////////////// inline void Socket_fdset::setForSocketNative(SOCKET inid) { @@ -60,15 +59,15 @@ inline void Socket_fdset::setForSocketNative(SOCKET inid) #ifndef WIN32 assert(inid < FD_SETSIZE); #endif - + FD_SET(inid, &_the_set); if (_maxid < inid) _maxid = inid; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_fdset::isSetForNative -// Description : Answer the question: was the socket marked for reading +// Function: Socket_fdset::isSetForNative +// Description: Answer the question: was the socket marked for reading? // there's a subtle difference in the NSPR version: it will respond if // the socket had an error //////////////////////////////////////////////////////////////////// @@ -78,13 +77,13 @@ inline bool Socket_fdset::isSetForNative(SOCKET inid) const #ifndef WIN32 assert(inid < FD_SETSIZE); #endif - + return (FD_ISSET(inid, &_the_set) != 0); } //////////////////////////////////////////////////////////////////// -// Function name : Socket_fdset::IsSetFor -// Description : check to see if a socket object has been marked for reading +// Function: Socket_fdset::IsSetFor +// Description: check to see if a socket object has been marked for reading //////////////////////////////////////////////////////////////////// inline bool Socket_fdset::IsSetFor(const Socket_IP & incon) const { @@ -92,48 +91,45 @@ inline bool Socket_fdset::IsSetFor(const Socket_IP & incon) const } //////////////////////////////////////////////////////////////////// -// Function name : WaitForRead -// Description : +// Function: WaitForRead +// Description: //////////////////////////////////////////////////////////////////// inline int Socket_fdset::WaitForRead(bool zeroFds, PN_uint32 sleep_time) { int retVal = 0; - if (sleep_time == 0xffffffff) - { + if (sleep_time == 0xffffffff) { retVal = DO_SELECT(_maxid + 1, &_the_set, NULL, NULL, NULL); - } - else - { + } else { timeval timeoutValue; timeoutValue.tv_sec = sleep_time / 1000; timeoutValue.tv_usec = (sleep_time % 1000) * 1000; - + retVal = DO_SELECT(_maxid + 1, &_the_set, NULL, NULL, &timeoutValue); } if (zeroFds) clear(); - - return retVal; -} -////////////////////////////////////////////////////////////// -// Function name : Socket_fdset::WaitForRead -// Description : -////////////////////////////////////////////////////////////// -inline int Socket_fdset::WaitForRead(bool zeroFds, const Time_Span & timeout) -{ - timeval localtv = timeout.GetTval(); - - int retVal = DO_SELECT(_maxid + 1, &_the_set, NULL, NULL, &localtv); - if (zeroFds) - clear(); - return retVal; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_fdset::zeroOut -// Description : Marks the content as empty +// Function: Socket_fdset::WaitForRead +// Description: +//////////////////////////////////////////////////////////////////// +inline int Socket_fdset::WaitForRead(bool zeroFds, const Time_Span & timeout) +{ + timeval localtv = timeout.GetTval(); + + int retVal = DO_SELECT(_maxid + 1, &_the_set, NULL, NULL, &localtv); + if (zeroFds) + clear(); + + return retVal; +} + +//////////////////////////////////////////////////////////////////// +// Function: Socket_fdset::zeroOut +// Description: Marks the content as empty //////////////////////////////////////////////////////////////////// inline void Socket_fdset::clear() { @@ -142,64 +138,63 @@ inline void Socket_fdset::clear() } //////////////////////////////////////////////////////////////////// -// Function name : Socket_fdset::setForSocket -// Description : +// Function: Socket_fdset::setForSocket +// Description: //////////////////////////////////////////////////////////////////// inline void Socket_fdset::setForSocket(const Socket_IP &incon) { setForSocketNative(incon.GetSocket()); } -//////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function name : Socket_fdset::WaitForWrite -// Description : This is the function that will wait till -// one of the sockets is ready for writing +// Function: Socket_fdset::WaitForWrite +// Description: This is the function that will wait till +// one of the sockets is ready for writing //////////////////////////////////////////////////////////////////// inline int Socket_fdset::WaitForWrite(bool zeroFds, PN_uint32 sleep_time) { int retVal = 0; - if (sleep_time == 0xffffffff) + if (sleep_time == 0xffffffff) { retVal = DO_SELECT(_maxid + 1, NULL, &_the_set, NULL, NULL); } - else + else { timeval timeoutValue; timeoutValue.tv_sec = sleep_time / 1000; timeoutValue.tv_usec = (sleep_time % 1000) * 1000; - + retVal = DO_SELECT(_maxid + 1, NULL, &_the_set, NULL, &timeoutValue); } if (zeroFds) clear(); - + return retVal; } -////////////////////////////////////////////////////////////// -// Function name : Socket_fdset::WaitForError -// Description : This is the function that will wait till -// one of the sockets is in error state -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Socket_fdset::WaitForError +// Description: This is the function that will wait till +// one of the sockets is in error state +//////////////////////////////////////////////////////////////////// inline int Socket_fdset::WaitForError(bool zeroFds, PN_uint32 sleep_time) { int retVal = 0; - if (sleep_time == 0xffffffff) + if (sleep_time == 0xffffffff) { retVal = DO_SELECT(_maxid + 1, NULL, NULL, &_the_set, NULL); } - else + else { timeval timeoutValue; timeoutValue.tv_sec = sleep_time / 1000; timeoutValue.tv_usec = (sleep_time % 1000) * 1000; - + retVal = DO_SELECT(_maxid + 1, NULL, NULL, &_the_set, &timeoutValue); } if (zeroFds) clear(); - + return retVal; } diff --git a/panda/src/nativenet/socket_ip.h b/panda/src/nativenet/socket_ip.h index fcdf1e2ee7..5fec7fd786 100644 --- a/panda/src/nativenet/socket_ip.h +++ b/panda/src/nativenet/socket_ip.h @@ -12,13 +12,12 @@ class Socket_UDP; class Socket_TCP_Listen; class Socket_UDP_Incoming; class Socket_UDP_Outgoing; -///////////////////////////////////////////////////////////////////// -// Class : Socket_IP -// + +//////////////////////////////////////////////////////////////////// +// Class : Socket_IP // Description : Base functionality for a INET domain Socket -// this call should be the starting point for all other -// unix domain sockets -// +// This call should be the starting point for all other +// unix domain sockets. // // SocketIP // | @@ -26,47 +25,41 @@ class Socket_UDP_Outgoing; // | | | | // SocketTCP SocketTCP_Listen SocketUDP_Incoming SocketUDP_OutBound // -// -// -// socket_fdset -// -///////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class EXPCL_PANDA_NATIVENET Socket_IP : public TypedObject { public: PUBLISHED: + inline Socket_IP(); + inline Socket_IP(SOCKET in); + virtual ~Socket_IP(); - inline Socket_IP(); - inline Socket_IP(SOCKET in); - virtual ~Socket_IP(); - - inline void Close(); - inline static int GetLastError(); - inline int SetNonBlocking(); - inline int SetBlocking(); - inline bool SetReuseAddress(bool flag = true); - inline bool Active(); - inline int SetRecvBufferSize(int size); - inline void SetSocket(SOCKET ins); - inline SOCKET GetSocket(); - inline SOCKET GetSocket() const; - inline Socket_Address GetPeerName(void) const; + inline void Close(); + inline static int GetLastError(); + inline int SetNonBlocking(); + inline int SetBlocking(); + inline bool SetReuseAddress(bool flag = true); + inline bool Active(); + inline int SetRecvBufferSize(int size); + inline void SetSocket(SOCKET ins); + inline SOCKET GetSocket(); + inline SOCKET GetSocket() const; + inline Socket_Address GetPeerName(void) const; - - inline static int InitNetworkDriver() { return init_network(); }; + inline static int InitNetworkDriver() { return init_network(); }; public: private: - inline bool ErrorClose(); - - SOCKET _socket; // see socket_portable.h - - friend class Socket_TCP; - friend class Socket_UDP; - friend class Socket_TCP_Listen; - friend class Socket_UDP_Incoming; - friend class Socket_UDP_Outgoing; - friend class Socket_TCP_SSL; - + inline bool ErrorClose(); + + SOCKET _socket; // see socket_portable.h + + friend class Socket_TCP; + friend class Socket_UDP; + friend class Socket_TCP_Listen; + friend class Socket_UDP_Incoming; + friend class Socket_UDP_Outgoing; + friend class Socket_TCP_SSL; + public: static TypeHandle get_class_type() { return _type_handle; @@ -86,183 +79,188 @@ private: }; //////////////////////////////////////////////////////////////////// -// Function name : Socket_IP::ErrorClose -// Description : Used by internal to force a close -// note that it always returns a false +// Function: Socket_IP::ErrorClose +// Description: Used by internal to force a close. Returns false. //////////////////////////////////////////////////////////////////// -inline bool Socket_IP::ErrorClose() -{ - if (Active()) - DO_CLOSE(_socket); - _socket = BAD_SOCKET; - return false; +inline bool Socket_IP:: +ErrorClose() { + if (Active()) { + DO_CLOSE(_socket); + } + + _socket = BAD_SOCKET; + return false; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_IP::Active -// Description : Ask if the socket is open (allocated) +// Function: Socket_IP::Active +// Description: Ask if the socket is open (allocated) //////////////////////////////////////////////////////////////////// -inline bool Socket_IP::Active() -{ - return (_socket != BAD_SOCKET); +inline bool Socket_IP:: +Active() { + return (_socket != BAD_SOCKET); } //////////////////////////////////////////////////////////////////// -// Function name : Socket_IP::Socket_IP -// Description : Def Constructor +// Function: Socket_IP::Socket_IP +// Description: Def Constructor //////////////////////////////////////////////////////////////////// -inline Socket_IP::Socket_IP() -{ - _socket = BAD_SOCKET; +inline Socket_IP:: +Socket_IP() { + _socket = BAD_SOCKET; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_IP::SetSocket -// Description : Assigns an existing socket to this class +// Function: Socket_IP::SetSocket +// Description: Assigns an existing socket to this class //////////////////////////////////////////////////////////////////// -inline Socket_IP::Socket_IP(SOCKET ins) -{ - _socket = ins; +inline Socket_IP:: +Socket_IP(SOCKET ins) { + _socket = ins; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_IP::~Socket_IP -// Description : Destructor +// Function: Socket_IP::~Socket_IP +// Description: Destructor //////////////////////////////////////////////////////////////////// -inline Socket_IP::~Socket_IP() -{ - Close(); +inline Socket_IP:: +~Socket_IP() { + Close(); } //////////////////////////////////////////////////////////////////// -// Function name : Socket_IP::Close -// Description : closes a socket if it is open (allocated) +// Function: Socket_IP::Close +// Description: Closes a socket if it is open (allocated). //////////////////////////////////////////////////////////////////// -inline void Socket_IP::Close() -{ - if (Active()) - DO_CLOSE(_socket); - _socket = BAD_SOCKET; +inline void Socket_IP:: +Close() { + if (Active()) { + DO_CLOSE(_socket); + } + + _socket = BAD_SOCKET; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_IP::GetLastError -// Description : gets the last errcode from a socket operation +// Function: Socket_IP::GetLastError +// Description: Gets the last errcode from a socket operation. //////////////////////////////////////////////////////////////////// -inline int Socket_IP::GetLastError() -{ - return GETERROR(); +inline int Socket_IP:: +GetLastError() { + return GETERROR(); } //////////////////////////////////////////////////////////////////// -// Function name : Socket_IP::SetSocket -// Description : Assigns an existing socket to this class +// Function: Socket_IP::SetSocket +// Description: Assigns an existing socket to this class //////////////////////////////////////////////////////////////////// -inline void Socket_IP::SetSocket(SOCKET ins) -{ - Close(); - _socket = ins; +inline void Socket_IP:: +SetSocket(SOCKET ins) { + Close(); + _socket = ins; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_IP::SetRecvBufferSize -// Description : Ok it sets the recv buffer size for both tcp and UDP +// Function: Socket_IP::SetRecvBufferSize +// Description: Ok it sets the recv buffer size for both tcp and UDP //////////////////////////////////////////////////////////////////// -int Socket_IP::SetRecvBufferSize(int insize) -{ - if (setsockopt(_socket, (int) SOL_SOCKET, (int) SO_RCVBUF, (char *) &insize, sizeof(int))) - return BASIC_ERROR; - - return ALL_OK; +int Socket_IP:: +SetRecvBufferSize(int insize) { + if (setsockopt(_socket, (int) SOL_SOCKET, (int) SO_RCVBUF, (char *) &insize, sizeof(int))) { + return BASIC_ERROR; + } + + return ALL_OK; } //////////////////////////////////////////////////////////////////// -// Function name : SetNonBlocking -// Description : this function will throw a socket into non-blocking mode +// Function: SetNonBlocking +// Description: this function will throw a socket into non-blocking mode //////////////////////////////////////////////////////////////////// -inline int Socket_IP::SetNonBlocking() -{ +inline int Socket_IP:: +SetNonBlocking() { #ifdef BSDBLOCK - - int flags = fcntl(_socket, F_GETFL, 0); - flags = flags | O_NONBLOCK; - fcntl(_socket, F_SETFL, flags); - return ALL_OK; + int flags = fcntl(_socket, F_GETFL, 0); + flags = flags | O_NONBLOCK; + fcntl(_socket, F_SETFL, flags); + return ALL_OK; #else - unsigned long val = LOCAL_NONBLOCK; - unsigned lanswer = 0; - lanswer = SOCKIOCTL(_socket, LOCAL_FL_SET, &val); - if (lanswer != 0) - return BASIC_ERROR; - return ALL_OK; - + unsigned long val = LOCAL_NONBLOCK; + unsigned lanswer = 0; + lanswer = SOCKIOCTL(_socket, LOCAL_FL_SET, &val); + if (lanswer != 0) { + return BASIC_ERROR; + } + return ALL_OK; #endif } //////////////////////////////////////////////////////////////////// -// Function name : Socket_IP::SetBlocking -// Description : Set the socket to block on subsequent calls to +// Function: Socket_IP::SetBlocking +// Description: Set the socket to block on subsequent calls to // socket functions that address this socket //////////////////////////////////////////////////////////////////// -inline int Socket_IP::SetBlocking() -{ +inline int Socket_IP:: +SetBlocking() { #ifdef BSDBLOCK - int flags = fcntl(_socket, F_GETFL, 0); - flags &= ~O_NONBLOCK; - fcntl(_socket, F_SETFL, flags); - return ALL_OK; + int flags = fcntl(_socket, F_GETFL, 0); + flags &= ~O_NONBLOCK; + fcntl(_socket, F_SETFL, flags); + return ALL_OK; #else - unsigned long val = 0; - unsigned lanswer = 0; - lanswer = SOCKIOCTL(_socket, LOCAL_FL_SET, &val); - if (lanswer != 0) - return BASIC_ERROR; - return ALL_OK; + unsigned long val = 0; + unsigned lanswer = 0; + lanswer = SOCKIOCTL(_socket, LOCAL_FL_SET, &val); + if (lanswer != 0) { + return BASIC_ERROR; + } + return ALL_OK; #endif } //////////////////////////////////////////////////////////////////// -// Function name : SetReuseAddress -// Description : Informs a socket to reuse IP address as needed +// Function: SetReuseAddress +// Description: Informs a socket to reuse IP address as needed //////////////////////////////////////////////////////////////////// -inline bool Socket_IP::SetReuseAddress(bool flag) -{ - int bOption = flag; - if (setsockopt(_socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&bOption, sizeof(bOption)) != 0) - return false; - return true; +inline bool Socket_IP:: +SetReuseAddress(bool flag) { + int bOption = flag; + if (setsockopt(_socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&bOption, sizeof(bOption)) != 0) { + return false; + } + return true; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_IP::GetSocket -// Description : Gets the base socket type +// Function: Socket_IP::GetSocket +// Description: Gets the base socket type //////////////////////////////////////////////////////////////////// -inline SOCKET Socket_IP::GetSocket() -{ - return _socket; +inline SOCKET Socket_IP:: +GetSocket() { + return _socket; } -////////////////////////////////////////////////////////////// -// Function name : Socket_IP::GetSocket -// Description : Get The RAW file id of the socket -////////////////////////////////////////////////////////////// -inline SOCKET Socket_IP::GetSocket() const -{ - return _socket; -} -////////////////////////////////////////////////////////////// -// Function name : Socket_IP::GetPeerName -// Description : Wrapper on berkly getpeername... -////////////////////////////////////////////////////////////// -inline Socket_Address Socket_IP::GetPeerName(void) const -{ - sockaddr_in name; - socklen_t name_len = sizeof(name); - memset(&name,0,name_len); - - getpeername(_socket,(sockaddr * )&name,&name_len); - return Socket_Address(name); +//////////////////////////////////////////////////////////////////// +// Function: Socket_IP::GetSocket +// Description: Get The RAW file id of the socket +//////////////////////////////////////////////////////////////////// +inline SOCKET Socket_IP:: +GetSocket() const { + return _socket; } +//////////////////////////////////////////////////////////////////// +// Function: Socket_IP::GetPeerName +// Description: Wrapper on berkly getpeername... +//////////////////////////////////////////////////////////////////// +inline Socket_Address Socket_IP:: +GetPeerName(void) const { + sockaddr_in name; + socklen_t name_len = sizeof(name); + memset(&name, 0, name_len); + + getpeername(_socket, (sockaddr *)&name, &name_len); + return Socket_Address(name); +} #endif //__SOCKET_IP_H__ diff --git a/panda/src/nativenet/socket_portable.h b/panda/src/nativenet/socket_portable.h index 0288366a84..010fcac17c 100644 --- a/panda/src/nativenet/socket_portable.h +++ b/panda/src/nativenet/socket_portable.h @@ -1,9 +1,9 @@ #ifndef __SOCKET_PORTABLE_H__ -#define __SOCKET_PORTABLE_H__ -////////////////////////////////////////////////////////////////// +#define __SOCKET_PORTABLE_H__ +//////////////////////////////////////////////////////////////////// // Lots of stuff to make network socket-based io transparent across multiple // platforms -////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// const int ALL_OK = 0; const int BASIC_ERROR = -1; @@ -121,7 +121,7 @@ inline int init_network() int answer = WSAStartup(0x0101, &mydata); if (answer != 0) return BASIC_ERROR; - + return ALL_OK; } @@ -269,7 +269,7 @@ const int LOCAL_CONNECT_BLOCKING = EINPROGRESS; #include #include -typedef struct sockaddr_in AddressType; +typedef struct sockaddr_in AddressType; typedef int SOCKET; const SOCKET BAD_SOCKET = -1; @@ -290,7 +290,7 @@ inline int DO_SOCKET_WRITE(const SOCKET a, const char * buff, const int len) { return (int)send(a, buff, (size_t)len, 0); } -/////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// inline int DO_SOCKET_WRITE_TO(const SOCKET a, const char * buffer, const int buf_len, const sockaddr_in * addr) { return (int)sendto(a, buffer, (size_t)buf_len, 0, reinterpret_cast(addr), sizeof(sockaddr)); @@ -361,7 +361,7 @@ const long LOCAL_NONBLOCK = 1; const int LOCAL_BLOCKING_ERROR = EAGAIN; const int LOCAL_CONNECT_BLOCKING = EINPROGRESS; -#else +#else /************************************************************************ * NO DEFINITION => GIVE COMPILATION ERROR ************************************************************************/ diff --git a/panda/src/nativenet/socket_selector.h b/panda/src/nativenet/socket_selector.h index 4b9cc3465a..3b0aa8b7c0 100644 --- a/panda/src/nativenet/socket_selector.h +++ b/panda/src/nativenet/socket_selector.h @@ -1,37 +1,37 @@ #ifndef __SOCKET_SELECTOR_H__ #define __SOCKET_SELECTOR_H__ -//////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // This is a structure on purpose. only used as a helper class to save on typing // -//////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// struct Socket_Selector { Socket_fdset _read; Socket_fdset _write; Socket_fdset _error; int _answer; - + Socket_Selector() : _answer( -1) { } - + Socket_Selector(const Socket_fdset &fd) : _read(fd), _write(fd), _error(fd) , _answer( -1) { } - + int WaitFor(const Time_Span &timeout); int WaitFor_All(const Socket_fdset & fd, const Time_Span & timeout); int WaitFor_Read_Error(const Socket_fdset & fd, const Time_Span & timeout); int WaitFor_Write_Error(const Socket_fdset & fd, const Time_Span & timeout); }; -////////////////////////////////////////////////////////////// -// Function name : Socket_Selector::WaitFor -// Description : This function is the reason this call exists.. +//////////////////////////////////////////////////////////////////// +// Function: Socket_Selector::WaitFor +// Description: This function is the reason this call exists.. // It will wait for a read, write or error condition // on a socket or it will time out -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// inline int Socket_Selector::WaitFor(const Time_Span &timeout) { SOCKET local_max = 0; @@ -41,16 +41,16 @@ inline int Socket_Selector::WaitFor(const Time_Span &timeout) local_max = _write._maxid; if (local_max < _error._maxid) local_max = _error._maxid; - + timeval localtv = timeout.GetTval(); _answer = DO_SELECT(local_max + 1, &_read._the_set, &_write._the_set, &_error._the_set, &localtv); return _answer; } -////////////////////////////////////////////////////////////// -// Function name : Socket_Selector::WaitFor_All -// Description : Helper function to utilize the WaitFor function -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Socket_Selector::WaitFor_All +// Description: Helper function to utilize the WaitFor function +//////////////////////////////////////////////////////////////////// inline int Socket_Selector::WaitFor_All(const Socket_fdset & fd, const Time_Span & timeout) { _read = fd; @@ -59,11 +59,11 @@ inline int Socket_Selector::WaitFor_All(const Socket_fdset & fd, const Time_Span return WaitFor(timeout); } -////////////////////////////////////////////////////////////// -// Function name : Socket_Selector::WaitFor_Read_Error -// Description : Helper function for WaitFor +//////////////////////////////////////////////////////////////////// +// Function: Socket_Selector::WaitFor_Read_Error +// Description: Helper function for WaitFor // Only looks for readability and errors -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// inline int Socket_Selector::WaitFor_Read_Error(const Socket_fdset & fd, const Time_Span & timeout) { _read = fd; @@ -72,11 +72,11 @@ inline int Socket_Selector::WaitFor_Read_Error(const Socket_fdset & fd, const Ti return WaitFor(timeout); } -////////////////////////////////////////////////////////////// -// Function name : Socket_Selector::WaitFor_Write_Error -// Description : Helper function for WaitFor +//////////////////////////////////////////////////////////////////// +// Function: Socket_Selector::WaitFor_Write_Error +// Description: Helper function for WaitFor // Only looks for writability and errors -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// inline int Socket_Selector::WaitFor_Write_Error(const Socket_fdset & fd, const Time_Span & timeout) { _read.clear(); diff --git a/panda/src/nativenet/socket_tcp.h b/panda/src/nativenet/socket_tcp.h index b3c4555736..e720aad2d3 100644 --- a/panda/src/nativenet/socket_tcp.h +++ b/panda/src/nativenet/socket_tcp.h @@ -1,26 +1,25 @@ #ifndef __SOCKET_TCP_H__ -#define __SOCKET_TCP_H__ +#define __SOCKET_TCP_H__ #include "pandabase.h" #include "socket_ip.h" -///////////////////////////////////////////////////////////////////// -// Class : Socket_TCP -// +//////////////////////////////////////////////////////////////////// +// Class : Socket_TCP // Description : Base functionality for a TCP connected socket // This class is pretty useless by itself but it does hide some of the // platform differences from machine to machine // -///////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class EXPCL_PANDA_NATIVENET Socket_TCP : public Socket_IP { -public: +public: PUBLISHED: inline Socket_TCP(SOCKET); - inline Socket_TCP() { }; + inline Socket_TCP() { }; inline int SetNoDelay(bool flag = true); inline int SetLinger(int interval_seconds = 0); - inline int DontLinger(); + inline int DontLinger(); inline int SetSendBufferSize(int insize); //inline bool ActiveOpen(const Socket_Address & theaddress); inline bool ActiveOpen(const Socket_Address & theaddress, bool setdelay); @@ -34,7 +33,7 @@ PUBLISHED: public: inline int SendData(const char * data, int size); inline int RecvData(char * data, int size); - + public: static TypeHandle get_class_type() { return _type_handle; @@ -53,33 +52,33 @@ private: static TypeHandle _type_handle; }; -////////////////////////////////////////////////////////////// -// Function name : Socket_TCP::Socket_TCP -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Socket_TCP::Socket_TCP +// Description: +//////////////////////////////////////////////////////////////////// inline Socket_TCP::Socket_TCP(SOCKET sck) : ::Socket_IP(sck) { } //////////////////////////////////////////////////////////////////// -// Function name : SetNoDelay -// Description : Disable Nagle algorithm. Don't delay send to coalesce packets +// Function: SetNoDelay +// Description: Disable Nagle algorithm. Don't delay send to coalesce packets //////////////////////////////////////////////////////////////////// inline int Socket_TCP::SetNoDelay(bool flag) { int nodel = flag; int ret1; ret1 = setsockopt(_socket, IPPROTO_TCP, TCP_NODELAY, (char *) & nodel, sizeof(nodel)); - + if (ret1 != 0) return BASIC_ERROR; - + return ALL_OK; } //////////////////////////////////////////////////////////////////// -// Function name : SetLinger -// Description : will control the behavior of SO_LINGER for a TCP socket +// Function: SetLinger +// Description: will control the behavior of SO_LINGER for a TCP socket //////////////////////////////////////////////////////////////////// int Socket_TCP::SetLinger(int interval_seconds) { @@ -93,11 +92,11 @@ int Socket_TCP::SetLinger(int interval_seconds) } //////////////////////////////////////////////////////////////////// -// Function name : Socket_TCP::DontLinger -// Description : Turn off the linger flag. The socket will quickly release -// buffered items and free up OS resources. You may lose -// a stream if you use this flag and do not negotiate the close -// at the application layer. +// Function: Socket_TCP::DontLinger +// Description: Turn off the linger flag. The socket will quickly release +// buffered items and free up OS resources. You may lose +// a stream if you use this flag and do not negotiate the close +// at the application layer. //////////////////////////////////////////////////////////////////// int Socket_TCP::DontLinger() { @@ -111,8 +110,8 @@ int Socket_TCP::DontLinger() } //////////////////////////////////////////////////////////////////// -// Function name : SetSendBufferSize -// Description : Just like it sounds. Sets a buffered socket recv buffer size. +// Function: SetSendBufferSize +// Description: Just like it sounds. Sets a buffered socket recv buffer size. // This function does not refuse ranges outside hard-coded OS // limits //////////////////////////////////////////////////////////////////// @@ -124,9 +123,9 @@ int Socket_TCP::SetSendBufferSize(int insize) } //////////////////////////////////////////////////////////////////// -// Function name : ActiveOpen -// Description : This function will try and set the socket up for active open to a specified -// address and port provided by the input parameter +// Function: ActiveOpen +// Description: This function will try and set the socket up for active open to a specified +// address and port provided by the input parameter //////////////////////////////////////////////////////////////////// bool Socket_TCP::ActiveOpen(const Socket_Address & theaddress, bool setdelay) { @@ -136,28 +135,28 @@ bool Socket_TCP::ActiveOpen(const Socket_Address & theaddress, bool setdelay) if(setdelay) SetNoDelay(); - + if (DO_CONNECT(_socket, &theaddress.GetAddressInfo()) != 0) return ErrorClose(); - + return true; } //////////////////////////////////////////////////////////////////// -// Function name : ActiveOpenNonBlocking -// Description : This function will try and set the socket up for active open to a specified -// address and port provided by the input parameter (non-blocking version) +// Function: ActiveOpenNonBlocking +// Description: This function will try and set the socket up for active open to a specified +// address and port provided by the input parameter (non-blocking version) //////////////////////////////////////////////////////////////////// bool Socket_TCP::ActiveOpenNonBlocking(const Socket_Address & theaddress) { _socket = DO_NEWTCP(); if (_socket == BAD_SOCKET) return false; - + SetNonBlocking(); SetReuseAddress(); - + if (DO_CONNECT(_socket, &theaddress.GetAddressInfo()) != 0) { if (GETERROR() != LOCAL_CONNECT_BLOCKING) { @@ -165,15 +164,13 @@ bool Socket_TCP::ActiveOpenNonBlocking(const Socket_Address & theaddress) return ErrorClose(); } } - + return true; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_TCP::SendData -// Description : Ok Lets Send the Data -// -// Return type : int +// Function: Socket_TCP::SendData +// Description: Ok Lets Send the Data // - if error // 0 if socket closed for write or lengh is 0 // + bytes writen ( May be smaller than requested) @@ -184,10 +181,8 @@ inline int Socket_TCP::SendData(const char * data, int size) } //////////////////////////////////////////////////////////////////// -// Function name : Socket_TCP::RecvData -// Description : Read the data from the connection -// -// Return type : int +// Function: Socket_TCP::RecvData +// Description: Read the data from the connection // - if error // 0 if socket closed for read or length is 0 // + bytes read ( May be smaller than requested) @@ -199,10 +194,8 @@ inline int Socket_TCP::RecvData(char * data, int len) } //////////////////////////////////////////////////////////////////// -// Function name : Socket_TCP::RecvData -// Description : Read the data from the connection -// -// Return type : int +// Function: Socket_TCP::RecvData +// Description: Read the data from the connection // - if error // 0 if socket closed for read or length is 0 // + bytes read ( May be smaller than requested) diff --git a/panda/src/nativenet/socket_tcp_listen.h b/panda/src/nativenet/socket_tcp_listen.h index 070493ed5e..4e43864ad4 100644 --- a/panda/src/nativenet/socket_tcp_listen.h +++ b/panda/src/nativenet/socket_tcp_listen.h @@ -5,10 +5,10 @@ #include "socket_ip.h" #include "socket_tcp.h" -///////////////////////////////////////////////////////////////////// -// Class : Socket_TCP_Listen +//////////////////////////////////////////////////////////////////// +// Class : Socket_TCP_Listen // Description : Base functionality for a TCP rendezvous socket -///////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class EXPCL_PANDA_NATIVENET Socket_TCP_Listen : public Socket_IP { public: @@ -16,10 +16,10 @@ PUBLISHED: Socket_TCP_Listen() {}; ~Socket_TCP_Listen() {}; inline bool OpenForListen(const Socket_Address & Inaddess, int backlog_size = 1024); - inline bool GetIncomingConnection(Socket_TCP & newsession, Socket_Address &address); + inline bool GetIncomingConnection(Socket_TCP & newsession, Socket_Address &address); public: inline bool GetIncomingConnection(SOCKET & newsession, Socket_Address &address); - + public: static TypeHandle get_class_type() { return _type_handle; @@ -39,20 +39,20 @@ private: }; //////////////////////////////////////////////////////////////////// -// Function name : OpenForListen -// Description : This function will initialize a listening Socket +// Function: OpenForListen +// Description: This function will initialize a listening Socket //////////////////////////////////////////////////////////////////// inline bool Socket_TCP_Listen::OpenForListen(const Socket_Address & Inaddess, int backlog_size ) { ErrorClose(); _socket = DO_NEWTCP(); - + SetReuseAddress(); - + if (DO_BIND(_socket, &Inaddess.GetAddressInfo()) != 0) { return ErrorClose(); } - + if (DO_LISTEN(_socket, backlog_size) != 0) { return ErrorClose(); } @@ -60,8 +60,8 @@ inline bool Socket_TCP_Listen::OpenForListen(const Socket_Address & Inaddess, in return true; } //////////////////////////////////////////////////////////////////// -// Function name : GetIncomingConnection -// Description : This function is used to accept new connections +// Function: GetIncomingConnection +// Description: This function is used to accept new connections //////////////////////////////////////////////////////////////////// inline bool Socket_TCP_Listen::GetIncomingConnection(SOCKET & newsession, Socket_Address &address) { diff --git a/panda/src/nativenet/socket_tcp_ssl.h b/panda/src/nativenet/socket_tcp_ssl.h index 6845e1a383..4af5dba8ac 100644 --- a/panda/src/nativenet/socket_tcp_ssl.h +++ b/panda/src/nativenet/socket_tcp_ssl.h @@ -1,5 +1,5 @@ #ifndef __SOCKET_TCP_SSL_H__ -#define __SOCKET_TCP_SSL_H__ +#define __SOCKET_TCP_SSL_H__ #include "pandabase.h" #include "config_nativenet.h" @@ -15,12 +15,11 @@ #include #include -///////////////////////////////////////////////////////////////////// -// Class : Socket_TCP_SSL +//////////////////////////////////////////////////////////////////// +// Class : Socket_TCP_SSL +// Description : // -// Description : -// -///////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// extern EXPCL_PANDA_NATIVENET SSL_CTX *global_ssl_ctx; @@ -35,15 +34,15 @@ struct SSlStartup meth = SSLv23_method(); SSL_load_error_strings(); // I hate this cast, but older versions of OpenSSL need it. - global_ssl_ctx = SSL_CTX_new ((SSL_METHOD *) meth); + global_ssl_ctx = SSL_CTX_new ((SSL_METHOD *) meth); } ~SSlStartup() { - SSL_CTX_free (global_ssl_ctx); + SSL_CTX_free (global_ssl_ctx); global_ssl_ctx = NULL; } - + bool isactive() { return global_ssl_ctx != NULL; }; }; @@ -52,7 +51,7 @@ struct SSlStartup class EXPCL_PANDA_NATIVENET Socket_TCP_SSL : public Socket_IP { public: - + inline Socket_TCP_SSL(SOCKET); inline Socket_TCP_SSL() : _ssl(NULL) {} @@ -60,11 +59,11 @@ public: { CleanSslUp(); } - + inline int SetNoDelay(); inline int SetLinger(int interval_seconds = 0); inline int DontLinger(); - + inline int SetSendBufferSize(int insize); inline bool ActiveOpen(const Socket_Address & theaddress); inline int SendData(const char * data, int size); @@ -86,7 +85,7 @@ private: _ssl = NULL; } } - + public: static TypeHandle get_class_type() { return _type_handle; @@ -105,46 +104,48 @@ private: static TypeHandle _type_handle; }; -////////////////////////////////////////////////////////////// -// Function name : Socket_TCP_SSL::Socket_TCP_SSL -// Description : -////////////////////////////////////////////////////////////// -// right know this will only work for a -// accepted ie a server socket ?? -inline Socket_TCP_SSL::Socket_TCP_SSL(SOCKET sck) : ::Socket_IP(sck) -{ - SetNonBlocking(); // maybe should be blocking? - - _ssl = SSL_new (global_ssl_ctx); - if(_ssl == NULL) - return; - SSL_set_fd (_ssl,(int)GetSocket() ); +//////////////////////////////////////////////////////////////////// +// Function: Socket_TCP_SSL::Socket_TCP_SSL +// Description: +//////////////////////////////////////////////////////////////////// +inline Socket_TCP_SSL:: +Socket_TCP_SSL(SOCKET sck) : ::Socket_IP(sck) { + // right know this will only work for a + // accepted ie a server socket ?? + SetNonBlocking(); // maybe should be blocking? - SSL_accept(_ssl); - ERR_clear_error(); + _ssl = SSL_new(global_ssl_ctx); + if (_ssl == NULL) { + return; + } -// printf(" Ssl Accept = %d \n",err); + SSL_set_fd(_ssl, (int)GetSocket()); + + SSL_accept(_ssl); + ERR_clear_error(); + + //printf(" Ssl Accept = %d \n",err); } //////////////////////////////////////////////////////////////////// -// Function name : SetNoDelay -// Description : Disable Nagle algorithm. Don't delay send to coalesce packets +// Function: SetNoDelay +// Description: Disable Nagle algorithm. Don't delay send to coalesce packets //////////////////////////////////////////////////////////////////// inline int Socket_TCP_SSL::SetNoDelay() { int nodel = 1; int ret1; ret1 = setsockopt(_socket, IPPROTO_TCP, TCP_NODELAY, (char *) & nodel, sizeof(nodel)); - + if (ret1 != 0) return BASIC_ERROR; - + return ALL_OK; } //////////////////////////////////////////////////////////////////// -// Function name : SetLinger -// Description : will control the behavior of SO_LINGER for a TCP socket +// Function: SetLinger +// Description: will control the behavior of SO_LINGER for a TCP socket //////////////////////////////////////////////////////////////////// int Socket_TCP_SSL::SetLinger(int interval_seconds) { @@ -158,11 +159,11 @@ int Socket_TCP_SSL::SetLinger(int interval_seconds) } //////////////////////////////////////////////////////////////////// -// Function name : Socket_TCP_SSL::DontLinger -// Description : Turn off the linger flag. The socket will quickly release -// buffered items and free up OS resources. You may lose -// a stream if you use this flag and do not negotiate the close -// at the application layer. +// Function: Socket_TCP_SSL::DontLinger +// Description: Turn off the linger flag. The socket will quickly release +// buffered items and free up OS resources. You may lose +// a stream if you use this flag and do not negotiate the close +// at the application layer. //////////////////////////////////////////////////////////////////// int Socket_TCP_SSL::DontLinger() { @@ -176,8 +177,8 @@ int Socket_TCP_SSL::DontLinger() } //////////////////////////////////////////////////////////////////// -// Function name : SetSendBufferSize -// Description : Just like it sounds. Sets a buffered socket recv buffer size. +// Function: SetSendBufferSize +// Description: Just like it sounds. Sets a buffered socket recv buffer size. // This function does not refuse ranges outside hard-coded OS // limits //////////////////////////////////////////////////////////////////// @@ -189,22 +190,22 @@ int Socket_TCP_SSL::SetSendBufferSize(int insize) } //////////////////////////////////////////////////////////////////// -// Function name : ActiveOpen -// Description : This function will try and set the socket up for active open to a specified -// address and port provided by the input parameter +// Function: ActiveOpen +// Description: This function will try and set the socket up for active open to a specified +// address and port provided by the input parameter //////////////////////////////////////////////////////////////////// bool Socket_TCP_SSL::ActiveOpen(const Socket_Address & theaddress) { _socket = DO_NEWTCP(); if (_socket == BAD_SOCKET) return false; - + if (DO_CONNECT(_socket, &theaddress.GetAddressInfo()) != 0) return ErrorClose(); - - _ssl = SSL_new (global_ssl_ctx); - if(_ssl == NULL) + + _ssl = SSL_new (global_ssl_ctx); + if(_ssl == NULL) return false; SSL_set_fd (_ssl,(int)GetSocket() ); if(SSL_connect(_ssl) == -1) @@ -215,10 +216,8 @@ bool Socket_TCP_SSL::ActiveOpen(const Socket_Address & theaddress) } //////////////////////////////////////////////////////////////////// -// Function name : Socket_TCP_SSL::SendData -// Description : Ok Lets Send the Data -// -// Return type : int +// Function: Socket_TCP_SSL::SendData +// Description: Ok Lets Send the Data // - if error // 0 if socket closed for write or lengh is 0 // + bytes writen ( May be smaller than requested) @@ -234,10 +233,8 @@ inline int Socket_TCP_SSL::SendData(const char * data, int size) } //////////////////////////////////////////////////////////////////// -// Function name : Socket_TCP_SSL::RecvData -// Description : Read the data from the connection -// -// Return type : int +// Function: Socket_TCP_SSL::RecvData +// Description: Read the data from the connection // - if error // 0 if socket closed for read or length is 0 // + bytes read ( May be smaller than requested) @@ -253,10 +250,8 @@ inline int Socket_TCP_SSL::RecvData(char * data, int len) } //////////////////////////////////////////////////////////////////// -// Function name : ErrorIs_WouldBlocking -// Description : Is last error a blocking error ?? -// -// Return type : Bool +// Function: ErrorIs_WouldBlocking +// Description: Is last error a blocking error ?? // True is last error was a blocking error //////////////////////////////////////////////////////////////////// inline bool Socket_TCP_SSL::ErrorIs_WouldBlocking(int err) @@ -271,7 +266,7 @@ inline bool Socket_TCP_SSL::ErrorIs_WouldBlocking(int err) int ssl_error_code = SSL_get_error(_ssl,err); bool answer = false; - + switch(ssl_error_code) { case SSL_ERROR_WANT_READ: diff --git a/panda/src/nativenet/socket_udp.h b/panda/src/nativenet/socket_udp.h index 23961eb476..07cce9f94a 100644 --- a/panda/src/nativenet/socket_udp.h +++ b/panda/src/nativenet/socket_udp.h @@ -17,14 +17,13 @@ #include "socket_udp_incoming.h" -///////////////////////////////////////////////////////////////////// -// Class : Socket_UDP -// +//////////////////////////////////////////////////////////////////// +// Class : Socket_UDP // Description : Base functionality for a combination UDP Reader and // Writer. This duplicates code from // Socket_UDP_Outgoing, to avoid the problems of // multiple inheritance. -///////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class EXPCL_PANDA_NATIVENET Socket_UDP : public Socket_UDP_Incoming { public: @@ -44,7 +43,7 @@ public: PUBLISHED: inline bool SendTo(const string &data, const Socket_Address & address); inline bool SetToBroadCast(); - + public: static TypeHandle get_class_type() { return _type_handle; @@ -62,43 +61,35 @@ public: private: static TypeHandle _type_handle; }; -////////////////////////////////////////////////////////////// -// Function name : Socket_UDP:SetToBroadCast -// Description : Ask the OS to let us receive BROADCASt packets on this port.. -// Return type : bool -// Argument : void -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Socket_UDP:SetToBroadCast +// Description: Ask the OS to let us receive BROADCASt packets on this port.. +//////////////////////////////////////////////////////////////////// inline bool Socket_UDP::SetToBroadCast() { int optval = 1; - + if (setsockopt(_socket, SOL_SOCKET, SO_BROADCAST, (char *)&optval, sizeof(optval)) != 0) return false; return true; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_UDP::InitToAddress -// Description : Connects the Socket to a Specified address -// -// Return type : inline bool -// Argument : NetAddress & address +// Function: Socket_UDP::InitToAddress +// Description: Connects the Socket to a Specified address //////////////////////////////////////////////////////////////////// inline bool Socket_UDP::InitToAddress(const Socket_Address & address) { if (InitNoAddress() != true) return false; - + if (DO_CONNECT(_socket, &address.GetAddressInfo()) != 0) return ErrorClose(); - + return true; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_UDP::InitNoAddress -// Description : This will set a udp up for targeted sends.. -// -// Return type : inline bool -// Argument : void +// Function: Socket_UDP::InitNoAddress +// Description: This will set a udp up for targeted sends.. //////////////////////////////////////////////////////////////////// inline bool Socket_UDP::InitNoAddress() { @@ -106,17 +97,13 @@ inline bool Socket_UDP::InitNoAddress() _socket = DO_NEWUDP(); if (_socket == BAD_SOCKET) return false; - + return true; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_UDP::Send -// Description : Send data to connected address -// -// Return type : inline bool -// Argument : char * data -// Argument : int len +// Function: Socket_UDP::Send +// Description: Send data to connected address //////////////////////////////////////////////////////////////////// inline bool Socket_UDP::Send(const char * data, int len) { @@ -124,11 +111,8 @@ inline bool Socket_UDP::Send(const char * data, int len) } //////////////////////////////////////////////////////////////////// -// Function name : Socket_UDP::Send -// Description : Send data to connected address -// -// Return type : inline bool -// Argument : const string &data +// Function: Socket_UDP::Send +// Description: Send data to connected address //////////////////////////////////////////////////////////////////// inline bool Socket_UDP::Send(const string &data) { @@ -136,13 +120,8 @@ inline bool Socket_UDP::Send(const string &data) } //////////////////////////////////////////////////////////////////// -// Function name : Socket_UDP::SendTo -// Description : Send data to specified address -// -// Return type : inline bool -// Argument : char * data -// Argument : int len -// Argument : NetAddress & address +// Function: Socket_UDP::SendTo +// Description: Send data to specified address //////////////////////////////////////////////////////////////////// inline bool Socket_UDP::SendTo(const char * data, int len, const Socket_Address & address) { @@ -150,12 +129,8 @@ inline bool Socket_UDP::SendTo(const char * data, int len, const Socket_Address } //////////////////////////////////////////////////////////////////// -// Function name : Socket_UDP::SendTo -// Description : Send data to specified address -// -// Return type : inline bool -// Argument : const string &data -// Argument : NetAddress & address +// Function: Socket_UDP::SendTo +// Description: Send data to specified address //////////////////////////////////////////////////////////////////// inline bool Socket_UDP::SendTo(const string &data, const Socket_Address & address) { diff --git a/panda/src/nativenet/socket_udp_incoming.h b/panda/src/nativenet/socket_udp_incoming.h index c915e6a875..a75f0ed876 100644 --- a/panda/src/nativenet/socket_udp_incoming.h +++ b/panda/src/nativenet/socket_udp_incoming.h @@ -4,13 +4,12 @@ #include "pandabase.h" #include "socket_ip.h" -///////////////////////////////////////////////////////////////////// -// Class : Socket_UDP_Incoming -// +//////////////////////////////////////////////////////////////////// +// Class : Socket_UDP_Incoming // Description : Base functionality for a UDP Reader // // -///////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class EXPCL_PANDA_NATIVENET Socket_UDP_Incoming : public Socket_IP { PUBLISHED: @@ -22,7 +21,7 @@ PUBLISHED: inline bool SendTo(const char * data, int len, const Socket_Address & address); inline bool InitNoAddress(); inline bool SetToBroadCast(); - + public: static TypeHandle get_class_type() { return _type_handle; @@ -41,44 +40,37 @@ private: static TypeHandle _type_handle; }; -////////////////////////////////////////////////////////////// -// Function name : Socket_UDP_Incoming::tToBroadCast -// Description : Flips the OS bits that allow for brodcast +//////////////////////////////////////////////////////////////////// +// Function: Socket_UDP_Incoming::tToBroadCast +// Description: Flips the OS bits that allow for brodcast // packets to com in on this port // -// Return type : bool -// Argument : void -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// inline bool Socket_UDP_Incoming::SetToBroadCast() { int optval = 1; - + if (setsockopt(_socket, SOL_SOCKET, SO_BROADCAST, (char *)&optval, sizeof(optval)) != 0) return false; return true; } -////////////////////////////////////////////////////////////// -// Function name : Socket_UDP_Incoming::InitNoAddress -// Description : Set this socket to work with out a bound external address.. -// Return type : inline bool -// Argument : void -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Socket_UDP_Incoming::InitNoAddress +// Description: Set this socket to work with out a bound external address.. +//////////////////////////////////////////////////////////////////// inline bool Socket_UDP_Incoming::InitNoAddress() { Close(); _socket = DO_NEWUDP(); if (_socket == BAD_SOCKET) return false; - + return true; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_UDP_Incoming::OpenForInput -// Description : Starts a UDP socket listening on a port -// -// Return type : bool -// Argument : NetAddress & address +// Function: Socket_UDP_Incoming::OpenForInput +// Description: Starts a UDP socket listening on a port //////////////////////////////////////////////////////////////////// inline bool Socket_UDP_Incoming::OpenForInput(const Socket_Address & address) { @@ -86,19 +78,16 @@ inline bool Socket_UDP_Incoming::OpenForInput(const Socket_Address & address) _socket = DO_NEWUDP(); if (_socket == BAD_SOCKET) return ErrorClose(); - + if (DO_BIND(_socket, &address.GetAddressInfo()) != 0) return ErrorClose(); - + return true; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_UDP_Incoming::OpenForInput -// Description : Starts a UDP socket listening on a port -// -// Return type : bool -// Argument : NetAddress & address +// Function: Socket_UDP_Incoming::OpenForInput +// Description: Starts a UDP socket listening on a port //////////////////////////////////////////////////////////////////// inline bool Socket_UDP_Incoming::OpenForInputMCast(const Socket_Address & address) { @@ -107,16 +96,16 @@ inline bool Socket_UDP_Incoming::OpenForInputMCast(const Socket_Address & addres if (_socket == BAD_SOCKET) return ErrorClose(); - Socket_Address wa1(address.get_port()); + Socket_Address wa1(address.get_port()); if (DO_BIND(_socket, &wa1.GetAddressInfo()) != 0) return ErrorClose(); - + struct ip_mreq imreq; memset(&imreq,0,sizeof(imreq)); imreq.imr_multiaddr.s_addr = address.GetAddressInfo().sin_addr.s_addr; imreq.imr_interface.s_addr = INADDR_ANY; // use DEFAULT interface - int status = setsockopt(GetSocket(), IPPROTO_IP, IP_ADD_MEMBERSHIP, + int status = setsockopt(GetSocket(), IPPROTO_IP, IP_ADD_MEMBERSHIP, (const char *)&imreq, sizeof(struct ip_mreq)); if(status != 0) @@ -125,38 +114,29 @@ inline bool Socket_UDP_Incoming::OpenForInputMCast(const Socket_Address & addres } //////////////////////////////////////////////////////////////////// -// Function name : Socket_UDP_Incoming::GetPacket -// Description : Grabs a dataset off the listening UDP socket +// Function: Socket_UDP_Incoming::GetPacket +// Description: Grabs a dataset off the listening UDP socket // and fills in the source address information // -// Return type : bool -// Argument : char * data -// Argument : int *max_len -// Argument : NetAddress & address //////////////////////////////////////////////////////////////////// inline bool Socket_UDP_Incoming::GetPacket(char * data, int *max_len, Socket_Address & address) { int val = DO_RECV_FROM(_socket, data, *max_len, &address.GetAddressInfo()); *max_len = 0; - - if (val <= 0) + + if (val <= 0) { if (GetLastError() != LOCAL_BLOCKING_ERROR) // im treating a blocking error as a 0 lenght read return false; } else *max_len = val; - + return true; } //////////////////////////////////////////////////////////////////// -// Function name : SocketUDP_Outgoing::SendTo -// Description : Send data to specified address -// -// Return type : inline bool -// Argument : char * data -// Argument : int len -// Argument : NetAddress & address +// Function: SocketUDP_Outgoing::SendTo +// Description: Send data to specified address //////////////////////////////////////////////////////////////////// inline bool Socket_UDP_Incoming::SendTo(const char * data, int len, const Socket_Address & address) { diff --git a/panda/src/nativenet/socket_udp_outgoing.h b/panda/src/nativenet/socket_udp_outgoing.h index d804a79d7a..424bcd1d15 100644 --- a/panda/src/nativenet/socket_udp_outgoing.h +++ b/panda/src/nativenet/socket_udp_outgoing.h @@ -4,13 +4,12 @@ #include "config_nativenet.h" #include "socket_ip.h" -///////////////////////////////////////////////////////////////////// -// Class : Socket_UDP_Outgoing -// +//////////////////////////////////////////////////////////////////// +// Class : Socket_UDP_Outgoing // Description : Base functionality for a UDP Sending Socket // // -///////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class EXPCL_PANDA_NATIVENET Socket_UDP_Outgoing : public Socket_IP { public: @@ -30,7 +29,7 @@ public: PUBLISHED: inline bool SendTo(const string &data, const Socket_Address & address); inline bool SetToBroadCast(); - + public: static TypeHandle get_class_type() { return _type_handle; @@ -48,43 +47,35 @@ public: private: static TypeHandle _type_handle; }; -////////////////////////////////////////////////////////////// -// Function name : Socket_UDP_Outgoing:SetToBroadCast -// Description : Ask the OS to let us receive BROADCASt packets on this port.. -// Return type : bool -// Argument : void -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Socket_UDP_Outgoing:SetToBroadCast +// Description: Ask the OS to let us receive BROADCASt packets on this port.. +//////////////////////////////////////////////////////////////////// inline bool Socket_UDP_Outgoing::SetToBroadCast() { int optval = 1; - + if (setsockopt(_socket, SOL_SOCKET, SO_BROADCAST, (char *)&optval, sizeof(optval)) != 0) return false; return true; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_UDP_Outgoing::InitToAddress -// Description : Connects the Socket to a Specified address -// -// Return type : inline bool -// Argument : NetAddress & address +// Function: Socket_UDP_Outgoing::InitToAddress +// Description: Connects the Socket to a Specified address //////////////////////////////////////////////////////////////////// inline bool Socket_UDP_Outgoing::InitToAddress(const Socket_Address & address) { if (InitNoAddress() != true) return false; - + if (DO_CONNECT(_socket, &address.GetAddressInfo()) != 0) return ErrorClose(); - + return true; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_UDP_Outgoing::InitNoAddress -// Description : This will set a udp up for targeted sends.. -// -// Return type : inline bool -// Argument : void +// Function: Socket_UDP_Outgoing::InitNoAddress +// Description: This will set a udp up for targeted sends.. //////////////////////////////////////////////////////////////////// inline bool Socket_UDP_Outgoing::InitNoAddress() { @@ -92,17 +83,13 @@ inline bool Socket_UDP_Outgoing::InitNoAddress() _socket = DO_NEWUDP(); if (_socket == BAD_SOCKET) return false; - + return true; } //////////////////////////////////////////////////////////////////// -// Function name : Socket_UDP_Outgoing::Send -// Description : Send data to connected address -// -// Return type : inline bool -// Argument : char * data -// Argument : int len +// Function: Socket_UDP_Outgoing::Send +// Description: Send data to connected address //////////////////////////////////////////////////////////////////// inline bool Socket_UDP_Outgoing::Send(const char * data, int len) { @@ -110,11 +97,8 @@ inline bool Socket_UDP_Outgoing::Send(const char * data, int len) } //////////////////////////////////////////////////////////////////// -// Function name : Socket_UDP_Outgoing::Send -// Description : Send data to connected address -// -// Return type : inline bool -// Argument : const string &data +// Function: Socket_UDP_Outgoing::Send +// Description: Send data to connected address //////////////////////////////////////////////////////////////////// inline bool Socket_UDP_Outgoing::Send(const string &data) { @@ -122,13 +106,8 @@ inline bool Socket_UDP_Outgoing::Send(const string &data) } //////////////////////////////////////////////////////////////////// -// Function name : Socket_UDP_Outgoing::SendTo -// Description : Send data to specified address -// -// Return type : inline bool -// Argument : char * data -// Argument : int len -// Argument : NetAddress & address +// Function: Socket_UDP_Outgoing::SendTo +// Description: Send data to specified address //////////////////////////////////////////////////////////////////// inline bool Socket_UDP_Outgoing::SendTo(const char * data, int len, const Socket_Address & address) { @@ -136,12 +115,8 @@ inline bool Socket_UDP_Outgoing::SendTo(const char * data, int len, const Socket } //////////////////////////////////////////////////////////////////// -// Function name : Socket_UDP_Outgoing::SendTo -// Description : Send data to specified address -// -// Return type : inline bool -// Argument : const string &data -// Argument : NetAddress & address +// Function: Socket_UDP_Outgoing::SendTo +// Description: Send data to specified address //////////////////////////////////////////////////////////////////// inline bool Socket_UDP_Outgoing::SendTo(const string &data, const Socket_Address & address) { diff --git a/panda/src/nativenet/time_accumulator.h b/panda/src/nativenet/time_accumulator.h index 5e73cb9855..e8a4728b48 100644 --- a/panda/src/nativenet/time_accumulator.h +++ b/panda/src/nativenet/time_accumulator.h @@ -1,10 +1,10 @@ #ifndef __TIME_ACCUMULATOR_H__ #define __TIME_ACCUMULATOR_H__ -/////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // -// Think of this as a stopwatch that can be restarted. +// Think of this as a stopwatch that can be restarted. // -/////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class Time_Accumulator { public: @@ -23,54 +23,54 @@ private: Time_Clock *_accum_start; // the time of day the clock started }; -////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // you can set the internal accumilator to a value.. -//////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// inline void Time_Accumulator::Set(const Time_Span & in) -{ +{ _total_time = in; // - // this seems to make the most since .. - // if you are running the clock right know... assume the timespane you + // this seems to make the most since .. + // if you are running the clock right know... assume the timespane you // are passing in is inclusive.. but keep clock running.. - // + // // May need to rethink this... // - if(_accum_start != NULL) + if(_accum_start != NULL) { Stop(); Start(); } } -////////////////////////////////////////////////////////////// -// Function name : Time_Accumulator::Time_Accumulator -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Accumulator::Time_Accumulator +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Accumulator::Time_Accumulator() : _total_time(0,0,0,0,0), _accum_start(NULL) { } -////////////////////////////////////////////////////////////// -// Function name : Time_Accumulator::~Time_Accumulator -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Accumulator::~Time_Accumulator +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Accumulator::~Time_Accumulator() { if(_accum_start != NULL) delete _accum_start; } -////////////////////////////////////////////////////////////// -// Function name : void Time_Accumulator::Start -// Description : -////////////////////////////////////////////////////////////// -inline void Time_Accumulator::Start() -{ +//////////////////////////////////////////////////////////////////// +// Function: void Time_Accumulator::Start +// Description: +//////////////////////////////////////////////////////////////////// +inline void Time_Accumulator::Start() +{ if(_accum_start == NULL) _accum_start = new Time_Clock(); } -////////////////////////////////////////////////////////////// -// Function name : void Time_Accumulator::Stop -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: void Time_Accumulator::Stop +// Description: +//////////////////////////////////////////////////////////////////// inline void Time_Accumulator::Stop() { if(_accum_start != NULL) @@ -81,29 +81,29 @@ inline void Time_Accumulator::Stop() _accum_start = NULL; } } -////////////////////////////////////////////////////////////// -// Function name : Time_Accumulator::Reset -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Accumulator::Reset +// Description: +//////////////////////////////////////////////////////////////////// void Time_Accumulator::Reset() { if(_accum_start != NULL) - { + { delete _accum_start; _accum_start = NULL; } _total_time.Set(0,0,0,0,0); } -////////////////////////////////////////////////////////////// -// Function name : Time_Accumulator::Report -// Description : -////////////////////////////////////////////////////////////// -inline Time_Span Time_Accumulator::Report() +//////////////////////////////////////////////////////////////////// +// Function: Time_Accumulator::Report +// Description: +//////////////////////////////////////////////////////////////////// +inline Time_Span Time_Accumulator::Report() { Time_Span answer(_total_time); if(_accum_start != NULL) { - Time_Span ww(Time_Clock::GetCurrentTime() - *_accum_start); + Time_Span ww(Time_Clock::GetCurrentTime() - *_accum_start); answer += ww; } return answer; diff --git a/panda/src/nativenet/time_base.h b/panda/src/nativenet/time_base.h index 1577f8850e..1daccc125d 100644 --- a/panda/src/nativenet/time_base.h +++ b/panda/src/nativenet/time_base.h @@ -1,6 +1,6 @@ #ifndef __TIME_BASE_H__ -#define __TIME_BASE_H__ -///////////////////////////////////////////////////////////////////// +#define __TIME_BASE_H__ +//////////////////////////////////////////////////////////////////// // Functions To support General Time Managment. And to allow for cross platform use. // // @@ -24,7 +24,7 @@ // Windows 2k and Linux are really slow (~250k a sec) at returning the current system time ?? // So use time functions that grab the current system time sparingly ?? // -//////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// #ifdef WIN32 #include #include @@ -38,48 +38,39 @@ #include enum { USEC = 1000000 }; -////////////////////////////////////////////////////////////// -// Function name : NormalizeTime -// Description : -// Return type : inline void -// Argument : timeval &in -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: NormalizeTime +// Description: +//////////////////////////////////////////////////////////////////// inline void NormalizeTime(timeval &in) { - while (in.tv_usec >= USEC) + while (in.tv_usec >= USEC) { in.tv_usec -= USEC; in.tv_sec++; } - - while (in.tv_usec < 0) + + while (in.tv_usec < 0) { in.tv_usec += USEC; in.tv_sec--; } } -////////////////////////////////////////////////////////////// -// Function name : TimeDif -// Description : -// Return type : inline void -// Argument : const struct timeval &start -// Argument : const struct timeval &fin -// Argument : struct timeval &answer -////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////// +// Function: TimeDif +// Description: +//////////////////////////////////////////////////////////////////// inline void TimeDif(const struct timeval &start, const struct timeval &fin, struct timeval &answer) { answer.tv_usec = fin.tv_usec - start.tv_usec; answer.tv_sec = fin.tv_sec - start.tv_sec; NormalizeTime(answer); } -////////////////////////////////////////////////////////////// -// Function name : TimeAdd -// Description : -// Return type : inline void -// Argument : const struct timeval &start -// Argument : const struct timeval &delta -// Argument : struct timeval &answer -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: TimeAdd +// Description: +//////////////////////////////////////////////////////////////////// inline void TimeAdd(const struct timeval &start, const struct timeval &delta, struct timeval &answer) { answer.tv_usec = start.tv_usec + delta.tv_usec; @@ -87,18 +78,13 @@ inline void TimeAdd(const struct timeval &start, const struct timeval &delta, st NormalizeTime(answer); } -#ifdef WIN32 -//////////////////////////////////////////////////////////////// -// +#ifdef WIN32 // Lets make Windows think it is a unix machine :) -// -////////////////////////////////////////////////////////////// -// Function name : gettimeofday -// Description : -// Return type : inline int -// Argument : struct timeval *tv -// Argument : void * trash -////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////// +// Function: gettimeofday +// Description: +//////////////////////////////////////////////////////////////////// inline int gettimeofday(struct timeval *tv, void * trash) { struct timeb timeb; diff --git a/panda/src/nativenet/time_clock.h b/panda/src/nativenet/time_clock.h index c41d8b489e..b84de8a50f 100644 --- a/panda/src/nativenet/time_clock.h +++ b/panda/src/nativenet/time_clock.h @@ -1,16 +1,13 @@ #ifndef __Time_H__ -#define __Time_H__ -////////////////////////////////////////////////////// -// Class : Time_Clock +#define __Time_H__ +//////////////////////////////////////////////////////////////////// +// Class : Time_Clock +// Description : This class is to provide a consistant interface and +// storage to clock time .. Epoch based time to the second // -// Description: -// This class is to provide a consistant interface and storage to -// clock time .. Epoch based time to the second +// jan-2000 .. rhh changing all time to use sub second timing... // -// jan-2000 .. rhh changinging all time to use sub second timing... -// -// -////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// #include @@ -20,7 +17,7 @@ class Time_Span; class Time_Clock { friend class Time_Span; - + public: // Constructors static Time_Clock GetCurrentTime(); @@ -34,14 +31,14 @@ public: Time_Clock(long secs, long usecs); Time_Clock(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, long microseconds = 0, int nDST = -1); Time_Clock(const Time_Clock& timeSrc); - + inline const Time_Clock& operator=(const Time_Clock& timeSrc); inline const Time_Clock& operator=(time_t t); - + // Attributes struct tm* GetGmtTm(struct tm* ptm = NULL) const; struct tm* GetLocalTm(struct tm* ptm = NULL) const; - + time_t GetTime() const; int GetYear() const; int GetMonth() const; // month of year (1 = Jan) @@ -50,10 +47,10 @@ public: int GetMinute() const; int GetSecond() const; int GetDayOfWeek() const; // 1=Sun, 2=Mon, ..., 7=Sat - + void Set(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, long microseconds = 0, int nDST = -1); - - + + // Operations // time math const Time_Clock& operator+=(const Time_Span &Time_Span); @@ -64,8 +61,8 @@ public: bool operator>(const Time_Clock &time) const; bool operator<=(const Time_Clock &time) const; bool operator>=(const Time_Clock &time) const; - - + + time_t GetTime_t() { return _my_time.tv_sec; @@ -74,7 +71,7 @@ public: { return _my_time.tv_usec; }; - + // formatting using "C" strftime std::string Format(const char * pFormat) const; std::string FormatGmt(const char * pFormat) const; @@ -89,20 +86,11 @@ public: private: struct timeval _my_time; }; -///////////////////////////////////////////////////////////////////////////// -// Time_Clock - absolute time -///////////////////////////////////////////////////////////// -// Function name : Time_Clock::Time_Clock -// Description : Construction from parts -// Argument : int nYear -// Argument : int nMonth -// Argument : int nDay -// Argument : int nHour -// Argument : int nMin -// Argument : int nSec -// Argument : int nDST -////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::Time_Clock +// Description: Construction from parts +//////////////////////////////////////////////////////////////////// inline Time_Clock::Time_Clock(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, long microseconds , int nDST) { struct tm atm; @@ -121,19 +109,10 @@ inline Time_Clock::Time_Clock(int nYear, int nMonth, int nDay, int nHour, int nM _my_time.tv_usec = microseconds; assert(_my_time.tv_usec < 1000000); } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::Set -// Description : -// Return type : inline -// Argument : int nYear -// Argument : int nMonth -// Argument : int nDay -// Argument : int nHour -// Argument : int nMin -// Argument : int nSec -// Argument : unsigned long microseconds -// Argument : int nDST -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::Set +// Description: +//////////////////////////////////////////////////////////////////// inline void Time_Clock::Set(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, long microseconds , int nDST) { struct tm atm; @@ -152,42 +131,36 @@ inline void Time_Clock::Set(int nYear, int nMonth, int nDay, int nHour, int nMin _my_time.tv_usec = microseconds; assert(_my_time.tv_usec < 1000000); } -///////////////////////////////////////////////////////////// -// Function name : Time_Clock::GetCurrentTime -// Description : The Default no param constructor.. Will set time to current system time -// Return type : Time_Clock -////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::GetCurrentTime +// Description: The Default no param constructor.. Will set time to current system time +//////////////////////////////////////////////////////////////////// inline Time_Clock Time_Clock::GetCurrentTime() { return Time_Clock(); } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::Time_Clock -// Description : -// Return type : inline -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::Time_Clock +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Clock::Time_Clock() { gettimeofday(&_my_time, NULL); } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::ToCurrentTime -// Description : Load this object with the current OS time -// Return type : inline void -// Argument : void -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::ToCurrentTime +// Description: Load this object with the current OS time +//////////////////////////////////////////////////////////////////// inline void Time_Clock::ToCurrentTime() { gettimeofday(&_my_time, NULL); } -///////////////////////////////////////////////////////////// -// Function name : Time_Clock::GetGmtTm -// Description : Access the stored time and convers to a struct tm format -// If storage location is specified then it will stor information in the -// provided buffer else it will use the library's internal buffer space -// Return type : struct tm* -// Argument : struct tm* ptm -////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::GetGmtTm +// Description: Access the stored time and converts to a struct tm format +// If storage location is specified then it will stor information in the +// provided buffer else it will use the library's internal buffer space +//////////////////////////////////////////////////////////////////// inline struct tm* Time_Clock::GetGmtTm(struct tm* ptm) const { if (ptm != NULL) @@ -199,11 +172,8 @@ inline struct tm* Time_Clock::GetGmtTm(struct tm* ptm) const } //////////////////////////////////////////////////////////////////// -// Function name : Time_Clock::GetLocalTm -// Description : Gets The local time in a tm structre from the internal time value -// -// Return type : struct tm* -// Argument : struct tm* ptm +// Function: Time_Clock::GetLocalTm +// Description: Gets The local time in a tm structre from the internal time value //////////////////////////////////////////////////////////////////// inline struct tm* Time_Clock::GetLocalTm(struct tm* ptm) const { @@ -217,30 +187,27 @@ inline struct tm* Time_Clock::GetLocalTm(struct tm* ptm) const } else return localtime((const time_t *)&_my_time.tv_sec); } -///////////////////////////////////////////////////////////////////////////// // String formatting -#define maxTimeBufferSize 4096 // Verifies will fail if the needed buffer size is too large -///////////////////////////////////////////////////////////// -// Function name : Time_Clock::Format -// Description : Used to allow access to the "C" library strftime functions.. -// -// Return type : std::string -// Argument : char * pFormat -////////////////////////////////////////////////////////// +#define maxTimeBufferSize 4096 + +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::Format +// Description: Used to allow access to the "C" library strftime functions.. +//////////////////////////////////////////////////////////////////// inline std::string Time_Clock::Format(const char * pFormat) const { - + char szBuffer[maxTimeBufferSize]; char ch, ch1; char * pch = szBuffer; - - while ((ch = *pFormat++) != '\0') + + while ((ch = *pFormat++) != '\0') { assert(pch < &szBuffer[maxTimeBufferSize]); - if (ch == '%') + if (ch == '%') { - switch (ch1 = *pFormat++) + switch (ch1 = *pFormat++) { default: *pch++ = ch; @@ -251,44 +218,41 @@ inline std::string Time_Clock::Format(const char * pFormat) const break; } } - else + else { *pch++ = ch; } } - + *pch = '\0'; - + char szBuffer1[maxTimeBufferSize]; - + struct tm* ptmTemp = localtime((const time_t *)&_my_time.tv_sec); if (ptmTemp == NULL || !strftime(szBuffer1, sizeof(szBuffer1), szBuffer, ptmTemp)) szBuffer1[0] = '\0'; return std::string(szBuffer1); } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::FormatGmt -// Description : A Wraper to -// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::FormatGmt +// Description: A Wraper to // size_t strftime( char *strDest, size_t maxsize, const char *format, const struct tm *timeptr ); // -// Return type : inline std::string -// Argument : char * pFormat -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// inline std::string Time_Clock::FormatGmt(const char * pFormat) const { - + char szBuffer[maxTimeBufferSize]; char ch, ch1; char * pch = szBuffer; - - while ((ch = *pFormat++) != '\0') + + while ((ch = *pFormat++) != '\0') { assert(pch < &szBuffer[maxTimeBufferSize]); - if (ch == '%') + if (ch == '%') { - switch (ch1 = *pFormat++) + switch (ch1 = *pFormat++) { default: *pch++ = ch; @@ -299,215 +263,184 @@ inline std::string Time_Clock::FormatGmt(const char * pFormat) const break; } } - else + else { *pch++ = ch; } } *pch = '\0'; - + char szBuffer1[maxTimeBufferSize]; - + struct tm* ptmTemp = gmtime((const time_t *)&_my_time.tv_sec); if (ptmTemp == NULL || !strftime(szBuffer1, sizeof(szBuffer1), szBuffer, ptmTemp)) szBuffer1[0] = '\0'; return std::string(szBuffer1); } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::Time_Clock -// Description : The Constructor that take a time_t objext -// Return type : inline -// Argument : time_t time -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::Time_Clock +// Description: The Constructor that take a time_t objext +//////////////////////////////////////////////////////////////////// inline Time_Clock::Time_Clock(time_t time) { _my_time.tv_sec = (long)time; _my_time.tv_usec = 0; }; -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::Time_Clock -// Description : Constructor that takes in sec and usecs.. -// Return type : inline -// Argument : long secs -// Argument : long usecs -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::Time_Clock +// Description: Constructor that takes in sec and usecs.. +//////////////////////////////////////////////////////////////////// inline Time_Clock::Time_Clock(long secs, long usecs) { _my_time.tv_sec = secs; _my_time.tv_usec = usecs; NormalizeTime(_my_time); }; -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::Time_Clock -// Description : yet another constructor -// Return type : inline -// Argument : const Time_Clock& timeSrc -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::Time_Clock +// Description: yet another constructor +//////////////////////////////////////////////////////////////////// inline Time_Clock::Time_Clock(const Time_Clock& timeSrc) { _my_time.tv_sec = timeSrc._my_time.tv_sec; _my_time.tv_usec = timeSrc._my_time.tv_usec; } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::operator== -// Description : .. is time equal -// Return type : inline bool -// Argument : const Time_Clock &time -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::operator== +// Description: .. is time equal +//////////////////////////////////////////////////////////////////// inline bool Time_Clock::operator==(const Time_Clock &time) const { return ((_my_time.tv_sec == time._my_time.tv_sec) && (_my_time.tv_usec == time._my_time.tv_usec)); } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::operator!= -// Description : .is time != -// Return type : inline bool -// Argument : const Time_Clock &time -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::operator!= +// Description: .is time != +//////////////////////////////////////////////////////////////////// inline bool Time_Clock::operator!=(const Time_Clock &time) const { return ((_my_time.tv_sec != time._my_time.tv_sec) || (_my_time.tv_usec != time._my_time.tv_usec)); } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::operator< -// Description : -// Return type : inline bool -// Argument : const Time_Clock &time -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::operator< +// Description: +//////////////////////////////////////////////////////////////////// inline bool Time_Clock::operator<(const Time_Clock &time) const { return ((_my_time.tv_sec < time._my_time.tv_sec) || ((_my_time.tv_sec == time._my_time.tv_sec) && (_my_time.tv_usec < time._my_time.tv_usec))); } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::operator> -// Description : -// Return type : inline bool -// Argument : const Time_Clock &time -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::operator> +// Description: +//////////////////////////////////////////////////////////////////// inline bool Time_Clock::operator>(const Time_Clock &time) const { return ((_my_time.tv_sec > time._my_time.tv_sec) || ((_my_time.tv_sec == time._my_time.tv_sec) && (_my_time.tv_usec > time._my_time.tv_usec))); } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::operator<= -// Description : -// Return type : inline bool -// Argument : const Time_Clock &time -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::operator<= +// Description: +//////////////////////////////////////////////////////////////////// inline bool Time_Clock::operator<=(const Time_Clock &time) const { return ((_my_time.tv_sec < time._my_time.tv_sec) || ((_my_time.tv_sec == time._my_time.tv_sec) && (_my_time.tv_usec <= time._my_time.tv_usec))); } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::operator>= -// Description : -// Return type : inline bool -// Argument : const Time_Clock &time -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::operator>= +// Description: +//////////////////////////////////////////////////////////////////// inline bool Time_Clock::operator>=(const Time_Clock &time) const { return ((_my_time.tv_sec > time._my_time.tv_sec) || ((_my_time.tv_sec == time._my_time.tv_sec) && (_my_time.tv_usec >= time._my_time.tv_usec))); } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock& Time_Clock::operator= -// Description : -// Return type : inline const -// Argument : const Time_Clock& timeSrc -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock& Time_Clock::operator= +// Description: +//////////////////////////////////////////////////////////////////// inline const Time_Clock& Time_Clock::operator=(const Time_Clock& timeSrc) { if (&timeSrc == this) return * this; - + _my_time = timeSrc._my_time; return *this; } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock& Time_Clock::operator= -// Description : -// Return type : inline const -// Argument : time_t t -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock& Time_Clock::operator= +// Description: +//////////////////////////////////////////////////////////////////// inline const Time_Clock& Time_Clock::operator=(time_t t) { _my_time.tv_sec = (long)t; _my_time.tv_usec = 0; return *this; } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::GetTime -// Description : -// Return type : inline time_t -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::GetTime +// Description: +//////////////////////////////////////////////////////////////////// inline time_t Time_Clock::GetTime() const { return _my_time.tv_sec; } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::GetYear -// Description : -// Return type : inline int -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::GetYear +// Description: +//////////////////////////////////////////////////////////////////// inline int Time_Clock::GetYear() const { return (GetLocalTm(NULL)->tm_year) + 1900; } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::GetMonth -// Description : -// Return type : inline int -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::GetMonth +// Description: +//////////////////////////////////////////////////////////////////// inline int Time_Clock::GetMonth() const { return GetLocalTm(NULL)->tm_mon + 1; } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::GetDay -// Description : -// Return type : inline int -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::GetDay +// Description: +//////////////////////////////////////////////////////////////////// inline int Time_Clock::GetDay() const { return GetLocalTm(NULL)->tm_mday; } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::GetHour -// Description : -// Return type : inline int -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::GetHour +// Description: +//////////////////////////////////////////////////////////////////// inline int Time_Clock::GetHour() const { return GetLocalTm(NULL)->tm_hour; } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::GetMinute -// Description : -// Return type : inline int -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::GetMinute +// Description: +//////////////////////////////////////////////////////////////////// inline int Time_Clock::GetMinute() const { return GetLocalTm(NULL)->tm_min; } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::GetSecond -// Description : -// Return type : inline int -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::GetSecond +// Description: +//////////////////////////////////////////////////////////////////// inline int Time_Clock::GetSecond() const { return GetLocalTm(NULL)->tm_sec; } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock::GetDayOfWeek -// Description : -// Return type : inline int -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock::GetDayOfWeek +// Description: +//////////////////////////////////////////////////////////////////// inline int Time_Clock::GetDayOfWeek() const { return GetLocalTm(NULL)->tm_wday + 1; diff --git a/panda/src/nativenet/time_general.h b/panda/src/nativenet/time_general.h index 9643fc23d5..24bd9ea7ca 100644 --- a/panda/src/nativenet/time_general.h +++ b/panda/src/nativenet/time_general.h @@ -14,51 +14,40 @@ Time_Clock operator-(const Time_Clock &tm, const Time_Span &ts); bool SetFromTimeStr(const char * str, Time_Clock & outtime); std::string GetTimeStr(const Time_Clock & intime); -////////////////////////////////////////////////////////////// -// Function name : TimeDifference -// Description : -// Return type : inline Time_Span -// Argument : const Time_Clock &time1 -// Argument : const Time_Clock &time2 -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: TimeDifference +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Span TimeDifference(const Time_Clock &time1, const Time_Clock &time2) { timeval ans; TimeDif(time2.GetTval(), time1.GetTval(), ans); return Time_Span(ans); } -////////////////////////////////////////////////////////////// -// Function name : TimeDifference -// Description : -// Return type : -// Argument : const Time_Clock &time1 -// Argument : const Time_Span &Time_Span -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: TimeDifference +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Clock TimeDifference( const Time_Clock &time1, const Time_Span &Time_Span) { timeval ans; TimeDif(Time_Span.GetTval(), time1.GetTval(), ans); return Time_Clock(ans); } -////////////////////////////////////////////////////////////// -// Function name : TimeAddition -// Description : -// Return type : -// Argument : const Time_Clock &time1 -// Argument : Time_Span &Time_Span -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: TimeAddition +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Clock TimeAddition(const Time_Clock &time1, Time_Span &Time_Span) { timeval ans; TimeAdd(time1.GetTval(), Time_Span.GetTval(), ans); return Time_Clock(ans); } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock& Time_Clock::operator+= -// Description : -// Return type : inline const -// Argument : Time_Span &Time_Span -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock& Time_Clock::operator+= +// Description: +//////////////////////////////////////////////////////////////////// inline const Time_Clock& Time_Clock::operator+=(const Time_Span &Time_Span) { _my_time.tv_usec += Time_Span._my_time.tv_usec; @@ -66,36 +55,28 @@ inline const Time_Clock& Time_Clock::operator+=(const Time_Span &Time_Span) NormalizeTime(_my_time); return *this; } -////////////////////////////////////////////////////////////// -// Function name : operator+ -// Description : -// Return type : inline Time_Clock -// Argument : const Time_Clock &tm -// Argument : const Time_Span &ts -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: operator+ +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Clock operator+(const Time_Clock &tm, const Time_Span &ts) { Time_Clock work(tm); work += ts; return work; } -////////////////////////////////////////////////////////////// -// Function name : operator- -// Description : -// Return type : inline Time_Clock -// Argument : const Time_Clock &tm -// Argument : const Time_Span &ts -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: operator- +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Clock operator-(const Time_Clock &tm, const Time_Span &ts) { return TimeDifference(tm, ts); } -////////////////////////////////////////////////////////////// -// Function name : Time_Clock& Time_Clock::operator-= -// Description : -// Return type : inline const -// Argument : Time_Span &Time_Span -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Clock& Time_Clock::operator-= +// Description: +//////////////////////////////////////////////////////////////////// inline const Time_Clock& Time_Clock::operator-=(const Time_Span &Time_Span) { _my_time.tv_usec -= Time_Span._my_time.tv_usec; @@ -103,52 +84,42 @@ inline const Time_Clock& Time_Clock::operator-=(const Time_Span &Time_Span) NormalizeTime(_my_time); return *this; } -////////////////////////////////////////////////////////////// -// Function name : operator- -// Description : -// Return type : inline Time_Span -// Argument : const Time_Clock &tm1 -// Argument : const Time_Clock &tm2 -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: operator- +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Span operator-(const Time_Clock &tm1, const Time_Clock &tm2) { return TimeDifference(tm1, tm2); } -////////////////////////////////////////////////////////////// -// Function name : char * GetTimeStr -// Description : -// Return type : inline const -// Argument : const Time_Clock & intime -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: char * GetTimeStr +// Description: +//////////////////////////////////////////////////////////////////// inline std::string GetTimeStr(const Time_Clock & intime) { static std::string ts; static Time_Clock prev_time; - - if (prev_time != intime || ts.empty()) + + if (prev_time != intime || ts.empty()) { ts = intime.Format("%Y-%m-%d %H:%M:%S"); prev_time = intime; } return ts; } -////////////////////////////////////////////////////////////// -// Function name : GetTimeStr -// Description : -// Return type : inline std::string -// Argument : void -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: GetTimeStr +// Description: +//////////////////////////////////////////////////////////////////// inline std::string GetTimeStr() { return GetTimeStr(Time_Clock::GetCurrentTime()); } -////////////////////////////////////////////////////////////// -// Function name : SetFromTimeStr -// Description : -// Return type : inline bool -// Argument : const char * str -// Argument : Time_Clock & outtime -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: SetFromTimeStr +// Description: +//////////////////////////////////////////////////////////////////// inline bool SetFromTimeStr(const char * str, Time_Clock & outtime) { int year = 0; @@ -157,10 +128,10 @@ inline bool SetFromTimeStr(const char * str, Time_Clock & outtime) int hour = 0; int min = 0; int sec = 0; - + if (sscanf(str, "%d-%d-%d %d:%d:%d", &year, &month, &day, &hour, &min, &sec) != 6) return false; - + outtime.Set(year, month, day, hour, min, sec); return true; } diff --git a/panda/src/nativenet/time_out.h b/panda/src/nativenet/time_out.h index eb0e74b958..64350f722d 100644 --- a/panda/src/nativenet/time_out.h +++ b/panda/src/nativenet/time_out.h @@ -1,7 +1,7 @@ #ifndef __TIME_OUT_H__ #define __TIME_OUT_H__ -/////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // think of this class as a time based alarm.. // @@ -9,38 +9,38 @@ // // I would do this but not sure how to represent the duration in the template ?? // -///////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class Time_Out { public: Time_Out() - { + { } - + Time_Out(const Time_Span & dur) : _alarm_time(Time_Clock::GetCurrentTime() + dur) , _duration(dur) { } -/* +/* Time_Out(const Time_Clock & tm, const Time_Span & dur) : _alarm_time(tm + dur) , _duration(dur) { } - */ + */ void ResetAll(const Time_Clock &tm, const Time_Span &sp); void ReStart(); void ResetTime(const Time_Clock & tm); void SetTimeOutSec(int sec); - + bool Expired(const Time_Clock &tm, bool reset = false); bool Expired(bool reset = false); - + Time_Span Remaining(const Time_Clock & tm) const; Time_Span Remaining() const; - + void ForceToExpired() { _alarm_time.ToCurrentTime(); } - + bool operator() (bool reset= false) { return Expired(reset); @@ -49,7 +49,7 @@ public: { return Expired(tm, reset); } - + Time_Clock GetAlarm(void) { return _alarm_time; @@ -58,7 +58,7 @@ public: Time_Span Duration() const { return _duration; }; void NextInStep(Time_Clock &curtime) - { + { _alarm_time += _duration; if(_alarm_time <=curtime) // if we fall way behind.. just ratchet it up ... _alarm_time = curtime+_duration; @@ -67,56 +67,45 @@ private: Time_Clock _alarm_time; Time_Span _duration; }; -////////////////////////////////////////////////////////////// -// Function name : Time_Out::ReStart -// Description : -// Return type : void -// Argument : const Time_Clock &tm -// Argument : const Time_Span &sp -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Out::ReStart +// Description: +//////////////////////////////////////////////////////////////////// inline void Time_Out::ResetAll(const Time_Clock &tm, const Time_Span &sp) { _duration = sp; _alarm_time = tm + _duration; } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::ReStart -// Description : -// Return type : void -// Argument : const Time_Clock &tm -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::ReStart +// Description: +//////////////////////////////////////////////////////////////////// inline void Time_Out::SetTimeOutSec(int sec) { _duration.Set(0, 0, 0, sec, 0); ReStart(); } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::ReStart -// Description : -// Return type : void -// Argument : void -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::ReStart +// Description: +//////////////////////////////////////////////////////////////////// inline void Time_Out::ReStart() { _alarm_time = Time_Clock::GetCurrentTime() + _duration; } -////////////////////////////////////////////////////////////// -// Function name : ResetTime -// Description : -// Return type : void -// Argument : const Time_Clock & tm -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: ResetTime +// Description: +//////////////////////////////////////////////////////////////////// inline void Time_Out::ResetTime(const Time_Clock & tm) { _alarm_time = tm + _duration; - + } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::Expired -// Description : -// Return type : bool -// Argument : const Time_Clock &tm -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::Expired +// Description: +//////////////////////////////////////////////////////////////////// inline bool Time_Out::Expired(const Time_Clock &tm, bool reset) { bool answer = (_alarm_time <= tm) ; @@ -124,32 +113,26 @@ inline bool Time_Out::Expired(const Time_Clock &tm, bool reset) ResetTime(tm); return answer; } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::Expired -// Description : -// Return type : bool -// Argument : void -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::Expired +// Description: +//////////////////////////////////////////////////////////////////// inline bool Time_Out::Expired(bool reset) { return Expired(Time_Clock::GetCurrentTime(), reset); } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::Remaining -// Description : -// Return type : Time_Span -// Argument : const Time_Clock & tm -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::Remaining +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Span Time_Out::Remaining(const Time_Clock & tm) const { return _alarm_time - tm; } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::Remaining -// Description : -// Return type : Time_Span -// Argument : void -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::Remaining +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Span Time_Out::Remaining() const { return Remaining(Time_Clock::GetCurrentTime()); diff --git a/panda/src/nativenet/time_span.h b/panda/src/nativenet/time_span.h index 7c7a1062ec..535cfe6de9 100644 --- a/panda/src/nativenet/time_span.h +++ b/panda/src/nativenet/time_span.h @@ -1,10 +1,9 @@ #ifndef __TIME_SPAN_H__ #define __TIME_SPAN_H__ -////////////////////////////////////////////////////// -// Class : Time_Span -// -// Description: -////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Class : Time_Span +// Description : +//////////////////////////////////////////////////////////////////// class Time_Span { public: @@ -12,23 +11,23 @@ public: Time_Span() { } - + Time_Span(struct timeval time) { _my_time = time;NormalizeTime(_my_time); } - + Time_Span(time_t time); Time_Span(long lDays, int nHours, int nMins, int nSecs, int usecs); Time_Span(long seconds, int usecs ) ; Time_Span(const Time_Span& Time_SpanSrc); Time_Span(const Time_Clock& Time_SpanSrc); Time_Span(PN_stdfloat Seconds); - - /////////////////// - + +//////////////////////////////////////////////////////////////////// + const Time_Span& operator=(const Time_Span& Time_SpanSrc); - + // Attributes // extract parts long GetDays() const; // total # of days @@ -41,7 +40,7 @@ public: long GetTotalMSeconds() const; long GetTotal100Seconds() const; long GetMSeconds() const; - + // Operations // time math const Time_Span& operator+=(Time_Span &Time_Span); @@ -56,87 +55,87 @@ public: { return _my_time; } - - + + void Set(long lDays, int nHours, int nMins, int nSecs, int usecs); - + std::string Format(char *pFormat) const; private: struct timeval _my_time; friend class Time_Clock; }; -////////////////////////////////////////////////////////////// -// Function name : Time_Span::Time_Span -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::Time_Span +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Span::Time_Span(long seconds, int usecs) { _my_time.tv_sec = seconds; _my_time.tv_usec = usecs; NormalizeTime(_my_time); } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::Time_Span -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::Time_Span +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Span::Time_Span(time_t time) { _my_time.tv_usec = 0; _my_time.tv_sec = (long)time; } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::Time_Span -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::Time_Span +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Span::Time_Span(PN_stdfloat Seconds) { _my_time.tv_sec = (long)Seconds; // this truncats .. desired result.. _my_time.tv_usec = (long)((Seconds - (double)_my_time.tv_sec) * (double)USEC); } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::Time_Span -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::Time_Span +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Span::Time_Span(long lDays, int nHours, int nMins, int nSecs, int usecs) { _my_time.tv_sec = nSecs + 60 * (nMins + 60 * (nHours + 24 * lDays)); _my_time.tv_usec = usecs; - + } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::Set -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::Set +// Description: +//////////////////////////////////////////////////////////////////// inline void Time_Span::Set(long lDays, int nHours, int nMins, int nSecs, int usecs) { _my_time.tv_sec = nSecs + 60 * (nMins + 60 * (nHours + 24 * lDays)); _my_time.tv_usec = usecs; - + } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::Time_Span -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::Time_Span +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Span::Time_Span(const Time_Span& Time_SpanSrc) { _my_time = Time_SpanSrc._my_time; } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::Time_Span -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::Time_Span +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Span::Time_Span(const Time_Clock& Time_SpanSrc) { _my_time = Time_SpanSrc._my_time; } -////////////////////////////////////////////////////////////// -// Function name : Time_Span& Time_Span::operator= -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span& Time_Span::operator= +// Description: +//////////////////////////////////////////////////////////////////// inline const Time_Span& Time_Span::operator=(const Time_Span& Time_SpanSrc) { if (&Time_SpanSrc == this) @@ -144,64 +143,64 @@ inline const Time_Span& Time_Span::operator=(const Time_Span& Time_SpanSrc) _my_time = Time_SpanSrc._my_time; return *this; } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::GetDays -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::GetDays +// Description: +//////////////////////////////////////////////////////////////////// inline long Time_Span::GetDays() const { return _my_time.tv_sec / (24*3600L); } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::GetTotalHours -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::GetTotalHours +// Description: +//////////////////////////////////////////////////////////////////// inline long Time_Span::GetTotalHours() const { return _my_time.tv_sec / 3600; } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::GetHours -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::GetHours +// Description: +//////////////////////////////////////////////////////////////////// inline int Time_Span::GetHours() const { return (int)(GetTotalHours() - GetDays()*24); } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::GetTotalMinutes -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::GetTotalMinutes +// Description: +//////////////////////////////////////////////////////////////////// inline long Time_Span::GetTotalMinutes() const { return _my_time.tv_sec / 60; } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::GetMinutes -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::GetMinutes +// Description: +//////////////////////////////////////////////////////////////////// inline int Time_Span::GetMinutes() const { return (int)(GetTotalMinutes() - GetTotalHours()*60); } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::GetTotalSeconds -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::GetTotalSeconds +// Description: +//////////////////////////////////////////////////////////////////// inline long Time_Span::GetTotalSeconds() const { return _my_time.tv_sec; } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::GetTotalMSeconds -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::GetTotalMSeconds +// Description: +//////////////////////////////////////////////////////////////////// inline long Time_Span::GetTotalMSeconds() const { return (_my_time.tv_sec * 1000) + (_my_time.tv_usec / 1000); @@ -215,29 +214,29 @@ inline long Time_Span::GetTotal100Seconds() const -////////////////////////////////////////////////////////////// -// Function name : Time_Span::GetTotalMSeconds -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::GetTotalMSeconds +// Description: +//////////////////////////////////////////////////////////////////// inline long Time_Span::GetMSeconds() const { return (_my_time.tv_usec / 1000); } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::GetSeconds -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::GetSeconds +// Description: +//////////////////////////////////////////////////////////////////// inline int Time_Span::GetSeconds() const { return (int)(GetTotalSeconds() - GetTotalMinutes()*60); } -////////////////////////////////////////////////////////////// -// Function name : TimeDifference -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: TimeDifference +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Span TimeDifference(const Time_Span &Time_Span1, const Time_Span &Time_Span2) { timeval ans; @@ -245,10 +244,10 @@ inline Time_Span TimeDifference(const Time_Span &Time_Span1, const Time_Span &Ti return Time_Span(ans); } -////////////////////////////////////////////////////////////// -// Function name : TimeAddition -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: TimeAddition +// Description: +//////////////////////////////////////////////////////////////////// inline Time_Span TimeAddition(const Time_Span &Time_Span1, const Time_Span &Time_Span2) { timeval ans; @@ -256,10 +255,10 @@ inline Time_Span TimeAddition(const Time_Span &Time_Span1, const Time_Span &Time return Time_Span(ans); } -////////////////////////////////////////////////////////////// -// Function name : Time_Span& Time_Span::operator+= -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span& Time_Span::operator+= +// Description: +//////////////////////////////////////////////////////////////////// inline const Time_Span& Time_Span::operator+=(Time_Span &Time_Span) { _my_time.tv_usec += Time_Span._my_time.tv_usec; @@ -268,10 +267,10 @@ inline const Time_Span& Time_Span::operator+=(Time_Span &Time_Span) return *this; } -////////////////////////////////////////////////////////////// -// Function name : Time_Span& Time_Span::operator-= -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span& Time_Span::operator-= +// Description: +//////////////////////////////////////////////////////////////////// inline const Time_Span& Time_Span::operator-=(Time_Span &Time_Span) { _my_time.tv_usec -= Time_Span._my_time.tv_usec; @@ -280,68 +279,68 @@ inline const Time_Span& Time_Span::operator-=(Time_Span &Time_Span) return *this; } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::operator== -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::operator== +// Description: +//////////////////////////////////////////////////////////////////// inline bool Time_Span::operator==(Time_Span &Time_Span) const { return ((_my_time.tv_sec == Time_Span._my_time.tv_sec) && (_my_time.tv_usec == Time_Span._my_time.tv_usec)); } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::operator!= -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::operator!= +// Description: +//////////////////////////////////////////////////////////////////// inline bool Time_Span::operator!=(Time_Span &Time_Span) const { return ((_my_time.tv_sec != Time_Span._my_time.tv_sec) || (_my_time.tv_usec != Time_Span._my_time.tv_usec)); } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::operator< -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::operator< +// Description: +//////////////////////////////////////////////////////////////////// inline bool Time_Span::operator<(Time_Span &Time_Span) const { return ((_my_time.tv_sec < Time_Span._my_time.tv_sec) || ((_my_time.tv_sec == Time_Span._my_time.tv_sec) && (_my_time.tv_usec < Time_Span._my_time.tv_usec))); } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::operator> -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::operator> +// Description: +//////////////////////////////////////////////////////////////////// inline bool Time_Span::operator>(Time_Span &Time_Span) const { return ((_my_time.tv_sec > Time_Span._my_time.tv_sec) || ((_my_time.tv_sec == Time_Span._my_time.tv_sec) && (_my_time.tv_usec > Time_Span._my_time.tv_usec))); } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::operator<= -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::operator<= +// Description: +//////////////////////////////////////////////////////////////////// inline bool Time_Span::operator<=(Time_Span &Time_Span) const { return ((_my_time.tv_sec < Time_Span._my_time.tv_sec) || ((_my_time.tv_sec == Time_Span._my_time.tv_sec) && (_my_time.tv_usec <= Time_Span._my_time.tv_usec))); } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::operator>= -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::operator>= +// Description: +//////////////////////////////////////////////////////////////////// inline bool Time_Span::operator>=(Time_Span &Time_Span) const { return ((_my_time.tv_sec > Time_Span._my_time.tv_sec) || ((_my_time.tv_sec == Time_Span._my_time.tv_sec) && (_my_time.tv_usec >= Time_Span._my_time.tv_usec))); } -////////////////////////////////////////////////////////////// -// Function name : Time_Span::Format -// Description : -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: Time_Span::Format +// Description: +//////////////////////////////////////////////////////////////////// inline std::string Time_Span::Format(char * pFormat) const // formatting Time_Spans is a little trickier than formatting // * we are only interested in relative time formats, ie. it is illegal @@ -358,7 +357,7 @@ inline std::string Time_Span::Format(char * pFormat) const char szBuffer[maxTimeBufferSize]; char ch; char * pch = szBuffer; - + while ((ch = *pFormat++) != '\0') { assert(pch < &szBuffer[maxTimeBufferSize]); if (ch == '%') { @@ -388,7 +387,7 @@ inline std::string Time_Span::Format(char * pFormat) const *pch++ = ch; } } - + *pch = '\0'; return std::string(szBuffer); } diff --git a/panda/src/net/netAddress.cxx b/panda/src/net/netAddress.cxx index facebd2169..a009f194f5 100644 --- a/panda/src/net/netAddress.cxx +++ b/panda/src/net/netAddress.cxx @@ -174,31 +174,31 @@ output(ostream &out) const { out << get_ip_string(); } -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: NetAddress::get_hash // Access: Published // Description: -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// size_t NetAddress:: get_hash() const { return (size_t)(((int)get_ip()) ^ ((int)get_port() << 16)); } -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: NetAddress::operator == // Access: Published // Description: -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// bool NetAddress:: operator == (const NetAddress &other) const { return _addr == other._addr; } -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: NetAddress::operator != // Access: Published // Description: -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// bool NetAddress:: operator != (const NetAddress &other) const { return _addr != other._addr; diff --git a/panda/src/ode/odeCollisionEntry.I b/panda/src/ode/odeCollisionEntry.I index fa525d4af9..2b8e221d34 100644 --- a/panda/src/ode/odeCollisionEntry.I +++ b/panda/src/ode/odeCollisionEntry.I @@ -1,4 +1,4 @@ -// Filename: odeCollisionEntry.cxx +// Filename: odeCollisionEntry.I // Created by: pro-rsoft (13Mar09) // //////////////////////////////////////////////////////////////////// @@ -15,7 +15,7 @@ //////////////////////////////////////////////////////////////////// // Function: OdeCollisionEntry::Constructor // Access: Private -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE OdeCollisionEntry:: OdeCollisionEntry() { diff --git a/panda/src/ode/odeConvexGeom.I b/panda/src/ode/odeConvexGeom.I index 9b65081c0f..1c3980d174 100644 --- a/panda/src/ode/odeConvexGeom.I +++ b/panda/src/ode/odeConvexGeom.I @@ -1,4 +1,4 @@ -// Filename: odeBoxGeom.I +// Filename: odeConvexGeom.I // Created by: joswilso (27Dec06) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/ode/odeHashSpace.h b/panda/src/ode/odeHashSpace.h index 03e2983689..e8cd4b17a0 100644 --- a/panda/src/ode/odeHashSpace.h +++ b/panda/src/ode/odeHashSpace.h @@ -25,8 +25,8 @@ //////////////////////////////////////////////////////////////////// // Class : OdeHashSpace -// Description : -////////////////////////////////////////////////////////////////////c +// Description : +//////////////////////////////////////////////////////////////////// class EXPCL_PANDAODE OdeHashSpace : public OdeSpace { friend class OdeSpace; friend class OdeGeom; diff --git a/panda/src/ode/odeHeightFieldGeom.h b/panda/src/ode/odeHeightFieldGeom.h index 00fd6593a1..d09d6e4b63 100644 --- a/panda/src/ode/odeHeightFieldGeom.h +++ b/panda/src/ode/odeHeightFieldGeom.h @@ -1,4 +1,4 @@ -// Filename: odeHeightfieldGeom.h +// Filename: odeHeightFieldGeom.h // Created by: joswilso (27Dec06) // //////////////////////////////////////////////////////////////////// @@ -24,7 +24,7 @@ //////////////////////////////////////////////////////////////////// // Class : OdeHeightfieldGeom -// Description : +// Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDAODE OdeHeightfieldGeom : public OdeGeom { friend class OdeGeom; @@ -38,25 +38,25 @@ PUBLISHED: INLINE dHeightfieldDataID heightfield_data_create(); INLINE void heightfield_data_destroy(dHeightfieldDataID d); - INLINE void heightfield_data_build_callback(dHeightfieldDataID d, - void* p_user_data, + INLINE void heightfield_data_build_callback(dHeightfieldDataID d, + void* p_user_data, dHeightfieldGetHeight* p_callback, dReal width, - dReal depth, + dReal depth, int width_samples, int depth_samples, - dReal scale, + dReal scale, dReal offset, dReal thickness, int b_wrap); - INLINE void heightfield_data_build_byte(dHeightfieldDataID d, + INLINE void heightfield_data_build_byte(dHeightfieldDataID d, const unsigned char* p_height_data, - int b_copy_height_data, - dReal width, - dReal depth, + int b_copy_height_data, + dReal width, + dReal depth, int width_samples, int depth_samples, - dReal scale, + dReal scale, dReal offset, dReal thickness, int b_wrap); @@ -66,35 +66,35 @@ PUBLISHED: dReal width, dReal depth, int width_samples, - int depth_samples, - dReal scale, - dReal offset, - dReal thickness, + int depth_samples, + dReal scale, + dReal offset, + dReal thickness, int b_wrap); - INLINE void heightfield_data_build_single(dHeightfieldDataID d, + INLINE void heightfield_data_build_single(dHeightfieldDataID d, const float* p_height_data, - int b_copy_height_data, - dReal width, - dReal depth, - int width_samples, - int depth_samples, - dReal scale, - dReal offset, - dReal thickness, - int b_wrap); - INLINE void heightfield_data_build_double(dHeightfieldDataID d, - const double* p_height_data, - int b_copy_height_data, - dReal width, + int b_copy_height_data, + dReal width, dReal depth, int width_samples, int depth_samples, - dReal scale, - dReal offset, + dReal scale, + dReal offset, + dReal thickness, + int b_wrap); + INLINE void heightfield_data_build_double(dHeightfieldDataID d, + const double* p_height_data, + int b_copy_height_data, + dReal width, + dReal depth, + int width_samples, + int depth_samples, + dReal scale, + dReal offset, dReal thickness, int b_wrap); INLINE void heightfield_data_set_bounds(dHeightfieldDataID d, - dReal min_height, + dReal min_height, dReal max_height); INLINE void heightfield_set_heightfield_data(dHeightfieldDataID d); diff --git a/panda/src/ode/odeQuadTreeSpace.h b/panda/src/ode/odeQuadTreeSpace.h index 0a57a7668f..70534122fd 100644 --- a/panda/src/ode/odeQuadTreeSpace.h +++ b/panda/src/ode/odeQuadTreeSpace.h @@ -24,8 +24,8 @@ //////////////////////////////////////////////////////////////////// // Class : OdeQuadTreeSpace -// Description : -////////////////////////////////////////////////////////////////////c +// Description : +//////////////////////////////////////////////////////////////////// class EXPCL_PANDAODE OdeQuadTreeSpace : public OdeSpace { friend class OdeSpace; friend class OdeGeom; diff --git a/panda/src/ode/odeSimpleSpace.h b/panda/src/ode/odeSimpleSpace.h index 63c16a8901..c40c5ae113 100644 --- a/panda/src/ode/odeSimpleSpace.h +++ b/panda/src/ode/odeSimpleSpace.h @@ -24,8 +24,8 @@ //////////////////////////////////////////////////////////////////// // Class : OdeSimpleSpace -// Description : -////////////////////////////////////////////////////////////////////c +// Description : +//////////////////////////////////////////////////////////////////// class EXPCL_PANDAODE OdeSimpleSpace : public OdeSpace { friend class OdeSpace; friend class OdeGeom; diff --git a/panda/src/ode/odeTriMeshData.cxx b/panda/src/ode/odeTriMeshData.cxx index cdaed29ae6..3badd9524f 100644 --- a/panda/src/ode/odeTriMeshData.cxx +++ b/panda/src/ode/odeTriMeshData.cxx @@ -45,7 +45,7 @@ unlink_data(dGeomID id) { void OdeTriMeshData:: print_data(const string &marker) { - odetrimeshdata_cat.debug() << get_class_type() << "::print_data(" << marker << ")\n"; + odetrimeshdata_cat.debug() << get_class_type() << "::print_data(" << marker << ")\n"; const TriMeshDataMap &data_map = get_tri_mesh_data_map(); TriMeshDataMap::const_iterator iter = data_map.begin(); for (;iter != data_map.end(); ++iter) { @@ -58,7 +58,7 @@ remove_data(OdeTriMeshData *data) { odetrimeshdata_cat.debug() << get_class_type() << "::remove_data(" << data->get_id() << ")" << "\n"; nassertv(_tri_mesh_data_map != (TriMeshDataMap *)NULL); TriMeshDataMap::iterator iter; - + for (iter = _tri_mesh_data_map->begin(); iter != _tri_mesh_data_map->end(); ++iter) { @@ -66,10 +66,10 @@ remove_data(OdeTriMeshData *data) { break; } } - + while (iter != _tri_mesh_data_map->end()) { _tri_mesh_data_map->erase(iter); - + for (iter = _tri_mesh_data_map->begin(); iter != _tri_mesh_data_map->end(); ++iter) { @@ -81,9 +81,6 @@ remove_data(OdeTriMeshData *data) { } -//////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////// - OdeTriMeshData:: OdeTriMeshData(const NodePath& model, bool use_normals) : _id(dGeomTriMeshDataCreate()), @@ -93,7 +90,7 @@ OdeTriMeshData(const NodePath& model, bool use_normals) : _num_vertices(0), _num_faces(0) { odetrimeshdata_cat.debug() << get_type() << "(" << _id << ")" << "\n"; - + process_model(model, use_normals); write_faces(odetrimeshdata_cat.debug()); @@ -142,7 +139,7 @@ destroy() { if (_id != 0) { dGeomTriMeshDataDestroy(_id); remove_data(this); - _id = 0; + _id = 0; } } @@ -168,10 +165,10 @@ process_model(const NodePath& model, bool &use_normals) { odetrimeshdata_cat.debug() << "Found " << _num_vertices << " vertices.\n"; odetrimeshdata_cat.debug() << "Found " << _num_faces << " faces.\n"; - + _vertices = (StridedVertex *)PANDA_MALLOC_ARRAY(_num_vertices * sizeof(StridedVertex)); _faces = (StridedTri *)PANDA_MALLOC_ARRAY(_num_faces * sizeof(StridedTri)); - + _num_vertices = 0, _num_faces = 0; for (int i = 0; i < geomNodePaths.get_num_paths(); ++i) { @@ -198,7 +195,7 @@ process_geom(const Geom *geom) { out.width(4); out << "" << "process_geom(" << *geom << ")" << "\n"; if (geom->get_primitive_type() != Geom::PT_polygons) { return; - } + } CPT(GeomVertexData) vData = geom->get_vertex_data(); @@ -208,7 +205,7 @@ process_geom(const Geom *geom) { } void OdeTriMeshData:: -process_primitive(const GeomPrimitive *primitive, +process_primitive(const GeomPrimitive *primitive, CPT(GeomVertexData) vData) { GeomVertexReader vReader(vData, "vertex"); GeomVertexReader nReader(vData, "normal"); @@ -217,7 +214,7 @@ process_primitive(const GeomPrimitive *primitive, CPT(GeomPrimitive) dPrimitive = primitive; ostream &out = odetrimeshdata_cat.debug(); out.width(6); out << "" << "process_primitive(" << *dPrimitive << ")" << "\n"; - + if (dPrimitive->get_type() == GeomTriangles::get_class_type()) { for (int i = 0; i < dPrimitive->get_num_primitives(); i++, _num_faces++) { @@ -270,7 +267,7 @@ process_primitive(const GeomPrimitive *primitive, _faces[_num_faces].Indices[1] = _num_vertices-1; _faces[_num_faces].Indices[2] = _num_vertices; } - } + } } out << "\n"; } @@ -287,7 +284,7 @@ void OdeTriMeshData:: analyze(const Geom *geom) { if (geom->get_primitive_type() != Geom::PT_polygons) { return; - } + } for (int i = 0; i < geom->get_num_primitives(); ++i) { analyze(geom->get_primitive(i)); @@ -308,7 +305,7 @@ write_faces(ostream &out) const { for (unsigned int i = 0; i < _num_faces; ++i) { out.width(2); out << "Face " << i << ":\n"; for (int j = 0; j < 3; ++j) { - out.width(4); + out.width(4); out << "(" << _vertices[_faces[i].Indices[j]].Vertex[0] \ << ", " << _vertices[_faces[i].Indices[j]].Vertex[1] \ << ", " << _vertices[_faces[i].Indices[j]].Vertex[2] << ")\n" ; diff --git a/panda/src/osxdisplay/config_osxdisplay.cxx b/panda/src/osxdisplay/config_osxdisplay.cxx index 04dad2052d..60c5c7e93e 100644 --- a/panda/src/osxdisplay/config_osxdisplay.cxx +++ b/panda/src/osxdisplay/config_osxdisplay.cxx @@ -1,3 +1,5 @@ +// Filename: config_osxdisplay.cxx +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE diff --git a/panda/src/osxdisplay/config_osxdisplay.h b/panda/src/osxdisplay/config_osxdisplay.h index 5f2db7cd11..552117cf32 100644 --- a/panda/src/osxdisplay/config_osxdisplay.h +++ b/panda/src/osxdisplay/config_osxdisplay.h @@ -1,3 +1,5 @@ +// Filename: config_osxdisplay.h +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE diff --git a/panda/src/osxdisplay/osxGraphicsBuffer.cxx b/panda/src/osxdisplay/osxGraphicsBuffer.cxx index b99d8af4d4..fffc18b7dd 100644 --- a/panda/src/osxdisplay/osxGraphicsBuffer.cxx +++ b/panda/src/osxdisplay/osxGraphicsBuffer.cxx @@ -1,3 +1,5 @@ +// Filename: osxGraphicsBuffer.cxx +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -39,7 +41,7 @@ osxGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, DCAST_INTO_V(osx_pipe, _pipe); _pbuffer = NULL; - + // Since the pbuffer never gets flipped, we get screenshots from the // same buffer we draw into. _screenshot_buffer_type = _draw_buffer_type; @@ -210,7 +212,7 @@ open_buffer() { } _fb_properties = osxgsg->get_fb_properties(); */ - + _is_valid = true; return true; } diff --git a/panda/src/osxdisplay/osxGraphicsBuffer.h b/panda/src/osxdisplay/osxGraphicsBuffer.h index a3c30b26c3..f807c1a70f 100644 --- a/panda/src/osxdisplay/osxGraphicsBuffer.h +++ b/panda/src/osxdisplay/osxGraphicsBuffer.h @@ -1,3 +1,5 @@ +// Filename: osxGraphicsBuffer.h +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -28,7 +30,7 @@ //////////////////////////////////////////////////////////////////// class osxGraphicsBuffer : public GraphicsBuffer { public: - osxGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, + osxGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe, const string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, @@ -46,7 +48,7 @@ protected: private: AGLPbuffer _pbuffer; - + public: static TypeHandle get_class_type() { return _type_handle; diff --git a/panda/src/osxdisplay/osxGraphicsPipe.cxx b/panda/src/osxdisplay/osxGraphicsPipe.cxx index 5c85bd018e..54ec803b8e 100644 --- a/panda/src/osxdisplay/osxGraphicsPipe.cxx +++ b/panda/src/osxdisplay/osxGraphicsPipe.cxx @@ -1,3 +1,5 @@ +// Filename: osxGraphicsPipe.cxx +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -35,7 +37,7 @@ Boolean GetDictionaryBoolean(CFDictionaryRef theDict, const void* key) { CFBooleanRef boolRef; boolRef = (CFBooleanRef)CFDictionaryGetValue(theDict, key); if (boolRef != NULL) - value = CFBooleanGetValue(boolRef); + value = CFBooleanGetValue(boolRef); return value; } @@ -45,7 +47,7 @@ long GetDictionaryLong(CFDictionaryRef theDict, const void* key) { CFNumberRef numRef; numRef = (CFNumberRef)CFDictionaryGetValue(theDict, key); if (numRef != NULL) - CFNumberGetValue(numRef, kCFNumberLongType, &value); + CFNumberGetValue(numRef, kCFNumberLongType, &value); return value; } @@ -54,37 +56,37 @@ static CFComparisonResult CompareModes (const void *val1,const void *val2,void * #pragma unused(context) CFDictionaryRef thisMode = (CFDictionaryRef)val1; CFDictionaryRef otherMode = (CFDictionaryRef)val2; - + long width = GetModeWidth(thisMode); long otherWidth = GetModeWidth(otherMode); long height = GetModeHeight(thisMode); long otherHeight = GetModeHeight(otherMode); - + // sort modes in screen size order if (width * height < otherWidth * otherHeight) { return kCFCompareLessThan; } else if (width * height > otherWidth * otherHeight) { return kCFCompareGreaterThan; } - + // sort modes by bits per pixel long bitsPerPixel = GetModeBitsPerPixel(thisMode); - long otherBitsPerPixel = GetModeBitsPerPixel(otherMode); + long otherBitsPerPixel = GetModeBitsPerPixel(otherMode); if (bitsPerPixel < otherBitsPerPixel) { return kCFCompareLessThan; } else if (bitsPerPixel > otherBitsPerPixel) { return kCFCompareGreaterThan; } - + // sort modes by refresh rate. long refreshRate = GetModeRefreshRate(thisMode); - long otherRefreshRate = GetModeRefreshRate(otherMode); + long otherRefreshRate = GetModeRefreshRate(otherMode); if (refreshRate < otherRefreshRate) { return kCFCompareLessThan; } else if (refreshRate > otherRefreshRate) { return kCFCompareGreaterThan; } - + return kCFCompareEqualTo; } @@ -92,18 +94,18 @@ CFArrayRef GSCGDisplayAvailableModesUsefulForOpenGL(CGDirectDisplayID display) { // get a list of all possible display modes for this system. CFArrayRef availableModes = CGDisplayAvailableModes(display); unsigned int numberOfAvailableModes = CFArrayGetCount(availableModes); - + // creat mutable array to hold the display modes we are interested int. CFMutableArrayRef usefulModes = CFArrayCreateMutable(kCFAllocatorDefault, numberOfAvailableModes, NULL); - + // get the current bits per pixel. long currentModeBitsPerPixel = GetModeBitsPerPixel(CGDisplayCurrentMode(display)); - + unsigned int i; for (i= 0; i _total_display_modes++; + _display_information -> _total_display_modes++; displays[i].width = (signed int)GetModeWidth (displayMode); displays[i].height = (signed int)GetModeHeight (displayMode); displays[i].bits_per_pixel = (signed int)GetModeBitsPerPixel (displayMode); displays[i].refresh_rate = (signed int)GetModeRefreshRate (displayMode); - } + } _display_information -> _display_mode_array = displays; } //////////////////////////////////////////////////////////////////// // Function: osxGraphicsPipe::Destructor // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// osxGraphicsPipe:: ~osxGraphicsPipe() { @@ -236,7 +238,7 @@ pipe_constructor() { // performed: typically either the app thread (e.g. X) // or the draw thread (Windows). //////////////////////////////////////////////////////////////////// -GraphicsPipe::PreferredWindowThread +GraphicsPipe::PreferredWindowThread osxGraphicsPipe::get_preferred_window_thread() const { return PWT_app; } @@ -333,7 +335,7 @@ create_cg_image(const PNMImage &pnm_image) { } nassertr((void *)dp == (void *)(char_array + num_bytes), NULL); - CGDataProviderRef provider = + CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, char_array, num_bytes, release_data); nassertr(provider != NULL, NULL); @@ -379,7 +381,7 @@ make_output(const string &name, if (!_is_valid) { return NULL; } - + osxGraphicsStateGuardian *osxgsg = 0; if (gsg != 0) { DCAST_INTO_R(osxgsg, gsg, NULL); @@ -403,7 +405,7 @@ make_output(const string &name, << "Got parent_window " << *window_handle << "\n"; #ifdef SUPPORT_SUBPROCESS_WINDOW WindowHandle::OSHandle *os_handle = window_handle->get_os_handle(); - if (os_handle != NULL && + if (os_handle != NULL && os_handle->is_of_type(NativeWindowHandle::SubprocessHandle::get_class_type())) { return new SubprocessWindow(engine, this, name, fb_prop, win_prop, flags, gsg, host); @@ -442,7 +444,7 @@ make_output(const string &name, } return new GLGraphicsBuffer(engine, this, name, fb_prop, win_prop, flags, gsg, host); } - + // Third thing to try: an osxGraphicsBuffer if (retry == 2) { if ((!support_render_texture)|| diff --git a/panda/src/osxdisplay/osxGraphicsPipe.h b/panda/src/osxdisplay/osxGraphicsPipe.h index 7cf7b9b718..236241d70e 100644 --- a/panda/src/osxdisplay/osxGraphicsPipe.h +++ b/panda/src/osxdisplay/osxGraphicsPipe.h @@ -1,3 +1,5 @@ +// Filename: osxGraphicsPipe.h +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE diff --git a/panda/src/osxdisplay/osxGraphicsStateGuardian.cxx b/panda/src/osxdisplay/osxGraphicsStateGuardian.cxx index ca1c261129..e15e44419a 100644 --- a/panda/src/osxdisplay/osxGraphicsStateGuardian.cxx +++ b/panda/src/osxdisplay/osxGraphicsStateGuardian.cxx @@ -1,3 +1,5 @@ +// Filename: osxGraphicsStateGuardian.cxx +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE diff --git a/panda/src/osxdisplay/osxGraphicsStateGuardian.h b/panda/src/osxdisplay/osxGraphicsStateGuardian.h index 855965c6ed..2dfd751154 100644 --- a/panda/src/osxdisplay/osxGraphicsStateGuardian.h +++ b/panda/src/osxdisplay/osxGraphicsStateGuardian.h @@ -1,3 +1,5 @@ +// Filename: osxGraphicsStateGuardian.h +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE diff --git a/panda/src/osxdisplay/osxGraphicsWindow.h b/panda/src/osxdisplay/osxGraphicsWindow.h index a6d66031ca..4fd6bfff24 100644 --- a/panda/src/osxdisplay/osxGraphicsWindow.h +++ b/panda/src/osxdisplay/osxGraphicsWindow.h @@ -1,3 +1,5 @@ +// Filename: osxGraphicsWindow.h +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -32,7 +34,7 @@ OSStatus report_agl_error(const string &comment); //////////////////////////////////////////////////////////////////// class osxGraphicsWindow : public GraphicsWindow { public: - osxGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, + osxGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, const string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, @@ -48,10 +50,10 @@ public: virtual void begin_flip(); virtual void end_flip(); virtual void process_events(); - + virtual bool do_reshape_request(int x_origin, int y_origin, bool has_origin, int x_size, int y_size); - + virtual void mouse_mode_absolute(); virtual void mouse_mode_relative(); @@ -73,7 +75,7 @@ private: // public: // do not call direct .. - OSStatus handle_key_input(EventHandlerCallRef myHandler, EventRef event, + OSStatus handle_key_input(EventHandlerCallRef myHandler, EventRef event, Boolean keyDown); OSStatus handle_text_input(EventHandlerCallRef myHandler, EventRef event); OSStatus handle_window_mouse_events(EventHandlerCallRef myHandler, EventRef event); @@ -107,10 +109,10 @@ private: CGImageRef _pending_icon; CGImageRef _current_icon; - + int _ID; - static osxGraphicsWindow *full_screen_window; - + static osxGraphicsWindow *full_screen_window; + #ifdef HACK_SCREEN_HASH_CONTEXT AGLContext _holder_aglcontext; #endif diff --git a/panda/src/osxdisplay/osxGraphicsWindow.mm b/panda/src/osxdisplay/osxGraphicsWindow.mm index 36db5a55ce..de82a2716b 100644 --- a/panda/src/osxdisplay/osxGraphicsWindow.mm +++ b/panda/src/osxdisplay/osxGraphicsWindow.mm @@ -1,3 +1,5 @@ +// Filename: osxGraphicsWindow.mm +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -41,8 +43,6 @@ #include "pmutex.h" -//////////////////////////////////// - static Mutex & osx_global_mutex() { static Mutex m("osx_global_mutex"); @@ -50,8 +50,6 @@ osx_global_mutex() { } -////////////////////////// Global Objects ..... - TypeHandle osxGraphicsWindow::_type_handle; osxGraphicsWindow *osxGraphicsWindow::full_screen_window = NULL; @@ -96,8 +94,8 @@ get_current_osx_window(WindowRef window) { if (full_screen_window != NULL) { return full_screen_window; } - - if (window == NULL) { + + if (window == NULL) { // HID use this path // Assume first we are a child window. If we cant find a window @@ -108,7 +106,7 @@ get_current_osx_window(WindowRef window) { window = FrontNonFloatingWindow(); } } - + if (window && check_my_window(window)) { return (osxGraphicsWindow *)GetWRefCon (window); } else { @@ -121,7 +119,7 @@ get_current_osx_window(WindowRef window) { // Description: Convenience function to report the current AGL error // code as a formatted error message. //////////////////////////////////////////////////////////////////// -OSStatus +OSStatus report_agl_error(const string &comment) { GLenum err = aglGetError(); if (err != AGL_NO_ERROR) { @@ -146,8 +144,8 @@ invert_gl_image(char *imageData, size_t imageSize, size_t rowBytes) { nassertv(buffer != (char *)NULL); // Copy by rows through temp buffer - for (size_t i = 0, j = imageSize - rowBytes; - i < imageSize >> 1; + for (size_t i = 0, j = imageSize - rowBytes; + i < imageSize >> 1; i += rowBytes, j -= rowBytes) { memcpy(buffer, &imageData[i], rowBytes); memcpy(&imageData[i], &imageData[j], rowBytes); @@ -157,19 +155,19 @@ invert_gl_image(char *imageData, size_t imageSize, size_t rowBytes) { //////////////////////////////////////////////////////////////////// // Function: composite_gl_buffer_into_window -// Description: Drop a GL overlay onto a carbon window.. +// Description: Drop a GL overlay onto a carbon window.. //////////////////////////////////////////////////////////////////// -static void -composite_gl_buffer_into_window(AGLContext ctx, Rect *bufferRect, +static void +composite_gl_buffer_into_window(AGLContext ctx, Rect *bufferRect, GrafPtr out_port) { GWorldPtr world; QDErr err; - + // blit OpenGL content into window backing store // allocate buffer to hold pane image long width = (bufferRect->right - bufferRect->left); long height = (bufferRect->bottom - bufferRect->top); - + Rect src_rect = {0, 0, height, width}; Rect ddrc_rect = {0, 0, height, width}; long row_bytes = width * 4; @@ -181,20 +179,20 @@ composite_gl_buffer_into_window(AGLContext ctx, Rect *bufferRect, << "Out of memory in composite_gl_buffer_into_window()!\n"; return; // no harm in continuing } - + // pull GL content down to our image buffer aglSetCurrentContext(ctx); - glReadPixels(0, 0, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, + glReadPixels(0, 0, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, image); // GL buffers are upside-down relative to QD buffers, so we need to flip it invert_gl_image(image, image_size, row_bytes); // create a GWorld containing our image - err = NewGWorldFromPtr(&world, k32ARGBPixelFormat, &src_rect, 0, 0, 0, + err = NewGWorldFromPtr(&world, k32ARGBPixelFormat, &src_rect, 0, 0, 0, image, row_bytes); if (err != noErr) { - osxdisplay_cat.error() + osxdisplay_cat.error() << " error in NewGWorldFromPtr, called from composite_gl_buffer_into_window()\n"; DisposePtr(image); return; @@ -203,10 +201,10 @@ composite_gl_buffer_into_window(AGLContext ctx, Rect *bufferRect, GrafPtr port_save = NULL; Boolean port_changed = QDSwapPort(out_port, &port_save); - CopyBits(GetPortBitMapForCopyBits(world), - GetPortBitMapForCopyBits(out_port), + CopyBits(GetPortBitMapForCopyBits(world), + GetPortBitMapForCopyBits(out_port), &src_rect, &ddrc_rect, srcCopy, 0); - + if (port_changed) { QDSwapPort(port_save, NULL); } @@ -228,7 +226,7 @@ event_handler(EventHandlerCallRef myHandler, EventRef event) { UInt32 kind = GetEventKind(event); WindowRef window = NULL; - GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, + GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(window), NULL, &window); UInt32 attributes = 0; @@ -237,7 +235,7 @@ event_handler(EventHandlerCallRef myHandler, EventRef event) { if (osxdisplay_cat.is_spam()) { osxdisplay_cat.spam() - << ClockObject::get_global_clock()->get_real_time() + << ClockObject::get_global_clock()->get_real_time() << " event_handler: " << (void *)this << ", " << window << ", " << the_class << ", " << kind << "\n"; } @@ -246,13 +244,13 @@ event_handler(EventHandlerCallRef myHandler, EventRef event) { case kEventClassMouse: result = handle_window_mouse_events (myHandler, event); break; - - case kEventClassWindow: + + case kEventClassWindow: switch (kind) { case kEventWindowCollapsing: /* Rect r; - GetWindowPortBounds (window, &r); + GetWindowPortBounds (window, &r); composite_gl_buffer_into_window(get_context(), &r, GetWindowPort (window)); UpdateCollapsedWindowDockTile (window); */ @@ -291,7 +289,7 @@ event_handler(EventHandlerCallRef myHandler, EventRef event) { bounds.right = bounds.left + _properties.get_x_size(); bounds.bottom = bounds.top + _properties.get_y_size(); SetEventParameter(event, kEventParamCurrentBounds, - typeQDRectangle, sizeof(bounds), &bounds); + typeQDRectangle, sizeof(bounds), &bounds); result = noErr; } } @@ -322,7 +320,7 @@ event_handler(EventHandlerCallRef myHandler, EventRef event) { } break; } - + return result; } @@ -352,12 +350,12 @@ user_close_request() { // an internal request //////////////////////////////////////////////////////////////////// void osxGraphicsWindow:: -system_close_window() { +system_close_window() { if (osxdisplay_cat.is_debug()) { osxdisplay_cat.debug() << "System Closing Window \n"; } - release_system_resources(false); + release_system_resources(false); } //////////////////////////////////////////////////////////////////// @@ -370,9 +368,9 @@ system_close_window() { static pascal OSStatus window_event_handler(EventHandlerCallRef my_handler, EventRef event, void *) { // volatile().lock(); - - WindowRef window = NULL; - GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, + + WindowRef window = NULL; + GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &window); if (window != NULL) { @@ -382,15 +380,15 @@ window_event_handler(EventHandlerCallRef my_handler, EventRef event, void *) { return osx_win->event_handler(my_handler, event); } } - + //osx_global_mutex().release(); return eventNotHandledErr; } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: osxGraphicsWindow::do_resize // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void osxGraphicsWindow:: do_resize() { @@ -401,14 +399,14 @@ do_resize() { // only in window mode .. not full screen if (_osx_window != NULL && !_is_fullscreen && _properties.has_size()) { - Rect rectPort = { - 0, 0, 0, 0 + Rect rectPort = { + 0, 0, 0, 0 }; - CGRect viewRect = { - { 0.0f, 0.0f }, { 0.0f, 0.0f } + CGRect viewRect = { + { 0.0f, 0.0f }, { 0.0f, 0.0f } }; - GetWindowPortBounds(_osx_window, &rectPort); + GetWindowPortBounds(_osx_window, &rectPort); viewRect.size.width = (PN_stdfloat)(rectPort.right - rectPort.left); viewRect.size.height = (PN_stdfloat)(rectPort.bottom - rectPort.top); @@ -417,10 +415,10 @@ do_resize() { properties.set_size((int)viewRect.size.width,(int)viewRect.size.height); properties.set_origin((int) rectPort.left,(int)rectPort.top); system_changed_properties(properties); - + if (osxdisplay_cat.is_debug()) { osxdisplay_cat.debug() - << " Resizing Window " << viewRect.size.width + << " Resizing Window " << viewRect.size.width << " " << viewRect.size.height << "\n"; } @@ -435,31 +433,31 @@ do_resize() { } if (osxdisplay_cat.is_debug()) { - osxdisplay_cat.debug() + osxdisplay_cat.debug() << "Resize Complete.....\n"; } - } + } } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: app_event_handler // Description: The C callback for Application events. // // Hooked once per application. //////////////////////////////////////////////////////////////////// static pascal OSStatus -app_event_handler(EventHandlerCallRef my_handler, EventRef event, +app_event_handler(EventHandlerCallRef my_handler, EventRef event, void *user_data) { OSStatus result = eventNotHandledErr; { //osx_global_mutex().lock(); osxGraphicsWindow *osx_win = NULL; - WindowRef window = NULL; + WindowRef window = NULL; UInt32 the_class = GetEventClass (event); UInt32 kind = GetEventKind (event); - GetEventParameter(event, kEventParamWindowRef, typeWindowRef, NULL, + GetEventParameter(event, kEventParamWindowRef, typeWindowRef, NULL, sizeof(WindowRef), NULL, (void*) &window); osx_win = osxGraphicsWindow::get_current_osx_window(window); if (osx_win == NULL) { @@ -472,9 +470,9 @@ app_event_handler(EventHandlerCallRef my_handler, EventRef event, if (kind == kEventTextInputUnicodeForKeyEvent) { osx_win->handle_text_input(my_handler, event); } - //result = noErr; + //result = noErr; // - // can not report handled .. the os will not sent the raw key strokes then + // can not report handled .. the os will not sent the raw key strokes then // if(osx_win->handle_text_input(my_handler, event) == noErr) // result = noErr; break; @@ -493,9 +491,9 @@ app_event_handler(EventHandlerCallRef my_handler, EventRef event, { UInt32 newModifiers; OSStatus error = GetEventParameter(event, kEventParamKeyModifiers,typeUInt32, NULL,sizeof(UInt32), NULL, &newModifiers); - if (error == noErr) { + if (error == noErr) { osx_win->handle_modifier_delta(newModifiers); - result = noErr; + result = noErr; } } break; @@ -505,19 +503,19 @@ app_event_handler(EventHandlerCallRef my_handler, EventRef event, case kEventClassMouse: // osxdisplay_cat.info() << "Mouse movement handled by Application handler\n"; - //if(osxGraphicsWindow::full_screen_window != NULL) + //if(osxGraphicsWindow::full_screen_window != NULL) result = osx_win->handle_window_mouse_events(my_handler, event); - //result = noErr; + //result = noErr; break; } - - //osx_global_mutex().release(); + + //osx_global_mutex().release(); } - + return result; } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: osxGraphicsWindow::handle_text_input // Access: Public // Description: Trap Unicode Input. @@ -525,14 +523,14 @@ app_event_handler(EventHandlerCallRef my_handler, EventRef event, OSStatus osxGraphicsWindow:: handle_text_input(EventHandlerCallRef my_handler, EventRef text_event) { UniChar *text = NULL; - UInt32 actual_size = 0; - - OSStatus ret = GetEventParameter(text_event, kEventParamTextInputSendText, + UInt32 actual_size = 0; + + OSStatus ret = GetEventParameter(text_event, kEventParamTextInputSendText, typeUnicodeText, NULL, 0, &actual_size, NULL); if (ret != noErr) { return ret; } - + text = (UniChar*)NewPtr(actual_size); if (text!= NULL) { ret = GetEventParameter (text_event, kEventParamTextInputSendText,typeUnicodeText, NULL, actual_size, NULL, text); @@ -541,15 +539,15 @@ handle_text_input(EventHandlerCallRef my_handler, EventRef text_event) { } for (unsigned int x = 0; x < actual_size/sizeof(UniChar); ++x) { - _input_devices[0].keystroke(text[x]); + _input_devices[0].keystroke(text[x]); } DisposePtr((char *)text); } - + return ret; } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: osxGraphicsWindow::release_system_resources // Access: Private // Description: Clean up the OS level messes. @@ -559,24 +557,24 @@ release_system_resources(bool destructing) { if (_is_fullscreen) { _is_fullscreen = false; full_screen_window = NULL; - + if (_originalMode != NULL) { CGDisplaySwitchToMode(kCGDirectMainDisplay, _originalMode); } CGDisplayRelease(kCGDirectMainDisplay); aglSetDrawable(get_gsg_context(), NULL); - + _originalMode = NULL; } - + // if the gsg context is assigned to this window // clear it.. if (_osx_window != NULL && GetWindowPort (_osx_window) == (GrafPtr)aglGetDrawable(get_gsg_context())) { aglSetDrawable(get_gsg_context(),NULL); } - - // if we are the active gl context clear it.. + + // if we are the active gl context clear it.. if (aglGetCurrentContext() == get_gsg_context()) { aglSetCurrentContext(NULL); } @@ -587,12 +585,12 @@ release_system_resources(bool destructing) { DisposeWindow(_osx_window); _osx_window = NULL; } - + if (_holder_aglcontext) { - aglDestroyContext(_holder_aglcontext); + aglDestroyContext(_holder_aglcontext); _holder_aglcontext = NULL; } - + if (_pending_icon != NULL) { CGImageRelease(_pending_icon); _pending_icon = NULL; @@ -610,8 +608,8 @@ release_system_resources(bool destructing) { properties.set_cursor_filename(Filename()); system_changed_properties(properties); } - - _is_fullscreen = false; + + _is_fullscreen = false; _osx_window = NULL; } @@ -624,7 +622,7 @@ static int id_seed = 100; // Description: //////////////////////////////////////////////////////////////////// osxGraphicsWindow:: -osxGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, +osxGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, const string &name, const FrameBufferProperties &fb_prop, const WindowProperties &win_prop, @@ -636,9 +634,9 @@ osxGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, _is_fullscreen(false), _pending_icon(NULL), _current_icon(NULL), -#ifdef HACK_SCREEN_HASH_CONTEXT +#ifdef HACK_SCREEN_HASH_CONTEXT _holder_aglcontext(NULL), -#endif +#endif _originalMode(NULL), _ID(id_seed++) { @@ -653,7 +651,7 @@ osxGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, _display_hide_cursor = false; _wheel_hdelta = 0; _wheel_vdelta = 0; - + if (osxdisplay_cat.is_debug()) { osxdisplay_cat.debug() << "osxGraphicsWindow::osxGraphicsWindow() -" <<_ID << "\n"; @@ -678,10 +676,10 @@ osxGraphicsWindow:: SetWRefCon(_osx_window, (long) NULL); } - release_system_resources(true); + release_system_resources(true); } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: osxGraphicsWindow::get_context // Access: Private // Description: Helper to decide whitch context to use if any @@ -695,22 +693,22 @@ get_context() { return get_gsg_context(); } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: osxGraphicsWindow::get_gsg_context // Access: Private -// Description: +// Description: //////////////////////////////////////////////////////////////////// AGLContext osxGraphicsWindow:: get_gsg_context() { if (_gsg != NULL) { osxGraphicsStateGuardian *osxgsg = NULL; - osxgsg = DCAST(osxGraphicsStateGuardian, _gsg); + osxgsg = DCAST(osxGraphicsStateGuardian, _gsg); return osxgsg->get_context(); } return NULL; } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: osxGraphicsWindow::build_gl // Access: Private // Description: Code of the class.. used to control the GL context @@ -726,26 +724,26 @@ build_gl(bool full_screen) { if (stat != noErr) { return stat; } - + OSStatus err = noErr; - + if (osxgsg->get_agl_pixel_format()) { _holder_aglcontext = aglCreateContext(osxgsg->get_agl_pixel_format(), NULL); - + err = report_agl_error("aglCreateContext"); if (_holder_aglcontext == NULL) { - osxdisplay_cat.error() + osxdisplay_cat.error() << "osxGraphicsWindow::build_gl Error aglCreateContext \n"; if (err ==noErr) { - err = -1; + err = -1; } - } else { - aglSetInteger(_holder_aglcontext, AGL_BUFFER_NAME, &osxgsg->_shared_buffer); + } else { + aglSetInteger(_holder_aglcontext, AGL_BUFFER_NAME, &osxgsg->_shared_buffer); err = report_agl_error ("aglSetInteger AGL_BUFFER_NAME"); } } else { osxdisplay_cat.error() - << "osxGraphicsWindow::build_gl Error Getting PixelFormat \n"; + << "osxGraphicsWindow::build_gl Error Getting PixelFormat \n"; if (err ==noErr) { err = -1; } @@ -784,12 +782,12 @@ set_icon_filename(const Filename &icon_filename) { << "Could not read icon filename " << icon_pathname << "\n"; return false; } - + CGImageRef icon_image = osxGraphicsPipe::create_cg_image(pnmimage); if (icon_image == NULL) { return false; } - + if (_pending_icon != NULL) { CGImageRelease(_pending_icon); _pending_icon = NULL; @@ -810,12 +808,12 @@ set_pointer_in_window(int x, int y) { if (_cursor_hidden != _display_hide_cursor) { if (_cursor_hidden) { - CGDisplayHideCursor(kCGDirectMainDisplay); + CGDisplayHideCursor(kCGDirectMainDisplay); _display_hide_cursor = true; - } else { - CGDisplayShowCursor(kCGDirectMainDisplay); + } else { + CGDisplayShowCursor(kCGDirectMainDisplay); _display_hide_cursor = false; - } + } } } @@ -830,7 +828,7 @@ set_pointer_out_of_window() { _input_devices[0].set_pointer_out_of_window(); if (_display_hide_cursor) { - CGDisplayShowCursor(kCGDirectMainDisplay); + CGDisplayShowCursor(kCGDirectMainDisplay); _display_hide_cursor = false; } } @@ -848,14 +846,14 @@ set_pointer_out_of_window() { bool osxGraphicsWindow:: begin_frame(FrameMode mode, Thread *current_thread) { PStatTimer timer(_make_current_pcollector); - + begin_frame_spam(mode); - if (_gsg == (GraphicsStateGuardian *)NULL || + if (_gsg == (GraphicsStateGuardian *)NULL || (_osx_window == NULL && !_is_fullscreen)) { // not powered up .. just abort.. return false; } - + // Now is a good time to apply the icon change that may have // recently been requested. By this point, we should be able to get // a handle to the dock context. @@ -863,8 +861,8 @@ begin_frame(FrameMode mode, Thread *current_thread) { CGContextRef context = BeginCGContextForApplicationDockTile(); if (context != NULL) { SetApplicationDockTileImage(_pending_icon); - EndCGContextForApplicationDockTile(context); - + EndCGContextForApplicationDockTile(context); + if (_current_icon != NULL) { CGImageRelease(_current_icon); _current_icon = NULL; @@ -873,25 +871,25 @@ begin_frame(FrameMode mode, Thread *current_thread) { _pending_icon = NULL; } } - + if (_is_fullscreen) { aglSetFullScreen(get_gsg_context(),0,0,0,0); - report_agl_error ("aglSetFullScreen"); - + report_agl_error ("aglSetFullScreen"); + } else { if (full_screen_window != NULL) { return false; } - + if (!aglSetDrawable(get_gsg_context(), GetWindowPort (_osx_window))) { report_agl_error("aglSetDrawable"); } } if (!aglSetCurrentContext(get_gsg_context())) { - report_agl_error ("aglSetCurrentContext"); + report_agl_error ("aglSetCurrentContext"); } - + _gsg->reset_if_new(); _gsg->set_current_properties(&get_fb_properties()); @@ -908,14 +906,14 @@ begin_frame(FrameMode mode, Thread *current_thread) { void osxGraphicsWindow:: end_frame(FrameMode mode, Thread *current_thread) { end_frame_spam(mode); - + if (mode == FM_render) { nassertv(_gsg != (GraphicsStateGuardian *)NULL); copy_to_textures(); - if (!_properties.get_fixed_size() && - !_properties.get_undecorated() && + if (!_properties.get_fixed_size() && + !_properties.get_undecorated() && !_properties.get_fullscreen() && show_resize_box) { // Draw a kludgey little resize box in the corner of the window, @@ -925,7 +923,7 @@ end_frame(FrameMode mode, Thread *current_thread) { _gsg->prepare_display_region(&dr_reader); DCAST(osxGraphicsStateGuardian, _gsg)->draw_resize_box(); } - + aglSwapBuffers (get_gsg_context()); _gsg->end_frame(current_thread); } @@ -955,26 +953,26 @@ begin_flip() { // this forces a rip to proper context // cerr << " begin_flip [" << _ID << "]\n"; return; - + if (_is_fullscreen) { if (!aglSetFullScreen(get_gsg_context(),0,0,0,0)) { - report_agl_error("aglSetFullScreen"); + report_agl_error("aglSetFullScreen"); } - + if (!aglSetCurrentContext(get_gsg_context())) { report_agl_error("aglSetCurrentContext"); } - + aglSwapBuffers (get_gsg_context()); } else { if (!aglSetDrawable (get_gsg_context(),GetWindowPort (_osx_window))) { report_agl_error("aglSetDrawable"); } - + if (!aglSetCurrentContext(get_gsg_context())) { report_agl_error("aglSetCurrentContext"); - } - + } + aglSwapBuffers (get_gsg_context()); } } @@ -998,7 +996,6 @@ close_window() { GraphicsWindow::close_window(); } -////////////////////////////////////////////////////////// // HACK ALLERT ************ Undocumented OSX calls... // I can not find any other way to get the mouse focus to a window in OSX.. // @@ -1008,7 +1005,7 @@ close_window() { // UInt32 lo; // UInt32 hi; // }; -/// + //extern OSErr CPSGetCurrentProcess(CPSProcessSerNum *psn); //extern OSErr CPSEnableForegroundOperation(struct CPSProcessSerNum *psn); //extern OSErr CPSSetProcessName (struct CPSProcessSerNum *psn, char *processname); @@ -1025,11 +1022,11 @@ close_window() { bool osxGraphicsWindow:: open_window() { WindowProperties req_properties = _properties; - + if (_gsg == 0) { _gsg = new osxGraphicsStateGuardian(_engine, _pipe, NULL); } - + //osx_global_mutex().lock(); bool answer = os_open_window(req_properties); //osx_global_mutex().release(); @@ -1051,18 +1048,18 @@ os_open_window(WindowProperties &req_properties) { _pending_icon = _current_icon; _current_icon = NULL; } - + static bool GlobalInits = false; if (!GlobalInits) { // // one time aplication inits.. to get a window open from a standalone aplication.. - + EventHandlerRef application_event_ref_ref1; - EventTypeSpec list1[] = { + EventTypeSpec list1[] = { //{ kEventClassCommand, kEventProcessCommand }, //{ kEventClassCommand, kEventCommandUpdateStatus }, { kEventClassMouse, kEventMouseDown },// handle trackball functionality globaly because there is only a single user - { kEventClassMouse, kEventMouseUp }, + { kEventClassMouse, kEventMouseUp }, { kEventClassMouse, kEventMouseMoved }, { kEventClassMouse, kEventMouseDragged }, { kEventClassMouse, kEventMouseWheelMoved } , @@ -1070,13 +1067,13 @@ os_open_window(WindowProperties &req_properties) { { kEventClassKeyboard, kEventRawKeyUp } , { kEventClassKeyboard, kEventRawKeyRepeat }, { kEventClassKeyboard, kEventRawKeyModifiersChanged } , - { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent}, + { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent}, }; - + EventHandlerUPP gEvtHandler = NewEventHandlerUPP(app_event_handler); err = InstallApplicationEventHandler (gEvtHandler, GetEventTypeCount (list1) , list1, this, &application_event_ref_ref1); GlobalInits = true; - + ProcessSerialNumber psn = { 0, kCurrentProcess }; // Determine if we're running from a bundle. @@ -1131,7 +1128,7 @@ os_open_window(WindowProperties &req_properties) { CGDisplayCapture(kCGDirectMainDisplay); // if sized try and switch it.. if (req_properties.has_size()) { - _originalMode = CGDisplayCurrentMode(kCGDirectMainDisplay); + _originalMode = CGDisplayCurrentMode(kCGDirectMainDisplay); CFDictionaryRef newMode = CGDisplayBestModeForParameters(kCGDirectMainDisplay, 32, req_properties.get_x_size(), req_properties.get_y_size(), 0); if (newMode == NULL) { osxdisplay_cat.error() @@ -1140,39 +1137,39 @@ os_open_window(WindowProperties &req_properties) { << "\n"; } else { CGDisplaySwitchToMode(kCGDirectMainDisplay, newMode); - + // Set our new window size according to the size we actually got. - + SInt32 width, height; CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(newMode, kCGDisplayWidth), kCFNumberSInt32Type, &width); CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(newMode, kCGDisplayHeight), kCFNumberSInt32Type, &height); - + _properties.set_size(width, height); } } - + if (build_gl(true) != noErr) { if (_originalMode != NULL) { CGDisplaySwitchToMode(kCGDirectMainDisplay, _originalMode); } _originalMode = NULL; - + CGDisplayRelease(kCGDirectMainDisplay); - return false; - } - + return false; + } + _properties.set_fullscreen(true); _properties.set_minimized(false); _properties.set_foreground(true); - _is_fullscreen = true; + _is_fullscreen = true; full_screen_window = this; req_properties.clear_fullscreen(); } else { int x_origin = 10; int y_origin = 50; - if (req_properties.has_origin()) { + if (req_properties.has_origin()) { y_origin = req_properties.get_y_origin(); x_origin = req_properties.get_x_origin(); } @@ -1183,7 +1180,7 @@ os_open_window(WindowProperties &req_properties) { x_size = req_properties.get_x_size(); y_size = req_properties.get_y_size(); } - + // A coordinate of -2 means to center the window on screen. if (y_origin == -2 || x_origin == -2) { if (y_origin == -2) { @@ -1217,10 +1214,10 @@ os_open_window(WindowProperties &req_properties) { osxdisplay_cat.debug() << "Creating child window\n"; } - + CreateNewWindow(kSimpleWindowClass, kWindowNoAttributes, &r, &_osx_window); add_a_window(_osx_window); - + _properties.set_fixed_size(true); if (osxdisplay_cat.is_debug()) { osxdisplay_cat.debug() @@ -1233,43 +1230,43 @@ os_open_window(WindowProperties &req_properties) { attributes &= ~kWindowResizableAttribute; } - if (req_properties.has_undecorated() && req_properties.get_undecorated()) { + if (req_properties.has_undecorated() && req_properties.get_undecorated()) { // create a unmovable .. no edge window.. - + if (osxdisplay_cat.is_debug()) { osxdisplay_cat.debug() << "Creating undecorated window\n"; } - + // We don't want a resize box either. attributes &= ~kWindowResizableAttribute; attributes |= kWindowNoTitleBarAttribute; CreateNewWindow(kDocumentWindowClass, attributes, &r, &_osx_window); - } else { + } else { // create a window with crome and sizing and sucj // In this case, we want to constrain the window to the // available size. - + Rect bounds; GetAvailableWindowPositioningBounds(GetMainDevice(), &bounds); - + r.left = max(r.left, bounds.left); r.right = min(r.right, bounds.right); r.top = max(r.top, bounds.top); r.bottom = min(r.bottom, bounds.bottom); - + if (osxdisplay_cat.is_debug()) { - osxdisplay_cat.debug() + osxdisplay_cat.debug() << "Creating standard window\n"; } CreateNewWindow(kDocumentWindowClass, attributes, &r, &_osx_window); add_a_window(_osx_window); } } - + if (_osx_window) { EventHandlerUPP gWinEvtHandler; // window event handler - EventTypeSpec list[] = { + EventTypeSpec list[] = { { kEventClassWindow, kEventWindowCollapsing }, { kEventClassWindow, kEventWindowShown }, { kEventClassWindow, kEventWindowActivated }, @@ -1277,7 +1274,7 @@ os_open_window(WindowProperties &req_properties) { { kEventClassWindow, kEventWindowClose }, { kEventClassWindow, kEventWindowBoundsChanging }, { kEventClassWindow, kEventWindowBoundsChanged }, - + { kEventClassWindow, kEventWindowCollapsed }, { kEventClassWindow, kEventWindowExpanded }, { kEventClassWindow, kEventWindowZoomed }, @@ -1286,11 +1283,11 @@ os_open_window(WindowProperties &req_properties) { // point to the window record in the ref con of the window SetWRefCon(_osx_window, (long) this); - gWinEvtHandler = NewEventHandlerUPP(window_event_handler); + gWinEvtHandler = NewEventHandlerUPP(window_event_handler); InstallWindowEventHandler(_osx_window, gWinEvtHandler, GetEventTypeCount(list), list, (void*)this, NULL); // add event handler ShowWindow (_osx_window); - + if (osxdisplay_cat.is_debug()) { osxdisplay_cat.debug() << "Event handler installed, now build_gl\n"; @@ -1298,14 +1295,14 @@ os_open_window(WindowProperties &req_properties) { if (build_gl(false) != noErr) { osxdisplay_cat.error() << "Error in build_gl\n"; - + HideWindow(_osx_window); SetWRefCon(_osx_window, (long int) NULL); DisposeWindow(_osx_window); _osx_window = NULL; return false; } - + if (osxdisplay_cat.is_debug()) { osxdisplay_cat.debug() << "build_gl complete, set properties\n"; @@ -1314,16 +1311,16 @@ os_open_window(WindowProperties &req_properties) { // // attach the holder context to the window.. // - + if (!aglSetDrawable(_holder_aglcontext, GetWindowPort(_osx_window))) { err = report_agl_error("aglSetDrawable"); } - + if (req_properties.has_fullscreen()) { - _properties.set_fullscreen(false); - req_properties.clear_fullscreen(); + _properties.set_fullscreen(false); + req_properties.clear_fullscreen(); } - + if (req_properties.has_undecorated()) { _properties.set_undecorated(req_properties.get_undecorated()); req_properties.clear_undecorated(); @@ -1343,18 +1340,18 @@ os_open_window(WindowProperties &req_properties) { // Now measure the size and placement of the window we // actually ended up with. Rect rectPort = {0,0,0,0}; - GetWindowPortBounds (_osx_window, &rectPort); + GetWindowPortBounds (_osx_window, &rectPort); _properties.set_size((int)(rectPort.right - rectPort.left),(int) (rectPort.bottom - rectPort.top)); req_properties.clear_size(); req_properties.clear_origin(); } - + if (req_properties.has_icon_filename()) { set_icon_filename(req_properties.get_icon_filename()); } - if (req_properties.has_cursor_hidden()) { - _properties.set_cursor_hidden(req_properties.get_cursor_hidden()); + if (req_properties.has_cursor_hidden()) { + _properties.set_cursor_hidden(req_properties.get_cursor_hidden()); _cursor_hidden = req_properties.get_cursor_hidden(); if (_cursor_hidden) { if (!_display_hide_cursor) { @@ -1375,7 +1372,7 @@ os_open_window(WindowProperties &req_properties) { if (_properties.has_size()) { set_size_and_recalc(_properties.get_x_size(), _properties.get_y_size()); } - + return (err == noErr); } @@ -1392,7 +1389,7 @@ process_events() { if (!osx_disable_event_loop) { EventRef theEvent; EventTargetRef theTarget = GetEventDispatcherTarget(); - + /*if (!_properties.has_parent_window()) */ { while (ReceiveNextEvent(0, NULL, kEventDurationNoWait, true, &theEvent)== noErr) { SendEventToEventTarget (theEvent, theTarget); @@ -1409,19 +1406,19 @@ process_events() { // application events back into panda. //////////////////////////////////////////////////////////////////// OSStatus osxGraphicsWindow:: -handle_key_input(EventHandlerCallRef my_handler, EventRef event, +handle_key_input(EventHandlerCallRef my_handler, EventRef event, Boolean key_down) { if (osxdisplay_cat.is_debug()) { UInt32 key_code; - GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, + GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &key_code); osxdisplay_cat.debug() - << ClockObject::get_global_clock()->get_real_time() - << " handle_key_input: " << (void *)this << ", " << key_code + << ClockObject::get_global_clock()->get_real_time() + << " handle_key_input: " << (void *)this << ", " << key_code << ", " << (int)key_down << "\n"; } - + //CallNextEventHandler(my_handler, event); // We don't check the result of the above function. In principle, @@ -1431,21 +1428,21 @@ handle_key_input(EventHandlerCallRef my_handler, EventRef event, // are already mapped in the desktop seem to not even come into this // function in the first place. UInt32 new_modifiers = 0; - OSStatus error = GetEventParameter(event, kEventParamKeyModifiers, - typeUInt32, NULL, sizeof(UInt32), + OSStatus error = GetEventParameter(event, kEventParamKeyModifiers, + typeUInt32, NULL, sizeof(UInt32), NULL, &new_modifiers); if (error == noErr) { handle_modifier_delta(new_modifiers); } - + UInt32 key_code; - GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, + GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &key_code); ButtonHandle button = osx_translate_key(key_code, event); if (key_down) { if ((new_modifiers & cmdKey) != 0) { - if (button == KeyboardButton::ascii_key("q") || + if (button == KeyboardButton::ascii_key("q") || button == KeyboardButton::ascii_key("w")) { // Command-Q or Command-W: quit the application or close the // window, respectively. For now, we treat them both the @@ -1465,38 +1462,38 @@ handle_key_input(EventHandlerCallRef my_handler, EventRef event, //////////////////////////////////////////////////////////////////// // Function: osxGraphicsWindow::system_set_window_foreground // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void osxGraphicsWindow:: system_set_window_foreground(bool foreground) { WindowProperties properties; properties.set_foreground(foreground); system_changed_properties(properties); -} - +} + //////////////////////////////////////////////////////////////////// // Function: osxGraphicsWindow::system_point_to_local_point // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void osxGraphicsWindow:: system_point_to_local_point(Point &global_point) { if (_osx_window != NULL) { GrafPtr savePort; Boolean port_changed = QDSwapPort(GetWindowPort(_osx_window), &savePort); - + GlobalToLocal(&global_point); - + if (port_changed) { QDSwapPort(savePort, NULL); } - } + } } - + //////////////////////////////////////////////////////////////////// // Function: osxGraphicsWindow::handle_mouse_window_events // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// OSStatus osxGraphicsWindow:: handle_window_mouse_events(EventHandlerCallRef my_handler, EventRef event) { @@ -1505,7 +1502,7 @@ handle_window_mouse_events(EventHandlerCallRef my_handler, EventRef event) { UInt32 kind = GetEventKind(event); EventMouseButton button = 0; Point global_point = {0, 0}; - UInt32 modifiers = 0; + UInt32 modifiers = 0; Rect rect_port; SInt32 this_wheel_delta; EventMouseWheelAxis wheelAxis; @@ -1514,7 +1511,7 @@ handle_window_mouse_events(EventHandlerCallRef my_handler, EventRef event) { // Mac OS X v10.1 and later // should this be front window??? - GetEventParameter(event, kEventParamWindowRef, typeWindowRef, NULL, + GetEventParameter(event, kEventParamWindowRef, typeWindowRef, NULL, sizeof(WindowRef), NULL, &window); if (!_is_fullscreen && (window == NULL || window != _osx_window)) { @@ -1526,8 +1523,8 @@ handle_window_mouse_events(EventHandlerCallRef my_handler, EventRef event) { GetWindowPortBounds(window, &rect_port); - // result = CallNextEventHandler(my_handler, event); - // if (eventNotHandledErr == result) + // result = CallNextEventHandler(my_handler, event); + // if (eventNotHandledErr == result) { // only handle events not already handled (prevents weird resize interaction) switch (kind) { // Whenever mouse button state changes, generate the @@ -1547,7 +1544,7 @@ handle_window_mouse_events(EventHandlerCallRef my_handler, EventRef event) { delta.y += currMouse.get_y(); set_pointer_in_window((int)delta.x, (int)delta.y); } else { - GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL , (void*) &global_point); + GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL , (void*) &global_point); system_point_to_local_point(global_point); set_pointer_in_window((int)global_point.h, (int)global_point.v); } @@ -1558,12 +1555,12 @@ handle_window_mouse_events(EventHandlerCallRef my_handler, EventRef event) { result = noErr; break; - case kEventMouseMoved: + case kEventMouseMoved: case kEventMouseDragged: if (_properties.get_mouse_mode() == WindowProperties::M_relative) { HIPoint delta; GetEventParameter(event, kEventParamMouseDelta, typeHIPoint, NULL, sizeof(HIPoint), NULL, (void*) &delta); - + MouseData currMouse = get_pointer(0); delta.x += currMouse.get_x(); delta.y += currMouse.get_y(); @@ -1572,7 +1569,7 @@ handle_window_mouse_events(EventHandlerCallRef my_handler, EventRef event) { GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, (void*) &global_point); system_point_to_local_point(global_point); - if (kind == kEventMouseMoved && + if (kind == kEventMouseMoved && (global_point.h < 0 || global_point.v < 0)) { // Moving into the titlebar region. set_pointer_out_of_window(); @@ -1583,13 +1580,13 @@ handle_window_mouse_events(EventHandlerCallRef my_handler, EventRef event) { } result = noErr; break; - - case kEventMouseWheelMoved: + + case kEventMouseWheelMoved: GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(this_wheel_delta), NULL, &this_wheel_delta); GetEventParameter(event, kEventParamMouseWheelAxis, typeMouseWheelAxis, NULL, sizeof(wheelAxis), NULL, &wheelAxis); GetEventParameter(event, kEventParamMouseLocation,typeQDPoint, NULL, sizeof(Point),NULL , (void*) &global_point); system_point_to_local_point(global_point); - + if (wheelAxis == kEventMouseWheelAxisX) { set_pointer_in_window((int)global_point.h, (int)global_point.v); _wheel_hdelta += this_wheel_delta; @@ -1621,11 +1618,11 @@ handle_window_mouse_events(EventHandlerCallRef my_handler, EventRef event) { } } result = noErr; - break; + break; } // result = noErr; - } - + } + return result; } @@ -1694,8 +1691,8 @@ osx_translate_key(UInt32 key, EventRef event) { case 51: nk = KeyboardButton::backspace(); break; case 48: nk = KeyboardButton::tab(); break; case 53: nk = KeyboardButton::escape(); break; - case 76: nk = KeyboardButton::enter(); break; - case 36: nk = KeyboardButton::enter(); break; + case 76: nk = KeyboardButton::enter(); break; + case 36: nk = KeyboardButton::enter(); break; case 123: nk = KeyboardButton::left(); break; case 124: nk = KeyboardButton::right(); break; @@ -1705,10 +1702,10 @@ osx_translate_key(UInt32 key, EventRef event) { case 121: nk = KeyboardButton::page_down(); break; case 115: nk = KeyboardButton::home(); break; case 119: nk = KeyboardButton::end(); break; - case 114: nk = KeyboardButton::help(); break; - case 117: nk = KeyboardButton::del(); break; + case 114: nk = KeyboardButton::help(); break; + case 117: nk = KeyboardButton::del(); break; - // case 71: nk = KeyboardButton::num_lock() break; + // case 71: nk = KeyboardButton::num_lock() break; case 122: nk = KeyboardButton::f1(); break; case 120: nk = KeyboardButton::f2(); break; @@ -1728,7 +1725,7 @@ osx_translate_key(UInt32 key, EventRef event) { case 113: nk = KeyboardButton::f15(); break; case 106: nk = KeyboardButton::f16(); break; - // shiftable chartablet + // shiftable chartablet case 50: nk = KeyboardButton::ascii_key('`'); break; case 27: nk = KeyboardButton::ascii_key('-'); break; case 24: nk = KeyboardButton::ascii_key('='); break; @@ -1750,10 +1747,10 @@ osx_translate_key(UInt32 key, EventRef event) { // not sure this is right .. but no mapping for keypad and such // this at least does a best gess.. - - char charCode = 0; + + char charCode = 0; if (GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, nil, sizeof(charCode), nil, &charCode) == noErr) { - nk = KeyboardButton::ascii_key(charCode); + nk = KeyboardButton::ascii_key(charCode); } } return nk; @@ -1783,13 +1780,13 @@ handle_modifier_delta(UInt32 new_modifiers) { if ((changed & cmdKey) != 0) { send_key_event(KeyboardButton::meta(),(new_modifiers & cmdKey) != 0); } - + if ((changed & alphaLock) != 0) { send_key_event(KeyboardButton::caps_lock(),(new_modifiers & alphaLock) != 0); } - + // save current state - _last_key_modifiers = new_modifiers; + _last_key_modifiers = new_modifiers; } //////////////////////////////////////////////////////////////////// @@ -1832,45 +1829,45 @@ handle_button_delta(UInt32 new_buttons) { // Function: osxGraphicsWindow::move_pointer // Access: Published, Virtual // Description: Forces the pointer to the indicated position within -// the window, if possible. +// the window, if possible. // // Returns true if successful, false on failure. This // may fail if the mouse is not currently within the // window, or if the API doesn't support this operation. //////////////////////////////////////////////////////////////////// bool osxGraphicsWindow:: -move_pointer(int device, int x, int y) { +move_pointer(int device, int x, int y) { if (_osx_window == NULL) { - return false; + return false; } - + if (osxdisplay_cat.is_debug()) { osxdisplay_cat.debug() - << "move_pointer " << device <<" "<< x <<" "<< y <<"\n"; + << "move_pointer " << device <<" "<< x <<" "<< y <<"\n"; } - - Point pt = { 0, 0 }; - pt.h = x; - pt.v = y; - set_pointer_in_window(x, y); + + Point pt = { 0, 0 }; + pt.h = x; + pt.v = y; + set_pointer_in_window(x, y); if (_properties.get_mouse_mode() == WindowProperties::M_absolute) { - local_point_to_system_point(pt); - CGPoint new_position = { 0, 0 }; - new_position.x = pt.h; - new_position.y = pt.v; + local_point_to_system_point(pt); + CGPoint new_position = { 0, 0 }; + new_position.x = pt.h; + new_position.y = pt.v; mouse_mode_relative(); - CGWarpMouseCursorPosition(new_position); + CGWarpMouseCursorPosition(new_position); mouse_mode_absolute(); } - - return true; -} + + return true; +} //////////////////////////////////////////////////////////////////// // Function: osxGraphicsWindow::do_reshape_request // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// bool osxGraphicsWindow:: do_reshape_request(int x_origin, int y_origin, bool has_origin, @@ -1902,12 +1899,12 @@ do_reshape_request(int x_origin, int y_origin, bool has_origin, system_changed_properties(_properties); } - /* + /* if (_properties.has_parent_window()) { if (has_origin) { NSWindow* parentWindow = (NSWindow *)_properties.get_parent_window(); NSRect parentFrame = [parentWindow frame]; - + MoveWindow(_osx_window, x_origin+parentFrame.origin.x, y_origin+parentFrame.origin.y, false); } } else */ @@ -1925,7 +1922,7 @@ do_reshape_request(int x_origin, int y_origin, bool has_origin, // Constrain the window to the available desktop size. Rect bounds; GetAvailableWindowPositioningBounds(GetMainDevice(), &bounds); - + x_size = min(x_size, bounds.right - bounds.left); y_size = min(y_size, bounds.bottom - bounds.top); } @@ -1934,7 +1931,7 @@ do_reshape_request(int x_origin, int y_origin, bool has_origin, system_changed_size(x_size, y_size); return true; -} +} //////////////////////////////////////////////////////////////////// // Function: osxGraphicsWindow::set_properties_now @@ -1963,51 +1960,51 @@ set_properties_now(WindowProperties &properties) { osxdisplay_cat.debug() << "set_properties_now " << properties << "\n"; } - + GraphicsWindow::set_properties_now(properties); - + if (osxdisplay_cat.is_debug()) { osxdisplay_cat.debug() << "set_properties_now After Base Class" << properties << "\n"; } - + // for some changes .. a full rebuild is required for the OS layer Window. // I think it is the chrome attribute and full screen behaviour. bool need_full_rebuild = false; - + // if we are not full and transitioning to full - if (properties.has_fullscreen() && + if (properties.has_fullscreen() && properties.get_fullscreen() != _properties.get_fullscreen()) { need_full_rebuild = true; } // If we are fullscreen and requesting a size change - if (_properties.get_fullscreen() && - (properties.has_size() && + if (_properties.get_fullscreen() && + (properties.has_size() && (properties.get_x_size() != _properties.get_x_size() || properties.get_y_size() != _properties.get_y_size()))) { need_full_rebuild = true; } // If we are fullscreen and requesting a minimize change - if (_properties.get_fullscreen() && - (properties.has_minimized() && + if (_properties.get_fullscreen() && + (properties.has_minimized() && (properties.get_minimized() != _properties.get_minimized()))) { need_full_rebuild = true; } - + if (need_full_rebuild) { // Logic here is .. take a union of the properties .. with the // new allowed to overwrite the old states. and start a bootstrap // of a new window .. - + // get a copy of my properties.. - WindowProperties req_properties(_properties); + WindowProperties req_properties(_properties); release_system_resources(false); - req_properties.add_properties(properties); - - os_open_window(req_properties); - + req_properties.add_properties(properties); + + os_open_window(req_properties); + // Now we've handled all of the requested properties. properties.clear(); } @@ -2038,8 +2035,8 @@ set_properties_now(WindowProperties &properties) { properties.clear_undecorated(); } - if (properties.has_cursor_hidden()) { - _properties.set_cursor_hidden(properties.get_cursor_hidden()); + if (properties.has_cursor_hidden()) { + _properties.set_cursor_hidden(properties.get_cursor_hidden()); _cursor_hidden = properties.get_cursor_hidden(); if (_cursor_hidden) { if (!_display_hide_cursor) { @@ -2091,32 +2088,29 @@ set_properties_now(WindowProperties &properties) { return; } -///////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// // Function: osxGraphicsWindow::local_point_to_system_point // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void osxGraphicsWindow:: -local_point_to_system_point(Point &local_point) { - if (_osx_window != NULL) { +local_point_to_system_point(Point &local_point) { + if (_osx_window != NULL) { GrafPtr save_port; Boolean port_changed = QDSwapPort(GetWindowPort(_osx_window), &save_port); - + LocalToGlobal(&local_point); - + if (port_changed) { QDSwapPort(save_port, NULL); } - } -} + } +} //////////////////////////////////////////////////////////////////// // Function: osxGraphicsWindow::mouse_mode_relative // Access: Protected, Virtual -// Description: detaches mouse. Only mouse delta from now on. +// Description: detaches mouse. Only mouse delta from now on. //////////////////////////////////////////////////////////////////// void osxGraphicsWindow:: mouse_mode_relative() { diff --git a/panda/src/particlesystem/arcEmitter.I b/panda/src/particlesystem/arcEmitter.I index b49520554f..288fc27aba 100644 --- a/panda/src/particlesystem/arcEmitter.I +++ b/panda/src/particlesystem/arcEmitter.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_start_angle -// Access : public -// Description : start angle set +// Function: set_start_angle +// Access: Public +// Description: start angle set //////////////////////////////////////////////////////////////////// INLINE void ArcEmitter:: @@ -24,9 +24,9 @@ set_start_angle(PN_stdfloat angle) { } //////////////////////////////////////////////////////////////////// -// Function : set_end_angle -// Access : public -// Description : end angle set +// Function: set_end_angle +// Access: Public +// Description: end angle set //////////////////////////////////////////////////////////////////// INLINE void ArcEmitter:: @@ -35,9 +35,9 @@ set_end_angle(PN_stdfloat angle) { } //////////////////////////////////////////////////////////////////// -// Function : set_arc -// Access : public -// Description : arc sweep set +// Function: set_arc +// Access: Public +// Description: arc sweep set //////////////////////////////////////////////////////////////////// INLINE void ArcEmitter:: @@ -47,9 +47,9 @@ set_arc(PN_stdfloat startAngle, PN_stdfloat endAngle) { } //////////////////////////////////////////////////////////////////// -// Function : get_start_angle -// Access : public -// Description : get start angle +// Function: get_start_angle +// Access: Public +// Description: get start angle //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ArcEmitter:: @@ -58,9 +58,9 @@ get_start_angle() { } //////////////////////////////////////////////////////////////////// -// Function : get_end_angle -// Access : public -// Description : get end angle +// Function: get_end_angle +// Access: Public +// Description: get end angle //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ArcEmitter:: diff --git a/panda/src/particlesystem/arcEmitter.cxx b/panda/src/particlesystem/arcEmitter.cxx index fd46d120f0..527653e090 100644 --- a/panda/src/particlesystem/arcEmitter.cxx +++ b/panda/src/particlesystem/arcEmitter.cxx @@ -15,9 +15,9 @@ #include "arcEmitter.h" //////////////////////////////////////////////////////////////////// -// Function : ArcEmitter -// Access : Public -// Description : constructor +// Function: ArcEmitter +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// ArcEmitter:: ArcEmitter() : @@ -26,9 +26,9 @@ ArcEmitter() : } //////////////////////////////////////////////////////////////////// -// Function : ArcEmitter -// Access : Public -// Description : copy constructor +// Function: ArcEmitter +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// ArcEmitter:: ArcEmitter(const ArcEmitter ©) : @@ -38,18 +38,18 @@ ArcEmitter(const ArcEmitter ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~ArcEmitter -// Access : Public -// Description : destructor +// Function: ~ArcEmitter +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// ArcEmitter:: ~ArcEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : copier +// Function: make_copy +// Access: Public +// Description: copier //////////////////////////////////////////////////////////////////// BaseParticleEmitter *ArcEmitter:: make_copy() { @@ -57,9 +57,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : ArcEmitter::assign_initial_position -// Access : Public -// Description : Generates a location for a new particle +// Function: ArcEmitter::assign_initial_position +// Access: Public +// Description: Generates a location for a new particle //////////////////////////////////////////////////////////////////// void ArcEmitter:: assign_initial_position(LPoint3& pos) { @@ -68,8 +68,8 @@ assign_initial_position(LPoint3& pos) { theta = LERP(NORMALIZED_RAND(), _start_theta, _end_theta); } else { theta = LERP(NORMALIZED_RAND(), _start_theta, _end_theta + 2.0f * MathNumbers::pi_f); - } - + } + theta += (MathNumbers::pi_f / 2.0); this->_cos_theta = cosf(theta); this->_sin_theta = sinf(theta); @@ -82,10 +82,10 @@ assign_initial_position(LPoint3& pos) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a starc representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a starc representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ArcEmitter:: output(ostream &out) const { @@ -95,10 +95,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a starc representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a starc representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ArcEmitter:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/arcEmitter.h b/panda/src/particlesystem/arcEmitter.h index 25fcc6a369..eae87e1997 100644 --- a/panda/src/particlesystem/arcEmitter.h +++ b/panda/src/particlesystem/arcEmitter.h @@ -1,4 +1,4 @@ -// Filename: ringEmitter.h +// Filename: arcEmitter.h // Created by: charles (22Jun00) // //////////////////////////////////////////////////////////////////// @@ -44,7 +44,6 @@ private: // our emitter limits PN_stdfloat _start_theta; PN_stdfloat _end_theta; - /////////////////////////////// virtual void assign_initial_position(LPoint3& pos); }; diff --git a/panda/src/particlesystem/baseParticle.cxx b/panda/src/particlesystem/baseParticle.cxx index 2824b64b48..63b7366dff 100644 --- a/panda/src/particlesystem/baseParticle.cxx +++ b/panda/src/particlesystem/baseParticle.cxx @@ -15,9 +15,9 @@ #include "baseParticle.h" //////////////////////////////////////////////////////////////////// -// Function : BaseParticle -// Access : Public -// Description : Default Constructor +// Function: BaseParticle +// Access: Public +// Description: Default Constructor //////////////////////////////////////////////////////////////////// BaseParticle:: BaseParticle(PN_stdfloat lifespan, bool alive) : @@ -25,9 +25,9 @@ BaseParticle(PN_stdfloat lifespan, bool alive) : } //////////////////////////////////////////////////////////////////// -// Function : BaseParticle -// Access : Public -// Description : Copy Constructor +// Function: BaseParticle +// Access: Public +// Description: Copy Constructor //////////////////////////////////////////////////////////////////// BaseParticle:: BaseParticle(const BaseParticle ©) : @@ -38,18 +38,18 @@ BaseParticle(const BaseParticle ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~BaseParticle -// Access : Public -// Description : Default Destructor +// Function: ~BaseParticle +// Access: Public +// Description: Default Destructor //////////////////////////////////////////////////////////////////// BaseParticle:: ~BaseParticle() { } //////////////////////////////////////////////////////////////////// -// Function : get_theta -// Access : Public -// Description : for spriteParticleRenderer +// Function: get_theta +// Access: Public +// Description: for spriteParticleRenderer //////////////////////////////////////////////////////////////////// PN_stdfloat BaseParticle:: get_theta() const { @@ -57,10 +57,10 @@ get_theta() const { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BaseParticle:: output(ostream &out) const { @@ -70,10 +70,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BaseParticle:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/baseParticleEmitter.I b/panda/src/particlesystem/baseParticleEmitter.I index 22116c1def..df0516d646 100644 --- a/panda/src/particlesystem/baseParticleEmitter.I +++ b/panda/src/particlesystem/baseParticleEmitter.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_emission_type -// Access : Public -// Description : emission type assignment +// Function: set_emission_type +// Access: Public +// Description: emission type assignment //////////////////////////////////////////////////////////////////// INLINE void BaseParticleEmitter:: set_emission_type(emissionType et) { @@ -23,9 +23,9 @@ set_emission_type(emissionType et) { } //////////////////////////////////////////////////////////////////// -// Function : get_emission_type -// Access : Public -// Description : emission type query +// Function: get_emission_type +// Access: Public +// Description: emission type query //////////////////////////////////////////////////////////////////// INLINE BaseParticleEmitter::emissionType BaseParticleEmitter:: get_emission_type() const { @@ -33,9 +33,9 @@ get_emission_type() const { } //////////////////////////////////////////////////////////////////// -// Function : set_explicit_launch_vector -// Access : Public -// Description : assignment of explicit emission launch vector +// Function: set_explicit_launch_vector +// Access: Public +// Description: assignment of explicit emission launch vector //////////////////////////////////////////////////////////////////// INLINE void BaseParticleEmitter:: set_explicit_launch_vector(const LVector3& elv) { @@ -43,9 +43,9 @@ set_explicit_launch_vector(const LVector3& elv) { } //////////////////////////////////////////////////////////////////// -// Function : get_explicit_launch_vector -// Access : Public -// Description : query for explicit emission launch vector +// Function: get_explicit_launch_vector +// Access: Public +// Description: query for explicit emission launch vector //////////////////////////////////////////////////////////////////// INLINE LVector3 BaseParticleEmitter:: get_explicit_launch_vector() const { @@ -53,9 +53,9 @@ get_explicit_launch_vector() const { } //////////////////////////////////////////////////////////////////// -// Function : set_radiate_origin -// Access : Public -// Description : assignment of radiate emission origin point +// Function: set_radiate_origin +// Access: Public +// Description: assignment of radiate emission origin point //////////////////////////////////////////////////////////////////// INLINE void BaseParticleEmitter:: set_radiate_origin(const LPoint3& ro) { @@ -63,9 +63,9 @@ set_radiate_origin(const LPoint3& ro) { } //////////////////////////////////////////////////////////////////// -// Function : get_radiate_origin -// Access : Public -// Description : query for explicit emission launch vector +// Function: get_radiate_origin +// Access: Public +// Description: query for explicit emission launch vector //////////////////////////////////////////////////////////////////// INLINE LPoint3 BaseParticleEmitter:: get_radiate_origin() const { @@ -73,9 +73,9 @@ get_radiate_origin() const { } //////////////////////////////////////////////////////////////////// -// Function : set_amplitude -// Access : Public -// Description : amplitude assignment +// Function: set_amplitude +// Access: Public +// Description: amplitude assignment //////////////////////////////////////////////////////////////////// INLINE void BaseParticleEmitter:: set_amplitude(PN_stdfloat a) { @@ -83,9 +83,9 @@ set_amplitude(PN_stdfloat a) { } //////////////////////////////////////////////////////////////////// -// Function : get_amplitude -// Access : Public -// Description : amplitude query +// Function: get_amplitude +// Access: Public +// Description: amplitude query //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat BaseParticleEmitter:: get_amplitude() const { @@ -93,9 +93,9 @@ get_amplitude() const { } //////////////////////////////////////////////////////////////////// -// Function : set_amplitude_spread -// Access : Public -// Description : amplitude spread assignment +// Function: set_amplitude_spread +// Access: Public +// Description: amplitude spread assignment //////////////////////////////////////////////////////////////////// INLINE void BaseParticleEmitter:: set_amplitude_spread(PN_stdfloat as) { @@ -103,9 +103,9 @@ set_amplitude_spread(PN_stdfloat as) { } //////////////////////////////////////////////////////////////////// -// Function : get_amplitude_spread -// Access : Public -// Description : amplitude spread query +// Function: get_amplitude_spread +// Access: Public +// Description: amplitude spread query //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat BaseParticleEmitter:: get_amplitude_spread() const { @@ -113,9 +113,9 @@ get_amplitude_spread() const { } //////////////////////////////////////////////////////////////////// -// Function : set_offset_force -// Access : Public -// Description : user-defined force +// Function: set_offset_force +// Access: Public +// Description: user-defined force //////////////////////////////////////////////////////////////////// INLINE void BaseParticleEmitter:: set_offset_force(const LVector3& of) { @@ -123,9 +123,9 @@ set_offset_force(const LVector3& of) { } //////////////////////////////////////////////////////////////////// -// Function : get_offset_force -// Access : Public -// Description : user-defined force +// Function: get_offset_force +// Access: Public +// Description: user-defined force //////////////////////////////////////////////////////////////////// INLINE LVector3 BaseParticleEmitter:: get_offset_force() const { diff --git a/panda/src/particlesystem/baseParticleEmitter.cxx b/panda/src/particlesystem/baseParticleEmitter.cxx index d5c8a2153f..1787d4f418 100644 --- a/panda/src/particlesystem/baseParticleEmitter.cxx +++ b/panda/src/particlesystem/baseParticleEmitter.cxx @@ -17,9 +17,9 @@ #include //////////////////////////////////////////////////////////////////// -// Function : BaseParticleEmitter -// Access : Protected -// Description : constructor +// Function: BaseParticleEmitter +// Access: Protected +// Description: constructor //////////////////////////////////////////////////////////////////// BaseParticleEmitter:: BaseParticleEmitter() { @@ -32,9 +32,9 @@ BaseParticleEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleEmitter -// Access : Protected -// Description : copy constructor +// Function: BaseParticleEmitter +// Access: Protected +// Description: copy constructor //////////////////////////////////////////////////////////////////// BaseParticleEmitter:: BaseParticleEmitter(const BaseParticleEmitter ©) { @@ -47,18 +47,18 @@ BaseParticleEmitter(const BaseParticleEmitter ©) { } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleEmitter -// Access : Protected -// Description : destructor +// Function: BaseParticleEmitter +// Access: Protected +// Description: destructor //////////////////////////////////////////////////////////////////// BaseParticleEmitter:: ~BaseParticleEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : generate -// Access : Public -// Description : parent generation function +// Function: generate +// Access: Public +// Description: parent generation function //////////////////////////////////////////////////////////////////// void BaseParticleEmitter:: generate(LPoint3& pos, LVector3& vel) { @@ -85,10 +85,10 @@ generate(LPoint3& pos, LVector3& vel) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BaseParticleEmitter:: output(ostream &out) const { @@ -98,10 +98,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BaseParticleEmitter:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/baseParticleFactory.I b/panda/src/particlesystem/baseParticleFactory.I index 4a01d9d706..bc8dbbf94d 100644 --- a/panda/src/particlesystem/baseParticleFactory.I +++ b/panda/src/particlesystem/baseParticleFactory.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_lifespan_base -// Description : public +// Function: set_lifespan_base +// Description: public //////////////////////////////////////////////////////////////////// INLINE void BaseParticleFactory:: set_lifespan_base(PN_stdfloat lb) { @@ -22,8 +22,8 @@ set_lifespan_base(PN_stdfloat lb) { } //////////////////////////////////////////////////////////////////// -// Function : set_lifespan_spread -// Description : public +// Function: set_lifespan_spread +// Description: public //////////////////////////////////////////////////////////////////// INLINE void BaseParticleFactory:: set_lifespan_spread(PN_stdfloat ld) { @@ -31,8 +31,8 @@ set_lifespan_spread(PN_stdfloat ld) { } //////////////////////////////////////////////////////////////////// -// Function : set_mass_base -// Description : public +// Function: set_mass_base +// Description: public //////////////////////////////////////////////////////////////////// INLINE void BaseParticleFactory:: set_mass_base(PN_stdfloat mb) { @@ -41,8 +41,8 @@ set_mass_base(PN_stdfloat mb) { } //////////////////////////////////////////////////////////////////// -// Function : set_mass_spread -// Description : public +// Function: set_mass_spread +// Description: public //////////////////////////////////////////////////////////////////// INLINE void BaseParticleFactory:: set_mass_spread(PN_stdfloat md) { @@ -51,8 +51,8 @@ set_mass_spread(PN_stdfloat md) { } //////////////////////////////////////////////////////////////////// -// Function : set_terminal_velocity_base -// Description : public +// Function: set_terminal_velocity_base +// Description: public //////////////////////////////////////////////////////////////////// INLINE void BaseParticleFactory:: set_terminal_velocity_base(PN_stdfloat tvb) { @@ -60,8 +60,8 @@ set_terminal_velocity_base(PN_stdfloat tvb) { } //////////////////////////////////////////////////////////////////// -// Function : set_terminal_velocity_spread -// Description : public +// Function: set_terminal_velocity_spread +// Description: public //////////////////////////////////////////////////////////////////// INLINE void BaseParticleFactory:: set_terminal_velocity_spread(PN_stdfloat tvd) { @@ -69,8 +69,8 @@ set_terminal_velocity_spread(PN_stdfloat tvd) { } //////////////////////////////////////////////////////////////////// -// Function : get_lifespan_base -// Description : public +// Function: get_lifespan_base +// Description: public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat BaseParticleFactory:: get_lifespan_base() const { @@ -78,8 +78,8 @@ get_lifespan_base() const { } //////////////////////////////////////////////////////////////////// -// Function : get_lifespan_spread -// Description : public +// Function: get_lifespan_spread +// Description: public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat BaseParticleFactory:: get_lifespan_spread() const { @@ -87,8 +87,8 @@ get_lifespan_spread() const { } //////////////////////////////////////////////////////////////////// -// Function : get_mass_base -// Description : public +// Function: get_mass_base +// Description: public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat BaseParticleFactory:: get_mass_base() const { @@ -96,8 +96,8 @@ get_mass_base() const { } //////////////////////////////////////////////////////////////////// -// Function : get_mass_spread -// Description : public +// Function: get_mass_spread +// Description: public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat BaseParticleFactory:: get_mass_spread() const { @@ -105,8 +105,8 @@ get_mass_spread() const { } //////////////////////////////////////////////////////////////////// -// Function : get_terminal_velocity_base -// Description : public +// Function: get_terminal_velocity_base +// Description: public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat BaseParticleFactory:: get_terminal_velocity_base() const { @@ -114,8 +114,8 @@ get_terminal_velocity_base() const { } //////////////////////////////////////////////////////////////////// -// Function : get_terminal_velocity_spread -// Description : public +// Function: get_terminal_velocity_spread +// Description: public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat BaseParticleFactory:: get_terminal_velocity_spread() const { diff --git a/panda/src/particlesystem/baseParticleFactory.cxx b/panda/src/particlesystem/baseParticleFactory.cxx index 0082207f0e..646c6cdfd3 100644 --- a/panda/src/particlesystem/baseParticleFactory.cxx +++ b/panda/src/particlesystem/baseParticleFactory.cxx @@ -15,12 +15,12 @@ #include "baseParticleFactory.h" //////////////////////////////////////////////////////////////////// -// Function : BaseParticleFactory -// Access : protected -// Description : constructor +// Function: BaseParticleFactory +// Access: Protected +// Description: constructor //////////////////////////////////////////////////////////////////// BaseParticleFactory:: -BaseParticleFactory() : +BaseParticleFactory() : _lifespan_base(1.0), _lifespan_spread(0.0), _mass_base(1.0f), @@ -31,12 +31,12 @@ BaseParticleFactory() : } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleFactory -// Access : protected -// Description : copy constructor +// Function: BaseParticleFactory +// Access: Protected +// Description: copy constructor //////////////////////////////////////////////////////////////////// BaseParticleFactory:: -BaseParticleFactory(const BaseParticleFactory ©) : +BaseParticleFactory(const BaseParticleFactory ©) : _lifespan_base(copy._lifespan_base), _lifespan_spread(copy._lifespan_spread), _mass_base(copy._mass_base), @@ -47,17 +47,17 @@ BaseParticleFactory(const BaseParticleFactory ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~BaseParticleFactory -// Access : public virtual -// Description : destructor +// Function: ~BaseParticleFactory +// Access: Public Virtual +// Description: destructor //////////////////////////////////////////////////////////////////// BaseParticleFactory:: ~BaseParticleFactory() { } //////////////////////////////////////////////////////////////////// -// Function : make_particle -// Description : public +// Function: make_particle +// Description: public //////////////////////////////////////////////////////////////////// void BaseParticleFactory:: populate_particle(BaseParticle *bp) { @@ -74,10 +74,10 @@ populate_particle(BaseParticle *bp) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BaseParticleFactory:: output(ostream &out) const { @@ -87,10 +87,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BaseParticleFactory:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/baseParticleRenderer.I b/panda/src/particlesystem/baseParticleRenderer.I index 24a2f59403..1e21843f7c 100644 --- a/panda/src/particlesystem/baseParticleRenderer.I +++ b/panda/src/particlesystem/baseParticleRenderer.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::get_render_node -// Class : Published -// Description : Query the geomnode pointer +// Function: BaseParticleRender::get_render_node +// Access: Published +// Description: Query the geomnode pointer //////////////////////////////////////////////////////////////////// INLINE GeomNode *BaseParticleRenderer:: get_render_node() const { @@ -23,9 +23,9 @@ get_render_node() const { } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::get_render_node_path -// Class : Published -// Description : Query the geomnode pointer +// Function: BaseParticleRender::get_render_node_path +// Access: Published +// Description: Query the geomnode pointer //////////////////////////////////////////////////////////////////// INLINE NodePath BaseParticleRenderer:: get_render_node_path() const { @@ -33,8 +33,8 @@ get_render_node_path() const { } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::set_alpha_mode -// Access : Published +// Function: BaseParticleRender::set_alpha_mode +// Access: Published //////////////////////////////////////////////////////////////////// INLINE void BaseParticleRenderer:: set_alpha_mode(BaseParticleRenderer::ParticleRendererAlphaMode am) { @@ -43,8 +43,8 @@ set_alpha_mode(BaseParticleRenderer::ParticleRendererAlphaMode am) { } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::get_alpha_mode -// Access : Published +// Function: BaseParticleRender::get_alpha_mode +// Access: Published //////////////////////////////////////////////////////////////////// INLINE BaseParticleRenderer::ParticleRendererAlphaMode BaseParticleRenderer:: get_alpha_mode() const { @@ -52,9 +52,9 @@ get_alpha_mode() const { } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::set_user_alpha -// Access : Published -// Description : sets alpha for "user" alpha mode +// Function: BaseParticleRender::set_user_alpha +// Access: Published +// Description: sets alpha for "user" alpha mode //////////////////////////////////////////////////////////////////// INLINE void BaseParticleRenderer:: set_user_alpha(PN_stdfloat ua) { @@ -62,9 +62,9 @@ set_user_alpha(PN_stdfloat ua) { } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::get_user_alpha -// Access : Published -// Description : gets alpha for "user" alpha mode +// Function: BaseParticleRender::get_user_alpha +// Access: Published +// Description: gets alpha for "user" alpha mode //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat BaseParticleRenderer:: get_user_alpha() const { @@ -72,9 +72,9 @@ get_user_alpha() const { } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::set_color_blend_mode -// Access : Published -// Description : sets the ColorBlendAttrib on the _render_node +// Function: BaseParticleRender::set_color_blend_mode +// Access: Published +// Description: sets the ColorBlendAttrib on the _render_node //////////////////////////////////////////////////////////////////// INLINE void BaseParticleRenderer:: set_color_blend_mode(ColorBlendAttrib::Mode bm, ColorBlendAttrib::Operand oa, ColorBlendAttrib::Operand ob) { @@ -90,9 +90,9 @@ set_color_blend_mode(ColorBlendAttrib::Mode bm, ColorBlendAttrib::Operand oa, Co } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::get_ignore_scale -// Access : Published -// Description : Returns the "ignore scale" flag. See +// Function: BaseParticleRender::get_ignore_scale +// Access: Published +// Description: Returns the "ignore scale" flag. See // set_ignore_scale(). //////////////////////////////////////////////////////////////////// INLINE bool BaseParticleRenderer:: @@ -101,9 +101,9 @@ get_ignore_scale() const { } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::get_cur_alpha -// Access : Published -// Description : gets current alpha for a particle +// Function: BaseParticleRender::get_cur_alpha +// Access: Published +// Description: gets current alpha for a particle //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat BaseParticleRenderer:: get_cur_alpha(BaseParticle* bp) { diff --git a/panda/src/particlesystem/baseParticleRenderer.cxx b/panda/src/particlesystem/baseParticleRenderer.cxx index 6efbf7c5c1..f34b8ab2e3 100644 --- a/panda/src/particlesystem/baseParticleRenderer.cxx +++ b/panda/src/particlesystem/baseParticleRenderer.cxx @@ -20,9 +20,9 @@ #include "compassEffect.h" //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::BaseParticleRenderer -// Access : Published -// Description : Default Constructor +// Function: BaseParticleRender::BaseParticleRenderer +// Access: Published +// Description: Default Constructor //////////////////////////////////////////////////////////////////// BaseParticleRenderer:: BaseParticleRenderer(ParticleRendererAlphaMode alpha_mode) : @@ -37,9 +37,9 @@ BaseParticleRenderer(ParticleRendererAlphaMode alpha_mode) : } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::BaseParticleRenderer -// Access : Published -// Description : Copy Constructor +// Function: BaseParticleRender::BaseParticleRenderer +// Access: Published +// Description: Copy Constructor //////////////////////////////////////////////////////////////////// BaseParticleRenderer:: BaseParticleRenderer(const BaseParticleRenderer& copy) : @@ -54,18 +54,18 @@ BaseParticleRenderer(const BaseParticleRenderer& copy) : } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::~BaseParticleRenderer -// Access : Published -// Description : Destructor +// Function: BaseParticleRender::~BaseParticleRenderer +// Access: Published +// Description: Destructor //////////////////////////////////////////////////////////////////// BaseParticleRenderer:: ~BaseParticleRenderer() { } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::set_ignore_scale -// Access : Published -// Description : Sets the "ignore scale" flag. When this is true, +// Function: BaseParticleRender::set_ignore_scale +// Access: Published +// Description: Sets the "ignore scale" flag. When this is true, // particles will be drawn as if they had no scale, // regardless of whatever scale might be inherited from // above the render node in the scene graph. @@ -87,10 +87,10 @@ set_ignore_scale(bool ignore_scale) { } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::output -// Access : Published -// Description : Write a string representation of this instance to -// . +// Function: BaseParticleRender::output +// Access: Published +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BaseParticleRenderer:: output(ostream &out) const { @@ -100,10 +100,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::write -// Access : Published -// Description : Write a string representation of this instance to -// . +// Function: BaseParticleRender::write +// Access: Published +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BaseParticleRenderer:: write(ostream &out, int indent) const { @@ -116,9 +116,9 @@ write(ostream &out, int indent) const { } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::update_alpha_state -// Access : Private -// Description : handles the base class part of alpha updating. +// Function: BaseParticleRender::update_alpha_state +// Access: Private +// Description: handles the base class part of alpha updating. //////////////////////////////////////////////////////////////////// void BaseParticleRenderer:: update_alpha_mode(ParticleRendererAlphaMode am) { @@ -134,9 +134,9 @@ update_alpha_mode(ParticleRendererAlphaMode am) { } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::enable_alpha -// Access : Private -// Description : Builds an intermediate node and transition that +// Function: BaseParticleRender::enable_alpha +// Access: Private +// Description: Builds an intermediate node and transition that // enables alpha channeling. //////////////////////////////////////////////////////////////////// void BaseParticleRenderer:: @@ -146,9 +146,9 @@ enable_alpha() { } //////////////////////////////////////////////////////////////////// -// Function : BaseParticleRender::disable_alpha -// Access : Private -// Description : kills the intermediate alpha node/arc +// Function: BaseParticleRender::disable_alpha +// Access: Private +// Description: kills the intermediate alpha node/arc //////////////////////////////////////////////////////////////////// void BaseParticleRenderer:: disable_alpha() { diff --git a/panda/src/particlesystem/boxEmitter.I b/panda/src/particlesystem/boxEmitter.I index d580118669..d61f1f3bbf 100644 --- a/panda/src/particlesystem/boxEmitter.I +++ b/panda/src/particlesystem/boxEmitter.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_min_bound -// Access : Public -// Description : boundary assignment +// Function: set_min_bound +// Access: Public +// Description: boundary assignment //////////////////////////////////////////////////////////////////// INLINE void BoxEmitter:: set_min_bound(const LPoint3& vmin) { @@ -23,9 +23,9 @@ set_min_bound(const LPoint3& vmin) { } //////////////////////////////////////////////////////////////////// -// Function : set_max_bound -// Access : Public -// Description : boundary assignment +// Function: set_max_bound +// Access: Public +// Description: boundary assignment //////////////////////////////////////////////////////////////////// INLINE void BoxEmitter:: set_max_bound(const LPoint3& vmax) { @@ -33,9 +33,9 @@ set_max_bound(const LPoint3& vmax) { } //////////////////////////////////////////////////////////////////// -// Function : get_min_bound -// Access : Public -// Description : boundary accessor +// Function: get_min_bound +// Access: Public +// Description: boundary accessor //////////////////////////////////////////////////////////////////// INLINE LPoint3 BoxEmitter:: get_min_bound() const { @@ -43,9 +43,9 @@ get_min_bound() const { } //////////////////////////////////////////////////////////////////// -// Function : get_max_bound -// Access : Public -// Description : boundary accessor +// Function: get_max_bound +// Access: Public +// Description: boundary accessor //////////////////////////////////////////////////////////////////// INLINE LPoint3 BoxEmitter:: get_max_bound() const { diff --git a/panda/src/particlesystem/boxEmitter.cxx b/panda/src/particlesystem/boxEmitter.cxx index 3355bf644d..5c67123af6 100644 --- a/panda/src/particlesystem/boxEmitter.cxx +++ b/panda/src/particlesystem/boxEmitter.cxx @@ -15,9 +15,9 @@ #include "boxEmitter.h" //////////////////////////////////////////////////////////////////// -// Function : BoxEmitter -// Access : Public -// Description : constructor +// Function: BoxEmitter +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// BoxEmitter:: BoxEmitter() : @@ -27,9 +27,9 @@ BoxEmitter() : } //////////////////////////////////////////////////////////////////// -// Function : BoxEmitter -// Access : Public -// Description : copy constructor +// Function: BoxEmitter +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// BoxEmitter:: BoxEmitter(const BoxEmitter ©) : @@ -39,18 +39,18 @@ BoxEmitter(const BoxEmitter ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~BoxEmitter -// Access : Public -// Description : destructor +// Function: ~BoxEmitter +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// BoxEmitter:: ~BoxEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : copier +// Function: make_copy +// Access: Public +// Description: copier //////////////////////////////////////////////////////////////////// BaseParticleEmitter *BoxEmitter:: make_copy() { @@ -58,9 +58,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : BoxEmitter::assign_initial_position -// Access : Public -// Description : Generates a location for a new particle +// Function: BoxEmitter::assign_initial_position +// Access: Public +// Description: Generates a location for a new particle //////////////////////////////////////////////////////////////////// void BoxEmitter:: assign_initial_position(LPoint3& pos) { @@ -78,9 +78,9 @@ assign_initial_position(LPoint3& pos) { } //////////////////////////////////////////////////////////////////// -// Function : BoxEmitter::assign_initial_velocity -// Access : Public -// Description : Generates a velocity for a new particle +// Function: BoxEmitter::assign_initial_velocity +// Access: Public +// Description: Generates a velocity for a new particle //////////////////////////////////////////////////////////////////// void BoxEmitter:: assign_initial_velocity(LVector3& vel) { @@ -88,10 +88,10 @@ assign_initial_velocity(LVector3& vel) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BoxEmitter:: output(ostream &out) const { @@ -101,10 +101,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BoxEmitter:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/colorInterpolationManager.I b/panda/src/particlesystem/colorInterpolationManager.I index ff02a08f6d..bf18afa8f9 100644 --- a/panda/src/particlesystem/colorInterpolationManager.I +++ b/panda/src/particlesystem/colorInterpolationManager.I @@ -12,12 +12,12 @@ // //////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionConstant::get_color_a -// Access : public -// Description : Returns the primary color of the function. +// Function: ColorInterpolationFunctionConstant::get_color_a +// Access: Public +// Description: Returns the primary color of the function. //////////////////////////////////////////////////////////////////// INLINE LColor ColorInterpolationFunctionConstant:: @@ -26,9 +26,9 @@ get_color_a() const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionConstant::set_color_a -// Access : public -// Description : Sets the primary color of the function. +// Function: ColorInterpolationFunctionConstant::set_color_a +// Access: Public +// Description: Sets the primary color of the function. //////////////////////////////////////////////////////////////////// INLINE void ColorInterpolationFunctionConstant:: @@ -37,9 +37,9 @@ set_color_a(const LColor &c) { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionLinear::get_color_b -// Access : public -// Description : Returns the secondary color of the function. +// Function: ColorInterpolationFunctionLinear::get_color_b +// Access: Public +// Description: Returns the secondary color of the function. //////////////////////////////////////////////////////////////////// INLINE LColor ColorInterpolationFunctionLinear:: @@ -48,9 +48,9 @@ get_color_b() const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionLinear::set_color_b -// Access : public -// Description : Sets the secondary color of the function. +// Function: ColorInterpolationFunctionLinear::set_color_b +// Access: Public +// Description: Sets the secondary color of the function. //////////////////////////////////////////////////////////////////// INLINE void ColorInterpolationFunctionLinear:: @@ -59,9 +59,9 @@ set_color_b(const LColor &c) { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionStepwave::get_width_a -// Access : public -// Description : Returns the primary width of the function. +// Function: ColorInterpolationFunctionStepwave::get_width_a +// Access: Public +// Description: Returns the primary width of the function. //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ColorInterpolationFunctionStepwave:: @@ -70,9 +70,9 @@ get_width_a() const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionStepwave::get_width_b -// Access : public -// Description : Returns the secondary width of the function. +// Function: ColorInterpolationFunctionStepwave::get_width_b +// Access: Public +// Description: Returns the secondary width of the function. //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ColorInterpolationFunctionStepwave:: @@ -81,9 +81,9 @@ get_width_b() const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionStepwave::set_width_a -// Access : public -// Description : Sets the primary width of the function. +// Function: ColorInterpolationFunctionStepwave::set_width_a +// Access: Public +// Description: Sets the primary width of the function. //////////////////////////////////////////////////////////////////// INLINE void ColorInterpolationFunctionStepwave:: @@ -92,9 +92,9 @@ set_width_a(const PN_stdfloat w) { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionStepwave::set_width_b -// Access : public -// Description : Sets the secondary width of the function. +// Function: ColorInterpolationFunctionStepwave::set_width_b +// Access: Public +// Description: Sets the secondary width of the function. //////////////////////////////////////////////////////////////////// INLINE void ColorInterpolationFunctionStepwave:: @@ -104,9 +104,9 @@ set_width_b(const PN_stdfloat w) { //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionSinusoid::get_period -// Access : public -// Description : Returns the time to transition from A to B then back +// Function: ColorInterpolationFunctionSinusoid::get_period +// Access: Public +// Description: Returns the time to transition from A to B then back // to A again. //////////////////////////////////////////////////////////////////// @@ -116,9 +116,9 @@ get_period() const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionSinusoid::set_period -// Access : public -// Description : Sets the time to transition from A to B then back +// Function: ColorInterpolationFunctionSinusoid::set_period +// Access: Public +// Description: Sets the time to transition from A to B then back // to A again. //////////////////////////////////////////////////////////////////// @@ -128,9 +128,9 @@ set_period(const PN_stdfloat p) { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationSegment::get_function -// Access : public -// Description : Returns a reference to the function object +// Function: ColorInterpolationSegment::get_function +// Access: Public +// Description: Returns a reference to the function object // corresponding to this segment. //////////////////////////////////////////////////////////////////// @@ -140,9 +140,9 @@ get_function() const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationSegment::get_time_begin -// Access : public -// Description : Returns the point in the particle's lifetime at which +// Function: ColorInterpolationSegment::get_time_begin +// Access: Public +// Description: Returns the point in the particle's lifetime at which // this segment begins its effect. It is an interpolated // value in the range [0,1]. //////////////////////////////////////////////////////////////////// @@ -153,9 +153,9 @@ get_time_begin() const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationSegment::get_time_end -// Access : public -// Description : Returns the point in the particle's lifetime at which +// Function: ColorInterpolationSegment::get_time_end +// Access: Public +// Description: Returns the point in the particle's lifetime at which // this segment's effect stops. It is an interpolated // value in the range [0,1]. //////////////////////////////////////////////////////////////////// @@ -166,9 +166,9 @@ get_time_end() const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationSegment::is_modulated -// Access : public -// Description : Returns whether the function is additive or modulated. +// Function: ColorInterpolationSegment::is_modulated +// Access: Public +// Description: Returns whether the function is additive or modulated. //////////////////////////////////////////////////////////////////// INLINE bool ColorInterpolationSegment:: @@ -177,9 +177,9 @@ is_modulated() const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationSegment::is_enabled() -// Access : public -// Description : Returns whether the segments effects are being applied. +// Function: ColorInterpolationSegment::is_enabled() +// Access: Public +// Description: Returns whether the segments effects are being applied. //////////////////////////////////////////////////////////////////// INLINE bool ColorInterpolationSegment:: @@ -188,9 +188,9 @@ is_enabled() const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationSegment::get_id -// Access : public -// Description : Returns the id assigned to this segment by the +// Function: ColorInterpolationSegment::get_id +// Access: Public +// Description: Returns the id assigned to this segment by the // manager that created it. //////////////////////////////////////////////////////////////////// @@ -200,9 +200,9 @@ get_id() const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationSegment::set_function -// Access : public -// Description : Sets the function that the segment will use for +// Function: ColorInterpolationSegment::set_function +// Access: Public +// Description: Sets the function that the segment will use for // its interpolation calculations. //////////////////////////////////////////////////////////////////// @@ -212,9 +212,9 @@ set_function(ColorInterpolationFunction* function) { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationSegment::set_time_begin -// Access : public -// Description : Sets the point in the particle's lifetime at which +// Function: ColorInterpolationSegment::set_time_begin +// Access: Public +// Description: Sets the point in the particle's lifetime at which // this segment begins its effect. It is an interpolated // value in the range [0,1]. //////////////////////////////////////////////////////////////////// @@ -226,9 +226,9 @@ set_time_begin(const PN_stdfloat time) { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationSegment::set_time_end -// Access : public -// Description : Sets the point in the particle's lifetime at which +// Function: ColorInterpolationSegment::set_time_end +// Access: Public +// Description: Sets the point in the particle's lifetime at which // this segment's effect ends. It is an interpolated // value in the range [0,1]. //////////////////////////////////////////////////////////////////// @@ -240,9 +240,9 @@ set_time_end(const PN_stdfloat time) { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationSegment::set_is_modulated -// Access : public -// Description : Sets how the function is applied to the final color. +// Function: ColorInterpolationSegment::set_is_modulated +// Access: Public +// Description: Sets how the function is applied to the final color. // If true, the value is multiplied. If false, the value // is simply added. Default is true. //////////////////////////////////////////////////////////////////// @@ -253,9 +253,9 @@ set_is_modulated(const bool flag) { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationSegment::set_enabled() -// Access : public -// Description : Sets whether the segments effects should be applied. +// Function: ColorInterpolationSegment::set_enabled() +// Access: Public +// Description: Sets whether the segments effects should be applied. //////////////////////////////////////////////////////////////////// INLINE void ColorInterpolationSegment:: @@ -264,9 +264,9 @@ set_enabled(const bool enabled) { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationManager::set_default_color -// Access : public -// Description : Sets the color to used if no segments are present +// Function: ColorInterpolationManager::set_default_color +// Access: Public +// Description: Sets the color to used if no segments are present //////////////////////////////////////////////////////////////////// INLINE void ColorInterpolationManager:: @@ -275,9 +275,9 @@ set_default_color(const LColor &c) { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationManager::get_segment -// Access : public -// Description : Returns the segment that corresponds to 'seg_id'. +// Function: ColorInterpolationManager::get_segment +// Access: Public +// Description: Returns the segment that corresponds to 'seg_id'. //////////////////////////////////////////////////////////////////// INLINE ColorInterpolationSegment* ColorInterpolationManager:: @@ -292,9 +292,9 @@ get_segment(const int seg_id) { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationManager::get_segment_id_list -// Access : public -// Description : Returns a space delimited list of all of the ids +// Function: ColorInterpolationManager::get_segment_id_list +// Access: Public +// Description: Returns a space delimited list of all of the ids // in the manager at the time. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/particlesystem/colorInterpolationManager.cxx b/panda/src/particlesystem/colorInterpolationManager.cxx index 522d6fbc63..90b49e0b06 100644 --- a/panda/src/particlesystem/colorInterpolationManager.cxx +++ b/panda/src/particlesystem/colorInterpolationManager.cxx @@ -21,9 +21,9 @@ TypeHandle ColorInterpolationFunctionStepwave::_type_handle; TypeHandle ColorInterpolationFunctionSinusoid::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunction::ColorInterpolationFunction -// Access : public -// Description : constructor +// Function: ColorInterpolationFunction::ColorInterpolationFunction +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// ColorInterpolationFunction:: @@ -31,9 +31,9 @@ ColorInterpolationFunction() { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunction::~ColorInterpolationFunction -// Access : public -// Description : destructor +// Function: ColorInterpolationFunction::~ColorInterpolationFunction +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// ColorInterpolationFunction:: @@ -41,9 +41,9 @@ ColorInterpolationFunction:: } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionConstant::ColorInterpolationFunctionConstant -// Access : public -// Description : default constructor +// Function: ColorInterpolationFunctionConstant::ColorInterpolationFunctionConstant +// Access: Public +// Description: default constructor //////////////////////////////////////////////////////////////////// ColorInterpolationFunctionConstant:: @@ -52,9 +52,9 @@ ColorInterpolationFunctionConstant() : } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionConstant::ColorInterpolationFunctionConstant -// Access : public -// Description : constructor +// Function: ColorInterpolationFunctionConstant::ColorInterpolationFunctionConstant +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// ColorInterpolationFunctionConstant:: @@ -63,9 +63,9 @@ ColorInterpolationFunctionConstant(const LColor &color_a) : } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionConstant::interpolate -// Access : protected -// Description : Returns the color associated with this instance. +// Function: ColorInterpolationFunctionConstant::interpolate +// Access: Protected +// Description: Returns the color associated with this instance. //////////////////////////////////////////////////////////////////// LColor ColorInterpolationFunctionConstant:: @@ -74,9 +74,9 @@ interpolate(const PN_stdfloat t) const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionLinear::ColorInterpolationFunctionLinear -// Access : public -// Description : default constructor +// Function: ColorInterpolationFunctionLinear::ColorInterpolationFunctionLinear +// Access: Public +// Description: default constructor //////////////////////////////////////////////////////////////////// ColorInterpolationFunctionLinear:: @@ -85,22 +85,22 @@ ColorInterpolationFunctionLinear() : } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionLinear::ColorInterpolationFunctionLinear -// Access : public -// Description : constructor +// Function: ColorInterpolationFunctionLinear::ColorInterpolationFunctionLinear +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// ColorInterpolationFunctionLinear:: -ColorInterpolationFunctionLinear(const LColor &color_a, +ColorInterpolationFunctionLinear(const LColor &color_a, const LColor &color_b) : ColorInterpolationFunctionConstant(color_a), _c_b(color_b) { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionLinear::interpolate -// Access : protected -// Description : Returns the linear mixture of A and B according to 't'. +// Function: ColorInterpolationFunctionLinear::interpolate +// Access: Protected +// Description: Returns the linear mixture of A and B according to 't'. //////////////////////////////////////////////////////////////////// LColor ColorInterpolationFunctionLinear:: @@ -109,9 +109,9 @@ interpolate(const PN_stdfloat t) const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionStepwave::ColorInterpolationFunctionStepwave -// Access : public -// Description : default constructor +// Function: ColorInterpolationFunctionStepwave::ColorInterpolationFunctionStepwave +// Access: Public +// Description: default constructor //////////////////////////////////////////////////////////////////// ColorInterpolationFunctionStepwave:: @@ -121,14 +121,14 @@ ColorInterpolationFunctionStepwave() : } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionStepwave::ColorInterpolationFunctionStepwave -// Access : public -// Description : constructor +// Function: ColorInterpolationFunctionStepwave::ColorInterpolationFunctionStepwave +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// ColorInterpolationFunctionStepwave:: ColorInterpolationFunctionStepwave(const LColor &color_a, - const LColor &color_b, + const LColor &color_b, const PN_stdfloat width_a, const PN_stdfloat width_b) : ColorInterpolationFunctionLinear(color_a,color_b), @@ -137,13 +137,13 @@ ColorInterpolationFunctionStepwave(const LColor &color_a, } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionStepwave::interpolate -// Access : protected -// Description : Returns either A or B. +// Function: ColorInterpolationFunctionStepwave::interpolate +// Access: Protected +// Description: Returns either A or B. //////////////////////////////////////////////////////////////////// LColor ColorInterpolationFunctionStepwave:: -interpolate(const PN_stdfloat t) const { +interpolate(const PN_stdfloat t) const { if(fmodf(t,(_w_a+_w_b))<_w_a) { return _c_a; } @@ -151,9 +151,9 @@ interpolate(const PN_stdfloat t) const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionSinusoid::ColorInterpolationFunctionSinusoid -// Access : public -// Description : default constructor +// Function: ColorInterpolationFunctionSinusoid::ColorInterpolationFunctionSinusoid +// Access: Public +// Description: default constructor //////////////////////////////////////////////////////////////////// ColorInterpolationFunctionSinusoid:: @@ -162,23 +162,23 @@ ColorInterpolationFunctionSinusoid() : } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionSinusoid::ColorInterpolationFunctionSinusoid -// Access : public -// Description : constructor +// Function: ColorInterpolationFunctionSinusoid::ColorInterpolationFunctionSinusoid +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// ColorInterpolationFunctionSinusoid:: -ColorInterpolationFunctionSinusoid(const LColor &color_a, - const LColor &color_b, +ColorInterpolationFunctionSinusoid(const LColor &color_a, + const LColor &color_b, const PN_stdfloat period) : ColorInterpolationFunctionLinear(color_a,color_b), _period(period) { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationFunctionSinusoid::interpolate -// Access : protected -// Description : Returns a sinusoidal blended color between A and B. +// Function: ColorInterpolationFunctionSinusoid::interpolate +// Access: Protected +// Description: Returns a sinusoidal blended color between A and B. // Period defines the time it will take to return to // A. //////////////////////////////////////////////////////////////////// @@ -190,9 +190,9 @@ interpolate(const PN_stdfloat t) const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationSegment::ColorInterpolationSegment -// Access : public -// Description : constructor +// Function: ColorInterpolationSegment::ColorInterpolationSegment +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// ColorInterpolationSegment:: @@ -211,9 +211,9 @@ ColorInterpolationSegment(ColorInterpolationFunction* function, } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationSegment::ColorInterpolationSegment -// Access : public -// Description : copy constructor +// Function: ColorInterpolationSegment::ColorInterpolationSegment +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// ColorInterpolationSegment:: @@ -228,9 +228,9 @@ ColorInterpolationSegment(const ColorInterpolationSegment ©) : } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationSegment::~ColorInterpolationSegment -// Access : public -// Description : destructor +// Function: ColorInterpolationSegment::~ColorInterpolationSegment +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// ColorInterpolationSegment:: @@ -238,9 +238,9 @@ ColorInterpolationSegment:: } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationSegment::interpolateColor -// Access : public -// Description : Returns the interpolated color according to the +// Function: ColorInterpolationSegment::interpolateColor +// Access: Public +// Description: Returns the interpolated color according to the // segment's function and start and end times. 't' is // a value in [0-1] where corresponds to beginning of // the segment and 1 corresponds to the end. @@ -252,9 +252,9 @@ interpolateColor(const PN_stdfloat t) const { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationManager::ColorInterpolationManager -// Access : public -// Description : default constructor +// Function: ColorInterpolationManager::ColorInterpolationManager +// Access: Public +// Description: default constructor //////////////////////////////////////////////////////////////////// ColorInterpolationManager:: @@ -264,9 +264,9 @@ ColorInterpolationManager() : } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationManager::ColorInterpolationManager -// Access : public -// Description : constructor +// Function: ColorInterpolationManager::ColorInterpolationManager +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// ColorInterpolationManager:: @@ -276,9 +276,9 @@ ColorInterpolationManager(const LColor &c) : } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationManager::ColorInterpolationManager -// Access : public -// Description : copy constructor +// Function: ColorInterpolationManager::ColorInterpolationManager +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// ColorInterpolationManager:: @@ -289,9 +289,9 @@ ColorInterpolationManager(const ColorInterpolationManager& copy) : } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationManager::~ColorInterpolationManager -// Access : public -// Description : destructor +// Function: ColorInterpolationManager::~ColorInterpolationManager +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// ColorInterpolationManager:: @@ -299,9 +299,9 @@ ColorInterpolationManager:: } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationManager::add_constant -// Access : public -// Description : Adds a constant segment of the specified color to the +// Function: ColorInterpolationManager::add_constant +// Access: Public +// Description: Adds a constant segment of the specified color to the // manager and returns the segment's id as known // by the manager. //////////////////////////////////////////////////////////////////// @@ -317,9 +317,9 @@ add_constant(const PN_stdfloat time_begin, const PN_stdfloat time_end, const LCo } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationManager::add_linear -// Access : public -// Description : Adds a linear segment between two colors to the manager +// Function: ColorInterpolationManager::add_linear +// Access: Public +// Description: Adds a linear segment between two colors to the manager // and returns the segment's id as known by the manager. //////////////////////////////////////////////////////////////////// @@ -334,9 +334,9 @@ add_linear(const PN_stdfloat time_begin, const PN_stdfloat time_end, const LColo } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationManager::add_stepwave -// Access : public -// Description : Adds a stepwave segment of two colors to the manager +// Function: ColorInterpolationManager::add_stepwave +// Access: Public +// Description: Adds a stepwave segment of two colors to the manager // and returns the segment's id as known by the manager. //////////////////////////////////////////////////////////////////// @@ -351,10 +351,10 @@ add_stepwave(const PN_stdfloat time_begin, const PN_stdfloat time_end, const LCo } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationManager::add_sinusoid -// Access : public -// Description : Adds a stepwave segment of two colors and a specified -// period to the manager and returns the segment's +// Function: ColorInterpolationManager::add_sinusoid +// Access: Public +// Description: Adds a stepwave segment of two colors and a specified +// period to the manager and returns the segment's // id as known by the manager. //////////////////////////////////////////////////////////////////// @@ -369,9 +369,9 @@ add_sinusoid(const PN_stdfloat time_begin, const PN_stdfloat time_end, const LCo } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationManager::clear_segment -// Access : public -// Description : Removes the segment of 'id' from the manager. +// Function: ColorInterpolationManager::clear_segment +// Access: Public +// Description: Removes the segment of 'id' from the manager. //////////////////////////////////////////////////////////////////// void ColorInterpolationManager:: @@ -387,9 +387,9 @@ clear_segment(const int seg_id) { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationManager::clear_to_initial -// Access : public -// Description : Removes all segments from the manager. +// Function: ColorInterpolationManager::clear_to_initial +// Access: Public +// Description: Removes all segments from the manager. //////////////////////////////////////////////////////////////////// void ColorInterpolationManager:: @@ -399,10 +399,10 @@ clear_to_initial() { } //////////////////////////////////////////////////////////////////// -// Function : ColorInterpolationManager:: -// Access : public -// Description : For time 'interpolated_time', this returns the -// additive composite color of all segments that influence +// Function: ColorInterpolationManager:: +// Access: Public +// Description: For time 'interpolated_time', this returns the +// additive composite color of all segments that influence // that instant in the particle's lifetime. If no segments // cover that time, the manager's default color is returned. //////////////////////////////////////////////////////////////////// @@ -416,8 +416,8 @@ generateColor(const PN_stdfloat interpolated_time) { for (iter = _i_segs.begin();iter != _i_segs.end();++iter) { cur_seg = (*iter); - if( cur_seg->is_enabled() && - interpolated_time >= cur_seg->get_time_begin() + if( cur_seg->is_enabled() && + interpolated_time >= cur_seg->get_time_begin() && interpolated_time <= cur_seg->get_time_end() ) { segment_found = true; LColor cur_color = cur_seg->interpolateColor(interpolated_time); @@ -435,7 +435,7 @@ generateColor(const PN_stdfloat interpolated_time) { } } } - + if(segment_found) { out[0] = max((PN_stdfloat)0.0, min(out[0], (PN_stdfloat)1.0)); out[1] = max((PN_stdfloat)0.0, min(out[1], (PN_stdfloat)1.0)); @@ -443,6 +443,6 @@ generateColor(const PN_stdfloat interpolated_time) { out[3] = max((PN_stdfloat)0.0, min(out[3], (PN_stdfloat)1.0)); return out; } - + return _default_color; } diff --git a/panda/src/particlesystem/discEmitter.I b/panda/src/particlesystem/discEmitter.I index 7f21639cbf..29fd59be2a 100644 --- a/panda/src/particlesystem/discEmitter.I +++ b/panda/src/particlesystem/discEmitter.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_radius -// Access : Public -// Description : radius assignment +// Function: set_radius +// Access: Public +// Description: radius assignment //////////////////////////////////////////////////////////////////// INLINE void DiscEmitter:: @@ -24,9 +24,9 @@ set_radius(PN_stdfloat r) { } //////////////////////////////////////////////////////////////////// -// Function : set_outer_angle -// Access : Public -// Description : aoe assignement +// Function: set_outer_angle +// Access: Public +// Description: aoe assignement //////////////////////////////////////////////////////////////////// INLINE void DiscEmitter:: @@ -35,9 +35,9 @@ set_outer_angle(PN_stdfloat o_angle) { } //////////////////////////////////////////////////////////////////// -// Function : set_inner_angle -// Access : Public -// Description : aoe assignment +// Function: set_inner_angle +// Access: Public +// Description: aoe assignment //////////////////////////////////////////////////////////////////// INLINE void DiscEmitter:: @@ -46,9 +46,9 @@ set_inner_angle(PN_stdfloat i_angle) { } //////////////////////////////////////////////////////////////////// -// Function : set_outer_magnitude -// Access : public -// Description : mag assignment +// Function: set_outer_magnitude +// Access: Public +// Description: mag assignment //////////////////////////////////////////////////////////////////// INLINE void DiscEmitter:: @@ -57,9 +57,9 @@ set_outer_magnitude(PN_stdfloat o_mag) { } //////////////////////////////////////////////////////////////////// -// Function : set_inner_magnitude -// Access : public -// Description : mag assignment +// Function: set_inner_magnitude +// Access: Public +// Description: mag assignment //////////////////////////////////////////////////////////////////// INLINE void DiscEmitter:: @@ -68,9 +68,9 @@ set_inner_magnitude(PN_stdfloat i_mag) { } //////////////////////////////////////////////////////////////////// -// Function : set_cubic_lerping -// Access : public -// Description : clerp flag +// Function: set_cubic_lerping +// Access: Public +// Description: clerp flag //////////////////////////////////////////////////////////////////// INLINE void DiscEmitter:: @@ -79,9 +79,9 @@ set_cubic_lerping(bool clerp) { } //////////////////////////////////////////////////////////////////// -// Function : get_radius -// Access : Public -// Description : radius accessor +// Function: get_radius +// Access: Public +// Description: radius accessor //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat DiscEmitter:: @@ -90,9 +90,9 @@ get_radius() const { } //////////////////////////////////////////////////////////////////// -// Function : get_outer_angle -// Access : Public -// Description : aoe accessor +// Function: get_outer_angle +// Access: Public +// Description: aoe accessor //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat DiscEmitter:: @@ -101,9 +101,9 @@ get_outer_angle() const { } //////////////////////////////////////////////////////////////////// -// Function : get_inner_angle -// Access : Public -// Description : aoe accessor +// Function: get_inner_angle +// Access: Public +// Description: aoe accessor //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat DiscEmitter:: @@ -112,9 +112,9 @@ get_inner_angle() const { } //////////////////////////////////////////////////////////////////// -// Function : get_outer_magnitude -// Access : public -// Description : mag accessor +// Function: get_outer_magnitude +// Access: Public +// Description: mag accessor //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat DiscEmitter:: @@ -123,9 +123,9 @@ get_outer_magnitude() const { } //////////////////////////////////////////////////////////////////// -// Function : get_inner_magnitude -// Access : public -// Description : mag accessor +// Function: get_inner_magnitude +// Access: Public +// Description: mag accessor //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat DiscEmitter:: @@ -134,9 +134,9 @@ get_inner_magnitude() const { } //////////////////////////////////////////////////////////////////// -// Function : get_cubic_lerping -// Access : public -// Description : clerp flag accessor +// Function: get_cubic_lerping +// Access: Public +// Description: clerp flag accessor //////////////////////////////////////////////////////////////////// INLINE bool DiscEmitter:: diff --git a/panda/src/particlesystem/discEmitter.cxx b/panda/src/particlesystem/discEmitter.cxx index 92cdd58214..3cd20a628c 100644 --- a/panda/src/particlesystem/discEmitter.cxx +++ b/panda/src/particlesystem/discEmitter.cxx @@ -15,9 +15,9 @@ #include "discEmitter.h" //////////////////////////////////////////////////////////////////// -// Function : DiscEmitter::DiscEmitter -// Access : Public -// Description : constructor +// Function: DiscEmitter::DiscEmitter +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// DiscEmitter:: DiscEmitter() { @@ -28,9 +28,9 @@ DiscEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : DiscEmitter::DiscEmitter -// Access : Public -// Description : copy constructor +// Function: DiscEmitter::DiscEmitter +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// DiscEmitter:: DiscEmitter(const DiscEmitter ©) : @@ -48,18 +48,18 @@ DiscEmitter(const DiscEmitter ©) : } //////////////////////////////////////////////////////////////////// -// Function : DiscEmitter::~DiscEmitter -// Access : Public -// Description : destructor +// Function: DiscEmitter::~DiscEmitter +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// DiscEmitter:: ~DiscEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : copier +// Function: make_copy +// Access: Public +// Description: copier //////////////////////////////////////////////////////////////////// BaseParticleEmitter *DiscEmitter:: make_copy() { @@ -67,9 +67,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : DiscEmitter::assign_initial_position -// Access : Public -// Description : Generates a location for a new particle +// Function: DiscEmitter::assign_initial_position +// Access: Public +// Description: Generates a location for a new particle //////////////////////////////////////////////////////////////////// void DiscEmitter:: assign_initial_position(LPoint3& pos) { @@ -89,9 +89,9 @@ assign_initial_position(LPoint3& pos) { } //////////////////////////////////////////////////////////////////// -// Function : DiscEmitter::assign_initial_velocity -// Access : Public -// Description : Generates a velocity for a new particle +// Function: DiscEmitter::assign_initial_velocity +// Access: Public +// Description: Generates a velocity for a new particle //////////////////////////////////////////////////////////////////// void DiscEmitter:: assign_initial_velocity(LVector3& vel) { @@ -125,10 +125,10 @@ assign_initial_velocity(LVector3& vel) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void DiscEmitter:: output(ostream &out) const { @@ -138,10 +138,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void DiscEmitter:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/discEmitter.h b/panda/src/particlesystem/discEmitter.h index aba279d671..d4327ce049 100644 --- a/panda/src/particlesystem/discEmitter.h +++ b/panda/src/particlesystem/discEmitter.h @@ -57,12 +57,10 @@ private: PN_stdfloat _outer_magnitude; bool _cubic_lerping; - /////////////////////////////// // scratch variables that carry over from position calc to velocity calc PN_stdfloat _distance_from_center; PN_stdfloat _sinf_theta; PN_stdfloat _cosf_theta; - /////////////////////////////// virtual void assign_initial_position(LPoint3& pos); virtual void assign_initial_velocity(LVector3& vel); diff --git a/panda/src/particlesystem/geomParticleRenderer.I b/panda/src/particlesystem/geomParticleRenderer.I index e84c11d976..fc193c4e17 100644 --- a/panda/src/particlesystem/geomParticleRenderer.I +++ b/panda/src/particlesystem/geomParticleRenderer.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_geom_node -// Access : public +// Function: set_geom_node +// Access: Public //////////////////////////////////////////////////////////////////// // we're forcing a pool resize to remove every node in the vector. @@ -30,8 +30,8 @@ set_geom_node(PandaNode *node) { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::set_x_scale_flag -// Access : public +// Function: GeomParticleRenderer::set_x_scale_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void GeomParticleRenderer:: set_x_scale_flag(bool animate_x_ratio) { @@ -40,8 +40,8 @@ set_x_scale_flag(bool animate_x_ratio) { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::set_y_scale_flag -// Access : public +// Function: GeomParticleRenderer::set_y_scale_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void GeomParticleRenderer:: set_y_scale_flag(bool animate_y_ratio) { @@ -50,8 +50,8 @@ set_y_scale_flag(bool animate_y_ratio) { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::set_z_scale_flag -// Access : public +// Function: GeomParticleRenderer::set_z_scale_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void GeomParticleRenderer:: set_z_scale_flag(bool animate_z_ratio) { @@ -60,8 +60,8 @@ set_z_scale_flag(bool animate_z_ratio) { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::set_initial_x_scale -// Access : public +// Function: GeomParticleRenderer::set_initial_x_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void GeomParticleRenderer:: set_initial_x_scale(PN_stdfloat initial_x_scale) { @@ -70,8 +70,8 @@ set_initial_x_scale(PN_stdfloat initial_x_scale) { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::set_final_x_scale -// Access : public +// Function: GeomParticleRenderer::set_final_x_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void GeomParticleRenderer:: set_final_x_scale(PN_stdfloat final_x_scale) { @@ -80,8 +80,8 @@ set_final_x_scale(PN_stdfloat final_x_scale) { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::set_initial_y_scale -// Access : public +// Function: GeomParticleRenderer::set_initial_y_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void GeomParticleRenderer:: set_initial_y_scale(PN_stdfloat initial_y_scale) { @@ -90,8 +90,8 @@ set_initial_y_scale(PN_stdfloat initial_y_scale) { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::set_final_y_scale -// Access : public +// Function: GeomParticleRenderer::set_final_y_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void GeomParticleRenderer:: set_final_y_scale(PN_stdfloat final_y_scale) { @@ -100,8 +100,8 @@ set_final_y_scale(PN_stdfloat final_y_scale) { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::set_initial_z_scale -// Access : public +// Function: GeomParticleRenderer::set_initial_z_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void GeomParticleRenderer:: set_initial_z_scale(PN_stdfloat initial_z_scale) { @@ -110,8 +110,8 @@ set_initial_z_scale(PN_stdfloat initial_z_scale) { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::set_final_z_scale -// Access : public +// Function: GeomParticleRenderer::set_final_z_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void GeomParticleRenderer:: set_final_z_scale(PN_stdfloat final_z_scale) { @@ -120,8 +120,8 @@ set_final_z_scale(PN_stdfloat final_z_scale) { } //////////////////////////////////////////////////////////////////// -// Function : get_geom_node -// Access : public +// Function: get_geom_node +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PandaNode *GeomParticleRenderer:: get_geom_node() { @@ -129,8 +129,8 @@ get_geom_node() { } //////////////////////////////////////////////////////////////////// -// Function : get_color_interpolation_manager -// Access : public +// Function: get_color_interpolation_manager +// Access: Public //////////////////////////////////////////////////////////////////// INLINE ColorInterpolationManager* GeomParticleRenderer:: get_color_interpolation_manager() const { @@ -138,8 +138,8 @@ get_color_interpolation_manager() const { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::get_x_scale_flag -// Access : public +// Function: GeomParticleRenderer::get_x_scale_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE bool GeomParticleRenderer:: get_x_scale_flag() const { @@ -147,8 +147,8 @@ get_x_scale_flag() const { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::get_y_scale_flag -// Access : public +// Function: GeomParticleRenderer::get_y_scale_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE bool GeomParticleRenderer:: get_y_scale_flag() const { @@ -156,8 +156,8 @@ get_y_scale_flag() const { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::get_z_scale_flag -// Access : public +// Function: GeomParticleRenderer::get_z_scale_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE bool GeomParticleRenderer:: get_z_scale_flag() const { @@ -165,8 +165,8 @@ get_z_scale_flag() const { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::get_initial_x_scale -// Access : public +// Function: GeomParticleRenderer::get_initial_x_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat GeomParticleRenderer:: get_initial_x_scale() const { @@ -174,8 +174,8 @@ get_initial_x_scale() const { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::get_final_x_scale -// Access : public +// Function: GeomParticleRenderer::get_final_x_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat GeomParticleRenderer:: get_final_x_scale() const { @@ -183,8 +183,8 @@ get_final_x_scale() const { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::get_initial_y_scale -// Access : public +// Function: GeomParticleRenderer::get_initial_y_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat GeomParticleRenderer:: get_initial_y_scale() const { @@ -192,8 +192,8 @@ get_initial_y_scale() const { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::get_final_y_scale -// Access : public +// Function: GeomParticleRenderer::get_final_y_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat GeomParticleRenderer:: get_final_y_scale() const { @@ -201,8 +201,8 @@ get_final_y_scale() const { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::get_initial_z_scale -// Access : public +// Function: GeomParticleRenderer::get_initial_z_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat GeomParticleRenderer:: get_initial_z_scale() const { @@ -210,8 +210,8 @@ get_initial_z_scale() const { } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer::get_final_z_scale -// Access : public +// Function: GeomParticleRenderer::get_final_z_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat GeomParticleRenderer:: get_final_z_scale() const { diff --git a/panda/src/particlesystem/geomParticleRenderer.cxx b/panda/src/particlesystem/geomParticleRenderer.cxx index dcb8fb7fd8..3c536d5370 100644 --- a/panda/src/particlesystem/geomParticleRenderer.cxx +++ b/panda/src/particlesystem/geomParticleRenderer.cxx @@ -23,9 +23,9 @@ PStatCollector GeomParticleRenderer::_render_collector("App:Particles:Geom:Render"); //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer -// Access : public -// Description : constructor +// Function: GeomParticleRenderer +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// GeomParticleRenderer:: @@ -49,14 +49,14 @@ GeomParticleRenderer(ParticleRendererAlphaMode am, PandaNode *geom_node) : } //////////////////////////////////////////////////////////////////// -// Function : GeomParticleRenderer -// Access : public -// Description : copy constructor +// Function: GeomParticleRenderer +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// GeomParticleRenderer:: GeomParticleRenderer(const GeomParticleRenderer& copy) : - BaseParticleRenderer(copy), + BaseParticleRenderer(copy), _pool_size(0), _initial_x_scale(copy._initial_x_scale), _final_x_scale(copy._final_x_scale), @@ -72,9 +72,9 @@ GeomParticleRenderer(const GeomParticleRenderer& copy) : } //////////////////////////////////////////////////////////////////// -// Function : ~GeomParticleRenderer -// Access : public -// Description : destructor +// Function: ~GeomParticleRenderer +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// GeomParticleRenderer:: @@ -83,9 +83,9 @@ GeomParticleRenderer:: } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : public -// Description : dynamic copying +// Function: make_copy +// Access: Public +// Description: dynamic copying //////////////////////////////////////////////////////////////////// BaseParticleRenderer *GeomParticleRenderer:: @@ -94,9 +94,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : init_geoms -// Access : private -// Description : links the child nodes to the parent stuff +// Function: init_geoms +// Access: Private +// Description: links the child nodes to the parent stuff //////////////////////////////////////////////////////////////////// void GeomParticleRenderer:: init_geoms() { @@ -104,9 +104,9 @@ init_geoms() { } //////////////////////////////////////////////////////////////////// -// Function : resize_pool -// Access : private -// Description : handles renderer-size resizing. +// Function: resize_pool +// Access: Private +// Description: handles renderer-size resizing. //////////////////////////////////////////////////////////////////// void GeomParticleRenderer:: @@ -125,8 +125,8 @@ resize_pool(int new_size) { } //////////////////////////////////////////////////////////////////// -// Function : kill_nodes -// Access : private +// Function: kill_nodes +// Access: Private //////////////////////////////////////////////////////////////////// void GeomParticleRenderer:: @@ -145,9 +145,9 @@ kill_nodes() { } //////////////////////////////////////////////////////////////////// -// Function : birth_particle -// Access : Private, virtual -// Description : child birth +// Function: birth_particle +// Access: Private, Virtual +// Description: child birth //////////////////////////////////////////////////////////////////// void GeomParticleRenderer:: @@ -161,9 +161,9 @@ birth_particle(int index) { } //////////////////////////////////////////////////////////////////// -// Function : kill_particle -// Access : Private, virtual -// Description : child kill +// Function: kill_particle +// Access: Private, Virtual +// Description: child kill //////////////////////////////////////////////////////////////////// void GeomParticleRenderer:: @@ -175,9 +175,9 @@ kill_particle(int index) { } //////////////////////////////////////////////////////////////////// -// Function : render -// Access : private -// Description : sets the transitions on each arc +// Function: render +// Access: Private +// Description: sets the transitions on each arc //////////////////////////////////////////////////////////////////// void GeomParticleRenderer:: @@ -223,7 +223,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { alpha_scalar = 2.0f * min(alpha_scalar, 1.0f - alpha_scalar); alpha_scalar *= get_user_alpha(); } - + c[3] *= alpha_scalar; cur_node->set_attrib(ColorScaleAttrib::make (LColor(1.0f, 1.0f, 1.0f, c[3]))); @@ -238,15 +238,15 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { if (_animate_x_ratio || _animate_y_ratio || _animate_z_ratio) { if (_animate_x_ratio) { - current_x_scale = (_initial_x_scale + + current_x_scale = (_initial_x_scale + (t * (_final_x_scale - _initial_x_scale))); } if (_animate_y_ratio) { - current_y_scale = (_initial_y_scale + + current_y_scale = (_initial_y_scale + (t * (_final_y_scale - _initial_y_scale))); } if (_animate_z_ratio) { - current_z_scale = (_initial_z_scale + + current_z_scale = (_initial_z_scale + (t * (_final_z_scale - _initial_z_scale))); } } @@ -269,10 +269,10 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void GeomParticleRenderer:: output(ostream &out) const { @@ -282,10 +282,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write_linear_forces -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write_linear_forces +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void GeomParticleRenderer:: write_linear_forces(ostream &out, int indent) const { @@ -301,10 +301,10 @@ write_linear_forces(ostream &out, int indent) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void GeomParticleRenderer:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/lineEmitter.I b/panda/src/particlesystem/lineEmitter.I index d29840a65f..56af4b0a45 100644 --- a/panda/src/particlesystem/lineEmitter.I +++ b/panda/src/particlesystem/lineEmitter.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_endpoint1 -// Access : Public -// Description : endpoint assignment +// Function: set_endpoint1 +// Access: Public +// Description: endpoint assignment //////////////////////////////////////////////////////////////////// INLINE void LineEmitter:: set_endpoint1(const LPoint3& point) { @@ -23,9 +23,9 @@ set_endpoint1(const LPoint3& point) { } //////////////////////////////////////////////////////////////////// -// Function : set_endpoint2 -// Access : Public -// Description : endpoint assignment +// Function: set_endpoint2 +// Access: Public +// Description: endpoint assignment //////////////////////////////////////////////////////////////////// INLINE void LineEmitter:: set_endpoint2(const LPoint3& point) { @@ -33,9 +33,9 @@ set_endpoint2(const LPoint3& point) { } //////////////////////////////////////////////////////////////////// -// Function : get_endpoint1 -// Access : Public -// Description : endpoint accessor +// Function: get_endpoint1 +// Access: Public +// Description: endpoint accessor //////////////////////////////////////////////////////////////////// INLINE LPoint3 LineEmitter:: get_endpoint1() const { @@ -43,9 +43,9 @@ get_endpoint1() const { } //////////////////////////////////////////////////////////////////// -// Function : get_endpoint2 -// Access : Public -// Description : endpoint accessor +// Function: get_endpoint2 +// Access: Public +// Description: endpoint accessor //////////////////////////////////////////////////////////////////// INLINE LPoint3 LineEmitter:: get_endpoint2() const { diff --git a/panda/src/particlesystem/lineEmitter.cxx b/panda/src/particlesystem/lineEmitter.cxx index f8a4441aff..5ade869a34 100644 --- a/panda/src/particlesystem/lineEmitter.cxx +++ b/panda/src/particlesystem/lineEmitter.cxx @@ -15,9 +15,9 @@ #include "lineEmitter.h" //////////////////////////////////////////////////////////////////// -// Function : LineEmitter -// Access : Public -// Description : constructor +// Function: LineEmitter +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// LineEmitter:: LineEmitter() : @@ -27,9 +27,9 @@ LineEmitter() : } //////////////////////////////////////////////////////////////////// -// Function : LineEmitter -// Access : Public -// Description : constructor +// Function: LineEmitter +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// LineEmitter:: LineEmitter(const LineEmitter ©) : @@ -39,18 +39,18 @@ LineEmitter(const LineEmitter ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~LineEmitter -// Access : Public -// Description : constructor +// Function: ~LineEmitter +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// LineEmitter:: ~LineEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : copier +// Function: make_copy +// Access: Public +// Description: copier //////////////////////////////////////////////////////////////////// BaseParticleEmitter *LineEmitter:: make_copy() { @@ -58,9 +58,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : LineEmitter::assign_initial_position -// Access : Public -// Description : Generates a location for a new particle +// Function: LineEmitter::assign_initial_position +// Access: Public +// Description: Generates a location for a new particle //////////////////////////////////////////////////////////////////// void LineEmitter:: assign_initial_position(LPoint3& pos) { @@ -76,9 +76,9 @@ assign_initial_position(LPoint3& pos) { } //////////////////////////////////////////////////////////////////// -// Function : LineEmitter::assign_initial_velocity -// Access : Public -// Description : Generates a velocity for a new particle +// Function: LineEmitter::assign_initial_velocity +// Access: Public +// Description: Generates a velocity for a new particle //////////////////////////////////////////////////////////////////// void LineEmitter:: assign_initial_velocity(LVector3& vel) { @@ -86,10 +86,10 @@ assign_initial_velocity(LVector3& vel) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LineEmitter:: output(ostream &out) const { @@ -99,10 +99,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LineEmitter:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/lineParticleRenderer.I b/panda/src/particlesystem/lineParticleRenderer.I index 0c9d2cbe03..5280a75629 100644 --- a/panda/src/particlesystem/lineParticleRenderer.I +++ b/panda/src/particlesystem/lineParticleRenderer.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_head_color -// Access : public +// Function: set_head_color +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void LineParticleRenderer:: set_head_color(const LColor& c) { @@ -22,8 +22,8 @@ set_head_color(const LColor& c) { } //////////////////////////////////////////////////////////////////// -// Function : set_tail_color -// Access : public +// Function: set_tail_color +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void LineParticleRenderer:: set_tail_color(const LColor& c) { @@ -31,8 +31,8 @@ set_tail_color(const LColor& c) { } //////////////////////////////////////////////////////////////////// -// Function : get_head_color -// Access : public +// Function: get_head_color +// Access: Public //////////////////////////////////////////////////////////////////// INLINE const LColor& LineParticleRenderer:: get_head_color() const { @@ -40,8 +40,8 @@ get_head_color() const { } //////////////////////////////////////////////////////////////////// -// Function : get_tail_color -// Access : public +// Function: get_tail_color +// Access: Public //////////////////////////////////////////////////////////////////// INLINE const LColor& LineParticleRenderer:: get_tail_color() const { @@ -49,8 +49,8 @@ get_tail_color() const { } //////////////////////////////////////////////////////////////////// -// Function : set_line_scale_factor -// Description : accessor +// Function: set_line_scale_factor +// Description: accessor //////////////////////////////////////////////////////////////////// INLINE void LineParticleRenderer:: set_line_scale_factor(PN_stdfloat sf) { @@ -58,8 +58,8 @@ set_line_scale_factor(PN_stdfloat sf) { } //////////////////////////////////////////////////////////////////// -// Function : get_line_scale_factor -// Description : accessor +// Function: get_line_scale_factor +// Description: accessor //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat LineParticleRenderer:: get_line_scale_factor() const { diff --git a/panda/src/particlesystem/lineParticleRenderer.cxx b/panda/src/particlesystem/lineParticleRenderer.cxx index 596d468c7d..615db00233 100644 --- a/panda/src/particlesystem/lineParticleRenderer.cxx +++ b/panda/src/particlesystem/lineParticleRenderer.cxx @@ -23,9 +23,9 @@ PStatCollector LineParticleRenderer::_render_collector("App:Particles:Line:Render"); //////////////////////////////////////////////////////////////////// -// Function : LineParticleRenderer -// Access : Public -// Description : Default Constructor +// Function: LineParticleRenderer +// Access: Public +// Description: Default Constructor //////////////////////////////////////////////////////////////////// LineParticleRenderer:: @@ -39,9 +39,9 @@ LineParticleRenderer() : } //////////////////////////////////////////////////////////////////// -// Function : LineParticleRenderer -// Access : Public -// Description : Constructor +// Function: LineParticleRenderer +// Access: Public +// Description: Constructor //////////////////////////////////////////////////////////////////// LineParticleRenderer:: @@ -55,9 +55,9 @@ LineParticleRenderer(const LColor& head, } //////////////////////////////////////////////////////////////////// -// Function : LineParticleRenderer -// Access : Public -// Description : Copy Constructor +// Function: LineParticleRenderer +// Access: Public +// Description: Copy Constructor //////////////////////////////////////////////////////////////////// LineParticleRenderer:: @@ -70,9 +70,9 @@ LineParticleRenderer(const LineParticleRenderer& copy) : } //////////////////////////////////////////////////////////////////// -// Function : ~LineParticleRenderer -// Access : Public -// Description : Destructor +// Function: ~LineParticleRenderer +// Access: Public +// Description: Destructor //////////////////////////////////////////////////////////////////// LineParticleRenderer:: @@ -80,9 +80,9 @@ LineParticleRenderer:: } //////////////////////////////////////////////////////////////////// -// Function : make copy -// Access : Public -// Description : child virtual for spawning systems +// Function: make copy +// Access: Public +// Description: child virtual for spawning systems //////////////////////////////////////////////////////////////////// BaseParticleRenderer *LineParticleRenderer:: @@ -91,9 +91,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : birth_particle -// Access : Private, virtual -// Description : child birth +// Function: birth_particle +// Access: Private, Virtual +// Description: child birth //////////////////////////////////////////////////////////////////// void LineParticleRenderer:: @@ -101,9 +101,9 @@ birth_particle(int) { } //////////////////////////////////////////////////////////////////// -// Function : kill_particle -// Access : Private, virtual -// Description : child kill +// Function: kill_particle +// Access: Private, Virtual +// Description: child kill //////////////////////////////////////////////////////////////////// void LineParticleRenderer:: @@ -111,9 +111,9 @@ kill_particle(int) { } //////////////////////////////////////////////////////////////////// -// Function : resize_pool -// Access : private -// Description : resizes the render pool. Reference counting +// Function: resize_pool +// Access: Private +// Description: resizes the render pool. Reference counting // makes this easy. //////////////////////////////////////////////////////////////////// @@ -125,9 +125,9 @@ resize_pool(int new_size) { } //////////////////////////////////////////////////////////////////// -// Function : init_geoms -// Access : private -// Description : initializes the geomnodes +// Function: init_geoms +// Access: Private +// Description: initializes the geomnodes //////////////////////////////////////////////////////////////////// void LineParticleRenderer:: @@ -146,9 +146,9 @@ init_geoms() { } //////////////////////////////////////////////////////////////////// -// Function : render -// Access : private -// Description : populates the GeomLine +// Function: render +// Access: Private +// Description: populates the GeomLine //////////////////////////////////////////////////////////////////// void LineParticleRenderer:: @@ -227,7 +227,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { // one line from current position to last position vertex.add_data3(position); - LPoint3 last_position = position + + LPoint3 last_position = position + (cur_particle->get_last_position() - position) * _line_scale_factor; vertex.add_data3(last_position); color.add_data4(head_color); @@ -251,10 +251,10 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LineParticleRenderer:: output(ostream &out) const { @@ -264,10 +264,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LineParticleRenderer:: write(ostream &out, int indent_level) const { diff --git a/panda/src/particlesystem/orientedParticle.I b/panda/src/particlesystem/orientedParticle.I index e5d888df4f..5051d95e75 100644 --- a/panda/src/particlesystem/orientedParticle.I +++ b/panda/src/particlesystem/orientedParticle.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_velocity -// Access : public +// Function: set_velocity +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void OrientedParticle:: @@ -22,8 +22,8 @@ set_velocity() { } //////////////////////////////////////////////////////////////////// -// Function : set_orientation -// Access : public +// Function: set_orientation +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void OrientedParticle:: diff --git a/panda/src/particlesystem/orientedParticle.cxx b/panda/src/particlesystem/orientedParticle.cxx index 3c88a13db5..0e39e2549f 100644 --- a/panda/src/particlesystem/orientedParticle.cxx +++ b/panda/src/particlesystem/orientedParticle.cxx @@ -15,9 +15,9 @@ #include "orientedParticle.h" //////////////////////////////////////////////////////////////////// -// Function : OrientedParticle -// Access : public -// Description : simple constructor +// Function: OrientedParticle +// Access: Public +// Description: simple constructor //////////////////////////////////////////////////////////////////// OrientedParticle:: OrientedParticle(int lifespan, bool alive) : @@ -26,9 +26,9 @@ OrientedParticle(int lifespan, bool alive) : } //////////////////////////////////////////////////////////////////// -// Function : OrientedParticle -// Access : public -// Description : copy constructor +// Function: OrientedParticle +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// OrientedParticle:: OrientedParticle(const OrientedParticle ©) : @@ -36,18 +36,18 @@ OrientedParticle(const OrientedParticle ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~OrientedParticle -// Access : public -// Description : simple destructor +// Function: ~OrientedParticle +// Access: Public +// Description: simple destructor //////////////////////////////////////////////////////////////////// OrientedParticle:: ~OrientedParticle() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : public, virtual -// Description : simple destructor +// Function: make_copy +// Access: Public, Virtual +// Description: simple destructor //////////////////////////////////////////////////////////////////// PhysicsObject *OrientedParticle:: make_copy() const { @@ -55,27 +55,27 @@ make_copy() const { } //////////////////////////////////////////////////////////////////// -// Function : init -// Access : Public -// Description : particle init routine +// Function: init +// Access: Public +// Description: particle init routine //////////////////////////////////////////////////////////////////// void OrientedParticle:: init() { } //////////////////////////////////////////////////////////////////// -// Function : die -// Access : public -// Description : particle death routine +// Function: die +// Access: Public +// Description: particle death routine //////////////////////////////////////////////////////////////////// void OrientedParticle:: die() { } //////////////////////////////////////////////////////////////////// -// Function : update -// Access : public -// Description : particle update routine. +// Function: update +// Access: Public +// Description: particle update routine. // This NEEDS to be filled in with quaternion slerp // stuff, or oriented particles will not rotate. //////////////////////////////////////////////////////////////////// @@ -84,10 +84,10 @@ update() { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void OrientedParticle:: output(ostream &out) const { @@ -97,10 +97,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void OrientedParticle:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/orientedParticle.h b/panda/src/particlesystem/orientedParticle.h index bcc03d873e..c5c9836889 100644 --- a/panda/src/particlesystem/orientedParticle.h +++ b/panda/src/particlesystem/orientedParticle.h @@ -18,8 +18,8 @@ #include "baseParticle.h" //////////////////////////////////////////////////////////////////// -// Class : OrientedParticle -// Description : Describes a particle that has angular +// Class : OrientedParticle +// Description : Describes a particle that has angular // characteristics (velocity, orientation). //////////////////////////////////////////////////////////////////// class EXPCL_PANDAPHYSICS OrientedParticle : public BaseParticle { diff --git a/panda/src/particlesystem/orientedParticleFactory.I b/panda/src/particlesystem/orientedParticleFactory.I index f5684c11d3..b60193e0ff 100644 --- a/panda/src/particlesystem/orientedParticleFactory.I +++ b/panda/src/particlesystem/orientedParticleFactory.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_initial_orientation -// Access : public +// Function: set_initial_orientation +// Access: Public //////////////////////////////////////////////////////////////////// void OrientedParticleFactory:: set_initial_orientation(const LOrientation &o) { @@ -22,8 +22,8 @@ set_initial_orientation(const LOrientation &o) { } //////////////////////////////////////////////////////////////////// -// Function : set_final_orientation -// Access : public +// Function: set_final_orientation +// Access: Public //////////////////////////////////////////////////////////////////// void OrientedParticleFactory:: set_final_orientation(const LOrientation &o) { @@ -31,8 +31,8 @@ set_final_orientation(const LOrientation &o) { } //////////////////////////////////////////////////////////////////// -// Function : get_initial_orientation -// Access : public +// Function: get_initial_orientation +// Access: Public //////////////////////////////////////////////////////////////////// LOrientation OrientedParticleFactory:: get_initial_orientation() const { @@ -40,8 +40,8 @@ get_initial_orientation() const { } //////////////////////////////////////////////////////////////////// -// Function : get_final_orientation -// Access : public +// Function: get_final_orientation +// Access: Public //////////////////////////////////////////////////////////////////// LOrientation OrientedParticleFactory:: get_final_orientation() const { diff --git a/panda/src/particlesystem/orientedParticleFactory.cxx b/panda/src/particlesystem/orientedParticleFactory.cxx index d5aacc67db..71dc3a6f68 100644 --- a/panda/src/particlesystem/orientedParticleFactory.cxx +++ b/panda/src/particlesystem/orientedParticleFactory.cxx @@ -16,9 +16,9 @@ #include "orientedParticle.h" //////////////////////////////////////////////////////////////////// -// Function : OrientedParticleFactory -// Access : Public -// Description : Constructor +// Function: OrientedParticleFactory +// Access: Public +// Description: Constructor //////////////////////////////////////////////////////////////////// OrientedParticleFactory:: OrientedParticleFactory() : @@ -26,9 +26,9 @@ OrientedParticleFactory() : } //////////////////////////////////////////////////////////////////// -// Function : OrientedParticleFactory -// Access : Public -// Description : copy Constructor +// Function: OrientedParticleFactory +// Access: Public +// Description: copy Constructor //////////////////////////////////////////////////////////////////// OrientedParticleFactory:: OrientedParticleFactory(const OrientedParticleFactory ©) : @@ -38,18 +38,18 @@ OrientedParticleFactory(const OrientedParticleFactory ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~OrientedParticleFactory -// Access : public -// Description : destructor +// Function: ~OrientedParticleFactory +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// OrientedParticleFactory:: ~OrientedParticleFactory() { } //////////////////////////////////////////////////////////////////// -// Function : populate_child_particle -// Access : private -// Description : child spawn +// Function: populate_child_particle +// Access: Private +// Description: child spawn //////////////////////////////////////////////////////////////////// void OrientedParticleFactory:: populate_child_particle(BaseParticle *bp) const { @@ -57,9 +57,9 @@ populate_child_particle(BaseParticle *bp) const { } //////////////////////////////////////////////////////////////////// -// Function : alloc_particle -// Access : public -// Description : child particle generation function +// Function: alloc_particle +// Access: Public +// Description: child particle generation function //////////////////////////////////////////////////////////////////// BaseParticle *OrientedParticleFactory:: alloc_particle() const { @@ -67,10 +67,10 @@ alloc_particle() const { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void OrientedParticleFactory:: output(ostream &out) const { @@ -80,10 +80,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void OrientedParticleFactory:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/particleSystem.I b/panda/src/particlesystem/particleSystem.I index d3b21c76f0..689f2bc970 100644 --- a/panda/src/particlesystem/particleSystem.I +++ b/panda/src/particlesystem/particleSystem.I @@ -12,38 +12,36 @@ // //////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////// -// Function : render -// Access : Public -// Description : Populates an attached GeomNode structure with the +// Function: render +// Access: Public +// Description: Populates an attached GeomNode structure with the // particle geometry for rendering. This is a // wrapper for accessability. //////////////////////////////////////////////////////////////////// - INLINE void ParticleSystem:: render() { _renderer->render(_physics_objects, _living_particles); } //////////////////////////////////////////////////////////////////// -// Function : induce_labor -// Access : Public -// Description : Forces the birth of a particle litter this frame +// Function: induce_labor +// Access: Public +// Description: Forces the birth of a particle litter this frame // by resetting _tics_since_birth //////////////////////////////////////////////////////////////////// - INLINE void ParticleSystem:: induce_labor() { _tics_since_birth = _cur_birth_rate; } //////////////////////////////////////////////////////////////////// -// Function : clear_to_initial -// Access : Public -// Description : Resets the system to its start state by resizing to 0, +// Function: clear_to_initial +// Access: Public +// Description: Resets the system to its start state by resizing to 0, // then resizing back to current size. //////////////////////////////////////////////////////////////////// - INLINE void ParticleSystem:: clear_to_initial() { BaseParticle *bp; @@ -59,11 +57,10 @@ clear_to_initial() { } //////////////////////////////////////////////////////////////////// -// Function : soft_start -// Access : Public -// Description : Causes system to use birth rate set by set_birth_rate() +// Function: soft_start +// Access: Public +// Description: Causes system to use birth rate set by set_birth_rate() //////////////////////////////////////////////////////////////////// - INLINE void ParticleSystem:: soft_start(PN_stdfloat br) { if (br > 0.0) @@ -73,12 +70,11 @@ soft_start(PN_stdfloat br) { } //////////////////////////////////////////////////////////////////// -// Function : soft_stop -// Access : Public -// Description : Causes system to use birth rate set by +// Function: soft_stop +// Access: Public +// Description: Causes system to use birth rate set by // set_soft_birth_rate() //////////////////////////////////////////////////////////////////// - INLINE void ParticleSystem:: soft_stop(PN_stdfloat br) { if (br > 0.0) @@ -87,25 +83,19 @@ soft_stop(PN_stdfloat br) { _tics_since_birth = 0.0f; } -//// /////////////////////////////////////////////////////// -//// SET METHODS /////////////////////////////////////////////////////// -//// /////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// -// Function : set_pool_size -// Access : Public +// Function: set_pool_size +// Access: Public //////////////////////////////////////////////////////////////////// - INLINE void ParticleSystem:: set_pool_size(int size) { resize_pool(size); } //////////////////////////////////////////////////////////////////// -// Function : set_birth_rate -// Access : Public +// Function: set_birth_rate +// Access: Public //////////////////////////////////////////////////////////////////// - INLINE void ParticleSystem:: set_birth_rate(PN_stdfloat new_br) { _birth_rate = new_br; @@ -114,10 +104,9 @@ set_birth_rate(PN_stdfloat new_br) { } //////////////////////////////////////////////////////////////////// -// Function : set_soft_birth_rate -// Access : Public +// Function: set_soft_birth_rate +// Access: Public //////////////////////////////////////////////////////////////////// - INLINE void ParticleSystem:: set_soft_birth_rate(PN_stdfloat new_br) { _soft_birth_rate = new_br; @@ -125,18 +114,17 @@ set_soft_birth_rate(PN_stdfloat new_br) { } //////////////////////////////////////////////////////////////////// -// Function : set_litter_size -// Access : Public +// Function: set_litter_size +// Access: Public //////////////////////////////////////////////////////////////////// - INLINE void ParticleSystem:: set_litter_size(int new_ls) { _litter_size = new_ls; } //////////////////////////////////////////////////////////////////// -// Function : set_litter_spread -// Access : Public +// Function: set_litter_spread +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: set_litter_spread(int new_ls) { @@ -144,8 +132,8 @@ set_litter_spread(int new_ls) { } //////////////////////////////////////////////////////////////////// -// Function : set_renderer -// Access : Public +// Function: set_renderer +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: set_renderer(BaseParticleRenderer *r) { @@ -158,8 +146,8 @@ set_renderer(BaseParticleRenderer *r) { } //////////////////////////////////////////////////////////////////// -// Function : set_emitter -// Access : Public +// Function: set_emitter +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: set_emitter(BaseParticleEmitter *e) { @@ -167,8 +155,8 @@ set_emitter(BaseParticleEmitter *e) { } //////////////////////////////////////////////////////////////////// -// Function : set_factory -// Access : Public +// Function: set_factory +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: set_factory(BaseParticleFactory *f) { @@ -180,8 +168,8 @@ set_factory(BaseParticleFactory *f) { } //////////////////////////////////////////////////////////////////// -// Function : set_floor_z -// Access : Public +// Function: set_floor_z +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: set_floor_z(PN_stdfloat z) { @@ -189,8 +177,8 @@ set_floor_z(PN_stdfloat z) { } //////////////////////////////////////////////////////////////////// -// Function : set_active_state -// Access : public +// Function: set_active_state +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: set_active_system_flag(bool a) { @@ -198,8 +186,8 @@ set_active_system_flag(bool a) { } //////////////////////////////////////////////////////////////////// -// Function : set_local_velocity_flag -// Access : public +// Function: set_local_velocity_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: set_local_velocity_flag(bool lv) { @@ -207,8 +195,8 @@ set_local_velocity_flag(bool lv) { } //////////////////////////////////////////////////////////////////// -// Function : set_spawn_on_death_flag -// Access : public +// Function: set_spawn_on_death_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: set_spawn_on_death_flag(bool sod) { @@ -216,8 +204,8 @@ set_spawn_on_death_flag(bool sod) { } //////////////////////////////////////////////////////////////////// -// Function : set_system_grows_older_flag -// Access : public +// Function: set_system_grows_older_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: set_system_grows_older_flag(bool sgo) { @@ -225,28 +213,26 @@ set_system_grows_older_flag(bool sgo) { } //////////////////////////////////////////////////////////////////// -// Function : set_system_lifespan -// Access : public +// Function: set_system_lifespan +// Access: Public //////////////////////////////////////////////////////////////////// - INLINE void ParticleSystem:: set_system_lifespan(PN_stdfloat sl) { _system_lifespan = sl; } //////////////////////////////////////////////////////////////////// -// Function : set_system_age -// Access : public +// Function: set_system_age +// Access: Public //////////////////////////////////////////////////////////////////// - INLINE void ParticleSystem:: set_system_age(PN_stdfloat age) { _system_age = age; } //////////////////////////////////////////////////////////////////// -// Function : set_spawn_render_node -// Access : public +// Function: set_spawn_render_node +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: set_spawn_render_node(PandaNode *node) { @@ -254,8 +240,8 @@ set_spawn_render_node(PandaNode *node) { } //////////////////////////////////////////////////////////////////// -// Function : set_spawn_render_node_path -// Access : public +// Function: set_spawn_render_node_path +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: set_spawn_render_node_path(const NodePath &node) { @@ -263,8 +249,8 @@ set_spawn_render_node_path(const NodePath &node) { } //////////////////////////////////////////////////////////////////// -// Function : set_render_parent -// Access : public +// Function: set_render_parent +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: set_render_parent(PandaNode *node) { @@ -272,8 +258,8 @@ set_render_parent(PandaNode *node) { } //////////////////////////////////////////////////////////////////// -// Function : set_render_parent -// Access : public +// Function: set_render_parent +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: set_render_parent(const NodePath &node) { @@ -285,18 +271,17 @@ set_render_parent(const NodePath &node) { } //////////////////////////////////////////////////////////////////// -// Function : set_template_system_flag -// Access : public +// Function: set_template_system_flag +// Access: Public //////////////////////////////////////////////////////////////////// - INLINE void ParticleSystem:: set_template_system_flag(bool tsf) { _template_system_flag = tsf; } //////////////////////////////////////////////////////////////////// -// Function : add_spawn_template -// Access : public +// Function: add_spawn_template +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: add_spawn_template(ParticleSystem *ps) { @@ -304,8 +289,8 @@ add_spawn_template(ParticleSystem *ps) { } //////////////////////////////////////////////////////////////////// -// Function : clear_spawn_templates -// Access : public +// Function: clear_spawn_templates +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: clear_spawn_templates() { @@ -314,21 +299,17 @@ clear_spawn_templates() { } //////////////////////////////////////////////////////////////////// -// Function : clear_floor_z -// Access : Public +// Function: clear_floor_z +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystem:: clear_floor_z() { _floor_z = -HUGE_VAL; } -//// ///////////////////////////////////////////////////// -//// GET METHODS ///////////////////////////////////////////////////// -//// ///////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// -// Function : get_pool_size -// Access : Public +// Function: get_pool_size +// Access: Public //////////////////////////////////////////////////////////////////// INLINE int ParticleSystem:: get_pool_size() const { @@ -336,8 +317,8 @@ get_pool_size() const { } //////////////////////////////////////////////////////////////////// -// Function : get_birth_rate -// Access : Public +// Function: get_birth_rate +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ParticleSystem:: get_birth_rate() const { @@ -345,8 +326,8 @@ get_birth_rate() const { } //////////////////////////////////////////////////////////////////// -// Function : get_soft_birth_rate -// Access : Public +// Function: get_soft_birth_rate +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ParticleSystem:: get_soft_birth_rate() const { @@ -354,8 +335,8 @@ get_soft_birth_rate() const { } //////////////////////////////////////////////////////////////////// -// Function : get_litter_size -// Access : Public +// Function: get_litter_size +// Access: Public //////////////////////////////////////////////////////////////////// INLINE int ParticleSystem:: get_litter_size() const { @@ -363,8 +344,8 @@ get_litter_size() const { } //////////////////////////////////////////////////////////////////// -// Function : get_litter_spread -// Access : Public +// Function: get_litter_spread +// Access: Public //////////////////////////////////////////////////////////////////// INLINE int ParticleSystem:: get_litter_spread() const { @@ -372,8 +353,8 @@ get_litter_spread() const { } //////////////////////////////////////////////////////////////////// -// Function : get_renderer -// Access : Public +// Function: get_renderer +// Access: Public //////////////////////////////////////////////////////////////////// INLINE BaseParticleRenderer *ParticleSystem:: get_renderer() const { @@ -381,8 +362,8 @@ get_renderer() const { } //////////////////////////////////////////////////////////////////// -// Function : get_emitter -// Access : Public +// Function: get_emitter +// Access: Public //////////////////////////////////////////////////////////////////// INLINE BaseParticleEmitter *ParticleSystem:: get_emitter() const { @@ -390,8 +371,8 @@ get_emitter() const { } //////////////////////////////////////////////////////////////////// -// Function : get_factory -// Access : Public +// Function: get_factory +// Access: Public //////////////////////////////////////////////////////////////////// INLINE BaseParticleFactory *ParticleSystem:: get_factory() const { @@ -399,8 +380,8 @@ get_factory() const { } //////////////////////////////////////////////////////////////////// -// Function : get_factory -// Access : Public +// Function: get_factory +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ParticleSystem:: get_floor_z() const { @@ -408,8 +389,8 @@ get_floor_z() const { } //////////////////////////////////////////////////////////////////// -// Function : get_living_particles -// Access : Public +// Function: get_living_particles +// Access: Public //////////////////////////////////////////////////////////////////// INLINE int ParticleSystem:: get_living_particles() const { @@ -417,8 +398,8 @@ get_living_particles() const { } //////////////////////////////////////////////////////////////////// -// Function : get_active_state -// Access : public +// Function: get_active_state +// Access: Public //////////////////////////////////////////////////////////////////// INLINE bool ParticleSystem:: get_active_system_flag() const { @@ -426,8 +407,8 @@ get_active_system_flag() const { } //////////////////////////////////////////////////////////////////// -// Function : get_local_velocity_flag -// Access : public +// Function: get_local_velocity_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE bool ParticleSystem:: get_local_velocity_flag() const { @@ -435,8 +416,8 @@ get_local_velocity_flag() const { } //////////////////////////////////////////////////////////////////// -// Function : get_spawn_on_death_flag -// Access : public +// Function: get_spawn_on_death_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE bool ParticleSystem:: get_spawn_on_death_flag() const { @@ -444,8 +425,8 @@ get_spawn_on_death_flag() const { } //////////////////////////////////////////////////////////////////// -// Function : get_system_grows_older_flag -// Access : public +// Function: get_system_grows_older_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE bool ParticleSystem:: get_system_grows_older_flag() const { @@ -453,8 +434,8 @@ get_system_grows_older_flag() const { } //////////////////////////////////////////////////////////////////// -// Function : get_system_lifespan -// Access : public +// Function: get_system_lifespan +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ParticleSystem:: get_system_lifespan() const { @@ -462,8 +443,8 @@ get_system_lifespan() const { } //////////////////////////////////////////////////////////////////// -// Function : get_system_age -// Access : public +// Function: get_system_age +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ParticleSystem:: get_system_age() const { @@ -471,8 +452,8 @@ get_system_age() const { } //////////////////////////////////////////////////////////////////// -// Function : get_i_was_spawned_flag -// Access : public +// Function: get_i_was_spawned_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE bool ParticleSystem:: get_i_was_spawned_flag() const { @@ -480,8 +461,8 @@ get_i_was_spawned_flag() const { } //////////////////////////////////////////////////////////////////// -// Function : get_spawn_render_node -// Access : public +// Function: get_spawn_render_node +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PandaNode *ParticleSystem:: get_spawn_render_node() const { @@ -489,8 +470,8 @@ get_spawn_render_node() const { } //////////////////////////////////////////////////////////////////// -// Function : get_spawn_render_node_path -// Access : public +// Function: get_spawn_render_node_path +// Access: Public //////////////////////////////////////////////////////////////////// INLINE NodePath ParticleSystem:: get_spawn_render_node_path() const { @@ -498,8 +479,8 @@ get_spawn_render_node_path() const { } //////////////////////////////////////////////////////////////////// -// Function : get_render_parent -// Access : public +// Function: get_render_parent +// Access: Public //////////////////////////////////////////////////////////////////// INLINE NodePath ParticleSystem:: get_render_parent() const { diff --git a/panda/src/particlesystem/particleSystem.cxx b/panda/src/particlesystem/particleSystem.cxx index 112b27159c..3da5b2b223 100644 --- a/panda/src/particlesystem/particleSystem.cxx +++ b/panda/src/particlesystem/particleSystem.cxx @@ -36,9 +36,9 @@ TypeHandle ParticleSystem::_type_handle; PStatCollector ParticleSystem::_update_collector("App:Particles:Update"); //////////////////////////////////////////////////////////////////// -// Function : ParticleSystem -// Access : Public -// Description : Default Constructor. +// Function: ParticleSystem +// Access: Public +// Description: Default Constructor. //////////////////////////////////////////////////////////////////// ParticleSystem:: ParticleSystem(int pool_size) : @@ -81,9 +81,9 @@ ParticleSystem(int pool_size) : } //////////////////////////////////////////////////////////////////// -// Function : ParticleSystem -// Access : Public -// Description : Copy Constructor. +// Function: ParticleSystem +// Access: Public +// Description: Copy Constructor. //////////////////////////////////////////////////////////////////// ParticleSystem:: ParticleSystem(const ParticleSystem& copy) : @@ -116,9 +116,9 @@ ParticleSystem(const ParticleSystem& copy) : } //////////////////////////////////////////////////////////////////// -// Function : ~ParticleSystem -// Access : Public -// Description : You get the ankles and I'll get the wrists. +// Function: ~ParticleSystem +// Access: Public +// Description: You get the ankles and I'll get the wrists. //////////////////////////////////////////////////////////////////// ParticleSystem:: ~ParticleSystem() { @@ -131,9 +131,9 @@ ParticleSystem:: } //////////////////////////////////////////////////////////////////// -// Function : birth_particle -// Access : Private -// Description : A new particle is born. This doesn't allocate, +// Function: birth_particle +// Access: Private +// Description: A new particle is born. This doesn't allocate, // resets an element from the particle pool. //////////////////////////////////////////////////////////////////// bool ParticleSystem:: @@ -202,9 +202,9 @@ birth_particle() { } //////////////////////////////////////////////////////////////////// -// Function : birth_litter -// Access : Private -// Description : spawns a new batch of particles +// Function: birth_litter +// Access: Private +// Description: spawns a new batch of particles //////////////////////////////////////////////////////////////////// void ParticleSystem:: birth_litter() { @@ -222,9 +222,9 @@ birth_litter() { } //////////////////////////////////////////////////////////////////// -// Function : spawn_child_system -// Access : private -// Description : Creates a new particle system based on local +// Function: spawn_child_system +// Access: Private +// Description: Creates a new particle system based on local // template info and adds it to the ps and physics // managers //////////////////////////////////////////////////////////////////// @@ -294,9 +294,9 @@ spawn_child_system(BaseParticle *bp) { } //////////////////////////////////////////////////////////////////// -// Function : kill_particle -// Access : Private -// Description : Kills a particle, returns its slot to the empty +// Function: kill_particle +// Access: Private +// Description: Kills a particle, returns its slot to the empty // stack. //////////////////////////////////////////////////////////////////// void ParticleSystem:: @@ -323,9 +323,9 @@ kill_particle(int pool_index) { } //////////////////////////////////////////////////////////////////// -// Function : resize_pool -// Access : Private -// Description : Resizes the particle pool +// Function: resize_pool +// Access: Private +// Description: Resizes the particle pool //////////////////////////////////////////////////////////////////// #ifdef PSDEBUG #define PARTICLE_SYSTEM_RESIZE_POOL_SENTRIES @@ -462,11 +462,11 @@ resize_pool(int size) { #endif } -////////////////////////////////////////////////////////////////////// -// Function : update -// Access : Public -// Description : Updates the particle system. Call once per frame. -////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: update +// Access: Public +// Description: Updates the particle system. Call once per frame. +//////////////////////////////////////////////////////////////////// #ifdef PSDEBUG //#define PARTICLE_SYSTEM_UPDATE_SENTRIES #endif @@ -531,7 +531,7 @@ update(PN_stdfloat dt) { } else { bp->update(); } - + // break out early if we're lucky ttl_updates_left--; } @@ -552,12 +552,12 @@ update(PN_stdfloat dt) { } #ifdef PSSANITYCHECK -////////////////////////////////////////////////////////////////////// -// Function : sanity_check -// Access : Private -// Description : Checks consistency of live particle count, free +//////////////////////////////////////////////////////////////////// +// Function: sanity_check +// Access: Private +// Description: Checks consistency of live particle count, free // particle list, etc. returns 0 if everything is normal -////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// #ifndef NDEBUG #define PSSCVERBOSE #endif @@ -608,7 +608,6 @@ sanity_check() { BaseParticle *bp; int pool_size; - /////////////////////////////////////////////////////////////////// // check pool size if (_particle_pool_size != _physics_objects.size()) { #ifdef PSSCVERBOSE @@ -618,9 +617,7 @@ sanity_check() { result++; } pool_size = min(_particle_pool_size, _physics_objects.size()); - /////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// // find out how many particles are REALLY alive and dead int real_live_particle_count = 0; int real_dead_particle_count = 0; @@ -649,9 +646,7 @@ sanity_check() { #endif result++; } - /////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// // check the free particle pool for (i = 0; i < _free_particle_fifo.size(); i++) { int index = _free_particle_fifo[i]; @@ -675,9 +670,7 @@ sanity_check() { result++; } } - /////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// // check the numbers of free particles, live particles, and total particles pvector< PT(SC_valuenamepair) > live_counts; pvector< PT(SC_valuenamepair) > dead_counts; @@ -692,17 +685,16 @@ sanity_check() { total_counts.push_back(new SC_valuenamepair(_physics_objects.size(), "actual particle pool size")); result += check_free_live_total_particles(live_counts, dead_counts, total_counts); - /////////////////////////////////////////////////////////////////// return result; } #endif //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ParticleSystem:: output(ostream &out) const { @@ -712,10 +704,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write_free_particle_fifo -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write_free_particle_fifo +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ParticleSystem:: write_free_particle_fifo(ostream &out, int indent) const { @@ -731,10 +723,10 @@ write_free_particle_fifo(ostream &out, int indent) const { } //////////////////////////////////////////////////////////////////// -// Function : write_spawn_templates -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write_spawn_templates +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ParticleSystem:: write_spawn_templates(ostream &out, int indent) const { @@ -750,10 +742,10 @@ write_spawn_templates(ostream &out, int indent) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ParticleSystem:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/particleSystemManager.I b/panda/src/particlesystem/particleSystemManager.I index 3d6c57395b..b4f3820f69 100644 --- a/panda/src/particlesystem/particleSystemManager.I +++ b/panda/src/particlesystem/particleSystemManager.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_frame_stepping -// Access : public +// Function: set_frame_stepping +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystemManager:: @@ -23,8 +23,8 @@ set_frame_stepping(int every_nth_frame) { } //////////////////////////////////////////////////////////////////// -// Function : get_frame_stepping -// Access : public +// Function: get_frame_stepping +// Access: Public //////////////////////////////////////////////////////////////////// INLINE int ParticleSystemManager:: @@ -33,8 +33,8 @@ get_frame_stepping() const { } //////////////////////////////////////////////////////////////////// -// Function : attach_particlesystem -// Access : public +// Function: attach_particlesystem +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystemManager:: @@ -48,8 +48,8 @@ attach_particlesystem(ParticleSystem *ps) { } //////////////////////////////////////////////////////////////////// -// Function : clear -// Access : public +// Function: clear +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ParticleSystemManager:: diff --git a/panda/src/particlesystem/particleSystemManager.cxx b/panda/src/particlesystem/particleSystemManager.cxx index d131017351..56ad5022cb 100644 --- a/panda/src/particlesystem/particleSystemManager.cxx +++ b/panda/src/particlesystem/particleSystemManager.cxx @@ -25,9 +25,9 @@ PStatCollector ParticleSystemManager::_do_particles_collector("App:Particles:Do Particles"); //////////////////////////////////////////////////////////////////// -// Function : ParticleSystemManager -// Access : public -// Description : default constructor +// Function: ParticleSystemManager +// Access: Public +// Description: default constructor //////////////////////////////////////////////////////////////////// ParticleSystemManager:: ParticleSystemManager(int every_nth_frame) : @@ -35,18 +35,18 @@ ParticleSystemManager(int every_nth_frame) : } //////////////////////////////////////////////////////////////////// -// Function : ParticleSystemManager -// Access : Public, Virtual -// Description : Destructor +// Function: ParticleSystemManager +// Access: Public, Virtual +// Description: Destructor //////////////////////////////////////////////////////////////////// ParticleSystemManager:: ~ParticleSystemManager() { } //////////////////////////////////////////////////////////////////// -// Function : remove_particlesystem -// Access : public -// Description : removes a ps from the maintenance list +// Function: remove_particlesystem +// Access: Public +// Description: removes a ps from the maintenance list //////////////////////////////////////////////////////////////////// void ParticleSystemManager:: remove_particlesystem(ParticleSystem *ps) { @@ -62,9 +62,9 @@ remove_particlesystem(ParticleSystem *ps) { } //////////////////////////////////////////////////////////////////// -// Function : do_particles -// Access : public -// Description : does an update and render for each ps in the list. +// Function: do_particles +// Access: Public +// Description: does an update and render for each ps in the list. // this is probably the one you want to use. Rendering // is the expensive operation, and particles REALLY // should at least be updated every frame, so nth_frame @@ -130,9 +130,9 @@ do_particles(PN_stdfloat dt) { } //////////////////////////////////////////////////////////////////// -// Function : do_particles -// Access : public -// Description : does an update and an optional render for a specific +// Function: do_particles +// Access: Public +// Description: does an update and an optional render for a specific // ps. Since rendering is the expensive operation, multiple // updates could be applied before calling the final render. //////////////////////////////////////////////////////////////////// @@ -145,7 +145,7 @@ do_particles(PN_stdfloat dt, ParticleSystem *ps, bool do_render) { PN_stdfloat age = ps->get_system_age() + dt; ps->set_system_age(age); } - + // handle render if (do_render) { ps->render(); @@ -154,10 +154,10 @@ do_particles(PN_stdfloat dt, ParticleSystem *ps, bool do_render) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ParticleSystemManager:: output(ostream &out) const { @@ -167,10 +167,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write_ps_list -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write_ps_list +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ParticleSystemManager:: write_ps_list(ostream &out, int indent) const { @@ -186,10 +186,10 @@ write_ps_list(ostream &out, int indent) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ParticleSystemManager:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/pointEmitter.I b/panda/src/particlesystem/pointEmitter.I index 0269cac5c8..7043aa019c 100644 --- a/panda/src/particlesystem/pointEmitter.I +++ b/panda/src/particlesystem/pointEmitter.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_point -// Access : public -// Description : point setting +// Function: set_point +// Access: Public +// Description: point setting //////////////////////////////////////////////////////////////////// INLINE void PointEmitter:: set_location(const LPoint3& p) { diff --git a/panda/src/particlesystem/pointEmitter.cxx b/panda/src/particlesystem/pointEmitter.cxx index a7d0a148df..70855982e4 100644 --- a/panda/src/particlesystem/pointEmitter.cxx +++ b/panda/src/particlesystem/pointEmitter.cxx @@ -15,9 +15,9 @@ #include "pointEmitter.h" //////////////////////////////////////////////////////////////////// -// Function : PointEmitter -// Access : Public -// Description : constructor +// Function: PointEmitter +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// PointEmitter:: PointEmitter() : @@ -26,9 +26,9 @@ PointEmitter() : } //////////////////////////////////////////////////////////////////// -// Function : PointEmitter -// Access : Public -// Description : copy constructor +// Function: PointEmitter +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// PointEmitter:: PointEmitter(const PointEmitter ©) : @@ -37,18 +37,18 @@ PointEmitter(const PointEmitter ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~PointEmitter -// Access : Public -// Description : destructor +// Function: ~PointEmitter +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// PointEmitter:: ~PointEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : copier +// Function: make_copy +// Access: Public +// Description: copier //////////////////////////////////////////////////////////////////// BaseParticleEmitter *PointEmitter:: make_copy() { @@ -56,9 +56,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : PointEmitter::assign_initial_position -// Access : Public -// Description : Generates a location for a new particle +// Function: PointEmitter::assign_initial_position +// Access: Public +// Description: Generates a location for a new particle //////////////////////////////////////////////////////////////////// void PointEmitter:: assign_initial_position(LPoint3& pos) { @@ -66,9 +66,9 @@ assign_initial_position(LPoint3& pos) { } //////////////////////////////////////////////////////////////////// -// Function : PointEmitter::assign_initial_velocity -// Access : Public -// Description : Generates a velocity for a new particle +// Function: PointEmitter::assign_initial_velocity +// Access: Public +// Description: Generates a velocity for a new particle //////////////////////////////////////////////////////////////////// void PointEmitter:: assign_initial_velocity(LVector3& vel) { @@ -76,10 +76,10 @@ assign_initial_velocity(LVector3& vel) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PointEmitter:: output(ostream &out) const { @@ -89,10 +89,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PointEmitter:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/pointParticle.cxx b/panda/src/particlesystem/pointParticle.cxx index 2b79167cfd..32f2955cf1 100644 --- a/panda/src/particlesystem/pointParticle.cxx +++ b/panda/src/particlesystem/pointParticle.cxx @@ -15,9 +15,9 @@ #include "pointParticle.h" //////////////////////////////////////////////////////////////////// -// Function : PointParticle -// Access : Public -// Description : simple constructor +// Function: PointParticle +// Access: Public +// Description: simple constructor //////////////////////////////////////////////////////////////////// PointParticle:: PointParticle(PN_stdfloat lifespan, bool alive) : @@ -26,9 +26,9 @@ PointParticle(PN_stdfloat lifespan, bool alive) : } //////////////////////////////////////////////////////////////////// -// Function : PointParticle -// Access : Public -// Description : copy constructor +// Function: PointParticle +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// PointParticle:: PointParticle(const PointParticle ©) : @@ -37,18 +37,18 @@ PointParticle(const PointParticle ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~PointParticle -// Access : Public -// Description : simple destructor +// Function: ~PointParticle +// Access: Public +// Description: simple destructor //////////////////////////////////////////////////////////////////// PointParticle:: ~PointParticle() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : dynamic copier +// Function: make_copy +// Access: Public +// Description: dynamic copier //////////////////////////////////////////////////////////////////// PhysicsObject *PointParticle:: make_copy() const { @@ -56,37 +56,37 @@ make_copy() const { } //////////////////////////////////////////////////////////////////// -// Function : die -// Access : Public -// Description : particle death routine +// Function: die +// Access: Public +// Description: particle death routine //////////////////////////////////////////////////////////////////// void PointParticle:: die() { } //////////////////////////////////////////////////////////////////// -// Function : init -// Access : Public -// Description : particle init routine +// Function: init +// Access: Public +// Description: particle init routine //////////////////////////////////////////////////////////////////// void PointParticle:: init() { } //////////////////////////////////////////////////////////////////// -// Function : update -// Access : Public -// Description : particle update +// Function: update +// Access: Public +// Description: particle update //////////////////////////////////////////////////////////////////// void PointParticle:: update() { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PointParticle:: output(ostream &out) const { @@ -96,10 +96,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PointParticle:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/pointParticleFactory.cxx b/panda/src/particlesystem/pointParticleFactory.cxx index b37243ef76..40a15fe559 100644 --- a/panda/src/particlesystem/pointParticleFactory.cxx +++ b/panda/src/particlesystem/pointParticleFactory.cxx @@ -18,9 +18,9 @@ #include //////////////////////////////////////////////////////////////////// -// Function : PointParticleFactory -// Access : public -// Description : default constructor +// Function: PointParticleFactory +// Access: Public +// Description: default constructor //////////////////////////////////////////////////////////////////// PointParticleFactory:: PointParticleFactory() : @@ -28,9 +28,9 @@ PointParticleFactory() : } //////////////////////////////////////////////////////////////////// -// Function : PointParticleFactory -// Access : public -// Description : copy constructor +// Function: PointParticleFactory +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// PointParticleFactory:: PointParticleFactory(const PointParticleFactory ©) : @@ -38,18 +38,18 @@ PointParticleFactory(const PointParticleFactory ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~PointParticleFactory -// Access : public -// Description : destructor +// Function: ~PointParticleFactory +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// PointParticleFactory:: ~PointParticleFactory() { } //////////////////////////////////////////////////////////////////// -// Function : populate_child_particle -// Access : public -// Description : child particle generation function +// Function: populate_child_particle +// Access: Public +// Description: child particle generation function //////////////////////////////////////////////////////////////////// void PointParticleFactory:: populate_child_particle(BaseParticle *bp) const { @@ -57,9 +57,9 @@ populate_child_particle(BaseParticle *bp) const { } //////////////////////////////////////////////////////////////////// -// Function : alloc_particle -// Access : public -// Description : child particle generation function +// Function: alloc_particle +// Access: Public +// Description: child particle generation function //////////////////////////////////////////////////////////////////// BaseParticle *PointParticleFactory:: alloc_particle() const { @@ -67,10 +67,10 @@ alloc_particle() const { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PointParticleFactory:: output(ostream &out) const { @@ -80,10 +80,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PointParticleFactory:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/pointParticleRenderer.I b/panda/src/particlesystem/pointParticleRenderer.I index 18c7ec4e1b..408dbd5250 100644 --- a/panda/src/particlesystem/pointParticleRenderer.I +++ b/panda/src/particlesystem/pointParticleRenderer.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_point_size -// Access : Public +// Function: set_point_size +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void PointParticleRenderer:: set_point_size(PN_stdfloat point_size) { @@ -23,8 +23,8 @@ set_point_size(PN_stdfloat point_size) { } //////////////////////////////////////////////////////////////////// -// Function : set_start_color -// Access : Public +// Function: set_start_color +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void PointParticleRenderer:: set_start_color(const LColor& sc) { @@ -32,8 +32,8 @@ set_start_color(const LColor& sc) { } //////////////////////////////////////////////////////////////////// -// Function : set_end_color -// Access : Public +// Function: set_end_color +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void PointParticleRenderer:: set_end_color(const LColor& ec) { @@ -41,8 +41,8 @@ set_end_color(const LColor& ec) { } //////////////////////////////////////////////////////////////////// -// Function : set_blend_type -// Access : Public +// Function: set_blend_type +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void PointParticleRenderer:: set_blend_type(PointParticleRenderer::PointParticleBlendType bt) { @@ -50,8 +50,8 @@ set_blend_type(PointParticleRenderer::PointParticleBlendType bt) { } //////////////////////////////////////////////////////////////////// -// Function : set_blend_method -// Access : Public +// Function: set_blend_method +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void PointParticleRenderer:: set_blend_method(BaseParticleRenderer::ParticleRendererBlendMethod bm) { @@ -59,8 +59,8 @@ set_blend_method(BaseParticleRenderer::ParticleRendererBlendMethod bm) { } //////////////////////////////////////////////////////////////////// -// Function : get_point_size -// Access : Public +// Function: get_point_size +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat PointParticleRenderer:: get_point_size() const { @@ -68,8 +68,8 @@ get_point_size() const { } //////////////////////////////////////////////////////////////////// -// Function : get_start_color -// Access : Public +// Function: get_start_color +// Access: Public //////////////////////////////////////////////////////////////////// INLINE const LColor& PointParticleRenderer:: get_start_color() const { @@ -77,8 +77,8 @@ get_start_color() const { } //////////////////////////////////////////////////////////////////// -// Function : get_end_color -// Access : Public +// Function: get_end_color +// Access: Public //////////////////////////////////////////////////////////////////// INLINE const LColor& PointParticleRenderer:: get_end_color() const { @@ -86,8 +86,8 @@ get_end_color() const { } //////////////////////////////////////////////////////////////////// -// Function : get_blend_type -// Access : Public +// Function: get_blend_type +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PointParticleRenderer::PointParticleBlendType PointParticleRenderer:: get_blend_type() const { @@ -95,8 +95,8 @@ get_blend_type() const { } //////////////////////////////////////////////////////////////////// -// Function : get_blend_method -// Access : Public +// Function: get_blend_method +// Access: Public //////////////////////////////////////////////////////////////////// INLINE BaseParticleRenderer::ParticleRendererBlendMethod PointParticleRenderer:: get_blend_method() const { diff --git a/panda/src/particlesystem/pointParticleRenderer.cxx b/panda/src/particlesystem/pointParticleRenderer.cxx index 6da6c0786a..d1a7ba759e 100644 --- a/panda/src/particlesystem/pointParticleRenderer.cxx +++ b/panda/src/particlesystem/pointParticleRenderer.cxx @@ -23,11 +23,10 @@ PStatCollector PointParticleRenderer::_render_collector("App:Particles:Point:Render"); //////////////////////////////////////////////////////////////////// -// Function : PointParticleRenderer -// Access : Public -// Description : special constructor +// Function: PointParticleRenderer +// Access: Public +// Description: special constructor //////////////////////////////////////////////////////////////////// - PointParticleRenderer:: PointParticleRenderer(ParticleRendererAlphaMode am, PN_stdfloat point_size, @@ -43,11 +42,10 @@ PointParticleRenderer(ParticleRendererAlphaMode am, } //////////////////////////////////////////////////////////////////// -// Function : PointParticleRenderer -// Access : Public -// Description : Copy constructor +// Function: PointParticleRenderer +// Access: Public +// Description: Copy constructor //////////////////////////////////////////////////////////////////// - PointParticleRenderer:: PointParticleRenderer(const PointParticleRenderer& copy) : BaseParticleRenderer(copy) @@ -62,33 +60,30 @@ PointParticleRenderer(const PointParticleRenderer& copy) : } //////////////////////////////////////////////////////////////////// -// Function : ~PointParticleRenderer -// Access : Public -// Description : Simple destructor +// Function: ~PointParticleRenderer +// Access: Public +// Description: Simple destructor //////////////////////////////////////////////////////////////////// - PointParticleRenderer:: ~PointParticleRenderer() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : for spawning systems from dead particles +// Function: make_copy +// Access: Public +// Description: for spawning systems from dead particles //////////////////////////////////////////////////////////////////// - BaseParticleRenderer *PointParticleRenderer:: make_copy() { return new PointParticleRenderer(*this); } //////////////////////////////////////////////////////////////////// -// Function : resize_pool -// Access : Public -// Description : reallocate the space for the vertex and color +// Function: resize_pool +// Access: Public +// Description: reallocate the space for the vertex and color // pools //////////////////////////////////////////////////////////////////// - void PointParticleRenderer:: resize_pool(int new_size) { if (new_size == _max_pool_size) @@ -100,11 +95,10 @@ resize_pool(int new_size) { } //////////////////////////////////////////////////////////////////// -// Function : init_geoms -// Access : Private -// Description : On-construction initialization +// Function: init_geoms +// Access: Private +// Description: On-construction initialization //////////////////////////////////////////////////////////////////// - void PointParticleRenderer:: init_geoms() { _vdata = new GeomVertexData @@ -114,38 +108,35 @@ init_geoms() { _point_primitive = geom; _points = new GeomPoints(Geom::UH_stream); geom->add_primitive(_points); - + GeomNode *render_node = get_render_node(); render_node->remove_all_geoms(); render_node->add_geom(_point_primitive, _render_state->add_attrib(_thick)); } //////////////////////////////////////////////////////////////////// -// Function : birth_particle -// Access : Private, virtual -// Description : child birth +// Function: birth_particle +// Access: Private, Virtual +// Description: child birth //////////////////////////////////////////////////////////////////// - void PointParticleRenderer:: birth_particle(int) { } //////////////////////////////////////////////////////////////////// -// Function : kill_particle -// Access : Private, virtual -// Description : child kill +// Function: kill_particle +// Access: Private, Virtual +// Description: child kill //////////////////////////////////////////////////////////////////// - void PointParticleRenderer:: kill_particle(int) { } //////////////////////////////////////////////////////////////////// -// Function : create_color -// Access : Private -// Description : Generates the point color based on the render_type +// Function: create_color +// Access: Private +// Description: Generates the point color based on the render_type //////////////////////////////////////////////////////////////////// - LColor PointParticleRenderer:: create_color(const BaseParticle *p) { LColor color; @@ -154,53 +145,49 @@ create_color(const BaseParticle *p) { bool have_alpha_t = false; switch (_blend_type) { - - //// Constant solid color - case PP_ONE_COLOR: + // Constant solid color color = _start_color; break; - //// Blending colors based on life - case PP_BLEND_LIFE: + // Blending colors based on life parameterized_age = p->get_parameterized_age(); life_t = parameterized_age; have_alpha_t = true; - if (_blend_method == PP_BLEND_CUBIC) + if (_blend_method == PP_BLEND_CUBIC) { life_t = CUBIC_T(life_t); - + } + color = LERP(life_t, _start_color, _end_color); - break; - - //// Blending colors based on vel case PP_BLEND_VEL: + // Blending colors based on vel vel_t = p->get_parameterized_vel(); - if (_blend_method == PP_BLEND_CUBIC) + if (_blend_method == PP_BLEND_CUBIC) { vel_t = CUBIC_T(vel_t); + } color = LERP(vel_t, _start_color, _end_color); - break; } - // handle alpha channel - - if(_alpha_mode != PR_ALPHA_NONE) { - if(_alpha_mode == PR_ALPHA_USER) { + // Handle alpha channel + if (_alpha_mode != PR_ALPHA_NONE) { + if (_alpha_mode == PR_ALPHA_USER) { parameterized_age = 1.0; } else { - if(!have_alpha_t) + if (!have_alpha_t) { parameterized_age = p->get_parameterized_age(); + } - if(_alpha_mode==PR_ALPHA_OUT) { + if (_alpha_mode == PR_ALPHA_OUT) { parameterized_age = 1.0f - parameterized_age; - } else if(_alpha_mode==PR_ALPHA_IN_OUT) { - parameterized_age = 2.0f * min(parameterized_age, + } else if (_alpha_mode == PR_ALPHA_IN_OUT) { + parameterized_age = 2.0f * min(parameterized_age, 1.0f - parameterized_age); } } @@ -211,11 +198,10 @@ create_color(const BaseParticle *p) { } //////////////////////////////////////////////////////////////////// -// Function : render -// Access : Public -// Description : renders the particle system out to a GeomNode +// Function: render +// Access: Public +// Description: renders the particle system out to a GeomNode //////////////////////////////////////////////////////////////////// - void PointParticleRenderer:: render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { PStatTimer t1(_render_collector); @@ -290,10 +276,10 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PointParticleRenderer:: output(ostream &out) const { @@ -303,10 +289,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PointParticleRenderer:: write(ostream &out, int indent_level) const { diff --git a/panda/src/particlesystem/rectangleEmitter.I b/panda/src/particlesystem/rectangleEmitter.I index 7617872cb9..7c809d8052 100644 --- a/panda/src/particlesystem/rectangleEmitter.I +++ b/panda/src/particlesystem/rectangleEmitter.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_min_bound -// Access : public -// Description : boundary set +// Function: set_min_bound +// Access: Public +// Description: boundary set //////////////////////////////////////////////////////////////////// INLINE void RectangleEmitter:: set_min_bound(const LPoint2& vmin) { @@ -23,9 +23,9 @@ set_min_bound(const LPoint2& vmin) { } //////////////////////////////////////////////////////////////////// -// Function : set_max_bound -// Access : public -// Description : boundary set +// Function: set_max_bound +// Access: Public +// Description: boundary set //////////////////////////////////////////////////////////////////// INLINE void RectangleEmitter:: set_max_bound(const LPoint2& vmax) { @@ -33,9 +33,9 @@ set_max_bound(const LPoint2& vmax) { } //////////////////////////////////////////////////////////////////// -// Function : get_min_bound -// Access : public -// Description : boundary get +// Function: get_min_bound +// Access: Public +// Description: boundary get //////////////////////////////////////////////////////////////////// INLINE LPoint2 RectangleEmitter:: get_min_bound() const { @@ -43,9 +43,9 @@ get_min_bound() const { } //////////////////////////////////////////////////////////////////// -// Function : get_max_bound -// Access : public -// Description : boundary get +// Function: get_max_bound +// Access: Public +// Description: boundary get //////////////////////////////////////////////////////////////////// INLINE LPoint2 RectangleEmitter:: get_max_bound() const { diff --git a/panda/src/particlesystem/rectangleEmitter.cxx b/panda/src/particlesystem/rectangleEmitter.cxx index 9afc19f6df..4fa67e242e 100644 --- a/panda/src/particlesystem/rectangleEmitter.cxx +++ b/panda/src/particlesystem/rectangleEmitter.cxx @@ -15,9 +15,9 @@ #include "rectangleEmitter.h" //////////////////////////////////////////////////////////////////// -// Function : RectangleEmitter -// Access : Public -// Description : constructor +// Function: RectangleEmitter +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// RectangleEmitter:: RectangleEmitter() : @@ -27,9 +27,9 @@ RectangleEmitter() : } //////////////////////////////////////////////////////////////////// -// Function : RectangleEmitter -// Access : Public -// Description : copy constructor +// Function: RectangleEmitter +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// RectangleEmitter:: RectangleEmitter(const RectangleEmitter ©) : @@ -39,18 +39,18 @@ RectangleEmitter(const RectangleEmitter ©) : } //////////////////////////////////////////////////////////////////// -// Function : RectangleEmitter -// Access : Public -// Description : destructor +// Function: RectangleEmitter +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// RectangleEmitter:: ~RectangleEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : copier +// Function: make_copy +// Access: Public +// Description: copier //////////////////////////////////////////////////////////////////// BaseParticleEmitter *RectangleEmitter:: make_copy() { @@ -58,9 +58,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : RectangleEmitter::assign_initial_position -// Access : Public -// Description : Generates a location for a new particle +// Function: RectangleEmitter::assign_initial_position +// Access: Public +// Description: Generates a location for a new particle //////////////////////////////////////////////////////////////////// void RectangleEmitter:: assign_initial_position(LPoint3& pos) { @@ -76,9 +76,9 @@ assign_initial_position(LPoint3& pos) { } //////////////////////////////////////////////////////////////////// -// Function : RectangleEmitter::assign_initial_velocity -// Access : Public -// Description : Generates a velocity for a new particle +// Function: RectangleEmitter::assign_initial_velocity +// Access: Public +// Description: Generates a velocity for a new particle //////////////////////////////////////////////////////////////////// void RectangleEmitter:: assign_initial_velocity(LVector3& vel) { @@ -86,10 +86,10 @@ assign_initial_velocity(LVector3& vel) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void RectangleEmitter:: output(ostream &out) const { @@ -99,10 +99,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void RectangleEmitter:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/ringEmitter.I b/panda/src/particlesystem/ringEmitter.I index 31d35afa5a..af683baa21 100644 --- a/panda/src/particlesystem/ringEmitter.I +++ b/panda/src/particlesystem/ringEmitter.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_radius -// Access : public -// Description : radius set +// Function: set_radius +// Access: Public +// Description: radius set //////////////////////////////////////////////////////////////////// INLINE void RingEmitter:: @@ -24,9 +24,9 @@ set_radius(PN_stdfloat r) { } //////////////////////////////////////////////////////////////////// -// Function : set_angle -// Access : public -// Description : angle of elevation set +// Function: set_angle +// Access: Public +// Description: angle of elevation set //////////////////////////////////////////////////////////////////// INLINE void RingEmitter:: @@ -35,9 +35,9 @@ set_angle(PN_stdfloat angle) { } //////////////////////////////////////////////////////////////////// -// Function : set_radius_spread -// Access : public -// Description : radius_spread set +// Function: set_radius_spread +// Access: Public +// Description: radius_spread set //////////////////////////////////////////////////////////////////// INLINE void RingEmitter:: @@ -46,9 +46,9 @@ set_radius_spread(PN_stdfloat spread) { } //////////////////////////////////////////////////////////////////// -// Function : set_uniform_emission -// Access : public -// Description : uniform_emission set +// Function: set_uniform_emission +// Access: Public +// Description: uniform_emission set //////////////////////////////////////////////////////////////////// INLINE void RingEmitter:: @@ -57,9 +57,9 @@ set_uniform_emission(int uniform_emission) { } //////////////////////////////////////////////////////////////////// -// Function : get_radius -// Access : public -// Description : radius get +// Function: get_radius +// Access: Public +// Description: radius get //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat RingEmitter:: @@ -68,9 +68,9 @@ get_radius() const { } //////////////////////////////////////////////////////////////////// -// Function : get_angle -// Access : public -// Description : angle of elevation get +// Function: get_angle +// Access: Public +// Description: angle of elevation get //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat RingEmitter:: @@ -79,9 +79,9 @@ get_angle() const { } //////////////////////////////////////////////////////////////////// -// Function : get_radius_spread -// Access : public -// Description : radius_spread get +// Function: get_radius_spread +// Access: Public +// Description: radius_spread get //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat RingEmitter:: @@ -90,9 +90,9 @@ get_radius_spread() const { } //////////////////////////////////////////////////////////////////// -// Function : get_uniform_emission -// Access : public -// Description : uniform_emission get +// Function: get_uniform_emission +// Access: Public +// Description: uniform_emission get //////////////////////////////////////////////////////////////////// INLINE int RingEmitter:: diff --git a/panda/src/particlesystem/ringEmitter.cxx b/panda/src/particlesystem/ringEmitter.cxx index 9037af4ebf..80101067a1 100644 --- a/panda/src/particlesystem/ringEmitter.cxx +++ b/panda/src/particlesystem/ringEmitter.cxx @@ -15,9 +15,9 @@ #include "ringEmitter.h" //////////////////////////////////////////////////////////////////// -// Function : RingEmitter -// Access : Public -// Description : constructor +// Function: RingEmitter +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// RingEmitter:: RingEmitter() : @@ -26,9 +26,9 @@ RingEmitter() : } //////////////////////////////////////////////////////////////////// -// Function : RingEmitter -// Access : Public -// Description : copy constructor +// Function: RingEmitter +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// RingEmitter:: RingEmitter(const RingEmitter ©) : @@ -44,18 +44,18 @@ RingEmitter(const RingEmitter ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~RingEmitter -// Access : Public -// Description : destructor +// Function: ~RingEmitter +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// RingEmitter:: ~RingEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : copier +// Function: make_copy +// Access: Public +// Description: copier //////////////////////////////////////////////////////////////////// BaseParticleEmitter *RingEmitter:: make_copy() { @@ -63,9 +63,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : RingEmitter::assign_initial_position -// Access : Public -// Description : Generates a location for a new particle +// Function: RingEmitter::assign_initial_position +// Access: Public +// Description: Generates a location for a new particle //////////////////////////////////////////////////////////////////// void RingEmitter:: assign_initial_position(LPoint3& pos) { @@ -75,7 +75,7 @@ assign_initial_position(LPoint3& pos) { if (_theta > 1.0) _theta = _theta - 1.0; } - else + else { _theta = NORMALIZED_RAND(); } @@ -91,9 +91,9 @@ assign_initial_position(LPoint3& pos) { } //////////////////////////////////////////////////////////////////// -// Function : RingEmitter::assign_initial_velocity -// Access : Public -// Description : Generates a velocity for a new particle +// Function: RingEmitter::assign_initial_velocity +// Access: Public +// Description: Generates a velocity for a new particle //////////////////////////////////////////////////////////////////// void RingEmitter:: assign_initial_velocity(LVector3& vel) { @@ -115,10 +115,10 @@ assign_initial_velocity(LVector3& vel) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void RingEmitter:: output(ostream &out) const { @@ -128,10 +128,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void RingEmitter:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/ringEmitter.h b/panda/src/particlesystem/ringEmitter.h index dbdee9e071..8b03012dc0 100644 --- a/panda/src/particlesystem/ringEmitter.h +++ b/panda/src/particlesystem/ringEmitter.h @@ -54,11 +54,9 @@ protected: int _uniform_emission; PN_stdfloat _theta; - /////////////////////////////// // scratch variables that carry over from position calc to velocity calc PN_stdfloat _sin_theta; PN_stdfloat _cos_theta; - /////////////////////////////// private: virtual void assign_initial_position(LPoint3& pos); diff --git a/panda/src/particlesystem/sparkleParticleRenderer.I b/panda/src/particlesystem/sparkleParticleRenderer.I index eca9f2df01..9c91b9cacb 100644 --- a/panda/src/particlesystem/sparkleParticleRenderer.I +++ b/panda/src/particlesystem/sparkleParticleRenderer.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_center_color -// Access : public +// Function: set_center_color +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SparkleParticleRenderer:: set_center_color(const LColor& c) { @@ -22,8 +22,8 @@ set_center_color(const LColor& c) { } //////////////////////////////////////////////////////////////////// -// Function : set_edge_color -// Access : public +// Function: set_edge_color +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SparkleParticleRenderer:: set_edge_color(const LColor& c) { @@ -31,8 +31,8 @@ set_edge_color(const LColor& c) { } //////////////////////////////////////////////////////////////////// -// Function : set_life_scale -// Access : public +// Function: set_life_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SparkleParticleRenderer:: set_life_scale(SparkleParticleRenderer::SparkleParticleLifeScale ls) { @@ -40,8 +40,8 @@ set_life_scale(SparkleParticleRenderer::SparkleParticleLifeScale ls) { } //////////////////////////////////////////////////////////////////// -// Function : set_birth_radius -// Access : public +// Function: set_birth_radius +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SparkleParticleRenderer:: set_birth_radius(PN_stdfloat radius) { @@ -49,8 +49,8 @@ set_birth_radius(PN_stdfloat radius) { } //////////////////////////////////////////////////////////////////// -// Function : set_death_radius -// Access : public +// Function: set_death_radius +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SparkleParticleRenderer:: set_death_radius(PN_stdfloat radius) { @@ -58,8 +58,8 @@ set_death_radius(PN_stdfloat radius) { } //////////////////////////////////////////////////////////////////// -// Function : get_center_color -// Access : public +// Function: get_center_color +// Access: Public //////////////////////////////////////////////////////////////////// INLINE const LColor& SparkleParticleRenderer:: get_center_color() const { @@ -67,8 +67,8 @@ get_center_color() const { } //////////////////////////////////////////////////////////////////// -// Function : get_edge_color -// Access : public +// Function: get_edge_color +// Access: Public //////////////////////////////////////////////////////////////////// INLINE const LColor& SparkleParticleRenderer:: get_edge_color() const { @@ -76,8 +76,8 @@ get_edge_color() const { } //////////////////////////////////////////////////////////////////// -// Function : get_life_scale -// Access : public +// Function: get_life_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE SparkleParticleRenderer::SparkleParticleLifeScale SparkleParticleRenderer:: get_life_scale() const { @@ -85,8 +85,8 @@ get_life_scale() const { } //////////////////////////////////////////////////////////////////// -// Function : get_birth_radius -// Access : public +// Function: get_birth_radius +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat SparkleParticleRenderer:: get_birth_radius() const { @@ -94,8 +94,8 @@ get_birth_radius() const { } //////////////////////////////////////////////////////////////////// -// Function : get_death_radius -// Access : public +// Function: get_death_radius +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat SparkleParticleRenderer:: get_death_radius() const { @@ -103,8 +103,8 @@ get_death_radius() const { } //////////////////////////////////////////////////////////////////// -// Function : get_radius -// Access : public +// Function: get_radius +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat SparkleParticleRenderer:: get_radius(BaseParticle *bp) { diff --git a/panda/src/particlesystem/sparkleParticleRenderer.cxx b/panda/src/particlesystem/sparkleParticleRenderer.cxx index 3827e74d0c..21adda99a8 100644 --- a/panda/src/particlesystem/sparkleParticleRenderer.cxx +++ b/panda/src/particlesystem/sparkleParticleRenderer.cxx @@ -23,9 +23,9 @@ PStatCollector SparkleParticleRenderer::_render_collector("App:Particles:Sparkle:Render"); //////////////////////////////////////////////////////////////////// -// Function : SparkleParticleRenderer -// Access : Public -// Description : Default Constructor +// Function: SparkleParticleRenderer +// Access: Public +// Description: Default Constructor //////////////////////////////////////////////////////////////////// SparkleParticleRenderer:: SparkleParticleRenderer() : @@ -38,9 +38,9 @@ SparkleParticleRenderer() : } //////////////////////////////////////////////////////////////////// -// Function : SparkleParticleRenderer -// Access : Public -// Description : Constructor +// Function: SparkleParticleRenderer +// Access: Public +// Description: Constructor //////////////////////////////////////////////////////////////////// SparkleParticleRenderer:: SparkleParticleRenderer(const LColor& center, const LColor& edge, @@ -55,9 +55,9 @@ SparkleParticleRenderer(const LColor& center, const LColor& edge, } //////////////////////////////////////////////////////////////////// -// Function : SparkleParticleRenderer -// Access : Public -// Description : Copy Constructor +// Function: SparkleParticleRenderer +// Access: Public +// Description: Copy Constructor //////////////////////////////////////////////////////////////////// SparkleParticleRenderer:: SparkleParticleRenderer(const SparkleParticleRenderer& copy) : @@ -72,18 +72,18 @@ SparkleParticleRenderer(const SparkleParticleRenderer& copy) : } //////////////////////////////////////////////////////////////////// -// Function : ~SparkleParticleRenderer -// Access : Public -// Description : Destructor +// Function: ~SparkleParticleRenderer +// Access: Public +// Description: Destructor //////////////////////////////////////////////////////////////////// SparkleParticleRenderer:: ~SparkleParticleRenderer() { } //////////////////////////////////////////////////////////////////// -// Function : make copy -// Access : Public -// Description : child virtual for spawning systems +// Function: make copy +// Access: Public +// Description: child virtual for spawning systems //////////////////////////////////////////////////////////////////// BaseParticleRenderer *SparkleParticleRenderer:: make_copy() { @@ -91,27 +91,27 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : birth_particle -// Access : Private, virtual -// Description : child birth +// Function: birth_particle +// Access: Private, Virtual +// Description: child birth //////////////////////////////////////////////////////////////////// void SparkleParticleRenderer:: birth_particle(int) { } //////////////////////////////////////////////////////////////////// -// Function : kill_particle -// Access : Private, virtual -// Description : child kill +// Function: kill_particle +// Access: Private, Virtual +// Description: child kill //////////////////////////////////////////////////////////////////// void SparkleParticleRenderer:: kill_particle(int) { } //////////////////////////////////////////////////////////////////// -// Function : resize_pool -// Access : private -// Description : resizes the render pool. Reference counting +// Function: resize_pool +// Access: Private +// Description: resizes the render pool. Reference counting // makes this easy. //////////////////////////////////////////////////////////////////// void SparkleParticleRenderer:: @@ -122,9 +122,9 @@ resize_pool(int new_size) { } //////////////////////////////////////////////////////////////////// -// Function : init_geoms -// Access : private -// Description : initializes the geomnodes +// Function: init_geoms +// Access: Private +// Description: initializes the geomnodes //////////////////////////////////////////////////////////////////// void SparkleParticleRenderer:: init_geoms() { @@ -142,9 +142,9 @@ init_geoms() { } //////////////////////////////////////////////////////////////////// -// Function : render -// Access : private -// Description : populates the GeomLine +// Function: render +// Access: Private +// Description: populates the GeomLine //////////////////////////////////////////////////////////////////// void SparkleParticleRenderer:: render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { @@ -250,7 +250,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { color.add_data4(edge_color); color.add_data4(center_color); color.add_data4(edge_color); - + _lines->add_next_vertices(2); _lines->close_primitive(); _lines->add_next_vertices(2); @@ -263,7 +263,7 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { _lines->close_primitive(); _lines->add_next_vertices(2); _lines->close_primitive(); - + remaining_particles--; if (remaining_particles == 0) { break; @@ -281,10 +281,10 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void SparkleParticleRenderer:: output(ostream &out) const { @@ -294,10 +294,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void SparkleParticleRenderer:: write(ostream &out, int indent_level) const { diff --git a/panda/src/particlesystem/sphereSurfaceEmitter.I b/panda/src/particlesystem/sphereSurfaceEmitter.I index ab31e44fdd..a1782d6919 100644 --- a/panda/src/particlesystem/sphereSurfaceEmitter.I +++ b/panda/src/particlesystem/sphereSurfaceEmitter.I @@ -15,9 +15,9 @@ #include "config_particlesystem.h" //////////////////////////////////////////////////////////////////// -// Function : set_radius -// Access : public -// Description : radius set +// Function: set_radius +// Access: Public +// Description: radius set //////////////////////////////////////////////////////////////////// INLINE void SphereSurfaceEmitter:: @@ -26,9 +26,9 @@ set_radius(PN_stdfloat r) { } //////////////////////////////////////////////////////////////////// -// Function : get_radius -// Access : public -// Description : radius get +// Function: get_radius +// Access: Public +// Description: radius get //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat SphereSurfaceEmitter:: diff --git a/panda/src/particlesystem/sphereSurfaceEmitter.cxx b/panda/src/particlesystem/sphereSurfaceEmitter.cxx index ce4dc0591f..44668ea7c3 100644 --- a/panda/src/particlesystem/sphereSurfaceEmitter.cxx +++ b/panda/src/particlesystem/sphereSurfaceEmitter.cxx @@ -15,9 +15,9 @@ #include "sphereSurfaceEmitter.h" //////////////////////////////////////////////////////////////////// -// Function : SphereSurfaceEmitter -// Access : Public -// Description : constructor +// Function: SphereSurfaceEmitter +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// SphereSurfaceEmitter:: SphereSurfaceEmitter() { @@ -25,9 +25,9 @@ SphereSurfaceEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : SphereSurfaceEmitter -// Access : Public -// Description : copy constructor +// Function: SphereSurfaceEmitter +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// SphereSurfaceEmitter:: SphereSurfaceEmitter(const SphereSurfaceEmitter ©) : @@ -36,18 +36,18 @@ SphereSurfaceEmitter(const SphereSurfaceEmitter ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~SphereSurfaceEmitter -// Access : Public -// Description : destructor +// Function: ~SphereSurfaceEmitter +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// SphereSurfaceEmitter:: ~SphereSurfaceEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : copier +// Function: make_copy +// Access: Public +// Description: copier //////////////////////////////////////////////////////////////////// BaseParticleEmitter *SphereSurfaceEmitter:: make_copy() { @@ -55,9 +55,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : SphereSurfaceEmitter::assign_initial_position -// Access : Public -// Description : Generates a location for a new particle +// Function: SphereSurfaceEmitter::assign_initial_position +// Access: Public +// Description: Generates a location for a new particle //////////////////////////////////////////////////////////////////// void SphereSurfaceEmitter:: assign_initial_position(LPoint3& pos) { @@ -71,9 +71,9 @@ assign_initial_position(LPoint3& pos) { } //////////////////////////////////////////////////////////////////// -// Function : SphereSurfaceEmitter::assign_initial_velocity -// Access : Public -// Description : Generates a velocity for a new particle +// Function: SphereSurfaceEmitter::assign_initial_velocity +// Access: Public +// Description: Generates a velocity for a new particle //////////////////////////////////////////////////////////////////// void SphereSurfaceEmitter:: assign_initial_velocity(LVector3& vel) { @@ -81,10 +81,10 @@ assign_initial_velocity(LVector3& vel) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void SphereSurfaceEmitter:: output(ostream &out) const { @@ -94,10 +94,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void SphereSurfaceEmitter:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/sphereVolumeEmitter.I b/panda/src/particlesystem/sphereVolumeEmitter.I index 9d52fa5858..e876e247f9 100644 --- a/panda/src/particlesystem/sphereVolumeEmitter.I +++ b/panda/src/particlesystem/sphereVolumeEmitter.I @@ -15,9 +15,9 @@ #include "config_particlesystem.h" //////////////////////////////////////////////////////////////////// -// Function : set_radius -// Access : public -// Description : radius set +// Function: set_radius +// Access: Public +// Description: radius set //////////////////////////////////////////////////////////////////// INLINE void SphereVolumeEmitter:: @@ -26,9 +26,9 @@ set_radius(PN_stdfloat r) { } //////////////////////////////////////////////////////////////////// -// Function : get_radius -// Access : public -// Description : radius get +// Function: get_radius +// Access: Public +// Description: radius get //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat SphereVolumeEmitter:: diff --git a/panda/src/particlesystem/sphereVolumeEmitter.cxx b/panda/src/particlesystem/sphereVolumeEmitter.cxx index 12a11cf764..5eda0bb648 100644 --- a/panda/src/particlesystem/sphereVolumeEmitter.cxx +++ b/panda/src/particlesystem/sphereVolumeEmitter.cxx @@ -15,9 +15,9 @@ #include "sphereVolumeEmitter.h" //////////////////////////////////////////////////////////////////// -// Function : SphereVolumeEmitter -// Access : Public -// Description : constructor +// Function: SphereVolumeEmitter +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// SphereVolumeEmitter:: SphereVolumeEmitter() { @@ -25,9 +25,9 @@ SphereVolumeEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : SphereVolumeEmitter -// Access : Public -// Description : copy constructor +// Function: SphereVolumeEmitter +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// SphereVolumeEmitter:: SphereVolumeEmitter(const SphereVolumeEmitter ©) : @@ -37,18 +37,18 @@ SphereVolumeEmitter(const SphereVolumeEmitter ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~SphereVolumeEmitter -// Access : Public -// Description : destructor +// Function: ~SphereVolumeEmitter +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// SphereVolumeEmitter:: ~SphereVolumeEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : copier +// Function: make_copy +// Access: Public +// Description: copier //////////////////////////////////////////////////////////////////// BaseParticleEmitter *SphereVolumeEmitter:: make_copy() { @@ -56,9 +56,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : SphereVolumeEmitter::assign_initial_position -// Access : Public -// Description : Generates a location for a new particle +// Function: SphereVolumeEmitter::assign_initial_position +// Access: Public +// Description: Generates a location for a new particle //////////////////////////////////////////////////////////////////// void SphereVolumeEmitter:: assign_initial_position(LPoint3& pos) { @@ -83,9 +83,9 @@ assign_initial_position(LPoint3& pos) { } //////////////////////////////////////////////////////////////////// -// Function : SphereVolumeEmitter::assign_initial_velocity -// Access : Public -// Description : Generates a velocity for a new particle +// Function: SphereVolumeEmitter::assign_initial_velocity +// Access: Public +// Description: Generates a velocity for a new particle //////////////////////////////////////////////////////////////////// void SphereVolumeEmitter:: assign_initial_velocity(LVector3& vel) { @@ -95,10 +95,10 @@ assign_initial_velocity(LVector3& vel) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void SphereVolumeEmitter:: output(ostream &out) const { @@ -108,10 +108,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void SphereVolumeEmitter:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/sphereVolumeEmitter.h b/panda/src/particlesystem/sphereVolumeEmitter.h index a3992e5c1c..32857c8ca4 100644 --- a/panda/src/particlesystem/sphereVolumeEmitter.h +++ b/panda/src/particlesystem/sphereVolumeEmitter.h @@ -42,10 +42,8 @@ private: // CUSTOM EMISSION PARAMETERS // none - /////////////////////////////// // scratch variables that carry over from position calc to velocity calc LPoint3 _particle_pos; - /////////////////////////////// virtual void assign_initial_position(LPoint3& pos); virtual void assign_initial_velocity(LVector3& vel); diff --git a/panda/src/particlesystem/spriteParticleRenderer.I b/panda/src/particlesystem/spriteParticleRenderer.I index aa9567661c..059e1c700f 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.I +++ b/panda/src/particlesystem/spriteParticleRenderer.I @@ -14,9 +14,9 @@ //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_texture -// Access : Published -// Description : Sets the renderer up to render the entire texture +// Function: SpriteParticleRenderer::set_texture +// Access: Published +// Description: Sets the renderer up to render the entire texture // image. The scale of each particle is based on the // size of the texture in each dimension, modified by // texels_per_unit. @@ -36,16 +36,16 @@ set_texture(Texture *tex, PN_stdfloat texels_per_unit) { // We scale the particle size by the size of the texture. set_size(tex->get_x_size() / texels_per_unit, tex->get_y_size() / texels_per_unit); - get_last_anim()->set_source_info(tex->get_filename()); + get_last_anim()->set_source_info(tex->get_filename()); } init_geoms(); } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::add_texture -// Access : Published -// Description : Adds texture to image pool, effectively creating a -// single frame animation that can be selected at +// Function: SpriteParticleRenderer::add_texture +// Access: Published +// Description: Adds texture to image pool, effectively creating a +// single frame animation that can be selected at // particle birth. This should only be called after // a previous call to set_texture(). //////////////////////////////////////////////////////////////////// @@ -70,9 +70,9 @@ add_texture(Texture *tex, PN_stdfloat texels_per_unit, bool resize) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::remove_animation -// Access : Published -// Description : Removes an animation texture set from the renderer. +// Function: SpriteParticleRenderer::remove_animation +// Access: Published +// Description: Removes an animation texture set from the renderer. //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: remove_animation(const int n) { @@ -91,9 +91,9 @@ remove_animation(const int n) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_ll_uv -// Access : public -// Description : Sets the UV coordinate of the lower-left corner of +// Function: SpriteParticleRenderer::set_ll_uv +// Access: Public +// Description: Sets the UV coordinate of the lower-left corner of // all the sprites generated by this renderer. Normally // this is (0, 0), but it might be set to something else // to use only a portion of the texture. @@ -104,9 +104,9 @@ set_ll_uv(const LTexCoord &ll_uv) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_ll_uv -// Access : public -// Description : Sets the UV coordinate of the lower-left corner of +// Function: SpriteParticleRenderer::set_ll_uv +// Access: Public +// Description: Sets the UV coordinate of the lower-left corner of // all the sprites generated by this renderer. Normally // this is (0, 0), but it might be set to something else // to use only a portion of the texture. @@ -119,9 +119,9 @@ set_ll_uv(const LTexCoord &ll_uv, const int anim, const int frame) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_ur_uv -// Access : public -// Description : Sets the UV coordinate of the upper-right corner of +// Function: SpriteParticleRenderer::set_ur_uv +// Access: Public +// Description: Sets the UV coordinate of the upper-right corner of // all the sprites generated by this renderer. Normally // this is (1, 1), but it might be set to something else // to use only a portion of the texture. @@ -132,9 +132,9 @@ set_ur_uv(const LTexCoord &ur_uv) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_ur_uv -// Access : public -// Description : Sets the UV coordinate of the upper-right corner of +// Function: SpriteParticleRenderer::set_ur_uv +// Access: Public +// Description: Sets the UV coordinate of the upper-right corner of // all the sprites generated by this renderer. Normally // this is (1, 1), but it might be set to something else // to use only a portion of the texture. @@ -147,9 +147,9 @@ set_ur_uv(const LTexCoord &ur_uv, const int anim, const int frame) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_size -// Access : public -// Description : Sets the size of each particle in world units. +// Function: SpriteParticleRenderer::set_size +// Access: Public +// Description: Sets the size of each particle in world units. //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: set_size(PN_stdfloat width, PN_stdfloat height) { @@ -159,8 +159,8 @@ set_size(PN_stdfloat width, PN_stdfloat height) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_color -// Access : public +// Function: SpriteParticleRenderer::set_color +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: set_color(const LColor &color) { @@ -169,8 +169,8 @@ set_color(const LColor &color) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_x_scale_flag -// Access : public +// Function: SpriteParticleRenderer::set_x_scale_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: set_x_scale_flag(bool animate_x_ratio) { @@ -179,8 +179,8 @@ set_x_scale_flag(bool animate_x_ratio) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_y_scale_flag -// Access : public +// Function: SpriteParticleRenderer::set_y_scale_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: set_y_scale_flag(bool animate_y_ratio) { @@ -189,8 +189,8 @@ set_y_scale_flag(bool animate_y_ratio) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_anim_angle_flag -// Access : public +// Function: SpriteParticleRenderer::set_anim_angle_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: set_anim_angle_flag(bool animate_theta) { @@ -199,8 +199,8 @@ set_anim_angle_flag(bool animate_theta) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_initial_x_scale -// Access : public +// Function: SpriteParticleRenderer::set_initial_x_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: set_initial_x_scale(PN_stdfloat initial_x_scale) { @@ -209,8 +209,8 @@ set_initial_x_scale(PN_stdfloat initial_x_scale) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_final_x_scale -// Access : public +// Function: SpriteParticleRenderer::set_final_x_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: set_final_x_scale(PN_stdfloat final_x_scale) { @@ -218,8 +218,8 @@ set_final_x_scale(PN_stdfloat final_x_scale) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_initial_y_scale -// Access : public +// Function: SpriteParticleRenderer::set_initial_y_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: set_initial_y_scale(PN_stdfloat initial_y_scale) { @@ -228,8 +228,8 @@ set_initial_y_scale(PN_stdfloat initial_y_scale) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_final_y_scale -// Access : public +// Function: SpriteParticleRenderer::set_final_y_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: set_final_y_scale(PN_stdfloat final_y_scale) { @@ -237,8 +237,8 @@ set_final_y_scale(PN_stdfloat final_y_scale) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_nonanimated_theta -// Access : public +// Function: SpriteParticleRenderer::set_nonanimated_theta +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: set_nonanimated_theta(PN_stdfloat theta) { @@ -247,8 +247,8 @@ set_nonanimated_theta(PN_stdfloat theta) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_alpha_blend_method -// Access : public +// Function: SpriteParticleRenderer::set_alpha_blend_method +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: set_alpha_blend_method(ParticleRendererBlendMethod bm) { @@ -256,8 +256,8 @@ set_alpha_blend_method(ParticleRendererBlendMethod bm) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_alpha_disable -// Access : public +// Function: SpriteParticleRenderer::set_alpha_disable +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: set_alpha_disable(bool ad) { @@ -265,8 +265,8 @@ set_alpha_disable(bool ad) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_animate_frames_enable -// Access : public +// Function: SpriteParticleRenderer::set_animate_frames_enable +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: set_animate_frames_enable(bool an) { @@ -274,8 +274,8 @@ set_animate_frames_enable(bool an) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_animate_frames_rate -// Access : public +// Function: SpriteParticleRenderer::set_animate_frames_rate +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: set_animate_frames_rate(PN_stdfloat r) { @@ -284,9 +284,8 @@ set_animate_frames_rate(PN_stdfloat r) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_animate_frames_index -// Access : public -// Purpose : Sets the frame to be used when animation is disabled. +// Function: SpriteParticleRenderer::set_animate_frames_index +// Access: Public// Purpose : Sets the frame to be used when animation is disabled. //////////////////////////////////////////////////////////////////// INLINE void SpriteParticleRenderer:: set_animate_frames_index(int i) { @@ -295,8 +294,8 @@ set_animate_frames_index(int i) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_texture -// Access : public +// Function: SpriteParticleRenderer::get_texture +// Access: Public //////////////////////////////////////////////////////////////////// INLINE Texture *SpriteParticleRenderer:: get_texture() const { @@ -304,8 +303,8 @@ get_texture() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_texture -// Access : public +// Function: SpriteParticleRenderer::get_texture +// Access: Public //////////////////////////////////////////////////////////////////// INLINE Texture *SpriteParticleRenderer:: get_texture(const int anim, const int frame) const { @@ -338,9 +337,9 @@ get_last_anim() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_ll_uv -// Access : public -// Description : Returns the UV coordinate of the lower-left corner; +// Function: SpriteParticleRenderer::get_ll_uv +// Access: Public +// Description: Returns the UV coordinate of the lower-left corner; // see set_ll_uv(). //////////////////////////////////////////////////////////////////// INLINE LTexCoord SpriteParticleRenderer:: @@ -349,9 +348,9 @@ get_ll_uv() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_ll_uv -// Access : public -// Description : Returns the UV coordinate of the lower-left corner; +// Function: SpriteParticleRenderer::get_ll_uv +// Access: Public +// Description: Returns the UV coordinate of the lower-left corner; // see set_ll_uv(). //////////////////////////////////////////////////////////////////// INLINE LTexCoord SpriteParticleRenderer:: @@ -362,9 +361,9 @@ get_ll_uv(const int anim, const int frame) const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_ur_uv -// Access : public -// Description : Returns the UV coordinate of the lower-left corner; +// Function: SpriteParticleRenderer::get_ur_uv +// Access: Public +// Description: Returns the UV coordinate of the lower-left corner; // see set_ur_uv(). //////////////////////////////////////////////////////////////////// INLINE LTexCoord SpriteParticleRenderer:: @@ -373,9 +372,9 @@ get_ur_uv() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_ur_uv -// Access : public -// Description : Returns the UV coordinate of the upper-right corner; +// Function: SpriteParticleRenderer::get_ur_uv +// Access: Public +// Description: Returns the UV coordinate of the upper-right corner; // see set_ur_uv(). //////////////////////////////////////////////////////////////////// INLINE LTexCoord SpriteParticleRenderer:: @@ -386,9 +385,9 @@ get_ur_uv(const int anim, const int frame) const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_width -// Access : public -// Description : Returns the width of each particle in world units. +// Function: SpriteParticleRenderer::get_width +// Access: Public +// Description: Returns the width of each particle in world units. //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat SpriteParticleRenderer:: get_width() const { @@ -396,9 +395,9 @@ get_width() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_height -// Access : public -// Description : Returns the height of each particle in world units. +// Function: SpriteParticleRenderer::get_height +// Access: Public +// Description: Returns the height of each particle in world units. //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat SpriteParticleRenderer:: get_height() const { @@ -406,8 +405,8 @@ get_height() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_color -// Access : public +// Function: SpriteParticleRenderer::get_color +// Access: Public //////////////////////////////////////////////////////////////////// INLINE LColor SpriteParticleRenderer:: get_color() const { @@ -415,8 +414,8 @@ get_color() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_x_scale_flag -// Access : public +// Function: SpriteParticleRenderer::get_x_scale_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE bool SpriteParticleRenderer:: get_x_scale_flag() const { @@ -424,8 +423,8 @@ get_x_scale_flag() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_y_scale_flag -// Access : public +// Function: SpriteParticleRenderer::get_y_scale_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE bool SpriteParticleRenderer:: get_y_scale_flag() const { @@ -433,8 +432,8 @@ get_y_scale_flag() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_anim_angle_flag -// Access : public +// Function: SpriteParticleRenderer::get_anim_angle_flag +// Access: Public //////////////////////////////////////////////////////////////////// INLINE bool SpriteParticleRenderer:: get_anim_angle_flag() const { @@ -442,8 +441,8 @@ get_anim_angle_flag() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_initial_x_scale -// Access : public +// Function: SpriteParticleRenderer::get_initial_x_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat SpriteParticleRenderer:: get_initial_x_scale() const { @@ -451,8 +450,8 @@ get_initial_x_scale() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_final_x_scale -// Access : public +// Function: SpriteParticleRenderer::get_final_x_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat SpriteParticleRenderer:: get_final_x_scale() const { @@ -460,8 +459,8 @@ get_final_x_scale() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_initial_y_scale -// Access : public +// Function: SpriteParticleRenderer::get_initial_y_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat SpriteParticleRenderer:: get_initial_y_scale() const { @@ -469,8 +468,8 @@ get_initial_y_scale() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_final_y_scale -// Access : public +// Function: SpriteParticleRenderer::get_final_y_scale +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat SpriteParticleRenderer:: get_final_y_scale() const { @@ -478,8 +477,8 @@ get_final_y_scale() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_nonanimated_theta -// Access : public +// Function: SpriteParticleRenderer::get_nonanimated_theta +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat SpriteParticleRenderer:: get_nonanimated_theta() const { @@ -487,8 +486,8 @@ get_nonanimated_theta() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_alpha_blend_method -// Access : public +// Function: SpriteParticleRenderer::get_alpha_blend_method +// Access: Public //////////////////////////////////////////////////////////////////// INLINE BaseParticleRenderer::ParticleRendererBlendMethod SpriteParticleRenderer:: get_alpha_blend_method() const { @@ -496,8 +495,8 @@ get_alpha_blend_method() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_alpha_disable -// Access : public +// Function: SpriteParticleRenderer::get_alpha_disable +// Access: Public //////////////////////////////////////////////////////////////////// INLINE bool SpriteParticleRenderer:: get_alpha_disable() const { @@ -505,8 +504,8 @@ get_alpha_disable() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_animate_frames_enable -// Access : public +// Function: SpriteParticleRenderer::get_animate_frames_enable +// Access: Public //////////////////////////////////////////////////////////////////// INLINE bool SpriteParticleRenderer:: get_animate_frames_enable() const { @@ -514,8 +513,8 @@ get_animate_frames_enable() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_animate_frames_rate -// Access : public +// Function: SpriteParticleRenderer::get_animate_frames_rate +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat SpriteParticleRenderer:: get_animate_frames_rate() const { @@ -523,9 +522,8 @@ get_animate_frames_rate() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_animate_frames_index -// Access : public -// Purpose : Gets the frame to be used when animation is disabled. +// Function: SpriteParticleRenderer::get_animate_frames_index +// Access: Public// Purpose : Gets the frame to be used when animation is disabled. //////////////////////////////////////////////////////////////////// INLINE int SpriteParticleRenderer:: get_animate_frames_index() const { @@ -533,8 +531,8 @@ get_animate_frames_index() const { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::get_color_interpolation_manager -// Access : public +// Function: SpriteParticleRenderer::get_color_interpolation_manager +// Access: Public //////////////////////////////////////////////////////////////////// INLINE ColorInterpolationManager* SpriteParticleRenderer:: get_color_interpolation_manager() const { diff --git a/panda/src/particlesystem/spriteParticleRenderer.cxx b/panda/src/particlesystem/spriteParticleRenderer.cxx index 7ddff5df5e..e0752a64e8 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.cxx +++ b/panda/src/particlesystem/spriteParticleRenderer.cxx @@ -34,9 +34,9 @@ PStatCollector SpriteParticleRenderer::_render_collector("App:Particles:Sprite:Render"); //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::SpriteParticleRenderer -// Access : public -// Description : constructor +// Function: SpriteParticleRenderer::SpriteParticleRenderer +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// SpriteParticleRenderer:: SpriteParticleRenderer(Texture *tex) : @@ -63,17 +63,17 @@ SpriteParticleRenderer(Texture *tex) : _color_interpolation_manager(new ColorInterpolationManager(_color)), _pool_size(0) { set_texture(tex); - init_geoms(); + init_geoms(); } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::SpriteParticleRenderer -// Access : public -// Description : copy constructor +// Function: SpriteParticleRenderer::SpriteParticleRenderer +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// SpriteParticleRenderer:: SpriteParticleRenderer(const SpriteParticleRenderer& copy) : - BaseParticleRenderer(copy), + BaseParticleRenderer(copy), _anims(copy._anims), _color(copy._color), _height(copy._height), @@ -101,9 +101,9 @@ SpriteParticleRenderer(const SpriteParticleRenderer& copy) : } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::~SpriteParticleRenderer -// Access : public -// Description : destructor +// Function: SpriteParticleRenderer::~SpriteParticleRenderer +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// SpriteParticleRenderer:: ~SpriteParticleRenderer() { @@ -111,9 +111,9 @@ SpriteParticleRenderer:: } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::make_copy -// Access : public -// Description : child dynamic copy +// Function: SpriteParticleRenderer::make_copy +// Access: Public +// Description: child dynamic copy //////////////////////////////////////////////////////////////////// BaseParticleRenderer *SpriteParticleRenderer:: make_copy() { @@ -122,9 +122,9 @@ make_copy() { //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::extract_textures_from_node -// Access : public -// Description : Pull either a set of textures from a SequenceNode or +// Function: SpriteParticleRenderer::extract_textures_from_node +// Access: Public +// Description: Pull either a set of textures from a SequenceNode or // a single texture from a GeomNode. This function is called // in both set_from_node() and add_from_node(). Notice the // second parameter. This nodepath will reference the GeomNode @@ -162,14 +162,14 @@ extract_textures_from_node(const NodePath &node_path, NodePathCollection &np_col } // If a sequence node is not found, we just want to look for a regular geom node. - if (geom_node_path.is_empty()) { + if (geom_node_path.is_empty()) { // Find the first GeomNode. if (!node_path.is_empty() && node_path.node()->get_type() != GeomNode::get_class_type()) { geom_node_path = node_path.find("**/+GeomNode"); if (geom_node_path.is_empty()) { particlesystem_cat.error(); return 0; - } + } } else { geom_node_path = node_path; } @@ -188,14 +188,14 @@ extract_textures_from_node(const NodePath &node_path, NodePathCollection &np_col } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_from_node -// Access : public -// Description : If the source type is important, use this one. +// Function: SpriteParticleRenderer::set_from_node +// Access: Public +// Description: If the source type is important, use this one. // // model and node should lead to node_path like this: // node_path = loader.loadModel(model).find(node) // -// This will remove all previously add textures and +// This will remove all previously add textures and // resize the renderer to match the new geometry. //////////////////////////////////////////////////////////////////// void SpriteParticleRenderer:: @@ -206,9 +206,9 @@ set_from_node(const NodePath &node_path, const string &model, const string &node } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::set_from_node -// Access : public -// Description : Sets the properties on this renderer from the geometry +// Function: SpriteParticleRenderer::set_from_node +// Access: Public +// Description: Sets the properties on this renderer from the geometry // referenced by the indicated NodePath. This should be // a reference to a GeomNode or a SequenceNode; it // extracts out the texture and UV range from the node. @@ -221,16 +221,16 @@ set_from_node(const NodePath &node_path, const string &model, const string &node // the texture, its size, and UV data will be extracted // from that. // -// If node_path references a SequenceNode(or has one -// beneath it) with multiple GeomNodes beneath it, -// the size data will correspond only to the first +// If node_path references a SequenceNode(or has one +// beneath it) with multiple GeomNodes beneath it, +// the size data will correspond only to the first // GeomNode found with a valid texture, while the texture // and UV information will be stored for each individual // node. // // If size_from_texels is true, the particle size is // based on the number of texels in the source image; -// otherwise, it is based on the size of the first +// otherwise, it is based on the size of the first // polygon found in the node. // // model and node are the two items used to construct @@ -246,9 +246,9 @@ set_from_node(const NodePath &node_path, bool size_from_texels) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::add_from_node -// Access : public -// Description : This will allow the renderer to randomly choose +// Function: SpriteParticleRenderer::add_from_node +// Access: Public +// Description: This will allow the renderer to randomly choose // from more than one texture or sequence at particle // birth. // @@ -257,9 +257,9 @@ set_from_node(const NodePath &node_path, bool size_from_texels) { // model and node should lead to node_path like this: // node_path = loader.loadModel(model).find(node) // -// If resize is true, or if there are no textures -// currently on the renderer, it will force the -// renderer to use the size information from this +// If resize is true, or if there are no textures +// currently on the renderer, it will force the +// renderer to use the size information from this // node from now on. (Default is false) //////////////////////////////////////////////////////////////////// void SpriteParticleRenderer:: @@ -274,15 +274,15 @@ add_from_node(const NodePath &node_path, const string &model, const string &node } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::add_from_node -// Access : public -// Description : This will allow the renderer to randomly choose +// Function: SpriteParticleRenderer::add_from_node +// Access: Public +// Description: This will allow the renderer to randomly choose // from more than one texture or sequence at particle // birth. // -// If resize is true, or if there are no textures -// currently on the renderer, it will force the -// renderer to use the size information from this +// If resize is true, or if there are no textures +// currently on the renderer, it will force the +// renderer to use the size information from this // node from now on. (Default is false) //////////////////////////////////////////////////////////////////// void SpriteParticleRenderer:: @@ -304,16 +304,16 @@ add_from_node(const NodePath &node_path, bool size_from_texels, bool resize) { for (int i = 0; i < np_col.get_num_paths(); ++i) { // Get the node from which we'll extract the geometry information. - gnode = DCAST(GeomNode, np_col[i].node()); - + gnode = DCAST(GeomNode, np_col[i].node()); + // Now examine the UV's of the first Geom within the GeomNode. nassertv(gnode->get_num_geoms() > 0); geom = gnode->get_geom(0); - + bool got_texcoord = false; LTexCoord min_uv(0.0f, 0.0f); LTexCoord max_uv(0.0f, 0.0f); - + GeomVertexReader texcoord(geom->get_vertex_data(), InternalName::get_texcoord()); if (texcoord.has_column()) { @@ -322,11 +322,11 @@ add_from_node(const NodePath &node_path, bool size_from_texels, bool resize) { for (int vi = 0; vi < primitive->get_num_vertices(); ++vi) { int vert = primitive->get_vertex(vi); texcoord.set_row_unsafe(vert); - + if (!got_texcoord) { min_uv = max_uv = texcoord.get_data2(); got_texcoord = true; - + } else { const LVecBase2 &uv = texcoord.get_data2(); @@ -338,7 +338,7 @@ add_from_node(const NodePath &node_path, bool size_from_texels, bool resize) { } } } - + if (got_texcoord) { // We don't really pay attention to orientation of UV's here; a // minor flaw. We assume the minimum is in the lower-left, and @@ -347,7 +347,7 @@ add_from_node(const NodePath &node_path, bool size_from_texels, bool resize) { ur.push_back(max_uv); } } - + _anims.push_back(new SpriteAnim(tex_col,ll,ur)); if (resize) { @@ -357,7 +357,7 @@ add_from_node(const NodePath &node_path, bool size_from_texels, bool resize) { bool got_vertex = false; LVertex min_xyz(0.0f, 0.0f, 0.0f); LVertex max_xyz(0.0f, 0.0f, 0.0f); - + GeomVertexReader vertex(geom->get_vertex_data(), InternalName::get_vertex()); if (vertex.has_column()) { @@ -366,14 +366,14 @@ add_from_node(const NodePath &node_path, bool size_from_texels, bool resize) { for (int vi = 0; vi < primitive->get_num_vertices(); ++vi) { int vert = primitive->get_vertex(vi); vertex.set_row_unsafe(vert); - + if (!got_vertex) { min_xyz = max_xyz = vertex.get_data3(); got_vertex = true; - + } else { const LVecBase3 &xyz = vertex.get_data3(); - + min_xyz[0] = min(min_xyz[0], xyz[0]); max_xyz[0] = max(max_xyz[0], xyz[0]); min_xyz[1] = min(min_xyz[1], xyz[1]); @@ -389,7 +389,7 @@ add_from_node(const NodePath &node_path, bool size_from_texels, bool resize) { PN_stdfloat width = max_xyz[0] - min_xyz[0]; PN_stdfloat height = max(max_xyz[1] - min_xyz[1], max_xyz[2] - min_xyz[2]); - + if (size_from_texels) { // If size_from_texels is true, we get the particle size from the // number of texels in the source image. @@ -400,7 +400,7 @@ add_from_node(const NodePath &node_path, bool size_from_texels, bool resize) { // the size of the polygon. set_size(width, height); } - + } else { // With no vertices, just punt. set_size(1.0f, 1.0f); @@ -411,22 +411,22 @@ add_from_node(const NodePath &node_path, bool size_from_texels, bool resize) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::resize_pool -// Access : private -// Description : reallocate the vertex pool. +// Function: SpriteParticleRenderer::resize_pool +// Access: Private +// Description: reallocate the vertex pool. //////////////////////////////////////////////////////////////////// void SpriteParticleRenderer:: resize_pool(int new_size) { if (new_size != _pool_size) { - _pool_size = new_size; + _pool_size = new_size; init_geoms(); } } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::init_geoms -// Access : public -// Description : initializes everything, called on traumatic events +// Function: SpriteParticleRenderer::init_geoms +// Access: Public +// Description: initializes everything, called on traumatic events // such as construction and serious particlesystem // modifications //////////////////////////////////////////////////////////////////// @@ -441,7 +441,7 @@ init_geoms() { PT(GeomVertexArrayFormat) array_format = new GeomVertexArrayFormat (InternalName::get_vertex(), 3, Geom::NT_stdfloat, Geom::C_point, InternalName::get_color(), 1, Geom::NT_packed_dabc, Geom::C_color); - + if (_animate_theta || _theta != 0.0f) { array_format->add_column (InternalName::get_rotate(), 1, Geom::NT_stdfloat, Geom::C_other); @@ -449,26 +449,26 @@ init_geoms() { _base_y_scale = _initial_y_scale; _aspect_ratio = _width / _height; - + PN_stdfloat final_x_scale = _animate_x_ratio ? _final_x_scale : _initial_x_scale; PN_stdfloat final_y_scale = _animate_y_ratio ? _final_y_scale : _initial_y_scale; - + if (_animate_y_ratio) { _base_y_scale = max(_initial_y_scale, _final_y_scale); array_format->add_column (InternalName::get_size(), 1, Geom::NT_stdfloat, Geom::C_other); } - + if (_aspect_ratio * _initial_x_scale != _initial_y_scale || _aspect_ratio * final_x_scale != final_y_scale) { array_format->add_column (InternalName::get_aspect_ratio(), 1, Geom::NT_stdfloat, Geom::C_other); } - + CPT(GeomVertexFormat) format = GeomVertexFormat::register_format (new GeomVertexFormat(array_format)); - + // Reset render() data structures for (i = 0; i < (int)_ttl_count.size(); ++i) { PANDA_FREE_ARRAY(_ttl_count[i]); @@ -489,7 +489,7 @@ init_geoms() { // For each animation... for (i = 0; i < anim_count; ++i) { anim = _anims[i]; - _anim_size[i] = anim->get_num_frames(); + _anim_size[i] = anim->get_num_frames(); _sprite_primitive.push_back(pvector()); _sprites.push_back(pvector()); @@ -504,15 +504,15 @@ init_geoms() { _sprite_primitive[i].push_back((Geom*)geom); _sprites[i].push_back(new GeomPoints(Geom::UH_stream)); geom->add_primitive(_sprites[i][j]); - - // This will be overwritten in render(), but we had to have some initial value + + // This will be overwritten in render(), but we had to have some initial value _sprite_writer[i].push_back(SpriteWriter()); state = state->add_attrib(RenderModeAttrib::make(RenderModeAttrib::M_unchanged, _base_y_scale * _height, true)); if (anim->get_frame(j) != (Texture *)NULL) { state = state->add_attrib(TextureAttrib::make(anim->get_frame(j))); state = state->add_attrib(TexGenAttrib::make(TextureStage::get_default(), TexGenAttrib::M_point_sprite)); - + // Build a transform to convert the texture coordinates to the // ll, ur space. LPoint2 ul(anim->get_ll(j)[0], anim->get_ur(j)[1]); @@ -531,9 +531,9 @@ init_geoms() { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::birth_particle -// Access : private -// Description : child birth, one of those 'there-if-we-want-it' +// Function: SpriteParticleRenderer::birth_particle +// Access: Private +// Description: child birth, one of those 'there-if-we-want-it' // things. not really too useful here, so it turns // out we don't really want it. //////////////////////////////////////////////////////////////////// @@ -543,27 +543,27 @@ birth_particle(int index) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::kill_particle -// Access : private -// Description : child death +// Function: SpriteParticleRenderer::kill_particle +// Access: Private +// Description: child death //////////////////////////////////////////////////////////////////// void SpriteParticleRenderer:: kill_particle(int) { } //////////////////////////////////////////////////////////////////// -// Function : SpriteParticleRenderer::render -// Access : private -// Description : big child render. populates the geom node. +// Function: SpriteParticleRenderer::render +// Access: Private +// Description: big child render. populates the geom node. //////////////////////////////////////////////////////////////////// void SpriteParticleRenderer:: -render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { +render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { PStatTimer t1(_render_collector); // There is no texture data available, exit. if (_anims.empty()) { return; } - + BaseParticle *cur_particle; int remaining_particles = ttl_particles; int i,j; // loop counters @@ -575,10 +575,10 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { for (vector_int::iterator vIter = _birth_list.begin(); vIter != _birth_list.end(); ++vIter) { cur_particle = (BaseParticle*)po_vector[*vIter].p(); i = int(NORMALIZED_RAND()*anim_count); - + // If there are multiple animations to choose from, choose one at random for this new particle cur_particle->set_index(i < anim_count?i:i-1); - + // This is an experimental age offset so that the animations don't appear synchronized. // If we are using animations, try to vary the frame flipping a bit for particles in the same litter. // A similar effect might be a achieved by using a small lifespan spread value on the factory. @@ -591,9 +591,9 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { } } _birth_list.clear(); - + // Create vertex writers for each of the possible geoms. - // Could possibly be changed to only create writers for geoms that would be used + // Could possibly be changed to only create writers for geoms that would be used // according to the animation configuration. for (i = 0; i < anim_count; ++i) { for (j = 0; j < _anim_size[i]; ++j) { @@ -684,19 +684,19 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { c[3] *= get_user_alpha(); } } - + // Send the data on its way... _sprite_writer[anim_index][frame].vertex.add_data3(position); _sprite_writer[anim_index][frame].color.add_data4(c); - + PN_stdfloat current_x_scale = _initial_x_scale; PN_stdfloat current_y_scale = _initial_y_scale; - + if (_animate_x_ratio || _animate_y_ratio) { if (_blend_method == PP_BLEND_CUBIC) { t = CUBIC_T(t); } - + if (_animate_x_ratio) { current_x_scale = (_initial_x_scale + (t * (_final_x_scale - _initial_x_scale))); @@ -727,11 +727,11 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { } int n = 0; GeomNode *render_node = get_render_node(); - + for (i = 0; i < anim_count; ++i) { for (j = 0; j < _anim_size[i]; ++j) { _sprites[i][j]->clear_vertices(); - _sprite_writer[i][j].clear(); + _sprite_writer[i][j].clear(); // We have to reassign the GeomVertexData and GeomPrimitive to // the Geom, and the Geom to the GeomNode, in case it got @@ -774,10 +774,10 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void SpriteParticleRenderer:: output(ostream &out) const { @@ -787,10 +787,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void SpriteParticleRenderer:: write(ostream &out, int indent_level) const { diff --git a/panda/src/particlesystem/tangentRingEmitter.I b/panda/src/particlesystem/tangentRingEmitter.I index 9d4bc86787..9c829c55da 100644 --- a/panda/src/particlesystem/tangentRingEmitter.I +++ b/panda/src/particlesystem/tangentRingEmitter.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_radius -// Access : public +// Function: set_radius +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void TangentRingEmitter:: set_radius(PN_stdfloat r) { @@ -22,8 +22,8 @@ set_radius(PN_stdfloat r) { } //////////////////////////////////////////////////////////////////// -// Function : set_radius_spread -// Access : public +// Function: set_radius_spread +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void TangentRingEmitter:: set_radius_spread(PN_stdfloat spread) { @@ -31,8 +31,8 @@ set_radius_spread(PN_stdfloat spread) { } //////////////////////////////////////////////////////////////////// -// Function : get_radius -// Access : public +// Function: get_radius +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat TangentRingEmitter:: get_radius() const { @@ -40,8 +40,8 @@ get_radius() const { } //////////////////////////////////////////////////////////////////// -// Function : get_radius_spread -// Access : public +// Function: get_radius_spread +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat TangentRingEmitter:: get_radius_spread() const { diff --git a/panda/src/particlesystem/tangentRingEmitter.cxx b/panda/src/particlesystem/tangentRingEmitter.cxx index 0f23472586..359f5fa5f2 100644 --- a/panda/src/particlesystem/tangentRingEmitter.cxx +++ b/panda/src/particlesystem/tangentRingEmitter.cxx @@ -15,9 +15,9 @@ #include "tangentRingEmitter.h" //////////////////////////////////////////////////////////////////// -// Function : tangentRingEmitter -// Access : public -// Description : constructor +// Function: tangentRingEmitter +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// TangentRingEmitter:: TangentRingEmitter() { @@ -26,9 +26,9 @@ TangentRingEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : tangentRingEmitter -// Access : public -// Description : copy constructor +// Function: tangentRingEmitter +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// TangentRingEmitter:: TangentRingEmitter(const TangentRingEmitter ©) : @@ -38,18 +38,18 @@ TangentRingEmitter(const TangentRingEmitter ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~tangentringemitter -// Access : public, virtual -// Description : destructor +// Function: ~tangentringemitter +// Access: Public, Virtual +// Description: destructor //////////////////////////////////////////////////////////////////// TangentRingEmitter:: ~TangentRingEmitter() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : public, virtual -// Description : child copier +// Function: make_copy +// Access: Public, Virtual +// Description: child copier //////////////////////////////////////////////////////////////////// BaseParticleEmitter *TangentRingEmitter:: make_copy() { @@ -57,9 +57,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : TangentRingEmitter::assign_initial_position -// Access : Public -// Description : Generates a location for a new particle +// Function: TangentRingEmitter::assign_initial_position +// Access: Public +// Description: Generates a location for a new particle //////////////////////////////////////////////////////////////////// void TangentRingEmitter:: assign_initial_position(LPoint3& pos) { @@ -73,9 +73,9 @@ assign_initial_position(LPoint3& pos) { } //////////////////////////////////////////////////////////////////// -// Function : TangentRingEmitter::assign_initial_velocity -// Access : Public -// Description : Generates a velocity for a new particle +// Function: TangentRingEmitter::assign_initial_velocity +// Access: Public +// Description: Generates a velocity for a new particle //////////////////////////////////////////////////////////////////// void TangentRingEmitter:: assign_initial_velocity(LVector3& vel) { @@ -83,10 +83,10 @@ assign_initial_velocity(LVector3& vel) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void TangentRingEmitter:: output(ostream &out) const { @@ -96,10 +96,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void TangentRingEmitter:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/tangentRingEmitter.h b/panda/src/particlesystem/tangentRingEmitter.h index 20bf70abc7..90110c0c03 100644 --- a/panda/src/particlesystem/tangentRingEmitter.h +++ b/panda/src/particlesystem/tangentRingEmitter.h @@ -47,11 +47,9 @@ private: // CUSTOM EMISSION PARAMETERS // none - /////////////////////////////// // scratch variables that carry over from position calc to velocity calc PN_stdfloat _x; PN_stdfloat _y; - /////////////////////////////// virtual void assign_initial_position(LPoint3& pos); virtual void assign_initial_velocity(LVector3& vel); diff --git a/panda/src/particlesystem/zSpinParticle.I b/panda/src/particlesystem/zSpinParticle.I index 75fd050591..9ffd006e9c 100644 --- a/panda/src/particlesystem/zSpinParticle.I +++ b/panda/src/particlesystem/zSpinParticle.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_initial_angle -// Description : accessor +// Function: set_initial_angle +// Description: accessor //////////////////////////////////////////////////////////////////// INLINE void ZSpinParticle:: set_initial_angle(PN_stdfloat t) { @@ -22,8 +22,8 @@ set_initial_angle(PN_stdfloat t) { } //////////////////////////////////////////////////////////////////// -// Function : get_initial_angle -// Description : accessor +// Function: get_initial_angle +// Description: accessor //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ZSpinParticle:: get_initial_angle() const { @@ -31,8 +31,8 @@ get_initial_angle() const { } //////////////////////////////////////////////////////////////////// -// Function : set_final_angle -// Description : accessor +// Function: set_final_angle +// Description: accessor //////////////////////////////////////////////////////////////////// INLINE void ZSpinParticle:: set_final_angle(PN_stdfloat t) { @@ -40,8 +40,8 @@ set_final_angle(PN_stdfloat t) { } //////////////////////////////////////////////////////////////////// -// Function : get_final_angle -// Description : accessor +// Function: get_final_angle +// Description: accessor //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ZSpinParticle:: get_final_angle() const { diff --git a/panda/src/particlesystem/zSpinParticle.cxx b/panda/src/particlesystem/zSpinParticle.cxx index 23c9e618de..bf552d5560 100644 --- a/panda/src/particlesystem/zSpinParticle.cxx +++ b/panda/src/particlesystem/zSpinParticle.cxx @@ -16,9 +16,9 @@ #include "cmath.h" //////////////////////////////////////////////////////////////////// -// Function : ZSpinParticle -// Access : public -// Description : constructor +// Function: ZSpinParticle +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// ZSpinParticle:: ZSpinParticle() : @@ -31,9 +31,9 @@ ZSpinParticle() : } //////////////////////////////////////////////////////////////////// -// Function : ZSpinParticle -// Access : public -// Description : copy constructor +// Function: ZSpinParticle +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// ZSpinParticle:: ZSpinParticle(const ZSpinParticle ©) : @@ -46,18 +46,18 @@ ZSpinParticle(const ZSpinParticle ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~ZSpinParticle -// Access : public, virtual -// Description : destructor +// Function: ~ZSpinParticle +// Access: Public, Virtual +// Description: destructor //////////////////////////////////////////////////////////////////// ZSpinParticle:: ~ZSpinParticle() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : public, virtual -// Description : dynamic copier +// Function: make_copy +// Access: Public, Virtual +// Description: dynamic copier //////////////////////////////////////////////////////////////////// PhysicsObject *ZSpinParticle:: make_copy() const { @@ -65,18 +65,18 @@ make_copy() const { } //////////////////////////////////////////////////////////////////// -// Function : init -// Access : public, virtual -// Description : +// Function: init +// Access: Public, Virtual +// Description: //////////////////////////////////////////////////////////////////// void ZSpinParticle:: init() { } //////////////////////////////////////////////////////////////////// -// Function : update -// Access : public, virtual -// Description : +// Function: update +// Access: Public, Virtual +// Description: //////////////////////////////////////////////////////////////////// void ZSpinParticle:: update() { @@ -102,18 +102,18 @@ update() { } //////////////////////////////////////////////////////////////////// -// Function : die -// Access : public, virtual -// Description : +// Function: die +// Access: Public, Virtual +// Description: //////////////////////////////////////////////////////////////////// void ZSpinParticle:: die() { } //////////////////////////////////////////////////////////////////// -// Function : get_theta -// Access : public, virtual -// Description : +// Function: get_theta +// Access: Public, Virtual +// Description: //////////////////////////////////////////////////////////////////// PN_stdfloat ZSpinParticle:: get_theta() const { @@ -121,10 +121,10 @@ get_theta() const { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ZSpinParticle:: output(ostream &out) const { @@ -134,10 +134,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ZSpinParticle:: write(ostream &out, int indent) const { diff --git a/panda/src/particlesystem/zSpinParticleFactory.I b/panda/src/particlesystem/zSpinParticleFactory.I index 365e0aabf0..f11a4c7882 100644 --- a/panda/src/particlesystem/zSpinParticleFactory.I +++ b/panda/src/particlesystem/zSpinParticleFactory.I @@ -14,8 +14,8 @@ //////////////////////////////////////////////////////////////////// -// Function : set_initial_angle -// Access : public +// Function: set_initial_angle +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ZSpinParticleFactory:: set_initial_angle(PN_stdfloat angle) { @@ -23,8 +23,8 @@ set_initial_angle(PN_stdfloat angle) { } //////////////////////////////////////////////////////////////////// -// Function : set_final_angle -// Access : public +// Function: set_final_angle +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ZSpinParticleFactory:: set_final_angle(PN_stdfloat angle) { @@ -32,8 +32,8 @@ set_final_angle(PN_stdfloat angle) { } //////////////////////////////////////////////////////////////////// -// Function : set_initial_angle_spread -// Access : public +// Function: set_initial_angle_spread +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ZSpinParticleFactory:: set_initial_angle_spread(PN_stdfloat spread) { @@ -41,8 +41,8 @@ set_initial_angle_spread(PN_stdfloat spread) { } //////////////////////////////////////////////////////////////////// -// Function : set_final_angle_spread -// Access : public +// Function: set_final_angle_spread +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ZSpinParticleFactory:: set_final_angle_spread(PN_stdfloat spread) { @@ -50,8 +50,8 @@ set_final_angle_spread(PN_stdfloat spread) { } //////////////////////////////////////////////////////////////////// -// Function : get_initial_angle -// Access : public +// Function: get_initial_angle +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ZSpinParticleFactory:: get_initial_angle() const { @@ -59,8 +59,8 @@ get_initial_angle() const { } //////////////////////////////////////////////////////////////////// -// Function : get_final_angle -// Access : public +// Function: get_final_angle +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ZSpinParticleFactory:: get_final_angle() const { @@ -68,8 +68,8 @@ get_final_angle() const { } //////////////////////////////////////////////////////////////////// -// Function : get_initial_angle_spread -// Access : public +// Function: get_initial_angle_spread +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ZSpinParticleFactory:: get_initial_angle_spread() const { @@ -77,8 +77,8 @@ get_initial_angle_spread() const { } //////////////////////////////////////////////////////////////////// -// Function : get_final_angle_spread -// Access : public +// Function: get_final_angle_spread +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ZSpinParticleFactory:: get_final_angle_spread() const { @@ -86,8 +86,8 @@ get_final_angle_spread() const { } //////////////////////////////////////////////////////////////////// -// Function : get_angular_velocity -// Access : public +// Function: get_angular_velocity +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat ZSpinParticleFactory:: get_angular_velocity() const { diff --git a/panda/src/particlesystem/zSpinParticleFactory.cxx b/panda/src/particlesystem/zSpinParticleFactory.cxx index 3573b4d933..86a4c915bb 100644 --- a/panda/src/particlesystem/zSpinParticleFactory.cxx +++ b/panda/src/particlesystem/zSpinParticleFactory.cxx @@ -16,9 +16,9 @@ #include "zSpinParticle.h" //////////////////////////////////////////////////////////////////// -// Function : ZSpinParticleFactory -// Access : public -// Description : constructor +// Function: ZSpinParticleFactory +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// ZSpinParticleFactory:: ZSpinParticleFactory() : @@ -33,9 +33,9 @@ ZSpinParticleFactory() : } //////////////////////////////////////////////////////////////////// -// Function : ZSpinParticleFactory -// Access : public -// Description : copy constructor +// Function: ZSpinParticleFactory +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// ZSpinParticleFactory:: ZSpinParticleFactory(const ZSpinParticleFactory ©) : @@ -50,18 +50,18 @@ ZSpinParticleFactory(const ZSpinParticleFactory ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~ZSpinParticleFactory -// Access : virtual, public -// Description : destructor +// Function: ~ZSpinParticleFactory +// Access: Virtual, Public +// Description: destructor //////////////////////////////////////////////////////////////////// ZSpinParticleFactory:: ~ZSpinParticleFactory() { } //////////////////////////////////////////////////////////////////// -// Function : alloc_particle -// Access : private, virtual -// Description : factory method +// Function: alloc_particle +// Access: Private, Virtual +// Description: factory method //////////////////////////////////////////////////////////////////// BaseParticle *ZSpinParticleFactory:: alloc_particle() const { @@ -69,9 +69,9 @@ alloc_particle() const { } //////////////////////////////////////////////////////////////////// -// Function : populate_child_particle -// Access : private, virtual -// Description : factory populator +// Function: populate_child_particle +// Access: Private, Virtual +// Description: factory populator //////////////////////////////////////////////////////////////////// void ZSpinParticleFactory:: populate_child_particle(BaseParticle *bp) const { @@ -84,10 +84,10 @@ populate_child_particle(BaseParticle *bp) const { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ZSpinParticleFactory:: output(ostream &out) const { @@ -97,10 +97,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ZSpinParticleFactory:: write(ostream &out, int indent) const { diff --git a/panda/src/pgraph/compassEffect.I b/panda/src/pgraph/compassEffect.I index 5fe8ea7b8b..115f12cf54 100644 --- a/panda/src/pgraph/compassEffect.I +++ b/panda/src/pgraph/compassEffect.I @@ -39,11 +39,9 @@ get_reference() const { //////////////////////////////////////////////////////////////////// // Function: CompassEffect::get_properties // Access: Published -// Description: - -// Returns the bitmask of properties that this -// CompassEffect object inherits from its reference node -// (or from the root). +// Description: Returns the bitmask of properties that this +// CompassEffect object inherits from its reference +// node (or from the root). //////////////////////////////////////////////////////////////////// INLINE int CompassEffect:: get_properties() const { diff --git a/panda/src/pgraph/cullBinManager.I b/panda/src/pgraph/cullBinManager.I index 94aa3fc0da..0ba7368060 100644 --- a/panda/src/pgraph/cullBinManager.I +++ b/panda/src/pgraph/cullBinManager.I @@ -334,7 +334,7 @@ set_bin_flash_active(int bin_index, bool active) { // Function: CullBinManager::set_bin_flash_color // Access: Published // Description: Changes the flash color for the given bin index. - +// // This method is not available in release builds. //////////////////////////////////////////////////////////////////// INLINE void CullBinManager:: diff --git a/panda/src/pgraph/findApproxPath.h b/panda/src/pgraph/findApproxPath.h index 3e422048ed..4b502e55e8 100644 --- a/panda/src/pgraph/findApproxPath.h +++ b/panda/src/pgraph/findApproxPath.h @@ -1,4 +1,4 @@ -// Filename: FindApproxPath.h +// Filename: findApproxPath.h // Created by: drose (13Mar02) // //////////////////////////////////////////////////////////////////// @@ -45,7 +45,7 @@ public: void add_match_inexact_type(TypeHandle type, int flags); void add_match_tag(const string &key, int flags); void add_match_tag_value(const string &key, const string &value, int flags); - + void add_match_one(int flags); void add_match_many(int flags); void add_match_pointer(PandaNode *pointer, int flags); diff --git a/panda/src/pgraph/modelNode.cxx b/panda/src/pgraph/modelNode.cxx index ec4057a227..890d1b0cb8 100644 --- a/panda/src/pgraph/modelNode.cxx +++ b/panda/src/pgraph/modelNode.cxx @@ -171,11 +171,11 @@ register_with_read_factory() { } //////////////////////////////////////////////////////////////////// -// Function : test_transform -// Access : private -// Description : this tests the transform to make sure it's within -// the specified limits. It's done so we can assert -// to see when an invalid transform is being applied. +// Function: test_transform +// Access: Private +// Description: This tests the transform to make sure it's within +// the specified limits. It's done so we can assert +// to see when an invalid transform is being applied. //////////////////////////////////////////////////////////////////// void ModelNode:: test_transform(const TransformState *ts) const { @@ -189,12 +189,12 @@ test_transform(const TransformState *ts) const { } //////////////////////////////////////////////////////////////////// -// Function : transform_changed -// Access : private, virtual -// Description : node hook. This function handles outside -// (non-physics) actions on the actor -// and updates the internal representation of the node. -// i.e. copy from PandaNode to PhysicsObject +// Function: transform_changed +// Access: Private, Virtual +// Description: node hook. This function handles outside +// (non-physics) actions on the actor +// and updates the internal representation of the node. +// i.e. copy from PandaNode to PhysicsObject //////////////////////////////////////////////////////////////////// void ModelNode:: transform_changed() { diff --git a/panda/src/pgraph/nodePath.cxx b/panda/src/pgraph/nodePath.cxx index e5896cbcb8..102ca908e7 100644 --- a/panda/src/pgraph/nodePath.cxx +++ b/panda/src/pgraph/nodePath.cxx @@ -4723,7 +4723,7 @@ has_material() const { // applied to the geometry at or below this level, as // another material at a higher or lower level may // override. - +// // See also find_material(). //////////////////////////////////////////////////////////////////// PT(Material) NodePath:: diff --git a/panda/src/pgraph/polylightNode.I b/panda/src/pgraph/polylightNode.I index c9b7de7c6d..aca68fe6f7 100644 --- a/panda/src/pgraph/polylightNode.I +++ b/panda/src/pgraph/polylightNode.I @@ -1,4 +1,4 @@ -// Filename: PolylightNodeEffect.I +// Filename: polylightNode.I // Created by: sshodhan (02Jun04) // //////////////////////////////////////////////////////////////////// @@ -141,7 +141,7 @@ set_attenuation(PolylightNode::Attenuation_Type type){ nassertr(type == ALINEAR || type == AQUADRATIC,false); _attenuation_type=type; return true; - + } //////////////////////////////////////////////////////////////////// @@ -262,7 +262,7 @@ is_flickering() const { INLINE bool PolylightNode:: set_flicker_type(PolylightNode::Flicker_Type type){ nassertr(type == FRANDOM || type == FSIN,false); - + _flicker_type=type; return true; } @@ -350,7 +350,7 @@ get_step_size() const { //////////////////////////////////////////////////////////////////// // Function: PolylightNode::set_color // Access: Published -// Description: Set the light's color... +// Description: Set the light's color... //////////////////////////////////////////////////////////////////// INLINE void PolylightNode:: set_color(const LColor &color) { @@ -376,7 +376,7 @@ set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b) { _color[0] = r; _color[1] = g; _color[2] = b; - _color[3] = 1.0; + _color[3] = 1.0; } //////////////////////////////////////////////////////////////////// @@ -394,7 +394,7 @@ get_color() const { // Access: Published // Description: This differs from get_color in that when applying // the light color we need to make sure that a color -// flattening external to the PolylightNode is not +// flattening external to the PolylightNode is not // ignored. //////////////////////////////////////////////////////////////////// INLINE LColor PolylightNode:: @@ -408,9 +408,9 @@ get_color_scenegraph() const { return ca->get_color(); } } - + return _color; - + } diff --git a/panda/src/pgraph/polylightNode.cxx b/panda/src/pgraph/polylightNode.cxx index 8d383db018..18138d6aab 100644 --- a/panda/src/pgraph/polylightNode.cxx +++ b/panda/src/pgraph/polylightNode.cxx @@ -1,4 +1,4 @@ -// Filename: PolylightNode.cxx +// Filename: polylightNode.cxx // Created by: sshodhan (02Jun04) // //////////////////////////////////////////////////////////////////// @@ -108,7 +108,7 @@ LColor PolylightNode::flicker() const { r = color[0]; g = color[1]; b = color[2]; - + if (_flicker_type == FRANDOM) { //srand((int)ClockObject::get_global_clock()->get_frame_time()); variation = (rand()%100); // a value between 0-99 @@ -133,7 +133,7 @@ LColor PolylightNode::flicker() const { variation *= _scale; }*/ } - + //variation += _offset; //variation *= _scale; @@ -141,7 +141,7 @@ LColor PolylightNode::flicker() const { r += r * variation; g += g * variation; b += b * variation; - + /* CLAMPING if (fabs(r - color[0]) > 0.5 || fabs(g - color[1]) > 0.5 || fabs(b - color[2]) > 0.5) { r = color[0]; @@ -170,7 +170,7 @@ LColor PolylightNode::flicker() const { //////////////////////////////////////////////////////////////////// int PolylightNode:: compare_to(const PolylightNode &other) const { - + if (_enabled != other._enabled) { return _enabled ? 1 :-1; } @@ -306,7 +306,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { //////////////////////////////////////////////////////////////////// // Function: PolylightNode::output // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PolylightNode:: output(ostream &out) const { diff --git a/panda/src/pgraph/polylightNode.h b/panda/src/pgraph/polylightNode.h index caacbecf57..9e3eb6e253 100644 --- a/panda/src/pgraph/polylightNode.h +++ b/panda/src/pgraph/polylightNode.h @@ -1,4 +1,4 @@ -// Filename: PolylightNode.h +// Filename: polylightNode.h // Created by: sshodhan (02Jun04) // //////////////////////////////////////////////////////////////////// @@ -34,8 +34,8 @@ class EXPCL_PANDA_PGRAPH PolylightNode : public PandaNode{ PUBLISHED: /* - // This was the old constructor... interrogate would generate a - // separate wrapper for each parameter... so its better to + // This was the old constructor... interrogate would generate a + // separate wrapper for each parameter... so its better to // have a simpler constructor and require the programmer // to use set_* methods. PolylightNode(const string &name, PN_stdfloat x = 0.0, PN_stdfloat y = 0.0, PN_stdfloat z = 0.0, @@ -119,7 +119,7 @@ private: PN_stdfloat _sin_freq; //PN_stdfloat _speed; //PN_stdfloat fixed_points - + public: static void register_with_read_factory(); diff --git a/panda/src/pgraph/portalNode.cxx b/panda/src/pgraph/portalNode.cxx index f7a2d26add..a18ec52bb5 100644 --- a/panda/src/pgraph/portalNode.cxx +++ b/panda/src/pgraph/portalNode.cxx @@ -236,7 +236,7 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) { portal_cat.debug() << "portal_depth is " << data._portal_depth << endl; PT(GeometricBoundingVolume) vf = trav->get_view_frustum(); PT(BoundingVolume) reduced_frustum; - + // remember old viewport and frustum, so we can restore them for the siblings. (it gets changed by the prepare_portal call) LPoint2 old_reduced_viewport_min, old_reduced_viewport_max; portal_viewer->get_reduced_viewport(old_reduced_viewport_min, old_reduced_viewport_max); @@ -250,17 +250,17 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) { set_visible(true); // The frustum is in camera space vf = DCAST(GeometricBoundingVolume, reduced_frustum); - + // create a copy of this reduced frustum, we'll transform it from camera space to the cell_out space PT(BoundingHexahedron) new_bh = DCAST(BoundingHexahedron, vf->make_copy()); - + // Get the net trasform of the _cell_out as seen from the camera. CPT(TransformState) cell_transform = _cell_out.get_net_transform(); CPT(TransformState) frustum_transform = cell_transform ->invert_compose(portal_viewer->_scene_setup->get_cull_center().get_net_transform()); // transform to _cell_out space new_bh->xform(frustum_transform->get_mat()); - + CPT(RenderState) next_state = data._state; // set clipping planes, if desired.. @@ -268,14 +268,14 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) { // create a copy of this reduced frustum, we'll transform it from camera space to this portal node's space (because the clip planes are attached to this node) PT(BoundingHexahedron) temp_bh = DCAST(BoundingHexahedron, vf->make_copy()); CPT(TransformState) temp_frustum_transform = data._node_path.get_node_path().get_net_transform()->invert_compose(portal_viewer->_scene_setup->get_cull_center().get_net_transform()); - + portal_cat.spam() << "clipping plane frustum transform " << *temp_frustum_transform << endl; - portal_cat.spam() << "frustum before transform " << *temp_bh << endl; + portal_cat.spam() << "frustum before transform " << *temp_bh << endl; // transform to portalNode space temp_bh->xform(temp_frustum_transform->get_mat()); portal_cat.spam() << "frustum after transform " << *temp_bh << endl; - + _left_plane_node->set_plane(-temp_bh->get_plane(4)); // left plane of bh _right_plane_node->set_plane(-temp_bh->get_plane(2));// right plane of bh _top_plane_node->set_plane(-temp_bh->get_plane(3)); // top plane of bh @@ -306,7 +306,7 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) { portal_cat.spam() << "next state after composition " << *next_state << endl; } - CullTraverserData next_data(_cell_out, + CullTraverserData next_data(_cell_out, cell_transform, next_state, new_bh, current_thread); @@ -363,9 +363,8 @@ output(ostream &out) const { //////////////////////////////////////////////////////////////////// // Function: PortalNode::draw // Access: Public -// Description: Draws the vertices of this portal rectangle to the -// screen with a line - +// Description: Draws the vertices of this portal rectangle to the +// screen with a line //////////////////////////////////////////////////////////////////// void PortalNode:: draw() const { diff --git a/panda/src/pgraph/portalNode.h b/panda/src/pgraph/portalNode.h index 8a82e39498..3466ac6aee 100644 --- a/panda/src/pgraph/portalNode.h +++ b/panda/src/pgraph/portalNode.h @@ -24,11 +24,11 @@ #include "pvector.h" //////////////////////////////////////////////////////////////////// -// Class : PortalNode -// Description : A node in the scene graph that can hold a -// Portal Polygon, which is a rectangle. Other +// Class : PortalNode +// Description : A node in the scene graph that can hold a +// Portal Polygon, which is a rectangle. Other // types of polygons are not supported for -// now. It also holds a PT(PandaNode) Cell that +// now. It also holds a PT(PandaNode) Cell that // this portal is connected to //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_PGRAPH PortalNode : public PandaNode { @@ -44,7 +44,7 @@ public: virtual PandaNode *make_copy() const; virtual bool preserve_name() const; virtual void xform(const LMatrix4 &mat); - virtual PandaNode *combine_with(PandaNode *other); + virtual PandaNode *combine_with(PandaNode *other); virtual void enable_clipping_planes(); diff --git a/panda/src/pgraph/sceneGraphReducer.cxx b/panda/src/pgraph/sceneGraphReducer.cxx index dbb2de844a..1f4f028b5a 100644 --- a/panda/src/pgraph/sceneGraphReducer.cxx +++ b/panda/src/pgraph/sceneGraphReducer.cxx @@ -1,4 +1,4 @@ -// Filename: SceneGraphReducer.cxx +// Filename: sceneGraphReducer.cxx // Created by: drose (14Mar02) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pgraphnodes/fadeLodNode.I b/panda/src/pgraphnodes/fadeLodNode.I index 3b93097f91..577db0d034 100644 --- a/panda/src/pgraphnodes/fadeLodNode.I +++ b/panda/src/pgraphnodes/fadeLodNode.I @@ -1,4 +1,4 @@ -// Filename: fadelodNode.I +// Filename: fadeLodNode.I // Created by: sshodhan (14Jun04) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pgraphnodes/uvScrollNode.cxx b/panda/src/pgraphnodes/uvScrollNode.cxx index 06c2af3410..358ac2c075 100644 --- a/panda/src/pgraphnodes/uvScrollNode.cxx +++ b/panda/src/pgraphnodes/uvScrollNode.cxx @@ -1,4 +1,4 @@ -// Filename: modelNode.cxx +// Filename: uvScrollNode.cxx // Created by: drose (16Mar02) // //////////////////////////////////////////////////////////////////// @@ -135,7 +135,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { //////////////////////////////////////////////////////////////////// bool UvScrollNode:: cull_callback(CullTraverser * trav, CullTraverserData &data) { - double elapsed = ClockObject::get_global_clock()->get_frame_time() - _start_time; + double elapsed = ClockObject::get_global_clock()->get_frame_time() - _start_time; CPT(TransformState) ts = TransformState::make_pos_hpr( LVecBase3(cmod(elapsed * _u_speed, 1.0) / 1.0, cmod(elapsed * _v_speed, 1.0) / 1.0, diff --git a/panda/src/pgraphnodes/uvScrollNode.h b/panda/src/pgraphnodes/uvScrollNode.h index 6eadda9ed5..e5a7a4e754 100644 --- a/panda/src/pgraphnodes/uvScrollNode.h +++ b/panda/src/pgraphnodes/uvScrollNode.h @@ -1,4 +1,4 @@ -// Filename: modelNode.h +// Filename: uvScrollNode.h // Created by: drose (16Mar02) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/physics/actorNode.I b/panda/src/physics/actorNode.I index 15b8edb1ba..c631f94d54 100644 --- a/panda/src/physics/actorNode.I +++ b/panda/src/physics/actorNode.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_contact_vector -// Access : Public -// Description : +// Function: set_contact_vector +// Access: Public +// Description: //////////////////////////////////////////////////////////////////// INLINE void ActorNode:: set_contact_vector(const LVector3 &contact_vector) { @@ -23,9 +23,9 @@ set_contact_vector(const LVector3 &contact_vector) { } //////////////////////////////////////////////////////////////////// -// Function : get_contact_vector -// Access : Public -// Description : +// Function: get_contact_vector +// Access: Public +// Description: //////////////////////////////////////////////////////////////////// INLINE const LVector3 &ActorNode:: get_contact_vector() const { diff --git a/panda/src/physics/actorNode.cxx b/panda/src/physics/actorNode.cxx index 653c213ea4..3a431e5f04 100644 --- a/panda/src/physics/actorNode.cxx +++ b/panda/src/physics/actorNode.cxx @@ -21,9 +21,9 @@ TypeHandle ActorNode::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : ActorNode -// Access : public -// Description : Constructor +// Function: ActorNode +// Access: Public +// Description: Constructor //////////////////////////////////////////////////////////////////// ActorNode:: ActorNode(const string &name) : @@ -40,9 +40,9 @@ ActorNode(const string &name) : } //////////////////////////////////////////////////////////////////// -// Function : ActorNode -// Access : public -// Description : Copy Constructor. +// Function: ActorNode +// Access: Public +// Description: Copy Constructor. //////////////////////////////////////////////////////////////////// ActorNode:: ActorNode(const ActorNode ©) : @@ -54,18 +54,18 @@ ActorNode(const ActorNode ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~ActorNode -// Access : public -// Description : destructor +// Function: ~ActorNode +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// ActorNode:: ~ActorNode() { } //////////////////////////////////////////////////////////////////// -// Function : update_transform -// Access : public -// Description : this sets the transform generated by the contained +// Function: update_transform +// Access: Public +// Description: this sets the transform generated by the contained // Physical, moving the node and subsequent geometry. // i.e. copy from PhysicsObject to PandaNode //////////////////////////////////////////////////////////////////// @@ -80,9 +80,9 @@ update_transform() { } //////////////////////////////////////////////////////////////////// -// Function : test_transform -// Access : private -// Description : this tests the transform to make sure it's within +// Function: test_transform +// Access: Private +// Description: this tests the transform to make sure it's within // the specified limits. It's done so we can assert // to see when an invalid transform is being applied. //////////////////////////////////////////////////////////////////// @@ -98,9 +98,9 @@ test_transform(const TransformState *ts) const { } //////////////////////////////////////////////////////////////////// -// Function : transform_changed -// Access : private, virtual -// Description : node hook. This function handles outside +// Function: transform_changed +// Access: Private, Virtual +// Description: node hook. This function handles outside // (non-physics) actions on the actor // and updates the internal representation of the node. // i.e. copy from PandaNode to PhysicsObject @@ -132,10 +132,10 @@ transform_changed() { //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ActorNode:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/angularEulerIntegrator.cxx b/panda/src/physics/angularEulerIntegrator.cxx index 9c80144b0a..10ac482008 100644 --- a/panda/src/physics/angularEulerIntegrator.cxx +++ b/panda/src/physics/angularEulerIntegrator.cxx @@ -18,27 +18,27 @@ #include "config_physics.h" //////////////////////////////////////////////////////////////////// -// Function : AngularEulerIntegrator -// Access : Public -// Description : constructor +// Function: AngularEulerIntegrator +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// AngularEulerIntegrator:: AngularEulerIntegrator() { } //////////////////////////////////////////////////////////////////// -// Function : AngularEulerIntegrator -// Access : Public -// Description : destructor +// Function: AngularEulerIntegrator +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// AngularEulerIntegrator:: ~AngularEulerIntegrator() { } //////////////////////////////////////////////////////////////////// -// Function : Integrate -// Access : Public -// Description : Integrate a step of motion (based on dt) by +// Function: Integrate +// Access: Public +// Description: Integrate a step of motion (based on dt) by // applying every force in force_vec to every object // in obj_vec. //////////////////////////////////////////////////////////////////// @@ -132,7 +132,7 @@ child_integrate(Physical *physical, #else //accum_quat*=viscosityDamper; //LOrientation orientation = current_object->get_orientation(); - + //accum_quat.normalize(); // x = x + v * t + 0.5 * a * t * t orientation = orientation * ((rot_quat * dt) * (accum_quat * (0.5 * dt * dt))); @@ -150,10 +150,10 @@ child_integrate(Physical *physical, } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void AngularEulerIntegrator:: output(ostream &out) const { @@ -163,10 +163,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void AngularEulerIntegrator:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/angularForce.cxx b/panda/src/physics/angularForce.cxx index 857bbd5d06..ca13448a65 100644 --- a/panda/src/physics/angularForce.cxx +++ b/panda/src/physics/angularForce.cxx @@ -17,9 +17,9 @@ TypeHandle AngularForce::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : AngularForce -// Access : protected -// Description : constructor +// Function: AngularForce +// Access: Protected +// Description: constructor //////////////////////////////////////////////////////////////////// AngularForce:: AngularForce() : @@ -27,9 +27,9 @@ AngularForce() : } //////////////////////////////////////////////////////////////////// -// Function : AngularForce -// Access : protected -// Description : copy constructor +// Function: AngularForce +// Access: Protected +// Description: copy constructor //////////////////////////////////////////////////////////////////// AngularForce:: AngularForce(const AngularForce ©) : @@ -37,18 +37,18 @@ AngularForce(const AngularForce ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~AngularForce -// Access : public, virtual -// Description : destructor +// Function: ~AngularForce +// Access: Public, Virtual +// Description: destructor //////////////////////////////////////////////////////////////////// AngularForce:: ~AngularForce() { } //////////////////////////////////////////////////////////////////// -// Function : get_quat -// Access : public -// Description : access query +// Function: get_quat +// Access: Public +// Description: access query //////////////////////////////////////////////////////////////////// LRotation AngularForce:: get_quat(const PhysicsObject *po) { @@ -57,9 +57,9 @@ get_quat(const PhysicsObject *po) { } //////////////////////////////////////////////////////////////////// -// Function : is_linear -// Access : public -// Description : access query +// Function: is_linear +// Access: Public +// Description: access query //////////////////////////////////////////////////////////////////// bool AngularForce:: is_linear() const { @@ -67,10 +67,10 @@ is_linear() const { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void AngularForce:: output(ostream &out) const { @@ -80,10 +80,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void AngularForce:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/angularIntegrator.cxx b/panda/src/physics/angularIntegrator.cxx index 00c47e9572..c0f6b53d79 100644 --- a/panda/src/physics/angularIntegrator.cxx +++ b/panda/src/physics/angularIntegrator.cxx @@ -18,27 +18,27 @@ ConfigVariableDouble AngularIntegrator::_max_angular_dt ("default_max_angular_dt", 1.0f / 30.0f); //////////////////////////////////////////////////////////////////// -// Function : AngularIntegrator -// Access : protected -// Description : constructor +// Function: AngularIntegrator +// Access: Protected +// Description: constructor //////////////////////////////////////////////////////////////////// AngularIntegrator:: AngularIntegrator() { } //////////////////////////////////////////////////////////////////// -// Function : ~AngularIntegrator -// Access : public, virtual -// Description : destructor +// Function: ~AngularIntegrator +// Access: Public, Virtual +// Description: destructor //////////////////////////////////////////////////////////////////// AngularIntegrator:: ~AngularIntegrator() { } //////////////////////////////////////////////////////////////////// -// Function : Integrate -// Access : public -// Description : high-level integration. API. +// Function: Integrate +// Access: Public +// Description: high-level integration. API. //////////////////////////////////////////////////////////////////// void AngularIntegrator:: integrate(Physical *physical, AngularForceVector& forces, @@ -53,10 +53,10 @@ integrate(Physical *physical, AngularForceVector& forces, } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void AngularIntegrator:: output(ostream &out) const { @@ -66,10 +66,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void AngularIntegrator:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/angularVectorForce.I b/panda/src/physics/angularVectorForce.I index 9e5d69a46e..7d2eb4db48 100644 --- a/panda/src/physics/angularVectorForce.I +++ b/panda/src/physics/angularVectorForce.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_quat -// Access : public +// Function: set_quat +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void AngularVectorForce:: set_quat(const LRotation &v) { @@ -22,8 +22,8 @@ set_quat(const LRotation &v) { } //////////////////////////////////////////////////////////////////// -// Function : set_hpr -// Access : public +// Function: set_hpr +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void AngularVectorForce:: set_hpr(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) { @@ -31,8 +31,8 @@ set_hpr(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) { } //////////////////////////////////////////////////////////////////// -// Function : get_local_quat -// Access : public +// Function: get_local_quat +// Access: Public //////////////////////////////////////////////////////////////////// INLINE LRotation AngularVectorForce:: get_local_quat() const { diff --git a/panda/src/physics/angularVectorForce.cxx b/panda/src/physics/angularVectorForce.cxx index 8cce5b3ef7..60e46d98f2 100644 --- a/panda/src/physics/angularVectorForce.cxx +++ b/panda/src/physics/angularVectorForce.cxx @@ -17,9 +17,9 @@ TypeHandle AngularVectorForce::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : AngularVectorForce -// Access : public -// Description : constructor +// Function: AngularVectorForce +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// AngularVectorForce:: AngularVectorForce(const LRotation &vec) : @@ -27,9 +27,9 @@ AngularVectorForce(const LRotation &vec) : } //////////////////////////////////////////////////////////////////// -// Function : AngularVectorForce -// Access : public -// Description : constructor +// Function: AngularVectorForce +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// AngularVectorForce:: AngularVectorForce(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) : @@ -38,9 +38,9 @@ AngularVectorForce(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) : } //////////////////////////////////////////////////////////////////// -// Function : AngularVectorForce -// Access : public -// Description : copy constructor +// Function: AngularVectorForce +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// AngularVectorForce:: AngularVectorForce(const AngularVectorForce ©) : @@ -49,18 +49,18 @@ AngularVectorForce(const AngularVectorForce ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~AngularVectorForce -// Access : public, virtual -// Description : destructor +// Function: ~AngularVectorForce +// Access: Public, Virtual +// Description: destructor //////////////////////////////////////////////////////////////////// AngularVectorForce:: ~AngularVectorForce() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : private, virtual -// Description : dynamic copier +// Function: make_copy +// Access: Private, Virtual +// Description: dynamic copier //////////////////////////////////////////////////////////////////// AngularForce *AngularVectorForce:: make_copy() const { @@ -68,9 +68,9 @@ make_copy() const { } //////////////////////////////////////////////////////////////////// -// Function : get_child_quat -// Access : private, virtual -// Description : query +// Function: get_child_quat +// Access: Private, Virtual +// Description: query //////////////////////////////////////////////////////////////////// LRotation AngularVectorForce:: get_child_quat(const PhysicsObject *) { @@ -78,10 +78,10 @@ get_child_quat(const PhysicsObject *) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void AngularVectorForce:: output(ostream &out) const { @@ -91,10 +91,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void AngularVectorForce:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/baseForce.I b/panda/src/physics/baseForce.I index b2607540a4..66f47f681a 100644 --- a/panda/src/physics/baseForce.I +++ b/panda/src/physics/baseForce.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : get_force_node -// Access : Public +// Function: get_force_node +// Access: Public //////////////////////////////////////////////////////////////////// INLINE ForceNode *BaseForce:: get_force_node() const { @@ -22,8 +22,8 @@ get_force_node() const { } //////////////////////////////////////////////////////////////////// -// Function : get_force_node_path -// Access : Public +// Function: get_force_node_path +// Access: Public //////////////////////////////////////////////////////////////////// INLINE NodePath BaseForce:: get_force_node_path() const { @@ -31,8 +31,8 @@ get_force_node_path() const { } //////////////////////////////////////////////////////////////////// -// Function : set_active -// Access : Public +// Function: set_active +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void BaseForce:: set_active(bool active) { @@ -40,8 +40,8 @@ set_active(bool active) { } //////////////////////////////////////////////////////////////////// -// Function : get_active -// Access : Public +// Function: get_active +// Access: Public //////////////////////////////////////////////////////////////////// INLINE bool BaseForce:: get_active() const { diff --git a/panda/src/physics/baseForce.cxx b/panda/src/physics/baseForce.cxx index b250e4067c..8f2fc41db2 100644 --- a/panda/src/physics/baseForce.cxx +++ b/panda/src/physics/baseForce.cxx @@ -18,44 +18,44 @@ TypeHandle BaseForce::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : BaseForce -// Access : protected -// Description : constructor +// Function: BaseForce +// Access: Protected +// Description: constructor //////////////////////////////////////////////////////////////////// BaseForce:: BaseForce(bool active) : - _force_node(NULL), - _active(active) + _force_node(NULL), + _active(active) { } //////////////////////////////////////////////////////////////////// -// Function : BaseForce -// Access : protected -// Description : copy constructor +// Function: BaseForce +// Access: Protected +// Description: copy constructor //////////////////////////////////////////////////////////////////// BaseForce:: BaseForce(const BaseForce ©) : - TypedReferenceCount(copy) + TypedReferenceCount(copy) { _active = copy._active; _force_node = (ForceNode *) NULL; } //////////////////////////////////////////////////////////////////// -// Function : ~BaseForce -// Access : public, virtual -// Description : destructor +// Function: ~BaseForce +// Access: Public, Virtual +// Description: destructor //////////////////////////////////////////////////////////////////// BaseForce:: ~BaseForce() { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BaseForce:: output(ostream &out) const { @@ -63,16 +63,16 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BaseForce:: write(ostream &out, int indent_level) const { indent(out, indent_level) << "BaseForce (id " << this << "):\n"; - + indent(out, indent_level + 2) << "_force_node "; if (_force_node) { @@ -80,7 +80,7 @@ write(ostream &out, int indent_level) const { } else { out << "null\n"; } - + indent(out, indent_level + 2) << "_active " << _active << "\n"; } diff --git a/panda/src/physics/baseForce.h b/panda/src/physics/baseForce.h index 8ea7419205..03846966ef 100644 --- a/panda/src/physics/baseForce.h +++ b/panda/src/physics/baseForce.h @@ -25,8 +25,8 @@ class ForceNode; //////////////////////////////////////////////////////////////////// -// Class : BaseForce -// Description : pure virtual base class for all forces that could +// Class : BaseForce +// Description : pure virtual base class for all forces that could // POSSIBLY exist. //////////////////////////////////////////////////////////////////// class EXPCL_PANDAPHYSICS BaseForce : public TypedReferenceCount { diff --git a/panda/src/physics/baseIntegrator.I b/panda/src/physics/baseIntegrator.I index 286e0519ec..80963aa13f 100644 --- a/panda/src/physics/baseIntegrator.I +++ b/panda/src/physics/baseIntegrator.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : get_precomputed_linear_matrices -// Access : protected +// Function: get_precomputed_linear_matrices +// Access: Protected //////////////////////////////////////////////////////////////////// INLINE const BaseIntegrator::MatrixVector &BaseIntegrator:: get_precomputed_linear_matrices() const { @@ -22,8 +22,8 @@ get_precomputed_linear_matrices() const { } //////////////////////////////////////////////////////////////////// -// Function : get_precomputed_angular_matrices -// Access : protected +// Function: get_precomputed_angular_matrices +// Access: Protected //////////////////////////////////////////////////////////////////// INLINE const BaseIntegrator::MatrixVector &BaseIntegrator:: get_precomputed_angular_matrices() const { diff --git a/panda/src/physics/baseIntegrator.cxx b/panda/src/physics/baseIntegrator.cxx index 4f66d77d78..3e512a5a7d 100644 --- a/panda/src/physics/baseIntegrator.cxx +++ b/panda/src/physics/baseIntegrator.cxx @@ -18,27 +18,27 @@ #include "nodePath.h" //////////////////////////////////////////////////////////////////// -// Function : BaseIntegrator -// Access : protected -// Description : constructor +// Function: BaseIntegrator +// Access: Protected +// Description: constructor //////////////////////////////////////////////////////////////////// BaseIntegrator:: BaseIntegrator() { } //////////////////////////////////////////////////////////////////// -// Function : ~BaseIntegrator -// Access : public, virtual -// Description : destructor +// Function: ~BaseIntegrator +// Access: Public, Virtual +// Description: destructor //////////////////////////////////////////////////////////////////// BaseIntegrator:: ~BaseIntegrator() { } //////////////////////////////////////////////////////////////////// -// Function : precompute_linear_matrices -// Access : protected -// Description : effectively caches the xform matrices between +// Function: precompute_linear_matrices +// Access: Protected +// Description: effectively caches the xform matrices between // the physical's node and every force acting on it // so that each PhysicsObject in the set held by the // Physical doesn't have to wrt. @@ -92,9 +92,9 @@ precompute_linear_matrices(Physical *physical, } //////////////////////////////////////////////////////////////////// -// Function : precompute_angular_matrices -// Access : protected -// Description : effectively caches the xform matrices between +// Function: precompute_angular_matrices +// Access: Protected +// Description: effectively caches the xform matrices between // the physical's node and every force acting on it // so that each PhysicsObject in the set held by the // Physical doesn't have to wrt. @@ -147,10 +147,10 @@ precompute_angular_matrices(Physical *physical, } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BaseIntegrator:: output(ostream &out) const { @@ -160,10 +160,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write_precomputed_linear_matrices -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write_precomputed_linear_matrices +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BaseIntegrator:: write_precomputed_linear_matrices(ostream &out, unsigned int indent) const { @@ -179,10 +179,10 @@ write_precomputed_linear_matrices(ostream &out, unsigned int indent) const { } //////////////////////////////////////////////////////////////////// -// Function : write_precomputed_angular_matrices -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write_precomputed_angular_matrices +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BaseIntegrator:: write_precomputed_angular_matrices(ostream &out, unsigned int indent) const { @@ -198,10 +198,10 @@ write_precomputed_angular_matrices(ostream &out, unsigned int indent) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void BaseIntegrator:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/forceNode.I b/panda/src/physics/forceNode.I index 849fafbb9c..a17b6bd09e 100644 --- a/panda/src/physics/forceNode.I +++ b/panda/src/physics/forceNode.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : clear -// Access : public +// Function: clear +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ForceNode:: clear() { @@ -22,8 +22,8 @@ clear() { } //////////////////////////////////////////////////////////////////// -// Function : get_force -// Access : public +// Function: get_force +// Access: Public //////////////////////////////////////////////////////////////////// INLINE BaseForce *ForceNode:: get_force(int index) const { @@ -33,8 +33,8 @@ get_force(int index) const { } //////////////////////////////////////////////////////////////////// -// Function : get_num_forces -// Access : public +// Function: get_num_forces +// Access: Public //////////////////////////////////////////////////////////////////// INLINE int ForceNode:: get_num_forces() const { @@ -42,8 +42,8 @@ get_num_forces() const { } //////////////////////////////////////////////////////////////////// -// Function : add_force -// Access : public +// Function: add_force +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void ForceNode:: add_force(BaseForce *force) { diff --git a/panda/src/physics/forceNode.cxx b/panda/src/physics/forceNode.cxx index 6ad0383b3b..937b338640 100644 --- a/panda/src/physics/forceNode.cxx +++ b/panda/src/physics/forceNode.cxx @@ -18,9 +18,9 @@ TypeHandle ForceNode::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : ForceNode -// Access : public -// Description : default constructor +// Function: ForceNode +// Access: Public +// Description: default constructor //////////////////////////////////////////////////////////////////// ForceNode:: ForceNode(const string &name) : @@ -28,9 +28,9 @@ ForceNode(const string &name) : } //////////////////////////////////////////////////////////////////// -// Function : ForceNode -// Access : protected -// Description : copy constructor +// Function: ForceNode +// Access: Protected +// Description: copy constructor //////////////////////////////////////////////////////////////////// ForceNode:: ForceNode(const ForceNode ©) : @@ -38,18 +38,18 @@ ForceNode(const ForceNode ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~ForceNode -// Access : public, virtual -// Description : destructor +// Function: ~ForceNode +// Access: Public, Virtual +// Description: destructor //////////////////////////////////////////////////////////////////// ForceNode:: ~ForceNode() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : public, virtual -// Description : dynamic child copy +// Function: make_copy +// Access: Public, Virtual +// Description: dynamic child copy //////////////////////////////////////////////////////////////////// PandaNode *ForceNode:: make_copy() const { @@ -57,9 +57,9 @@ make_copy() const { } //////////////////////////////////////////////////////////////////// -// Function : add_forces_from -// Access : public -// Description : append operation +// Function: add_forces_from +// Access: Public +// Description: append operation //////////////////////////////////////////////////////////////////// void ForceNode:: add_forces_from(const ForceNode &other) { @@ -76,9 +76,9 @@ add_forces_from(const ForceNode &other) { } //////////////////////////////////////////////////////////////////// -// Function : remove_force -// Access : public -// Description : remove operation +// Function: remove_force +// Access: Public +// Description: remove operation //////////////////////////////////////////////////////////////////// void ForceNode:: remove_force(BaseForce *f) { @@ -91,9 +91,9 @@ remove_force(BaseForce *f) { } //////////////////////////////////////////////////////////////////// -// Function : remove_force -// Access : public -// Description : remove operation +// Function: remove_force +// Access: Public +// Description: remove operation //////////////////////////////////////////////////////////////////// void ForceNode:: remove_force(int index) { @@ -108,10 +108,10 @@ remove_force(int index) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ForceNode:: output(ostream &out) const { @@ -120,10 +120,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write_linear_forces -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write_linear_forces +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ForceNode:: write_forces(ostream &out, unsigned int indent) const { @@ -139,10 +139,10 @@ write_forces(ostream &out, unsigned int indent) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void ForceNode:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/forceNode.h b/panda/src/physics/forceNode.h index ee24f961c1..bd05bb18db 100644 --- a/panda/src/physics/forceNode.h +++ b/panda/src/physics/forceNode.h @@ -21,8 +21,8 @@ #include "baseForce.h" //////////////////////////////////////////////////////////////////// -// Class : ForceNode -// Description : A force that lives in the scene graph and is +// Class : ForceNode +// Description : A force that lives in the scene graph and is // therefore subject to local coordinate systems. // An example of this would be simulating gravity // in a rotating space station. or something. @@ -39,7 +39,7 @@ PUBLISHED: void add_forces_from(const ForceNode &other); void remove_force(BaseForce *f); void remove_force(int index); - + virtual void output(ostream &out) const; virtual void write_forces(ostream &out, unsigned int indent=0) const; virtual void write(ostream &out, unsigned int indent=0) const; diff --git a/panda/src/physics/linearControlForce.I b/panda/src/physics/linearControlForce.I index c224407ad6..9d992a63c1 100644 --- a/panda/src/physics/linearControlForce.I +++ b/panda/src/physics/linearControlForce.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : clear_physics_object -// Access : Public -// Description : encapsulating wrapper +// Function: clear_physics_object +// Access: Public +// Description: encapsulating wrapper //////////////////////////////////////////////////////////////////// INLINE void LinearControlForce:: clear_physics_object() { @@ -23,9 +23,9 @@ clear_physics_object() { } //////////////////////////////////////////////////////////////////// -// Function : set_physics_object -// Access : Public -// Description : encapsulating wrapper +// Function: set_physics_object +// Access: Public +// Description: encapsulating wrapper //////////////////////////////////////////////////////////////////// INLINE void LinearControlForce:: set_physics_object(const PhysicsObject *po) { @@ -33,9 +33,9 @@ set_physics_object(const PhysicsObject *po) { } //////////////////////////////////////////////////////////////////// -// Function : get_physics_object -// Access : Public -// Description : piecewise encapsulating wrapper +// Function: get_physics_object +// Access: Public +// Description: piecewise encapsulating wrapper //////////////////////////////////////////////////////////////////// INLINE CPT(PhysicsObject) LinearControlForce:: get_physics_object() const { @@ -43,9 +43,9 @@ get_physics_object() const { } //////////////////////////////////////////////////////////////////// -// Function : set_vector -// Access : Public -// Description : encapsulating wrapper +// Function: set_vector +// Access: Public +// Description: encapsulating wrapper //////////////////////////////////////////////////////////////////// INLINE void LinearControlForce:: set_vector(const LVector3& v) { @@ -53,9 +53,9 @@ set_vector(const LVector3& v) { } //////////////////////////////////////////////////////////////////// -// Function : set_vector -// Access : Public -// Description : piecewise encapsulating wrapper +// Function: set_vector +// Access: Public +// Description: piecewise encapsulating wrapper //////////////////////////////////////////////////////////////////// INLINE void LinearControlForce:: set_vector(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) { @@ -63,9 +63,9 @@ set_vector(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) { } //////////////////////////////////////////////////////////////////// -// Function : get_local_vector -// Access : Public -// Description : +// Function: get_local_vector +// Access: Public +// Description: //////////////////////////////////////////////////////////////////// INLINE LVector3 LinearControlForce:: get_local_vector() const { diff --git a/panda/src/physics/linearControlForce.cxx b/panda/src/physics/linearControlForce.cxx index 7762320617..9a3da6eb13 100644 --- a/panda/src/physics/linearControlForce.cxx +++ b/panda/src/physics/linearControlForce.cxx @@ -22,9 +22,9 @@ TypeHandle LinearControlForce::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : LinearControlForce -// Access : Public -// Description : Vector Constructor +// Function: LinearControlForce +// Access: Public +// Description: Vector Constructor //////////////////////////////////////////////////////////////////// LinearControlForce:: LinearControlForce(const PhysicsObject *po, PN_stdfloat a, bool mass) : @@ -34,9 +34,9 @@ LinearControlForce(const PhysicsObject *po, PN_stdfloat a, bool mass) : } //////////////////////////////////////////////////////////////////// -// Function : LinearControlForce -// Access : Public -// Description : Copy Constructor +// Function: LinearControlForce +// Access: Public +// Description: Copy Constructor //////////////////////////////////////////////////////////////////// LinearControlForce:: LinearControlForce(const LinearControlForce ©) : @@ -46,18 +46,18 @@ LinearControlForce(const LinearControlForce ©) : } //////////////////////////////////////////////////////////////////// -// Function : LinearControlForce -// Access : Public -// Description : Destructor +// Function: LinearControlForce +// Access: Public +// Description: Destructor //////////////////////////////////////////////////////////////////// LinearControlForce:: ~LinearControlForce() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public, virtual -// Description : copier +// Function: make_copy +// Access: Public, Virtual +// Description: copier //////////////////////////////////////////////////////////////////// LinearForce *LinearControlForce:: make_copy() { @@ -65,9 +65,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : get_child_vector -// Access : Public -// Description : vector access +// Function: get_child_vector +// Access: Public +// Description: vector access //////////////////////////////////////////////////////////////////// LVector3 LinearControlForce:: get_child_vector(const PhysicsObject *po) { @@ -79,10 +79,10 @@ get_child_vector(const PhysicsObject *po) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearControlForce:: output(ostream &out) const { @@ -92,10 +92,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearControlForce:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/linearControlForce.h b/panda/src/physics/linearControlForce.h index d443253993..44627f9c7e 100644 --- a/panda/src/physics/linearControlForce.h +++ b/panda/src/physics/linearControlForce.h @@ -17,15 +17,15 @@ #include "linearForce.h" -//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : LinearControlForce -// Description : Simple directed vector force. This force is +// Description : Simple directed vector force. This force is // different from the others in that it can be // global and still only affect a single object. // That might not make sense for a physics simulation, // but it's very handy for a game. I.e. this is // the force applied by user on the selected object. -//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class EXPCL_PANDAPHYSICS LinearControlForce : public LinearForce { PUBLISHED: LinearControlForce(const PhysicsObject *po = 0, PN_stdfloat a = 1.0f, @@ -41,7 +41,7 @@ PUBLISHED: INLINE void set_vector(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z); INLINE LVector3 get_local_vector() const; - + virtual void output(ostream &out) const; virtual void write(ostream &out, unsigned int indent=0) const; diff --git a/panda/src/physics/linearCylinderVortexForce.I b/panda/src/physics/linearCylinderVortexForce.I index 6f080753bc..e9766c684b 100644 --- a/panda/src/physics/linearCylinderVortexForce.I +++ b/panda/src/physics/linearCylinderVortexForce.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_radius -// Access : public +// Function: set_radius +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void LinearCylinderVortexForce:: set_radius(PN_stdfloat radius) { @@ -22,8 +22,8 @@ set_radius(PN_stdfloat radius) { } //////////////////////////////////////////////////////////////////// -// Function : set_length -// Access : public +// Function: set_length +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void LinearCylinderVortexForce:: set_length(PN_stdfloat length) { @@ -31,8 +31,8 @@ set_length(PN_stdfloat length) { } //////////////////////////////////////////////////////////////////// -// Function : set_coef -// Access : public +// Function: set_coef +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void LinearCylinderVortexForce:: set_coef(PN_stdfloat coef) { @@ -40,8 +40,8 @@ set_coef(PN_stdfloat coef) { } //////////////////////////////////////////////////////////////////// -// Function : get_radius -// Access : public +// Function: get_radius +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat LinearCylinderVortexForce:: get_radius() const { @@ -49,8 +49,8 @@ get_radius() const { } //////////////////////////////////////////////////////////////////// -// Function : get_length -// Access : public +// Function: get_length +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat LinearCylinderVortexForce:: get_length() const { @@ -58,8 +58,8 @@ get_length() const { } //////////////////////////////////////////////////////////////////// -// Function : get_coef -// Access : public +// Function: get_coef +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat LinearCylinderVortexForce:: get_coef() const { diff --git a/panda/src/physics/linearCylinderVortexForce.cxx b/panda/src/physics/linearCylinderVortexForce.cxx index d6531751e0..bb0429a1bb 100644 --- a/panda/src/physics/linearCylinderVortexForce.cxx +++ b/panda/src/physics/linearCylinderVortexForce.cxx @@ -20,9 +20,9 @@ TypeHandle LinearCylinderVortexForce::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : LinearCylinderVortexForce -// Access : public -// Description : Simple Constructor +// Function: LinearCylinderVortexForce +// Access: Public +// Description: Simple Constructor //////////////////////////////////////////////////////////////////// LinearCylinderVortexForce:: LinearCylinderVortexForce(PN_stdfloat radius, PN_stdfloat length, PN_stdfloat coef, @@ -32,9 +32,9 @@ LinearCylinderVortexForce(PN_stdfloat radius, PN_stdfloat length, PN_stdfloat co } //////////////////////////////////////////////////////////////////// -// Function : LinearCylinderVortexForce -// Access : public -// Description : copy Constructor +// Function: LinearCylinderVortexForce +// Access: Public +// Description: copy Constructor //////////////////////////////////////////////////////////////////// LinearCylinderVortexForce:: LinearCylinderVortexForce(const LinearCylinderVortexForce ©) : @@ -45,18 +45,18 @@ LinearCylinderVortexForce(const LinearCylinderVortexForce ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~LinearCylinderVortexForce -// Access : public -// Description : Destructor +// Function: ~LinearCylinderVortexForce +// Access: Public +// Description: Destructor //////////////////////////////////////////////////////////////////// LinearCylinderVortexForce:: ~LinearCylinderVortexForce() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : public, virtual -// Description : child copier +// Function: make_copy +// Access: Public, Virtual +// Description: child copier //////////////////////////////////////////////////////////////////// LinearForce *LinearCylinderVortexForce:: make_copy() { @@ -64,9 +64,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : get_child_vector -// Access : private, virtual -// Description : returns the centripetal force vector for the +// Function: get_child_vector +// Access: Private, Virtual +// Description: returns the centripetal force vector for the // passed-in object //////////////////////////////////////////////////////////////////// LVector3 LinearCylinderVortexForce:: @@ -128,10 +128,10 @@ get_child_vector(const PhysicsObject *po) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearCylinderVortexForce:: output(ostream &out) const { @@ -141,10 +141,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearCylinderVortexForce:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/linearDistanceForce.I b/panda/src/physics/linearDistanceForce.I index ac7746e91a..245d04f2e9 100644 --- a/panda/src/physics/linearDistanceForce.I +++ b/panda/src/physics/linearDistanceForce.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_falloff_type -// Access : Public -// Description : falloff_type encapsulating wrap +// Function: set_falloff_type +// Access: Public +// Description: falloff_type encapsulating wrap //////////////////////////////////////////////////////////////////// INLINE void LinearDistanceForce:: set_falloff_type(FalloffType ft) { @@ -23,9 +23,9 @@ set_falloff_type(FalloffType ft) { } //////////////////////////////////////////////////////////////////// -// Function : set_radius -// Access : Public -// Description : set the radius +// Function: set_radius +// Access: Public +// Description: set the radius //////////////////////////////////////////////////////////////////// INLINE void LinearDistanceForce:: set_radius(PN_stdfloat r) { @@ -33,9 +33,9 @@ set_radius(PN_stdfloat r) { } //////////////////////////////////////////////////////////////////// -// Function : set_force_center -// Access : Public -// Description : set the force center +// Function: set_force_center +// Access: Public +// Description: set the force center //////////////////////////////////////////////////////////////////// INLINE void LinearDistanceForce:: set_force_center(const LPoint3& p) { @@ -43,9 +43,9 @@ set_force_center(const LPoint3& p) { } //////////////////////////////////////////////////////////////////// -// Function : get_falloff_type -// Access : public -// Description : falloff_type query +// Function: get_falloff_type +// Access: Public +// Description: falloff_type query //////////////////////////////////////////////////////////////////// INLINE LinearDistanceForce::FalloffType LinearDistanceForce:: get_falloff_type() const { @@ -53,9 +53,9 @@ get_falloff_type() const { } //////////////////////////////////////////////////////////////////// -// Function : get_radius -// Access : public -// Description : radius query +// Function: get_radius +// Access: Public +// Description: radius query //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat LinearDistanceForce:: get_radius() const { @@ -63,9 +63,9 @@ get_radius() const { } //////////////////////////////////////////////////////////////////// -// Function : get_force_center -// Access : public -// Description : force_center query +// Function: get_force_center +// Access: Public +// Description: force_center query //////////////////////////////////////////////////////////////////// INLINE LPoint3 LinearDistanceForce:: get_force_center() const { @@ -73,9 +73,9 @@ get_force_center() const { } //////////////////////////////////////////////////////////////////// -// Function : get_scalar_term -// Access : private -// Description : calculate the term based on falloff +// Function: get_scalar_term +// Access: Private +// Description: calculate the term based on falloff //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat LinearDistanceForce:: get_scalar_term() const { diff --git a/panda/src/physics/linearDistanceForce.cxx b/panda/src/physics/linearDistanceForce.cxx index e3aa7368f9..76879dae8c 100644 --- a/panda/src/physics/linearDistanceForce.cxx +++ b/panda/src/physics/linearDistanceForce.cxx @@ -17,9 +17,9 @@ TypeHandle LinearDistanceForce::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : LinearDistanceForce -// Access : Protected -// Description : Simple constructor +// Function: LinearDistanceForce +// Access: Protected +// Description: Simple constructor //////////////////////////////////////////////////////////////////// LinearDistanceForce:: LinearDistanceForce(const LPoint3& p, FalloffType ft, PN_stdfloat r, PN_stdfloat a, bool m) : @@ -29,9 +29,9 @@ LinearDistanceForce(const LPoint3& p, FalloffType ft, PN_stdfloat r, PN_stdfloat } //////////////////////////////////////////////////////////////////// -// Function : LinearDistanceForce -// Access : Protected -// Description : copy constructor +// Function: LinearDistanceForce +// Access: Protected +// Description: copy constructor //////////////////////////////////////////////////////////////////// LinearDistanceForce:: LinearDistanceForce(const LinearDistanceForce ©) : @@ -42,19 +42,19 @@ LinearDistanceForce(const LinearDistanceForce ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~LinearDistanceForce -// Access : Protected -// Description : destructor +// Function: ~LinearDistanceForce +// Access: Protected +// Description: destructor //////////////////////////////////////////////////////////////////// LinearDistanceForce:: ~LinearDistanceForce() { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearDistanceForce:: output(ostream &out) const { @@ -64,10 +64,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearDistanceForce:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/linearEulerIntegrator.cxx b/panda/src/physics/linearEulerIntegrator.cxx index ec026f59a9..8e7a2fbe31 100644 --- a/panda/src/physics/linearEulerIntegrator.cxx +++ b/panda/src/physics/linearEulerIntegrator.cxx @@ -18,33 +18,33 @@ #include "config_physics.h" //////////////////////////////////////////////////////////////////// -// Function : LinearEulerIntegrator -// Access : Public -// Description : constructor +// Function: LinearEulerIntegrator +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// LinearEulerIntegrator:: LinearEulerIntegrator() { } //////////////////////////////////////////////////////////////////// -// Function : LinearEulerIntegrator -// Access : Public -// Description : destructor +// Function: LinearEulerIntegrator +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// LinearEulerIntegrator:: ~LinearEulerIntegrator() { } //////////////////////////////////////////////////////////////////// -// Function : Integrate -// Access : Public -// Description : Integrate a step of motion (based on dt) by +// Function: Integrate +// Access: Public +// Description: Integrate a step of motion (based on dt) by // applying every force in force_vec to every object // in obj_vec. -// +// // physical, // The objects being acted upon and the -// set of local forces that are applied +// set of local forces that are applied // after the global forces. // forces, // Global forces to be applied first. @@ -90,16 +90,16 @@ child_integrate(Physical *physical, if (current_object == (PhysicsObject *) NULL) { continue; } - + if (current_object->get_active() == false) { continue; } - + LVector3 md_accum_vec; // mass dependent accumulation vector. LVector3 non_md_accum_vec; LVector3 accel_vec; LVector3 vel_vec; - + // reset the accumulation vectors for this object md_accum_vec.set(0.0f, 0.0f, 0.0f); non_md_accum_vec.set(0.0f, 0.0f, 0.0f); @@ -181,15 +181,15 @@ child_integrate(Physical *physical, pos += vel_vec * dt; #else //][ assert(current_object->get_position()==current_object->get_last_position()); - + accel_vec*=viscosityDamper; - + // x = x + v * t + 0.5 * a * t * t pos += vel_vec * dt + 0.5 * accel_vec * dt * dt; // v = v + a * t vel_vec += accel_vec * dt; #endif //] - + // and store them back. if (!pos.is_nan()) { current_object->set_position(pos); @@ -201,10 +201,10 @@ child_integrate(Physical *physical, } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearEulerIntegrator:: output(ostream &out) const { @@ -214,10 +214,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearEulerIntegrator:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/linearForce.I b/panda/src/physics/linearForce.I index 2c09236f4a..cbf114d6dc 100644 --- a/panda/src/physics/linearForce.I +++ b/panda/src/physics/linearForce.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_amplitude -// Access : Public +// Function: set_amplitude +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void LinearForce:: set_amplitude(PN_stdfloat a) { @@ -22,8 +22,8 @@ set_amplitude(PN_stdfloat a) { } //////////////////////////////////////////////////////////////////// -// Function : get_amplitude -// Access : Public +// Function: get_amplitude +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat LinearForce:: get_amplitude() const { @@ -31,8 +31,8 @@ get_amplitude() const { } //////////////////////////////////////////////////////////////////// -// Function : get_mass_dependent -// Access : Public +// Function: get_mass_dependent +// Access: Public //////////////////////////////////////////////////////////////////// INLINE bool LinearForce:: get_mass_dependent() const { @@ -40,8 +40,8 @@ get_mass_dependent() const { } //////////////////////////////////////////////////////////////////// -// Function : set_mass_Dependent -// Access : Public +// Function: set_mass_Dependent +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void LinearForce:: set_mass_dependent(bool m) { @@ -49,8 +49,8 @@ set_mass_dependent(bool m) { } //////////////////////////////////////////////////////////////////// -// Function : set_vector_masks -// Access : Public +// Function: set_vector_masks +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void LinearForce:: set_vector_masks(bool x, bool y, bool z) { @@ -60,8 +60,8 @@ set_vector_masks(bool x, bool y, bool z) { } //////////////////////////////////////////////////////////////////// -// Function : set_vector_masks -// Access : Public +// Function: set_vector_masks +// Access: Public //////////////////////////////////////////////////////////////////// INLINE LVector3 LinearForce:: get_vector_masks() { diff --git a/panda/src/physics/linearForce.cxx b/panda/src/physics/linearForce.cxx index d687fdb99d..3b3b114c1c 100644 --- a/panda/src/physics/linearForce.cxx +++ b/panda/src/physics/linearForce.cxx @@ -22,9 +22,9 @@ TypeHandle LinearForce::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : LinearForce -// Access : Protected -// Description : Default/component-based constructor +// Function: LinearForce +// Access: Protected +// Description: Default/component-based constructor //////////////////////////////////////////////////////////////////// LinearForce:: LinearForce(PN_stdfloat a, bool mass) : @@ -34,9 +34,9 @@ LinearForce(PN_stdfloat a, bool mass) : } //////////////////////////////////////////////////////////////////// -// Function : LinearForce -// Access : Protected -// Description : copy constructor +// Function: LinearForce +// Access: Protected +// Description: copy constructor //////////////////////////////////////////////////////////////////// LinearForce:: LinearForce(const LinearForce& copy) : @@ -49,17 +49,17 @@ LinearForce(const LinearForce& copy) : } //////////////////////////////////////////////////////////////////// -// Function : ~LinearForce -// Access : Public -// Description : Destructor +// Function: ~LinearForce +// Access: Public +// Description: Destructor //////////////////////////////////////////////////////////////////// LinearForce:: ~LinearForce() { } //////////////////////////////////////////////////////////////////// -// Function : get_vector -// Access : Public +// Function: get_vector +// Access: Public //////////////////////////////////////////////////////////////////// LVector3 LinearForce:: get_vector(const PhysicsObject *po) { @@ -79,8 +79,8 @@ get_vector(const PhysicsObject *po) { } //////////////////////////////////////////////////////////////////// -// Function : is_linear -// Access : Public +// Function: is_linear +// Access: Public //////////////////////////////////////////////////////////////////// bool LinearForce:: is_linear() const { @@ -88,10 +88,10 @@ is_linear() const { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearForce:: output(ostream &out) const { @@ -101,10 +101,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearForce:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/linearFrictionForce.I b/panda/src/physics/linearFrictionForce.I index 8011e15717..184d59f2a2 100644 --- a/panda/src/physics/linearFrictionForce.I +++ b/panda/src/physics/linearFrictionForce.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_coef -// Access : public +// Function: set_coef +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void LinearFrictionForce:: set_coef(PN_stdfloat coef) { @@ -28,8 +28,8 @@ set_coef(PN_stdfloat coef) { } //////////////////////////////////////////////////////////////////// -// Function : get_coef -// Access : public +// Function: get_coef +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat LinearFrictionForce:: get_coef() const { diff --git a/panda/src/physics/linearFrictionForce.cxx b/panda/src/physics/linearFrictionForce.cxx index 85ca8bb948..042f172202 100644 --- a/panda/src/physics/linearFrictionForce.cxx +++ b/panda/src/physics/linearFrictionForce.cxx @@ -18,9 +18,9 @@ TypeHandle LinearFrictionForce::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : LinearFrictionForce -// Access : Public -// Description : Constructor +// Function: LinearFrictionForce +// Access: Public +// Description: Constructor //////////////////////////////////////////////////////////////////// LinearFrictionForce:: LinearFrictionForce(PN_stdfloat coef, PN_stdfloat a, bool m) : @@ -29,9 +29,9 @@ LinearFrictionForce(PN_stdfloat coef, PN_stdfloat a, bool m) : } //////////////////////////////////////////////////////////////////// -// Function : LinearFrictionForce -// Access : Public -// Description : copy constructor +// Function: LinearFrictionForce +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// LinearFrictionForce:: LinearFrictionForce(const LinearFrictionForce ©) : @@ -40,18 +40,18 @@ LinearFrictionForce(const LinearFrictionForce ©) : } //////////////////////////////////////////////////////////////////// -// Function : LinearFrictionForce -// Access : Public -// Description : destructor +// Function: LinearFrictionForce +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// LinearFrictionForce:: ~LinearFrictionForce() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : copier +// Function: make_copy +// Access: Public +// Description: copier //////////////////////////////////////////////////////////////////// LinearForce *LinearFrictionForce:: make_copy() { @@ -59,9 +59,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : LinearFrictionForce -// Access : Public -// Description : Constructor +// Function: LinearFrictionForce +// Access: Public +// Description: Constructor //////////////////////////////////////////////////////////////////// LVector3 LinearFrictionForce:: get_child_vector(const PhysicsObject* po) { @@ -72,7 +72,7 @@ get_child_vector(const PhysicsObject* po) { physics_debug(" v "<. +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearFrictionForce:: output(ostream &out) const { @@ -95,10 +95,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearFrictionForce:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/linearIntegrator.cxx b/panda/src/physics/linearIntegrator.cxx index dec4d04c0d..6c88db005b 100644 --- a/panda/src/physics/linearIntegrator.cxx +++ b/panda/src/physics/linearIntegrator.cxx @@ -22,27 +22,27 @@ ConfigVariableDouble LinearIntegrator::_max_linear_dt //////////////////////////////////////////////////////////////////// -// Function : BaseLinearIntegrator -// Access : Protected -// Description : constructor +// Function: BaseLinearIntegrator +// Access: Protected +// Description: constructor //////////////////////////////////////////////////////////////////// LinearIntegrator:: LinearIntegrator() { } //////////////////////////////////////////////////////////////////// -// Function : ~LinearIntegrator -// Access : public, virtual -// Description : destructor +// Function: ~LinearIntegrator +// Access: Public, Virtual +// Description: destructor //////////////////////////////////////////////////////////////////// LinearIntegrator:: ~LinearIntegrator() { } //////////////////////////////////////////////////////////////////// -// Function : integrate -// Access : public -// Description : parent integration routine, hands off to child +// Function: integrate +// Access: Public +// Description: parent integration routine, hands off to child // virtual. //////////////////////////////////////////////////////////////////// void LinearIntegrator:: @@ -59,7 +59,7 @@ integrate(Physical *physical, LinearForceVector &forces, for (; current_object_iter != physical->get_object_vector().end(); ++current_object_iter) { PhysicsObject *current_object = *current_object_iter; - + // bail out if this object doesn't exist or doesn't want to be // processed. if (current_object == (PhysicsObject *) NULL) { @@ -73,10 +73,10 @@ integrate(Physical *physical, LinearForceVector &forces, } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearIntegrator:: output(ostream &out) const { @@ -86,10 +86,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearIntegrator:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/linearJitterForce.cxx b/panda/src/physics/linearJitterForce.cxx index e380c0b035..f3ab44207d 100644 --- a/panda/src/physics/linearJitterForce.cxx +++ b/panda/src/physics/linearJitterForce.cxx @@ -17,9 +17,9 @@ TypeHandle LinearJitterForce::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : LinearJitterForce -// Access : Public -// Description : constructor +// Function: LinearJitterForce +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// LinearJitterForce:: LinearJitterForce(PN_stdfloat a, bool mass) : @@ -27,9 +27,9 @@ LinearJitterForce(PN_stdfloat a, bool mass) : } //////////////////////////////////////////////////////////////////// -// Function : LinearJitterForce -// Access : Public -// Description : copy constructor +// Function: LinearJitterForce +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// LinearJitterForce:: LinearJitterForce(const LinearJitterForce ©) : @@ -37,18 +37,18 @@ LinearJitterForce(const LinearJitterForce ©) : } //////////////////////////////////////////////////////////////////// -// Function : LinearJitterForce -// Access : Public -// Description : constructor +// Function: LinearJitterForce +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// LinearJitterForce:: ~LinearJitterForce() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : copier +// Function: make_copy +// Access: Public +// Description: copier //////////////////////////////////////////////////////////////////// LinearForce *LinearJitterForce:: make_copy() { @@ -56,9 +56,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : get_child_vector -// Access : Public -// Description : random value +// Function: get_child_vector +// Access: Public +// Description: random value //////////////////////////////////////////////////////////////////// LVector3 LinearJitterForce:: get_child_vector(const PhysicsObject *) { @@ -66,10 +66,10 @@ get_child_vector(const PhysicsObject *) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearJitterForce:: output(ostream &out) const { @@ -79,10 +79,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearJitterForce:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/linearNoiseForce.I b/panda/src/physics/linearNoiseForce.I index 324d230ff3..c30f73204a 100644 --- a/panda/src/physics/linearNoiseForce.I +++ b/panda/src/physics/linearNoiseForce.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : prn_lookup -// Access : Private -// Description : Returns a valid entry in the prn table +// Function: prn_lookup +// Access: Private +// Description: Returns a valid entry in the prn table //////////////////////////////////////////////////////////////////// INLINE unsigned char LinearNoiseForce:: prn_lookup(int index) const { @@ -23,9 +23,9 @@ prn_lookup(int index) const { } //////////////////////////////////////////////////////////////////// -// Function : get_prn_entry -// Access : Private -// Description : Hashes a point, returns a prn +// Function: get_prn_entry +// Access: Private +// Description: Hashes a point, returns a prn //////////////////////////////////////////////////////////////////// INLINE unsigned char LinearNoiseForce:: get_prn_entry(const LPoint3& point) const { @@ -33,9 +33,9 @@ get_prn_entry(const LPoint3& point) const { } //////////////////////////////////////////////////////////////////// -// Function : get_prn_entry -// Access : Private -// Description : Hashes a point, returns a prn (piecewise) +// Function: get_prn_entry +// Access: Private +// Description: Hashes a point, returns a prn (piecewise) //////////////////////////////////////////////////////////////////// INLINE unsigned char LinearNoiseForce:: get_prn_entry(const PN_stdfloat x, const PN_stdfloat y, const PN_stdfloat z) const { @@ -43,9 +43,9 @@ get_prn_entry(const PN_stdfloat x, const PN_stdfloat y, const PN_stdfloat z) con } //////////////////////////////////////////////////////////////////// -// Function : get_lattice_entry -// Access : Private -// Description : Hashes a point, returns a gradient vector +// Function: get_lattice_entry +// Access: Private +// Description: Hashes a point, returns a gradient vector //////////////////////////////////////////////////////////////////// INLINE LVector3& LinearNoiseForce:: get_lattice_entry(const LPoint3& point) { @@ -53,9 +53,9 @@ get_lattice_entry(const LPoint3& point) { } //////////////////////////////////////////////////////////////////// -// Function : get_lattice_entry -// Access : Private -// Description : Hashes a point, returns a gradient vector (piecewise) +// Function: get_lattice_entry +// Access: Private +// Description: Hashes a point, returns a gradient vector (piecewise) //////////////////////////////////////////////////////////////////// INLINE LVector3& LinearNoiseForce:: get_lattice_entry(const PN_stdfloat x, const PN_stdfloat y, const PN_stdfloat z) { @@ -63,9 +63,9 @@ get_lattice_entry(const PN_stdfloat x, const PN_stdfloat y, const PN_stdfloat z) } //////////////////////////////////////////////////////////////////// -// Function : cubic_step -// Access : Private -// Description : Smooths a parameterized interpolation using +// Function: cubic_step +// Access: Private +// Description: Smooths a parameterized interpolation using // 2x^3 - 3x^2 //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat LinearNoiseForce:: @@ -74,9 +74,9 @@ cubic_step(const PN_stdfloat x) const { } //////////////////////////////////////////////////////////////////// -// Function : vlerp -// Access : Private -// Description : Vector linear interpolation +// Function: vlerp +// Access: Private +// Description: Vector linear interpolation //////////////////////////////////////////////////////////////////// INLINE LVector3 LinearNoiseForce:: vlerp(const PN_stdfloat t, const LVector3& v0, const LVector3& v1) const { diff --git a/panda/src/physics/linearNoiseForce.cxx b/panda/src/physics/linearNoiseForce.cxx index e687599aa5..37c492f8ea 100644 --- a/panda/src/physics/linearNoiseForce.cxx +++ b/panda/src/physics/linearNoiseForce.cxx @@ -29,9 +29,9 @@ LVector3 LinearNoiseForce::_gradient_table[256]; TypeHandle LinearNoiseForce::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : InitNoiseTables -// Access : Public -// Description : One-time config function, sets up the PRN +// Function: InitNoiseTables +// Access: Public +// Description: One-time config function, sets up the PRN // lattice. //////////////////////////////////////////////////////////////////// void LinearNoiseForce:: @@ -51,9 +51,9 @@ init_noise_tables() { } //////////////////////////////////////////////////////////////////// -// Function : LinearNoiseForce -// Access : Public -// Description : constructor +// Function: LinearNoiseForce +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// LinearNoiseForce:: LinearNoiseForce(PN_stdfloat a, bool mass) : @@ -65,9 +65,9 @@ LinearNoiseForce(PN_stdfloat a, bool mass) : } //////////////////////////////////////////////////////////////////// -// Function : LinearNoiseForce -// Access : Public -// Description : copy constructor +// Function: LinearNoiseForce +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// LinearNoiseForce:: LinearNoiseForce(const LinearNoiseForce ©) : @@ -75,18 +75,18 @@ LinearNoiseForce(const LinearNoiseForce ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~LinearNoiseForce -// Access : Public -// Description : destructor +// Function: ~LinearNoiseForce +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// LinearNoiseForce:: ~LinearNoiseForce() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : copier +// Function: make_copy +// Access: Public +// Description: copier //////////////////////////////////////////////////////////////////// LinearForce *LinearNoiseForce:: make_copy() { @@ -94,9 +94,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : get_child_vector -// Access : Public -// Description : Returns the noise value based on the object's +// Function: get_child_vector +// Access: Public +// Description: Returns the noise value based on the object's // position. //////////////////////////////////////////////////////////////////// LVector3 LinearNoiseForce:: @@ -148,10 +148,10 @@ get_child_vector(const PhysicsObject *po) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearNoiseForce:: output(ostream &out) const { @@ -161,10 +161,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearNoiseForce:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/linearRandomForce.I b/panda/src/physics/linearRandomForce.I index ba4b9f2e85..fe9d10c3c1 100644 --- a/panda/src/physics/linearRandomForce.I +++ b/panda/src/physics/linearRandomForce.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : random_unit_vector -// Access : Protected -// Description : generates a random unit vector +// Function: random_unit_vector +// Access: Protected +// Description: generates a random unit vector //////////////////////////////////////////////////////////////////// INLINE LVector3 LinearRandomForce:: random_unit_vector() { diff --git a/panda/src/physics/linearRandomForce.cxx b/panda/src/physics/linearRandomForce.cxx index cad1fdcbb3..a6cb34b2ed 100644 --- a/panda/src/physics/linearRandomForce.cxx +++ b/panda/src/physics/linearRandomForce.cxx @@ -17,9 +17,9 @@ TypeHandle LinearRandomForce::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : LinearRandomForce -// Access : Protected -// Description : vector constructor +// Function: LinearRandomForce +// Access: Protected +// Description: vector constructor //////////////////////////////////////////////////////////////////// LinearRandomForce:: LinearRandomForce(PN_stdfloat a, bool mass) : @@ -27,9 +27,9 @@ LinearRandomForce(PN_stdfloat a, bool mass) : } //////////////////////////////////////////////////////////////////// -// Function : LinearRandomForce -// Access : Protected -// Description : copy constructor +// Function: LinearRandomForce +// Access: Protected +// Description: copy constructor //////////////////////////////////////////////////////////////////// LinearRandomForce:: LinearRandomForce(const LinearRandomForce ©) : @@ -37,18 +37,18 @@ LinearRandomForce(const LinearRandomForce ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~LinearRandomForce -// Access : public -// Description : destructor +// Function: ~LinearRandomForce +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// LinearRandomForce:: ~LinearRandomForce() { } //////////////////////////////////////////////////////////////////// -// Function : bounded_rand -// Access : Protected -// Description : Returns a float in [0, 1] +// Function: bounded_rand +// Access: Protected +// Description: Returns a float in [0, 1] //////////////////////////////////////////////////////////////////// PN_stdfloat LinearRandomForce:: bounded_rand() { @@ -56,10 +56,10 @@ bounded_rand() { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearRandomForce:: output(ostream &out) const { @@ -69,10 +69,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearRandomForce:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/linearSinkForce.cxx b/panda/src/physics/linearSinkForce.cxx index f5ce9744dc..1928a5c318 100644 --- a/panda/src/physics/linearSinkForce.cxx +++ b/panda/src/physics/linearSinkForce.cxx @@ -17,9 +17,9 @@ TypeHandle LinearSinkForce::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : LinearSinkForce -// Access : Public -// Description : Simple constructor +// Function: LinearSinkForce +// Access: Public +// Description: Simple constructor //////////////////////////////////////////////////////////////////// LinearSinkForce:: LinearSinkForce(const LPoint3& p, FalloffType f, PN_stdfloat r, PN_stdfloat a, @@ -28,9 +28,9 @@ LinearSinkForce(const LPoint3& p, FalloffType f, PN_stdfloat r, PN_stdfloat a, } //////////////////////////////////////////////////////////////////// -// Function : LinearSinkForce -// Access : Public -// Description : Simple constructor +// Function: LinearSinkForce +// Access: Public +// Description: Simple constructor //////////////////////////////////////////////////////////////////// LinearSinkForce:: LinearSinkForce() : @@ -39,9 +39,9 @@ LinearSinkForce() : } //////////////////////////////////////////////////////////////////// -// Function : LinearSinkForce -// Access : Public -// Description : copy constructor +// Function: LinearSinkForce +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// LinearSinkForce:: LinearSinkForce(const LinearSinkForce ©) : @@ -49,18 +49,18 @@ LinearSinkForce(const LinearSinkForce ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~LinearSinkForce -// Access : Public -// Description : Simple destructor +// Function: ~LinearSinkForce +// Access: Public +// Description: Simple destructor //////////////////////////////////////////////////////////////////// LinearSinkForce:: ~LinearSinkForce() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : copier +// Function: make_copy +// Access: Public +// Description: copier //////////////////////////////////////////////////////////////////// LinearForce *LinearSinkForce:: make_copy() { @@ -68,9 +68,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : get_child_vector -// Access : Public -// Description : virtual force query +// Function: get_child_vector +// Access: Public +// Description: virtual force query //////////////////////////////////////////////////////////////////// LVector3 LinearSinkForce:: get_child_vector(const PhysicsObject *po) { @@ -78,10 +78,10 @@ get_child_vector(const PhysicsObject *po) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearSinkForce:: output(ostream &out) const { @@ -91,10 +91,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearSinkForce:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/linearSourceForce.cxx b/panda/src/physics/linearSourceForce.cxx index b139df80fc..bf7686899a 100644 --- a/panda/src/physics/linearSourceForce.cxx +++ b/panda/src/physics/linearSourceForce.cxx @@ -17,9 +17,9 @@ TypeHandle LinearSourceForce::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : LinearSourceForce -// Access : Public -// Description : Simple constructor +// Function: LinearSourceForce +// Access: Public +// Description: Simple constructor //////////////////////////////////////////////////////////////////// LinearSourceForce:: LinearSourceForce(const LPoint3& p, FalloffType f, PN_stdfloat r, PN_stdfloat a, @@ -28,9 +28,9 @@ LinearSourceForce(const LPoint3& p, FalloffType f, PN_stdfloat r, PN_stdfloat a, } //////////////////////////////////////////////////////////////////// -// Function : LinearSourceForce -// Access : Public -// Description : Simple constructor +// Function: LinearSourceForce +// Access: Public +// Description: Simple constructor //////////////////////////////////////////////////////////////////// LinearSourceForce:: LinearSourceForce() : @@ -39,9 +39,9 @@ LinearSourceForce() : } //////////////////////////////////////////////////////////////////// -// Function : LinearSourceForce -// Access : Public -// Description : copy constructor +// Function: LinearSourceForce +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// LinearSourceForce:: LinearSourceForce(const LinearSourceForce ©) : @@ -49,18 +49,18 @@ LinearSourceForce(const LinearSourceForce ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~LinearSourceForce -// Access : Public -// Description : Simple destructor +// Function: ~LinearSourceForce +// Access: Public +// Description: Simple destructor //////////////////////////////////////////////////////////////////// LinearSourceForce:: ~LinearSourceForce() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public -// Description : copier +// Function: make_copy +// Access: Public +// Description: copier //////////////////////////////////////////////////////////////////// LinearForce *LinearSourceForce:: make_copy() { @@ -68,9 +68,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : get_child_vector -// Access : Public -// Description : virtual force query +// Function: get_child_vector +// Access: Public +// Description: virtual force query //////////////////////////////////////////////////////////////////// LVector3 LinearSourceForce:: get_child_vector(const PhysicsObject *po) { @@ -78,10 +78,10 @@ get_child_vector(const PhysicsObject *po) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearSourceForce:: output(ostream &out) const { @@ -91,10 +91,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearSourceForce:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/linearUserDefinedForce.I b/panda/src/physics/linearUserDefinedForce.I index 36e7b84b31..7c9a539d4f 100644 --- a/panda/src/physics/linearUserDefinedForce.I +++ b/panda/src/physics/linearUserDefinedForce.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_proc -// Access : public +// Function: set_proc +// Access: Public //////////////////////////////////////////////////////////////////// void LinearUserDefinedForce:: set_proc(LVector3 (*proc)(const PhysicsObject *)) { diff --git a/panda/src/physics/linearUserDefinedForce.cxx b/panda/src/physics/linearUserDefinedForce.cxx index 703f4b2ebb..056af25062 100644 --- a/panda/src/physics/linearUserDefinedForce.cxx +++ b/panda/src/physics/linearUserDefinedForce.cxx @@ -17,9 +17,9 @@ TypeHandle LinearUserDefinedForce::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : LinearUserDefinedForce -// Access : public -// Description : constructor +// Function: LinearUserDefinedForce +// Access: Public +// Description: constructor //////////////////////////////////////////////////////////////////// LinearUserDefinedForce:: LinearUserDefinedForce(LVector3 (*proc)(const PhysicsObject *), @@ -30,9 +30,9 @@ LinearUserDefinedForce(LVector3 (*proc)(const PhysicsObject *), } //////////////////////////////////////////////////////////////////// -// Function : LinearUserDefinedForce -// Access : public -// Description : copy constructor +// Function: LinearUserDefinedForce +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// LinearUserDefinedForce:: LinearUserDefinedForce(const LinearUserDefinedForce ©) : @@ -41,18 +41,18 @@ LinearUserDefinedForce(const LinearUserDefinedForce ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~LinearUserDefinedForce -// Access : public -// Description : destructor +// Function: ~LinearUserDefinedForce +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// LinearUserDefinedForce:: ~LinearUserDefinedForce() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : private, virtual -// Description : child copier +// Function: make_copy +// Access: Private, Virtual +// Description: child copier //////////////////////////////////////////////////////////////////// LinearForce *LinearUserDefinedForce:: make_copy() { @@ -60,9 +60,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : get_child_vector -// Access : private, virtual -// Description : force builder +// Function: get_child_vector +// Access: Private, Virtual +// Description: force builder //////////////////////////////////////////////////////////////////// LVector3 LinearUserDefinedForce:: get_child_vector(const PhysicsObject *po) { @@ -70,10 +70,10 @@ get_child_vector(const PhysicsObject *po) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearUserDefinedForce:: output(ostream &out) const { @@ -83,10 +83,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearUserDefinedForce:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/linearVectorForce.I b/panda/src/physics/linearVectorForce.I index b14a6e67f0..3ed488ceb8 100644 --- a/panda/src/physics/linearVectorForce.I +++ b/panda/src/physics/linearVectorForce.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_vector -// Access : Public -// Description : encapsulating wrapper +// Function: set_vector +// Access: Public +// Description: encapsulating wrapper //////////////////////////////////////////////////////////////////// INLINE void LinearVectorForce:: set_vector(const LVector3& v) { @@ -23,9 +23,9 @@ set_vector(const LVector3& v) { } //////////////////////////////////////////////////////////////////// -// Function : set_vector -// Access : Public -// Description : piecewise encapsulating wrapper +// Function: set_vector +// Access: Public +// Description: piecewise encapsulating wrapper //////////////////////////////////////////////////////////////////// INLINE void LinearVectorForce:: set_vector(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) { @@ -33,9 +33,9 @@ set_vector(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) { } //////////////////////////////////////////////////////////////////// -// Function : get_local_vector -// Access : Public -// Description : +// Function: get_local_vector +// Access: Public +// Description: //////////////////////////////////////////////////////////////////// INLINE LVector3 LinearVectorForce:: get_local_vector() const { diff --git a/panda/src/physics/linearVectorForce.cxx b/panda/src/physics/linearVectorForce.cxx index a74921c3b5..e5828dbf3a 100644 --- a/panda/src/physics/linearVectorForce.cxx +++ b/panda/src/physics/linearVectorForce.cxx @@ -22,9 +22,9 @@ TypeHandle LinearVectorForce::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : LinearVectorForce -// Access : Public -// Description : Vector Constructor +// Function: LinearVectorForce +// Access: Public +// Description: Vector Constructor //////////////////////////////////////////////////////////////////// LinearVectorForce:: LinearVectorForce(const LVector3& vec, PN_stdfloat a, bool mass) : @@ -33,9 +33,9 @@ LinearVectorForce(const LVector3& vec, PN_stdfloat a, bool mass) : } //////////////////////////////////////////////////////////////////// -// Function : LinearVectorForce -// Access : Public -// Description : Default/Piecewise constructor +// Function: LinearVectorForce +// Access: Public +// Description: Default/Piecewise constructor //////////////////////////////////////////////////////////////////// LinearVectorForce:: LinearVectorForce(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat a, bool mass) : @@ -44,9 +44,9 @@ LinearVectorForce(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat a, bo } //////////////////////////////////////////////////////////////////// -// Function : LinearVectorForce -// Access : Public -// Description : Copy Constructor +// Function: LinearVectorForce +// Access: Public +// Description: Copy Constructor //////////////////////////////////////////////////////////////////// LinearVectorForce:: LinearVectorForce(const LinearVectorForce ©) : @@ -55,18 +55,18 @@ LinearVectorForce(const LinearVectorForce ©) : } //////////////////////////////////////////////////////////////////// -// Function : LinearVectorForce -// Access : Public -// Description : Destructor +// Function: LinearVectorForce +// Access: Public +// Description: Destructor //////////////////////////////////////////////////////////////////// LinearVectorForce:: ~LinearVectorForce() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public, virtual -// Description : copier +// Function: make_copy +// Access: Public, Virtual +// Description: copier //////////////////////////////////////////////////////////////////// LinearForce *LinearVectorForce:: make_copy() { @@ -74,9 +74,9 @@ make_copy() { } //////////////////////////////////////////////////////////////////// -// Function : get_child_vector -// Access : Public -// Description : vector access +// Function: get_child_vector +// Access: Public +// Description: vector access //////////////////////////////////////////////////////////////////// LVector3 LinearVectorForce:: get_child_vector(const PhysicsObject *) { @@ -84,10 +84,10 @@ get_child_vector(const PhysicsObject *) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearVectorForce:: output(ostream &out) const { @@ -97,10 +97,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void LinearVectorForce:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/linearVectorForce.h b/panda/src/physics/linearVectorForce.h index a48fb78064..4fa1222001 100644 --- a/panda/src/physics/linearVectorForce.h +++ b/panda/src/physics/linearVectorForce.h @@ -17,11 +17,11 @@ #include "linearForce.h" -//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Class : LinearVectorForce // Description : Simple directed vector force. Suitable for // gravity, non-turbulent wind, etc... -//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class EXPCL_PANDAPHYSICS LinearVectorForce : public LinearForce { PUBLISHED: LinearVectorForce(const LVector3& vec, PN_stdfloat a = 1.0f, bool mass = false); @@ -34,7 +34,7 @@ PUBLISHED: INLINE void set_vector(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z); INLINE LVector3 get_local_vector() const; - + virtual void output(ostream &out) const; virtual void write(ostream &out, unsigned int indent=0) const; diff --git a/panda/src/physics/physical.I b/panda/src/physics/physical.I index e46bb228fd..afbc8d9bac 100644 --- a/panda/src/physics/physical.I +++ b/panda/src/physics/physical.I @@ -15,9 +15,9 @@ #include //////////////////////////////////////////////////////////////////// -// Function : clear_linear_forces -// Access : Public -// Description : Erases the linear force list +// Function: clear_linear_forces +// Access: Public +// Description: Erases the linear force list //////////////////////////////////////////////////////////////////// INLINE void Physical:: clear_linear_forces() { @@ -26,9 +26,9 @@ clear_linear_forces() { } //////////////////////////////////////////////////////////////////// -// Function : clear_angular_forces -// Access : Public -// Description : Erases the angular force list +// Function: clear_angular_forces +// Access: Public +// Description: Erases the angular force list //////////////////////////////////////////////////////////////////// INLINE void Physical:: clear_angular_forces() { @@ -37,9 +37,9 @@ clear_angular_forces() { } //////////////////////////////////////////////////////////////////// -// Function : clear_physics_objects -// Access : Public -// Description : Erases the object list +// Function: clear_physics_objects +// Access: Public +// Description: Erases the object list //////////////////////////////////////////////////////////////////// INLINE void Physical:: clear_physics_objects() { @@ -48,9 +48,9 @@ clear_physics_objects() { } //////////////////////////////////////////////////////////////////// -// Function : add_linear_force -// Access : Public -// Description : Adds a linear force to the force list +// Function: add_linear_force +// Access: Public +// Description: Adds a linear force to the force list //////////////////////////////////////////////////////////////////// INLINE void Physical:: add_linear_force(LinearForce *f) { @@ -58,9 +58,9 @@ add_linear_force(LinearForce *f) { } //////////////////////////////////////////////////////////////////// -// Function : add_angular_force -// Access : Public -// Description : Adds an angular force to the force list +// Function: add_angular_force +// Access: Public +// Description: Adds an angular force to the force list //////////////////////////////////////////////////////////////////// INLINE void Physical:: add_angular_force(AngularForce *f) { @@ -68,9 +68,9 @@ add_angular_force(AngularForce *f) { } //////////////////////////////////////////////////////////////////// -// Function : remove_linear_force -// Access : Public -// Description : removes a linear force from the force list +// Function: remove_linear_force +// Access: Public +// Description: removes a linear force from the force list //////////////////////////////////////////////////////////////////// INLINE void Physical:: remove_linear_force(LinearForce *f) { @@ -88,9 +88,9 @@ remove_linear_force(LinearForce *f) { } //////////////////////////////////////////////////////////////////// -// Function : remove_angular_force -// Access : Public -// Description : removes an angular force from the force list +// Function: remove_angular_force +// Access: Public +// Description: removes an angular force from the force list //////////////////////////////////////////////////////////////////// INLINE void Physical:: remove_angular_force(AngularForce *f) { @@ -106,9 +106,9 @@ remove_angular_force(AngularForce *f) { } //////////////////////////////////////////////////////////////////// -// Function : add_physics_object -// Access : Public -// Description : Adds an object to the physics object vector +// Function: add_physics_object +// Access: Public +// Description: Adds an object to the physics object vector //////////////////////////////////////////////////////////////////// INLINE void Physical:: add_physics_object(PhysicsObject *po) { @@ -116,8 +116,8 @@ add_physics_object(PhysicsObject *po) { } //////////////////////////////////////////////////////////////////// -// Function : get_physics_manager -// Access : Public +// Function: get_physics_manager +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PhysicsManager *Physical:: get_physics_manager() const { @@ -125,8 +125,8 @@ get_physics_manager() const { } //////////////////////////////////////////////////////////////////// -// Function : get_phys_body -// Access : Public +// Function: get_phys_body +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PhysicsObject *Physical:: get_phys_body() const { @@ -134,8 +134,8 @@ get_phys_body() const { } //////////////////////////////////////////////////////////////////// -// Function : get_physical_node -// Access : Public +// Function: get_physical_node +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PhysicalNode *Physical:: get_physical_node() const { @@ -143,8 +143,8 @@ get_physical_node() const { } //////////////////////////////////////////////////////////////////// -// Function : get_physical_node_path -// Access : Public +// Function: get_physical_node_path +// Access: Public //////////////////////////////////////////////////////////////////// INLINE NodePath Physical:: get_physical_node_path() const { @@ -152,8 +152,8 @@ get_physical_node_path() const { } //////////////////////////////////////////////////////////////////// -// Function : get_object_vector -// Access : Public +// Function: get_object_vector +// Access: Public //////////////////////////////////////////////////////////////////// INLINE const PhysicsObject::Vector &Physical:: get_object_vector() const { @@ -161,8 +161,8 @@ get_object_vector() const { } //////////////////////////////////////////////////////////////////// -// Function : get_linear_forces -// Access : Public +// Function: get_linear_forces +// Access: Public //////////////////////////////////////////////////////////////////// INLINE const Physical::LinearForceVector &Physical:: get_linear_forces() const { @@ -170,8 +170,8 @@ get_linear_forces() const { } //////////////////////////////////////////////////////////////////// -// Function : get_angular_forces -// Access : Public +// Function: get_angular_forces +// Access: Public //////////////////////////////////////////////////////////////////// INLINE const Physical::AngularForceVector &Physical:: get_angular_forces() const { @@ -179,8 +179,8 @@ get_angular_forces() const { } //////////////////////////////////////////////////////////////////// -// Function : get_num_linear_forces -// Access : Public +// Function: get_num_linear_forces +// Access: Public //////////////////////////////////////////////////////////////////// INLINE int Physical:: get_num_linear_forces() const { @@ -188,8 +188,8 @@ get_num_linear_forces() const { } //////////////////////////////////////////////////////////////////// -// Function : get_linear_force -// Access : Public +// Function: get_linear_force +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PT(LinearForce) Physical:: get_linear_force(int index) const { @@ -198,8 +198,8 @@ get_linear_force(int index) const { } //////////////////////////////////////////////////////////////////// -// Function : get_num_angular_forces -// Access : Public +// Function: get_num_angular_forces +// Access: Public //////////////////////////////////////////////////////////////////// INLINE int Physical:: get_num_angular_forces() const { @@ -207,8 +207,8 @@ get_num_angular_forces() const { } //////////////////////////////////////////////////////////////////// -// Function : get_angular_force -// Access : Public +// Function: get_angular_force +// Access: Public //////////////////////////////////////////////////////////////////// INLINE PT(AngularForce) Physical:: get_angular_force(int index) const { @@ -217,9 +217,9 @@ get_angular_force(int index) const { } //////////////////////////////////////////////////////////////////// -// Function : set_viscosity -// Access : Public -// Description : Set the local viscosity. +// Function: set_viscosity +// Access: Public +// Description: Set the local viscosity. //////////////////////////////////////////////////////////////////// INLINE void Physical:: set_viscosity(PN_stdfloat viscosity) { @@ -227,9 +227,9 @@ set_viscosity(PN_stdfloat viscosity) { } //////////////////////////////////////////////////////////////////// -// Function : get_viscosity -// Access : Public -// Description : Get the local viscosity. +// Function: get_viscosity +// Access: Public +// Description: Get the local viscosity. //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat Physical:: get_viscosity() const { diff --git a/panda/src/physics/physical.cxx b/panda/src/physics/physical.cxx index 5c4e0d274f..4b912d6538 100644 --- a/panda/src/physics/physical.cxx +++ b/panda/src/physics/physical.cxx @@ -20,20 +20,19 @@ TypeHandle Physical::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : Physical -// Access : Public -// Description : Default Constructor -// -// The idea here is that most physicals will NOT -// be collections of sets (i.e. particle systems -// and whatever else). Because of this, the default -// constructor, unless otherwise specified, will -// automatically allocate and initialize one -// PhysicalObject. This makes it easier for +// Function: Physical +// Access: Public +// Description: Default Constructor +// The idea here is that most physicals will NOT +// be collections of sets (i.e. particle systems +// and whatever else). Because of this, the default +// constructor, unless otherwise specified, will +// automatically allocate and initialize one +// PhysicalObject. This makes it easier for // high-level work. // -// pre-alloc is ONLY for multiple-object physicals, -// and if true, fills the physics_object vector +// pre-alloc is ONLY for multiple-object physicals, +// and if true, fills the physics_object vector // with dead nodes, pre-allocating for the speed // end of the speed-vs-overhead deal. //////////////////////////////////////////////////////////////////// @@ -59,9 +58,9 @@ Physical(int total_objects, bool pre_alloc) { } //////////////////////////////////////////////////////////////////// -// Function : Physical -// Access : Public -// Description : copy constructor (note- does deep copy of pn's) +// Function: Physical +// Access: Public +// Description: copy constructor (note- does deep copy of pn's) // but does NOT attach itself to its template's // physicsmanager. //////////////////////////////////////////////////////////////////// @@ -101,9 +100,9 @@ Physical(const Physical& copy) { } //////////////////////////////////////////////////////////////////// -// Function : ~Physical -// Access : Public -// Description : destructor +// Function: ~Physical +// Access: Public +// Description: destructor //////////////////////////////////////////////////////////////////// Physical:: ~Physical() { @@ -117,8 +116,8 @@ Physical:: } //////////////////////////////////////////////////////////////////// -// Function : get_objects -// Access : Public +// Function: get_objects +// Access: Public //////////////////////////////////////////////////////////////////// const PhysicsObjectCollection Physical:: get_objects() const{ @@ -134,10 +133,10 @@ get_objects() const{ } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void Physical:: output(ostream &out) const { @@ -147,10 +146,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write_physics_objects -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write_physics_objects +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void Physical:: write_physics_objects(ostream &out, unsigned int indent) const { @@ -166,10 +165,10 @@ write_physics_objects(ostream &out, unsigned int indent) const { } //////////////////////////////////////////////////////////////////// -// Function : write_linear_forces -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write_linear_forces +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void Physical:: write_linear_forces(ostream &out, unsigned int indent) const { @@ -185,10 +184,10 @@ write_linear_forces(ostream &out, unsigned int indent) const { } //////////////////////////////////////////////////////////////////// -// Function : write_angular_forces -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write_angular_forces +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void Physical:: write_angular_forces(ostream &out, unsigned int indent) const { @@ -204,10 +203,10 @@ write_angular_forces(ostream &out, unsigned int indent) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void Physical:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/physicalNode.I b/panda/src/physics/physicalNode.I index e6f5ebe611..f1ecbb7a2d 100644 --- a/panda/src/physics/physicalNode.I +++ b/panda/src/physics/physicalNode.I @@ -13,8 +13,8 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : clear -// Access : public +// Function: clear +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void PhysicalNode:: clear() { @@ -22,8 +22,8 @@ clear() { } //////////////////////////////////////////////////////////////////// -// Function : get_physical -// Access : public +// Function: get_physical +// Access: Public //////////////////////////////////////////////////////////////////// INLINE Physical *PhysicalNode:: get_physical(int index) const { @@ -33,8 +33,8 @@ get_physical(int index) const { } //////////////////////////////////////////////////////////////////// -// Function : get_num_physicals -// Access : public +// Function: get_num_physicals +// Access: Public //////////////////////////////////////////////////////////////////// INLINE int PhysicalNode:: get_num_physicals() const { @@ -42,8 +42,8 @@ get_num_physicals() const { } //////////////////////////////////////////////////////////////////// -// Function : add_physical -// Access : public +// Function: add_physical +// Access: Public //////////////////////////////////////////////////////////////////// INLINE void PhysicalNode:: add_physical(Physical *physical) { diff --git a/panda/src/physics/physicalNode.cxx b/panda/src/physics/physicalNode.cxx index 50c1ae91d1..99b70717ab 100644 --- a/panda/src/physics/physicalNode.cxx +++ b/panda/src/physics/physicalNode.cxx @@ -18,20 +18,20 @@ TypeHandle PhysicalNode::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : PhysicalNode -// Access : public -// Description : default constructor +// Function: PhysicalNode +// Access: Public +// Description: default constructor //////////////////////////////////////////////////////////////////// PhysicalNode:: PhysicalNode(const string &name) : - PandaNode(name) + PandaNode(name) { } //////////////////////////////////////////////////////////////////// -// Function : PhysicalNode -// Access : protected -// Description : copy constructor +// Function: PhysicalNode +// Access: Protected +// Description: copy constructor //////////////////////////////////////////////////////////////////// PhysicalNode:: PhysicalNode(const PhysicalNode ©) : @@ -39,18 +39,18 @@ PhysicalNode(const PhysicalNode ©) : } //////////////////////////////////////////////////////////////////// -// Function : ~PhysicalNode -// Access : protected, virtual -// Description : destructor +// Function: ~PhysicalNode +// Access: Protected, Virtual +// Description: destructor //////////////////////////////////////////////////////////////////// PhysicalNode:: ~PhysicalNode() { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : public, virtual -// Description : dynamic child copy +// Function: make_copy +// Access: Public, Virtual +// Description: dynamic child copy //////////////////////////////////////////////////////////////////// PandaNode *PhysicalNode:: make_copy() const { @@ -58,9 +58,9 @@ make_copy() const { } //////////////////////////////////////////////////////////////////// -// Function : add_physicals_from -// Access : public -// Description : append operation +// Function: add_physicals_from +// Access: Public +// Description: append operation //////////////////////////////////////////////////////////////////// void PhysicalNode:: add_physicals_from(const PhysicalNode &other) { @@ -75,9 +75,9 @@ add_physicals_from(const PhysicalNode &other) { } //////////////////////////////////////////////////////////////////// -// Function : remove_physical -// Access : public -// Description : remove operation +// Function: remove_physical +// Access: Public +// Description: remove operation //////////////////////////////////////////////////////////////////// void PhysicalNode:: remove_physical(Physical *physical) { @@ -90,9 +90,9 @@ remove_physical(Physical *physical) { } //////////////////////////////////////////////////////////////////// -// Function : remove_physical -// Access : public -// Description : remove operation +// Function: remove_physical +// Access: Public +// Description: remove operation //////////////////////////////////////////////////////////////////// void PhysicalNode:: remove_physical(int index) { @@ -106,10 +106,10 @@ remove_physical(int index) { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PhysicalNode:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physics/physicalNode.h b/panda/src/physics/physicalNode.h index d7f997a2c2..e79ef73cbc 100644 --- a/panda/src/physics/physicalNode.h +++ b/panda/src/physics/physicalNode.h @@ -24,8 +24,8 @@ #include "config_physics.h" //////////////////////////////////////////////////////////////////// -// Class : PhysicalNode -// Description : Graph node that encapsulated a series of physical +// Class : PhysicalNode +// Description : Graph node that encapsulated a series of physical // objects //////////////////////////////////////////////////////////////////// class EXPCL_PANDAPHYSICS PhysicalNode : public PandaNode { @@ -40,7 +40,7 @@ PUBLISHED: void add_physicals_from(const PhysicalNode &other); void remove_physical(Physical *physical); void remove_physical(int index); - + virtual void write(ostream &out, unsigned int indent=0) const; public: diff --git a/panda/src/physics/physicsManager.I b/panda/src/physics/physicsManager.I index d13fcf70f0..eb37cd577c 100644 --- a/panda/src/physics/physicsManager.I +++ b/panda/src/physics/physicsManager.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : attach_physical -// Access : Public -// Description : Registers a Physical class with the manager +// Function: attach_physical +// Access: Public +// Description: Registers a Physical class with the manager //////////////////////////////////////////////////////////////////// INLINE void PhysicsManager:: attach_physical(Physical *p) { @@ -29,9 +29,9 @@ attach_physical(Physical *p) { } //////////////////////////////////////////////////////////////////// -// Function : attach_linear_force -// Access : Public -// Description : Adds a global linear force to the physics manager +// Function: attach_linear_force +// Access: Public +// Description: Adds a global linear force to the physics manager //////////////////////////////////////////////////////////////////// INLINE void PhysicsManager:: add_linear_force(LinearForce *f) { @@ -45,9 +45,9 @@ add_linear_force(LinearForce *f) { } //////////////////////////////////////////////////////////////////// -// Function : attach_physicalnode -// Access : Public -// Description : Please call attach_physical_node instead. +// Function: attach_physicalnode +// Access: Public +// Description: Please call attach_physical_node instead. //////////////////////////////////////////////////////////////////// INLINE void PhysicsManager:: attach_physicalnode(PhysicalNode *p) { @@ -59,9 +59,9 @@ attach_physicalnode(PhysicalNode *p) { } //////////////////////////////////////////////////////////////////// -// Function : attach_physical_node -// Access : Public -// Description : Registers a physicalnode with the manager +// Function: attach_physical_node +// Access: Public +// Description: Registers a physicalnode with the manager //////////////////////////////////////////////////////////////////// INLINE void PhysicsManager:: attach_physical_node(PhysicalNode *p) { @@ -72,9 +72,9 @@ attach_physical_node(PhysicalNode *p) { } //////////////////////////////////////////////////////////////////// -// Function : clear_linear_forces -// Access : Public -// Description : Resets the physics manager force vector +// Function: clear_linear_forces +// Access: Public +// Description: Resets the physics manager force vector //////////////////////////////////////////////////////////////////// INLINE void PhysicsManager:: clear_linear_forces() { @@ -82,9 +82,9 @@ clear_linear_forces() { } //////////////////////////////////////////////////////////////////// -// Function : attach_angular_force -// Access : Public -// Description : Adds a global angular force to the physics manager +// Function: attach_angular_force +// Access: Public +// Description: Adds a global angular force to the physics manager //////////////////////////////////////////////////////////////////// INLINE void PhysicsManager:: add_angular_force(AngularForce *f) { @@ -97,9 +97,9 @@ add_angular_force(AngularForce *f) { } //////////////////////////////////////////////////////////////////// -// Function : clear_angular_forces -// Access : Public -// Description : Resets the physics manager force vector +// Function: clear_angular_forces +// Access: Public +// Description: Resets the physics manager force vector //////////////////////////////////////////////////////////////////// INLINE void PhysicsManager:: clear_angular_forces() { @@ -107,9 +107,9 @@ clear_angular_forces() { } //////////////////////////////////////////////////////////////////// -// Function : clear_physicals -// Access : Public -// Description : Resets the physics manager objects vector +// Function: clear_physicals +// Access: Public +// Description: Resets the physics manager objects vector //////////////////////////////////////////////////////////////////// INLINE void PhysicsManager:: clear_physicals() { @@ -117,9 +117,9 @@ clear_physicals() { } //////////////////////////////////////////////////////////////////// -// Function : set_viscosity -// Access : Public -// Description : Set the global viscosity. +// Function: set_viscosity +// Access: Public +// Description: Set the global viscosity. //////////////////////////////////////////////////////////////////// INLINE void PhysicsManager:: set_viscosity(PN_stdfloat viscosity) { @@ -127,9 +127,9 @@ set_viscosity(PN_stdfloat viscosity) { } //////////////////////////////////////////////////////////////////// -// Function : get_viscosity -// Access : Public -// Description : Get the global viscosity. +// Function: get_viscosity +// Access: Public +// Description: Get the global viscosity. //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat PhysicsManager:: get_viscosity() const { @@ -137,9 +137,9 @@ get_viscosity() const { } //////////////////////////////////////////////////////////////////// -// Function : attach_linear_integrator -// Access : Public -// Description : Hooks a linear integrator into the manager +// Function: attach_linear_integrator +// Access: Public +// Description: Hooks a linear integrator into the manager //////////////////////////////////////////////////////////////////// INLINE void PhysicsManager:: attach_linear_integrator(LinearIntegrator *i) { @@ -148,9 +148,9 @@ attach_linear_integrator(LinearIntegrator *i) { } //////////////////////////////////////////////////////////////////// -// Function : attach_angular_integrator -// Access : Public -// Description : Hooks an angular integrator into the manager +// Function: attach_angular_integrator +// Access: Public +// Description: Hooks an angular integrator into the manager //////////////////////////////////////////////////////////////////// INLINE void PhysicsManager:: attach_angular_integrator(AngularIntegrator *i) { diff --git a/panda/src/physics/physicsManager.cxx b/panda/src/physics/physicsManager.cxx index fd91a041da..5c26cead3d 100644 --- a/panda/src/physics/physicsManager.cxx +++ b/panda/src/physics/physicsManager.cxx @@ -22,9 +22,9 @@ ConfigVariableInt PhysicsManager::_random_seed ("physics_manager_random_seed", 139); //////////////////////////////////////////////////////////////////// -// Function : PhysicsManager -// Access : Public -// Description : Default Constructor. NOTE: EulerIntegrator is +// Function: PhysicsManager +// Access: Public +// Description: Default Constructor. NOTE: EulerIntegrator is // the standard default. //////////////////////////////////////////////////////////////////// PhysicsManager:: @@ -35,9 +35,9 @@ PhysicsManager() { } //////////////////////////////////////////////////////////////////// -// Function : ~PhysicsManager -// Access : Public -// Description : Simple Destructor +// Function: ~PhysicsManager +// Access: Public +// Description: Simple Destructor //////////////////////////////////////////////////////////////////// PhysicsManager:: ~PhysicsManager() { @@ -49,9 +49,9 @@ PhysicsManager:: } //////////////////////////////////////////////////////////////////// -// Function : InitRandomSeed -// Access : Public -// Description : One-time config function, sets up the random seed +// Function: InitRandomSeed +// Access: Public +// Description: One-time config function, sets up the random seed // used by the physics and particle systems. // For synchronizing across distributed computers //////////////////////////////////////////////////////////////////// @@ -63,9 +63,9 @@ init_random_seed() { } //////////////////////////////////////////////////////////////////// -// Function : remove_linear_force -// Access : Public -// Description : takes a linear force out of the physics list +// Function: remove_linear_force +// Access: Public +// Description: takes a linear force out of the physics list //////////////////////////////////////////////////////////////////// void PhysicsManager:: remove_linear_force(LinearForce *f) { @@ -82,9 +82,9 @@ remove_linear_force(LinearForce *f) { } //////////////////////////////////////////////////////////////////// -// Function : remove_angular_force -// Access : Public -// Description : takes an angular force out of the physics list +// Function: remove_angular_force +// Access: Public +// Description: takes an angular force out of the physics list //////////////////////////////////////////////////////////////////// void PhysicsManager:: remove_angular_force(AngularForce *f) { @@ -101,9 +101,9 @@ remove_angular_force(AngularForce *f) { } //////////////////////////////////////////////////////////////////// -// Function : remove_physical -// Access : Public -// Description : takes a physical out of the object list +// Function: remove_physical +// Access: Public +// Description: takes a physical out of the object list //////////////////////////////////////////////////////////////////// void PhysicsManager:: remove_physical(Physical *p) { @@ -120,9 +120,9 @@ remove_physical(Physical *p) { } //////////////////////////////////////////////////////////////////// -// Function : remove_physical_node -// Access : Public -// Description : Removes a physicalnode from the manager +// Function: remove_physical_node +// Access: Public +// Description: Removes a physicalnode from the manager //////////////////////////////////////////////////////////////////// void PhysicsManager:: remove_physical_node(PhysicalNode *p) { @@ -133,9 +133,9 @@ remove_physical_node(PhysicalNode *p) { } //////////////////////////////////////////////////////////////////// -// Function : DoPhysics -// Access : Public -// Description : This is the main high-level API call. Performs +// Function: DoPhysics +// Access: Public +// Description: This is the main high-level API call. Performs // integration on every attached Physical. //////////////////////////////////////////////////////////////////// void PhysicsManager:: @@ -168,28 +168,28 @@ do_physics(PN_stdfloat dt) { } //////////////////////////////////////////////////////////////////// -// Function : DoPhysics -// Access : Public -// Description : This is the main high-level API call. Performs -// integration on a single physical. Make sure its +// Function: DoPhysics +// Access: Public +// Description: This is the main high-level API call. Performs +// integration on a single physical. Make sure its // associated forces are active. //////////////////////////////////////////////////////////////////// void PhysicsManager:: do_physics(PN_stdfloat dt, Physical *physical) { nassertv(physical); - + // do linear //if (_linear_integrator.is_null() == false) { if (_linear_integrator) { _linear_integrator->integrate(physical, _linear_forces, dt); } - + // do angular //if (_angular_integrator.is_null() == false) { if (_angular_integrator) { _angular_integrator->integrate(physical, _angular_forces, dt); } - + // if it's an actor node, tell it to update itself. PhysicalNode *pn = physical->get_physical_node(); if (pn && pn->is_of_type(ActorNode::get_class_type())) { @@ -199,10 +199,10 @@ do_physics(PN_stdfloat dt, Physical *physical) { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PhysicsManager:: output(ostream &out) const { @@ -212,10 +212,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write_physicals -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write_physicals +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PhysicsManager:: write_physicals(ostream &out, unsigned int indent) const { @@ -235,10 +235,10 @@ write_physicals(ostream &out, unsigned int indent) const { } //////////////////////////////////////////////////////////////////// -// Function : write_forces -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write_forces +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PhysicsManager:: write_linear_forces(ostream &out, unsigned int indent) const { @@ -254,10 +254,10 @@ write_linear_forces(ostream &out, unsigned int indent) const { } //////////////////////////////////////////////////////////////////// -// Function : write_angular_forces -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write_angular_forces +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PhysicsManager:: write_angular_forces(ostream &out, unsigned int indent) const { @@ -273,10 +273,10 @@ write_angular_forces(ostream &out, unsigned int indent) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PhysicsManager:: write(ostream &out, unsigned int indent) const { @@ -306,10 +306,10 @@ write(ostream &out, unsigned int indent) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PhysicsManager:: debug_output(ostream &out, unsigned int indent) const { @@ -317,7 +317,7 @@ debug_output(ostream &out, unsigned int indent) const { out.width(indent); out<<""<<"PhysicsManager li"<<(_linear_integrator?1:0)<<" ai"<<(_angular_integrator?1:0)<<"\n"; out<<" _physicals "<<_physicals.size()<<"\n"; //_physicals._phys_body.write(out, indent+2); - + out.width(indent+2); out<<""<<"_linear_forces ("<<_linear_forces.size()<<" forces)\n"; diff --git a/panda/src/physics/physicsObject.I b/panda/src/physics/physicsObject.I index 2666883b4e..dd430752c6 100644 --- a/panda/src/physics/physicsObject.I +++ b/panda/src/physics/physicsObject.I @@ -13,9 +13,9 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Function : set_mass -// Access : Public -// Description : Set the mass in slugs (or kilograms). +// Function: set_mass +// Access: Public +// Description: Set the mass in slugs (or kilograms). //////////////////////////////////////////////////////////////////// INLINE void PhysicsObject:: set_mass(PN_stdfloat m) { @@ -24,9 +24,9 @@ set_mass(PN_stdfloat m) { } //////////////////////////////////////////////////////////////////// -// Function : set_position -// Access : Public -// Description : Vector position assignment. This is also used as +// Function: set_position +// Access: Public +// Description: Vector position assignment. This is also used as // the center of mass. //////////////////////////////////////////////////////////////////// INLINE void PhysicsObject:: @@ -36,9 +36,9 @@ set_position(const LPoint3 &pos) { } //////////////////////////////////////////////////////////////////// -// Function : set_position -// Access : Public -// Description : Piecewise position assignment +// Function: set_position +// Access: Public +// Description: Piecewise position assignment //////////////////////////////////////////////////////////////////// INLINE void PhysicsObject:: set_position(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) { @@ -47,9 +47,9 @@ set_position(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) { } //////////////////////////////////////////////////////////////////// -// Function : reset_position -// Access : Public -// Description : use this to place an object in a completely new +// Function: reset_position +// Access: Public +// Description: use this to place an object in a completely new // position, that has nothing to do with its last // position. //////////////////////////////////////////////////////////////////// @@ -62,9 +62,9 @@ reset_position(const LPoint3 &pos) { } //////////////////////////////////////////////////////////////////// -// Function : reset_orientation -// Access : Public -// Description : set the orientation while clearing the rotation +// Function: reset_orientation +// Access: Public +// Description: set the orientation while clearing the rotation // velocity. //////////////////////////////////////////////////////////////////// INLINE void PhysicsObject:: @@ -75,9 +75,9 @@ reset_orientation(const LOrientation &orientation) { } //////////////////////////////////////////////////////////////////// -// Function : set_last_position -// Access : Public -// Description : Last position assignment +// Function: set_last_position +// Access: Public +// Description: Last position assignment //////////////////////////////////////////////////////////////////// INLINE void PhysicsObject:: set_last_position(const LPoint3 &pos) { @@ -85,9 +85,9 @@ set_last_position(const LPoint3 &pos) { } //////////////////////////////////////////////////////////////////// -// Function : set_velocity -// Access : Public -// Description : Vector velocity assignment +// Function: set_velocity +// Access: Public +// Description: Vector velocity assignment //////////////////////////////////////////////////////////////////// INLINE void PhysicsObject:: set_velocity(const LVector3 &vel) { @@ -96,9 +96,9 @@ set_velocity(const LVector3 &vel) { } //////////////////////////////////////////////////////////////////// -// Function : set_velocity -// Access : Public -// Description : Piecewise velocity assignment +// Function: set_velocity +// Access: Public +// Description: Piecewise velocity assignment //////////////////////////////////////////////////////////////////// INLINE void PhysicsObject:: set_velocity(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) { @@ -107,10 +107,10 @@ set_velocity(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) { } //////////////////////////////////////////////////////////////////// -// Function : add_local_torque -// Access : Public -// Description : Adds an torque force (i.e. an instantanious change -// in velocity). This is a quicker way to get the +// Function: add_local_torque +// Access: Public +// Description: Adds an torque force (i.e. an instantanious change +// in velocity). This is a quicker way to get the // angular velocity, add a vector to it and set that // value to be the new angular velocity. //////////////////////////////////////////////////////////////////// @@ -121,10 +121,10 @@ add_local_torque(const LRotation &torque) { } //////////////////////////////////////////////////////////////////// -// Function : add_local_impulse -// Access : Public -// Description : Adds an impulse force (i.e. an instantanious change -// in velocity). This is a quicker way to get the +// Function: add_local_impulse +// Access: Public +// Description: Adds an impulse force (i.e. an instantanious change +// in velocity). This is a quicker way to get the // velocity, add a vector to it and set that value to // be the new velocity. //////////////////////////////////////////////////////////////////// @@ -135,10 +135,10 @@ add_local_impulse(const LVector3 &impulse) { } //////////////////////////////////////////////////////////////////// -// Function : add_torque -// Access : Public -// Description : Adds an torque force (i.e. an instantanious change -// in velocity). This is a quicker way to get the +// Function: add_torque +// Access: Public +// Description: Adds an torque force (i.e. an instantanious change +// in velocity). This is a quicker way to get the // angular velocity, add a vector to it and set that // value to be the new angular velocity. //////////////////////////////////////////////////////////////////// @@ -149,10 +149,10 @@ add_torque(const LRotation &torque) { } //////////////////////////////////////////////////////////////////// -// Function : add_impulse -// Access : Public -// Description : Adds an impulse force (i.e. an instantanious change -// in velocity). This is a quicker way to get the +// Function: add_impulse +// Access: Public +// Description: Adds an impulse force (i.e. an instantanious change +// in velocity). This is a quicker way to get the // velocity, add a vector to it and set that value to // be the new velocity. //////////////////////////////////////////////////////////////////// @@ -163,9 +163,9 @@ add_impulse(const LVector3 &impulse) { } //////////////////////////////////////////////////////////////////// -// Function : set_active -// Access : Public -// Description : Process Flag assignment +// Function: set_active +// Access: Public +// Description: Process Flag assignment //////////////////////////////////////////////////////////////////// INLINE void PhysicsObject:: set_active(bool flag) { @@ -173,9 +173,9 @@ set_active(bool flag) { } //////////////////////////////////////////////////////////////////// -// Function : set_terminal_velocity -// Access : Public -// Description : tv assignment +// Function: set_terminal_velocity +// Access: Public +// Description: tv assignment //////////////////////////////////////////////////////////////////// INLINE void PhysicsObject:: set_terminal_velocity(PN_stdfloat tv) { @@ -183,9 +183,9 @@ set_terminal_velocity(PN_stdfloat tv) { } //////////////////////////////////////////////////////////////////// -// Function : get_mass -// Access : Public -// Description : Get the mass in slugs (or kilograms). +// Function: get_mass +// Access: Public +// Description: Get the mass in slugs (or kilograms). //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat PhysicsObject:: get_mass() const { @@ -193,9 +193,9 @@ get_mass() const { } //////////////////////////////////////////////////////////////////// -// Function : get_position -// Access : Public -// Description : Position Query +// Function: get_position +// Access: Public +// Description: Position Query //////////////////////////////////////////////////////////////////// INLINE LPoint3 PhysicsObject:: get_position() const { @@ -203,9 +203,9 @@ get_position() const { } //////////////////////////////////////////////////////////////////// -// Function : get_last_position -// Access : Public -// Description : Get the position of the physics object at the start +// Function: get_last_position +// Access: Public +// Description: Get the position of the physics object at the start // of the most recent do_physics. //////////////////////////////////////////////////////////////////// INLINE LPoint3 PhysicsObject:: @@ -214,9 +214,9 @@ get_last_position() const { } //////////////////////////////////////////////////////////////////// -// Function : get_velocity -// Access : Public -// Description : Velocity Query per second +// Function: get_velocity +// Access: Public +// Description: Velocity Query per second //////////////////////////////////////////////////////////////////// INLINE LVector3 PhysicsObject:: get_velocity() const { @@ -224,9 +224,9 @@ get_velocity() const { } //////////////////////////////////////////////////////////////////// -// Function : get_implicit_velocity -// Access : Public -// Description : Velocity Query over the last dt +// Function: get_implicit_velocity +// Access: Public +// Description: Velocity Query over the last dt //////////////////////////////////////////////////////////////////// INLINE LVector3 PhysicsObject:: get_implicit_velocity() const { @@ -234,9 +234,9 @@ get_implicit_velocity() const { } //////////////////////////////////////////////////////////////////// -// Function : get_active -// Access : Public -// Description : Process Flag Query +// Function: get_active +// Access: Public +// Description: Process Flag Query //////////////////////////////////////////////////////////////////// INLINE bool PhysicsObject:: get_active() const { @@ -244,9 +244,9 @@ get_active() const { } //////////////////////////////////////////////////////////////////// -// Function : get_terminal_velocity -// Access : Public -// Description : tv query +// Function: get_terminal_velocity +// Access: Public +// Description: tv query //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat PhysicsObject:: get_terminal_velocity() const { @@ -254,9 +254,9 @@ get_terminal_velocity() const { } //////////////////////////////////////////////////////////////////// -// Function : set_orientation -// Access : Public -// Description : +// Function: set_orientation +// Access: Public +// Description: //////////////////////////////////////////////////////////////////// INLINE void PhysicsObject:: set_orientation(const LOrientation &orientation) { @@ -265,9 +265,9 @@ set_orientation(const LOrientation &orientation) { } //////////////////////////////////////////////////////////////////// -// Function : set_rotation -// Access : Public -// Description : set rotation as a quaternion delta per second. +// Function: set_rotation +// Access: Public +// Description: set rotation as a quaternion delta per second. //////////////////////////////////////////////////////////////////// INLINE void PhysicsObject:: set_rotation(const LRotation &rotation) { @@ -276,9 +276,9 @@ set_rotation(const LRotation &rotation) { } //////////////////////////////////////////////////////////////////// -// Function : get_orientation -// Access : Public -// Description : get current orientation. +// Function: get_orientation +// Access: Public +// Description: get current orientation. //////////////////////////////////////////////////////////////////// INLINE LOrientation PhysicsObject:: get_orientation() const { @@ -286,9 +286,9 @@ get_orientation() const { } //////////////////////////////////////////////////////////////////// -// Function : get_rotation -// Access : Public -// Description : get rotation per second. +// Function: get_rotation +// Access: Public +// Description: get rotation per second. //////////////////////////////////////////////////////////////////// INLINE LRotation PhysicsObject:: get_rotation() const { @@ -296,9 +296,9 @@ get_rotation() const { } //////////////////////////////////////////////////////////////////// -// Function : set_oriented -// Access : Public -// Description : Set flag to determine whether this object should do +// Function: set_oriented +// Access: Public +// Description: Set flag to determine whether this object should do // any rotation or orientation calculations. Optimization. //////////////////////////////////////////////////////////////////// INLINE void PhysicsObject:: @@ -307,9 +307,9 @@ set_oriented(bool flag) { } //////////////////////////////////////////////////////////////////// -// Function : get_oriented -// Access : Public -// Description : See set_oriented(). +// Function: get_oriented +// Access: Public +// Description: See set_oriented(). //////////////////////////////////////////////////////////////////// INLINE bool PhysicsObject:: get_oriented() const { diff --git a/panda/src/physics/physicsObject.cxx b/panda/src/physics/physicsObject.cxx index a58b1cc8e1..51b6b385fb 100644 --- a/panda/src/physics/physicsObject.cxx +++ b/panda/src/physics/physicsObject.cxx @@ -20,9 +20,9 @@ ConfigVariableDouble PhysicsObject::_default_terminal_velocity TypeHandle PhysicsObject::_type_handle; //////////////////////////////////////////////////////////////////// -// Function : PhysicsObject -// Access : Public -// Description : Default Constructor +// Function: PhysicsObject +// Access: Public +// Description: Default Constructor //////////////////////////////////////////////////////////////////// PhysicsObject:: PhysicsObject() : @@ -39,9 +39,9 @@ PhysicsObject() : } //////////////////////////////////////////////////////////////////// -// Function : PhysicsObject -// Access : Public -// Description : copy constructor +// Function: PhysicsObject +// Access: Public +// Description: copy constructor //////////////////////////////////////////////////////////////////// PhysicsObject:: PhysicsObject(const PhysicsObject& copy) { @@ -49,18 +49,18 @@ PhysicsObject(const PhysicsObject& copy) { } //////////////////////////////////////////////////////////////////// -// Function : ~PhysicsObject -// Access : Public -// Description : Destructor +// Function: ~PhysicsObject +// Access: Public +// Description: Destructor //////////////////////////////////////////////////////////////////// PhysicsObject:: ~PhysicsObject() { } //////////////////////////////////////////////////////////////////// -// Function : Assignment operator -// Access : Public -// Description : +// Function: Assignment operator +// Access: Public +// Description: //////////////////////////////////////////////////////////////////// const PhysicsObject &PhysicsObject:: operator =(const PhysicsObject &other) { @@ -78,9 +78,9 @@ operator =(const PhysicsObject &other) { } //////////////////////////////////////////////////////////////////// -// Function : make_copy -// Access : Public, virtual -// Description : dynamic copy. +// Function: make_copy +// Access: Public, Virtual +// Description: dynamic copy. //////////////////////////////////////////////////////////////////// PhysicsObject *PhysicsObject:: make_copy() const { @@ -88,9 +88,9 @@ make_copy() const { } //////////////////////////////////////////////////////////////////// -// Function : add_local_impact -// Access : Public -// Description : Adds an impulse and/or torque (i.e. an instantanious +// Function: add_local_impact +// Access: Public +// Description: Adds an impulse and/or torque (i.e. an instantanious // change in velocity) based on how well the offset and // impulse align with the center of mass (aka position). // If you wanted to immitate this function you could @@ -109,9 +109,9 @@ add_local_impact(const LPoint3 &offset_from_center_of_mass, } //////////////////////////////////////////////////////////////////// -// Function : add_impact -// Access : Public -// Description : Adds an impulse and/or torque (i.e. an instantanious +// Function: add_impact +// Access: Public +// Description: Adds an impulse and/or torque (i.e. an instantanious // change in velocity) based on how well the offset and // impulse align with the center of mass (aka position). // If you wanted to immitate this function you could @@ -144,9 +144,9 @@ add_impact(const LPoint3 &offset, } //////////////////////////////////////////////////////////////////// -// Function : get_lcs -// Access : Public -// Description : returns a transform matrix to this object's +// Function: get_lcs +// Access: Public +// Description: returns a transform matrix to this object's // local coordinate system. //////////////////////////////////////////////////////////////////// LMatrix4 PhysicsObject:: @@ -160,9 +160,9 @@ get_lcs() const { } //////////////////////////////////////////////////////////////////// -// Function : get_inertial_tensor -// Access : Public -// Description : returns a transform matrix that represents the +// Function: get_inertial_tensor +// Access: Public +// Description: returns a transform matrix that represents the // object's willingness to be forced. //////////////////////////////////////////////////////////////////// LMatrix4 PhysicsObject:: @@ -171,10 +171,10 @@ get_inertial_tensor() const { } //////////////////////////////////////////////////////////////////// -// Function : output -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: output +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PhysicsObject:: output(ostream &out) const { @@ -184,10 +184,10 @@ output(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function : write -// Access : Public -// Description : Write a string representation of this instance to -// . +// Function: write +// Access: Public +// Description: Write a string representation of this instance to +// . //////////////////////////////////////////////////////////////////// void PhysicsObject:: write(ostream &out, unsigned int indent) const { diff --git a/panda/src/physx/physxActor.cxx b/panda/src/physx/physxActor.cxx index 996aea2245..4358a28b9e 100644 --- a/panda/src/physx/physxActor.cxx +++ b/panda/src/physx/physxActor.cxx @@ -23,7 +23,7 @@ TypeHandle PhysxActor::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxActor::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxActor:: link(NxActor *actorPtr) { @@ -51,7 +51,7 @@ link(NxActor *actorPtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxActor:: unlink() { @@ -76,7 +76,7 @@ unlink() { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::release // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxActor:: release() { @@ -91,7 +91,7 @@ release() { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::link_controller // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxActor:: link_controller(PhysxController *controller) { @@ -102,7 +102,7 @@ link_controller(PhysxController *controller) { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::save_body_to_desc // Access: Published -// Description: Saves the body information of a dynamic actor to +// Description: Saves the body information of a dynamic actor to // the passed body descriptor. //////////////////////////////////////////////////////////////////// bool PhysxActor:: @@ -115,7 +115,7 @@ save_body_to_desc(PhysxBodyDesc &bodyDesc) const { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::save_to_desc // Access: Published -// Description: Saves the state of the actor to the passed +// Description: Saves the state of the actor to the passed // descriptor. //////////////////////////////////////////////////////////////////// void PhysxActor:: @@ -129,7 +129,7 @@ save_to_desc(PhysxActorDesc &actorDesc) const { // Function: PhysxActor::set_name // Access: Published // Description: Sets a name string for the object that can be -// retrieved with get_name(). +// retrieved with get_name(). // This is for debugging and is not used by the // engine. //////////////////////////////////////////////////////////////////// @@ -240,7 +240,7 @@ set_global_pos(const LPoint3f &pos) { // Function: PhysxActor::set_global_mat // Access: Published // Description: Method for setting a dynamic actor's transform -// matrix in the world. +// matrix in the world. // // This method instantaneously changes the actor space // to world space transformation. @@ -269,7 +269,7 @@ set_global_pos(const LPoint3f &pos) { // - When moving jointed actors the joints' cached // transform information is destroyed and recreated // next frame; thus this call is expensive for -// jointed actors. +// jointed actors. //////////////////////////////////////////////////////////////////// void PhysxActor:: set_global_mat(const LMatrix4f &mat) { @@ -301,7 +301,7 @@ set_global_hpr(float h, float p, float r) { // Function: PhysxActor::move_global_pos // Access: Published // Description: The move_global_* calls serve to move kinematically -// controlled dynamic actors through the game world. +// controlled dynamic actors through the game world. // // See move_global_mat() for more information. // @@ -321,7 +321,7 @@ move_global_pos(const LPoint3f &pos) { // Access: Published // Description: The move_global_* calls serve to move // kinematically controlled dynamic actors through -// the game world. +// the game world. // // You set a dynamic actor to be kinematic using the // BF_KINEMATIC body flag, used either in the @@ -355,7 +355,7 @@ move_global_mat(const LMatrix4f &mat) { // Function: PhysxActor::move_global_hpr // Access: Published // Description: The move_global_* calls serve to move kinematically -// controlled dynamic actors through the game world. +// controlled dynamic actors through the game world. // // See move_global_mat() for more information. // @@ -455,7 +455,7 @@ get_num_shapes() const { // Function: PhysxActor::create_shape // Access: Published // Description: Creates a new shape and adds it to the list of -// shapes of this actor. +// shapes of this actor. // // Mass properties of dynamic actors will not // automatically be recomputed to reflect the new mass @@ -557,7 +557,7 @@ add_force(const LVector3f force, PhysxForceMode mode, bool wakeup) { // Access: Published // Description: Applies a force (or impulse) defined in the global // coordinate frame, acting at a particular point in -// global coordinates, to the actor. +// global coordinates, to the actor. // // Note that if the force does not act along the // center of mass of the actor, this will also add the @@ -588,7 +588,7 @@ add_force_at_pos(const LVector3f force, const LPoint3f &pos, PhysxForceMode mode // Access: Published // Description: Applies a force (or impulse) defined in the global // coordinate frame, acting at a particular point in -// local coordinates, to the actor. +// local coordinates, to the actor. // // Note that if the force does not act along the // center of mass of the actor, this will also add @@ -618,7 +618,7 @@ add_force_at_local_pos(const LVector3f force, const LPoint3f &pos, PhysxForceMod // Function: PhysxActor::add_torque // Access: Published // Description: Applies an impulsive torque defined in the global -// coordinate frame to the actor. +// coordinate frame to the actor. // // Mode determines if the torque is to be conventional // or impulsive. @@ -640,7 +640,7 @@ add_torque(const LVector3f torque, PhysxForceMode mode, bool wakeup) { // Function: PhysxActor::add_local_force // Access: Published // Description: Applies a force (or impulse) defined in the actor -// local coordinate frame to the actor. +// local coordinate frame to the actor. // This will not induce a torque. // // Mode determines if the torque is to be conventional @@ -664,7 +664,7 @@ add_local_force(const LVector3f force, PhysxForceMode mode, bool wakeup) { // Access: Published // Description: Applies a force (or impulse) defined in the actor // local coordinate frame, acting at a particular -// point in global coordinates, to the actor. +// point in global coordinates, to the actor. // // Note that if the force does not act along the // center of mass of the actor, this will also add @@ -695,7 +695,7 @@ add_local_force_at_pos(const LVector3f force, const LPoint3f &pos, PhysxForceMod // Access: Published // Description: Applies a force (or impulse) defined in the actor // local coordinate frame, acting at a particular -// point in local coordinates, to the actor. +// point in local coordinates, to the actor. // // Note that if the force does not act along the // center of mass of the actor, this will also add the @@ -747,7 +747,7 @@ add_local_torque(const LVector3f torque, PhysxForceMode mode, bool wakeup) { // Function: PhysxActor::update_mass_from_shapes // Access: Published // Description: Recomputes a dynamic actor's mass properties from -// its shapes. +// its shapes. // // Given a constant density or total mass, the actors // mass properties can be recomputed using the shapes @@ -834,7 +834,7 @@ set_shape_group(unsigned int group) { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::set_body_flag // Access: Published -// Description: Raise or lower individual BodyFlag flags. +// Description: Raise or lower individual BodyFlag flags. //////////////////////////////////////////////////////////////////// void PhysxActor:: set_body_flag(PhysxBodyFlag flag, bool value) { @@ -862,7 +862,7 @@ get_body_flag(PhysxBodyFlag flag) const { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::set_actor_flag // Access: Published -// Description: Raise or lower individual ActorFlag flags. +// Description: Raise or lower individual ActorFlag flags. //////////////////////////////////////////////////////////////////// void PhysxActor:: set_actor_flag(PhysxActorFlag flag, bool value) { @@ -891,7 +891,7 @@ get_actor_flag(PhysxActorFlag flag) const { // Function: PhysxActor::set_contact_report_flag // Access: Published // Description: Sets the actor's contact report flags. -// +// // These flags are used to determine the kind of // report that is generated for interactions with // other actors. @@ -909,7 +909,7 @@ set_contact_report_flag(PhysxContactPairFlag flag, bool value) { nassertv(_error_type == ET_ok); - NxU32 flags = _ptr->getContactReportFlags(); + NxU32 flags = _ptr->getContactReportFlags(); if (value == true) { flags |= flag; @@ -1037,7 +1037,7 @@ set_angular_damping(float angDamp) { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::get_angular_damping // Access: Published -// Description: Returns the angular damping coefficient. +// Description: Returns the angular damping coefficient. // The actor must be dynamic. //////////////////////////////////////////////////////////////////// float PhysxActor:: @@ -1067,7 +1067,7 @@ set_linear_damping(float linDamp) { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::get_linear_damping // Access: Published -// Description: Retrieves the linear damping coefficient. +// Description: Retrieves the linear damping coefficient. // The actor must be dynamic. //////////////////////////////////////////////////////////////////// float PhysxActor:: @@ -1080,7 +1080,7 @@ get_linear_damping() const { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::set_linear_velocity // Access: Published -// Description: Sets the linear velocity of the actor. +// Description: Sets the linear velocity of the actor. // // Note that if you continuously set the velocity of // an actor yourself, forces such as gravity or @@ -1102,7 +1102,7 @@ set_linear_velocity(const LVector3f &linVel) { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::set_angular_velocity // Access: Published -// Description: Sets the angular velocity of the actor. +// Description: Sets the angular velocity of the actor. // // Note that if you continuously set the angular // velocity of an actor yourself, forces such as @@ -1125,7 +1125,7 @@ set_angular_velocity(const LVector3f &angVel) { // Function: PhysxActor::set_max_angular_velocity // Access: Published // Description: Lets you set the maximum angular velocity permitted -// for this actor. +// for this actor. // // Because for various internal computations, very // quickly rotating actors introduce error into the @@ -1219,7 +1219,7 @@ get_point_velocity(const LPoint3f &point) const { // Access: Published // Description: Computes the velocity of a point given in body // local coordinates as if it were attached to the -// actor and moving with it. +// actor and moving with it. // // The actor must be dynamic. //////////////////////////////////////////////////////////////////// @@ -1236,7 +1236,7 @@ get_local_point_velocity(const LPoint3f &point) const { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::set_linear_momentum // Access: Published -// Description: Sets the linear momentum of the actor. +// Description: Sets the linear momentum of the actor. // Note that if you continuously set the linear // momentum of an actor yourself, forces such as // gravity or friction will not be able to manifest @@ -1254,7 +1254,7 @@ set_linear_momentum(const LVector3f &momentum) { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::set_angular_momentum // Access: Published -// Description: Sets the angular momentum of the actor. +// Description: Sets the angular momentum of the actor. // Note that if you continuously set the angular // velocity of an actor yourself, forces such as // friction will not be able to rotate the actor, @@ -1272,7 +1272,7 @@ set_angular_momentum(const LVector3f &momentum) { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::get_linear_momentum // Access: Published -// Description: Retrieves the linear momentum of an actor. +// Description: Retrieves the linear momentum of an actor. // The momentum is equal to the velocity times the // mass. // The actor must be dynamic. @@ -1287,7 +1287,7 @@ get_linear_momentum() const { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::get_angular_momentum // Access: Published -// Description: Retrieves the angular momentum of an actor. +// Description: Retrieves the angular momentum of an actor. // The angular momentum is equal to the angular // velocity times the global space inertia tensor. // The actor must be dynamic. @@ -1408,7 +1408,7 @@ get_sleep_energy_threshold() const { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::is_sleeping // Access: Published -// Description: Returns true if this body is sleeping. +// Description: Returns true if this body is sleeping. // // When an actor does not move for a period of time, // it is no longer simulated in order to save time. @@ -1430,7 +1430,7 @@ is_sleeping() const { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::wake_up // Access: Published -// Description: Wakes up the actor if it is sleeping. +// Description: Wakes up the actor if it is sleeping. // // The wakeCounterValue determines how long until the // body is put to sleep, a value of zero means that @@ -1449,7 +1449,7 @@ wake_up(float wakeCounterValue) { //////////////////////////////////////////////////////////////////// // Function: PhysxActor::put_to_sleep // Access: Published -// Description: Forces the actor to sleep. +// Description: Forces the actor to sleep. // // The actor will stay asleep until the next call to // simulate, and will not wake up until then even when diff --git a/panda/src/physx/physxBoxForceFieldShape.cxx b/panda/src/physx/physxBoxForceFieldShape.cxx index d441871f23..cd897fad1d 100644 --- a/panda/src/physx/physxBoxForceFieldShape.cxx +++ b/panda/src/physx/physxBoxForceFieldShape.cxx @@ -21,7 +21,7 @@ TypeHandle PhysxBoxForceFieldShape::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxBoxForceFieldShape::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxBoxForceFieldShape:: link(NxForceFieldShape *shapePtr) { @@ -39,7 +39,7 @@ link(NxForceFieldShape *shapePtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxBoxForceFieldShape::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxBoxForceFieldShape:: unlink() { @@ -52,10 +52,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxBoxForceFieldShape::save_to_desc -// Access : Published -// Description : Saves the state of the shape object to a -// descriptor. +// Function: PhysxBoxForceFieldShape::save_to_desc +// Access: Published +// Description: Saves the state of the shape object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxBoxForceFieldShape:: save_to_desc(PhysxBoxForceFieldShapeDesc &shapeDesc) const { @@ -67,7 +67,7 @@ save_to_desc(PhysxBoxForceFieldShapeDesc &shapeDesc) const { //////////////////////////////////////////////////////////////////// // Function: PhysxBoxForceFieldShape::set_dimensions // Access: Published -// Description: Sets the box dimensions. +// Description: Sets the box dimensions. // // The dimensions are the 'radii' of the box, // meaning 1/2 extents in x dimension, 1/2 extents @@ -83,7 +83,7 @@ set_dimensions(const LVector3f &vec) { //////////////////////////////////////////////////////////////////// // Function: PhysxBoxForceFieldShape::get_dimensions // Access: Published -// Description: Retrieves the dimensions of the box. +// Description: Retrieves the dimensions of the box. // // The dimensions are the 'radii' of the box, // meaning 1/2 extents in x dimension, 1/2 extents diff --git a/panda/src/physx/physxBoxForceFieldShape.h b/panda/src/physx/physxBoxForceFieldShape.h index bc5ad05f6c..62eda5887a 100644 --- a/panda/src/physx/physxBoxForceFieldShape.h +++ b/panda/src/physx/physxBoxForceFieldShape.h @@ -28,7 +28,6 @@ class PhysxBoxForceFieldShapeDesc; // Description : A box shaped region used to define a force field. //////////////////////////////////////////////////////////////////// class EXPCL_PANDAPHYSX PhysxBoxForceFieldShape : public PhysxForceFieldShape { - PUBLISHED: INLINE PhysxBoxForceFieldShape(); INLINE ~PhysxBoxForceFieldShape(); @@ -38,7 +37,6 @@ PUBLISHED: void set_dimensions(const LVector3f &dimensions); LVector3f get_dimensions() const; -//////////////////////////////////////////////////////////////////// public: INLINE NxForceFieldShape *ptr() const { return (NxForceFieldShape *)_ptr; }; @@ -48,14 +46,13 @@ public: private: NxBoxForceFieldShape *_ptr; -//////////////////////////////////////////////////////////////////// public: static TypeHandle get_class_type() { return _type_handle; } static void init_type() { PhysxForceFieldShape::init_type(); - register_type(_type_handle, "PhysxBoxForceFieldShape", + register_type(_type_handle, "PhysxBoxForceFieldShape", PhysxForceFieldShape::get_class_type()); } virtual TypeHandle get_type() const { diff --git a/panda/src/physx/physxBoxShape.cxx b/panda/src/physx/physxBoxShape.cxx index ac09e1b7e4..e1fc59f5db 100644 --- a/panda/src/physx/physxBoxShape.cxx +++ b/panda/src/physx/physxBoxShape.cxx @@ -21,7 +21,7 @@ TypeHandle PhysxBoxShape::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxBoxShape::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxBoxShape:: link(NxShape *shapePtr) { @@ -39,7 +39,7 @@ link(NxShape *shapePtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxBoxShape::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxBoxShape:: unlink() { @@ -52,10 +52,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxBoxShape::save_to_desc -// Access : Published -// Description : Saves the state of the shape object to a -// descriptor. +// Function: PhysxBoxShape::save_to_desc +// Access: Published +// Description: Saves the state of the shape object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxBoxShape:: save_to_desc(PhysxBoxShapeDesc &shapeDesc) const { @@ -67,7 +67,7 @@ save_to_desc(PhysxBoxShapeDesc &shapeDesc) const { //////////////////////////////////////////////////////////////////// // Function: PhysxBoxShape::set_dimensions // Access: Published -// Description: Sets the box dimensions. +// Description: Sets the box dimensions. // // The dimensions are the 'radii' of the box, // meaning 1/2 extents in x dimension, 1/2 extents @@ -83,7 +83,7 @@ set_dimensions(const LVector3f &vec) { //////////////////////////////////////////////////////////////////// // Function: PhysxBoxShape::get_dimensions // Access: Published -// Description: Retrieves the dimensions of the box. +// Description: Retrieves the dimensions of the box. // // The dimensions are the 'radii' of the box, // meaning 1/2 extents in x dimension, 1/2 extents diff --git a/panda/src/physx/physxCapsuleForceFieldShape.cxx b/panda/src/physx/physxCapsuleForceFieldShape.cxx index 4f9cf1cec8..eb56d68043 100644 --- a/panda/src/physx/physxCapsuleForceFieldShape.cxx +++ b/panda/src/physx/physxCapsuleForceFieldShape.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxCapsuleForceFieldShape::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxCapsuleForceFieldShape::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxCapsuleForceFieldShape:: link(NxForceFieldShape *shapePtr) { @@ -38,7 +38,7 @@ link(NxForceFieldShape *shapePtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxCapsuleForceFieldShape::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxCapsuleForceFieldShape:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxCapsuleForceFieldShape::save_to_desc -// Access : Published -// Description : Saves the state of the shape object to a -// descriptor. +// Function: PhysxCapsuleForceFieldShape::save_to_desc +// Access: Published +// Description: Saves the state of the shape object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxCapsuleForceFieldShape:: save_to_desc(PhysxCapsuleForceFieldShapeDesc &shapeDesc) const { diff --git a/panda/src/physx/physxCapsuleShape.cxx b/panda/src/physx/physxCapsuleShape.cxx index bd8ca4c033..83ae2b0a19 100644 --- a/panda/src/physx/physxCapsuleShape.cxx +++ b/panda/src/physx/physxCapsuleShape.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxCapsuleShape::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxCapsuleShape::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxCapsuleShape:: link(NxShape *shapePtr) { @@ -38,7 +38,7 @@ link(NxShape *shapePtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxCapsuleShape::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxCapsuleShape:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxCapsuleShape::save_to_desc -// Access : Published -// Description : Saves the state of the shape object to a -// descriptor. +// Function: PhysxCapsuleShape::save_to_desc +// Access: Published +// Description: Saves the state of the shape object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxCapsuleShape:: save_to_desc(PhysxCapsuleShapeDesc &shapeDesc) const { diff --git a/panda/src/physx/physxConvexForceFieldShape.cxx b/panda/src/physx/physxConvexForceFieldShape.cxx index 8f6c409224..4e9582b450 100644 --- a/panda/src/physx/physxConvexForceFieldShape.cxx +++ b/panda/src/physx/physxConvexForceFieldShape.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxConvexForceFieldShape::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxConvexForceFieldShape::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxConvexForceFieldShape:: link(NxForceFieldShape *shapePtr) { @@ -38,7 +38,7 @@ link(NxForceFieldShape *shapePtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxConvexForceFieldShape::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxConvexForceFieldShape:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxConvexForceFieldShape::save_to_desc -// Access : Published -// Description : Saves the state of the shape object to a -// descriptor. +// Function: PhysxConvexForceFieldShape::save_to_desc +// Access: Published +// Description: Saves the state of the shape object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxConvexForceFieldShape:: save_to_desc(PhysxConvexForceFieldShapeDesc &shapeDesc) const { diff --git a/panda/src/physx/physxConvexShape.cxx b/panda/src/physx/physxConvexShape.cxx index dcf6fcf257..79599e658d 100644 --- a/panda/src/physx/physxConvexShape.cxx +++ b/panda/src/physx/physxConvexShape.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxConvexShape::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxConvexShape::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxConvexShape:: link(NxShape *shapePtr) { @@ -38,7 +38,7 @@ link(NxShape *shapePtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxConvexShape::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxConvexShape:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxConvexShape::save_to_desc -// Access : Published -// Description : Saves the state of the shape object to a -// descriptor. +// Function: PhysxConvexShape::save_to_desc +// Access: Published +// Description: Saves the state of the shape object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxConvexShape:: save_to_desc(PhysxConvexShapeDesc &shapeDesc) const { diff --git a/panda/src/physx/physxCylindricalJoint.cxx b/panda/src/physx/physxCylindricalJoint.cxx index 1d07767583..9e699dc648 100644 --- a/panda/src/physx/physxCylindricalJoint.cxx +++ b/panda/src/physx/physxCylindricalJoint.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxCylindricalJoint::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxCylindricalJoint::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxCylindricalJoint:: link(NxJoint *jointPtr) { @@ -38,7 +38,7 @@ link(NxJoint *jointPtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxCylindricalJoint::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxCylindricalJoint:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxCylindricalJoint::save_to_desc -// Access : Published -// Description : Saves the state of the joint object to a -// descriptor. +// Function: PhysxCylindricalJoint::save_to_desc +// Access: Published +// Description: Saves the state of the joint object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxCylindricalJoint:: save_to_desc(PhysxCylindricalJointDesc &jointDesc) const { @@ -64,10 +64,10 @@ save_to_desc(PhysxCylindricalJointDesc &jointDesc) const { } //////////////////////////////////////////////////////////////////// -// Function : PhysxCylindricalJoint::load_from_desc -// Access : Published -// Description : Loads the entire state of the joint from a -// descriptor with a single call. +// Function: PhysxCylindricalJoint::load_from_desc +// Access: Published +// Description: Loads the entire state of the joint from a +// descriptor with a single call. //////////////////////////////////////////////////////////////////// void PhysxCylindricalJoint:: load_from_desc(const PhysxCylindricalJointDesc &jointDesc) { diff --git a/panda/src/physx/physxD6Joint.cxx b/panda/src/physx/physxD6Joint.cxx index 2459b20922..4e64b34459 100644 --- a/panda/src/physx/physxD6Joint.cxx +++ b/panda/src/physx/physxD6Joint.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxD6Joint::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxD6Joint::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxD6Joint:: link(NxJoint *jointPtr) { @@ -38,7 +38,7 @@ link(NxJoint *jointPtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxD6Joint::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxD6Joint:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxD6Joint::save_to_desc -// Access : Published -// Description : Saves the state of the joint object to a -// descriptor. +// Function: PhysxD6Joint::save_to_desc +// Access: Published +// Description: Saves the state of the joint object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxD6Joint:: save_to_desc(PhysxD6JointDesc &jointDesc) const { @@ -64,10 +64,10 @@ save_to_desc(PhysxD6JointDesc &jointDesc) const { } //////////////////////////////////////////////////////////////////// -// Function : PhysxD6Joint::load_from_desc -// Access : Published -// Description : Loads the entire state of the joint from a -// descriptor with a single call. +// Function: PhysxD6Joint::load_from_desc +// Access: Published +// Description: Loads the entire state of the joint from a +// descriptor with a single call. //////////////////////////////////////////////////////////////////// void PhysxD6Joint:: load_from_desc(const PhysxD6JointDesc &jointDesc) { diff --git a/panda/src/physx/physxDistanceJoint.cxx b/panda/src/physx/physxDistanceJoint.cxx index 3be88b1551..9ab6a4a4a2 100644 --- a/panda/src/physx/physxDistanceJoint.cxx +++ b/panda/src/physx/physxDistanceJoint.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxDistanceJoint::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxDistanceJoint::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxDistanceJoint:: link(NxJoint *jointPtr) { @@ -38,7 +38,7 @@ link(NxJoint *jointPtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxDistanceJoint::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxDistanceJoint:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxDistanceJoint::save_to_desc -// Access : Published -// Description : Saves the state of the joint object to a -// descriptor. +// Function: PhysxDistanceJoint::save_to_desc +// Access: Published +// Description: Saves the state of the joint object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxDistanceJoint:: save_to_desc(PhysxDistanceJointDesc &jointDesc) const { @@ -64,10 +64,10 @@ save_to_desc(PhysxDistanceJointDesc &jointDesc) const { } //////////////////////////////////////////////////////////////////// -// Function : PhysxDistanceJoint::load_from_desc -// Access : Published -// Description : Loads the entire state of the joint from a -// descriptor with a single call. +// Function: PhysxDistanceJoint::load_from_desc +// Access: Published +// Description: Loads the entire state of the joint from a +// descriptor with a single call. //////////////////////////////////////////////////////////////////// void PhysxDistanceJoint:: load_from_desc(const PhysxDistanceJointDesc &jointDesc) { diff --git a/panda/src/physx/physxFixedJoint.cxx b/panda/src/physx/physxFixedJoint.cxx index 538805c64f..d11277c472 100644 --- a/panda/src/physx/physxFixedJoint.cxx +++ b/panda/src/physx/physxFixedJoint.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxFixedJoint::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxFixedJoint::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxFixedJoint:: link(NxJoint *jointPtr) { @@ -38,7 +38,7 @@ link(NxJoint *jointPtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxFixedJoint::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxFixedJoint:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxFixedJoint::save_to_desc -// Access : Published -// Description : Saves the state of the joint object to a -// descriptor. +// Function: PhysxFixedJoint::save_to_desc +// Access: Published +// Description: Saves the state of the joint object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxFixedJoint:: save_to_desc(PhysxFixedJointDesc &jointDesc) const { @@ -64,10 +64,10 @@ save_to_desc(PhysxFixedJointDesc &jointDesc) const { } //////////////////////////////////////////////////////////////////// -// Function : PhysxFixedJoint::load_from_desc -// Access : Published -// Description : Loads the entire state of the joint from a -// descriptor with a single call. +// Function: PhysxFixedJoint::load_from_desc +// Access: Published +// Description: Loads the entire state of the joint from a +// descriptor with a single call. //////////////////////////////////////////////////////////////////// void PhysxFixedJoint:: load_from_desc(const PhysxFixedJointDesc &jointDesc) { diff --git a/panda/src/physx/physxForceFieldShapeGroup.cxx b/panda/src/physx/physxForceFieldShapeGroup.cxx index 4393f9dfe0..d47cc9f785 100644 --- a/panda/src/physx/physxForceFieldShapeGroup.cxx +++ b/panda/src/physx/physxForceFieldShapeGroup.cxx @@ -22,7 +22,7 @@ TypeHandle PhysxForceFieldShapeGroup::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxForceFieldShapeGroup::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxForceFieldShapeGroup:: link(NxForceFieldShapeGroup *groupPtr) { @@ -50,7 +50,7 @@ link(NxForceFieldShapeGroup *groupPtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxForceFieldShapeGroup::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxForceFieldShapeGroup:: unlink() { @@ -120,10 +120,10 @@ get_force_field() const { } //////////////////////////////////////////////////////////////////// -// Function : PhysxForceFieldShapeGroup::save_to_desc -// Access : Published -// Description : Saves the state of the force field shape group -// object to a descriptor. +// Function: PhysxForceFieldShapeGroup::save_to_desc +// Access: Published +// Description: Saves the state of the force field shape group +// object to a descriptor. //////////////////////////////////////////////////////////////////// void PhysxForceFieldShapeGroup:: save_to_desc(PhysxForceFieldShapeGroupDesc &groupDesc) const { @@ -136,7 +136,7 @@ save_to_desc(PhysxForceFieldShapeGroupDesc &groupDesc) const { // Function: PhysxForceFieldShapeGroup::set_name // Access: Published // Description: Sets a name string for the object that can be -// retrieved with get_name(). +// retrieved with get_name(). // This is for debugging and is not used by the // engine. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/physx/physxGroupsMask.I b/panda/src/physx/physxGroupsMask.I index 3e23b9c611..2ad689b8a0 100644 --- a/panda/src/physx/physxGroupsMask.I +++ b/panda/src/physx/physxGroupsMask.I @@ -1,4 +1,4 @@ -// Filename: physxGroupsMask.cxx +// Filename: physxGroupsMask.I // Created by: enn0x (21Oct09) // //////////////////////////////////////////////////////////////////// @@ -51,7 +51,7 @@ INLINE PhysxGroupsMask:: //////////////////////////////////////////////////////////////////// // Function: PhysxGroupsMask::get_mask // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE NxGroupsMask PhysxGroupsMask:: get_mask() const { @@ -62,7 +62,7 @@ get_mask() const { //////////////////////////////////////////////////////////////////// // Function: PhysxGroupsMask::set_mask // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void PhysxGroupsMask:: set_mask(NxGroupsMask mask) { @@ -73,7 +73,7 @@ set_mask(NxGroupsMask mask) { //////////////////////////////////////////////////////////////////// // Function: PhysxGroupsMask::get_bits0 // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE unsigned int PhysxGroupsMask:: get_bits0() const { @@ -84,7 +84,7 @@ get_bits0() const { //////////////////////////////////////////////////////////////////// // Function: PhysxGroupsMask::set_bits0 // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void PhysxGroupsMask:: set_bits0(unsigned int bits) { @@ -95,7 +95,7 @@ set_bits0(unsigned int bits) { //////////////////////////////////////////////////////////////////// // Function: PhysxGroupsMask::get_bits1 // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE unsigned int PhysxGroupsMask:: get_bits1() const { @@ -106,7 +106,7 @@ get_bits1() const { //////////////////////////////////////////////////////////////////// // Function: PhysxGroupsMask::set_bits1 // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void PhysxGroupsMask:: set_bits1(unsigned int bits) { @@ -117,7 +117,7 @@ set_bits1(unsigned int bits) { //////////////////////////////////////////////////////////////////// // Function: PhysxGroupsMask::get_bits2 // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE unsigned int PhysxGroupsMask:: get_bits2() const { @@ -128,7 +128,7 @@ get_bits2() const { //////////////////////////////////////////////////////////////////// // Function: PhysxGroupsMask::set_bits2 // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void PhysxGroupsMask:: set_bits2(unsigned int bits) { @@ -139,7 +139,7 @@ set_bits2(unsigned int bits) { //////////////////////////////////////////////////////////////////// // Function: PhysxGroupsMask::get_bits3 // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE unsigned int PhysxGroupsMask:: get_bits3() const { @@ -150,7 +150,7 @@ get_bits3() const { //////////////////////////////////////////////////////////////////// // Function: PhysxGroupsMask::set_bits3 // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void PhysxGroupsMask:: set_bits3(unsigned int bits) { diff --git a/panda/src/physx/physxHeightFieldShape.cxx b/panda/src/physx/physxHeightFieldShape.cxx index b08e87f714..6971e3b72e 100644 --- a/panda/src/physx/physxHeightFieldShape.cxx +++ b/panda/src/physx/physxHeightFieldShape.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxHeightFieldShape::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxHeightFieldShape::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxHeightFieldShape:: link(NxShape *shapePtr) { @@ -38,7 +38,7 @@ link(NxShape *shapePtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxHeightFieldShape::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxHeightFieldShape:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxHeightFieldShape::save_to_desc -// Access : Published -// Description : Saves the state of the shape object to a -// descriptor. +// Function: PhysxHeightFieldShape::save_to_desc +// Access: Published +// Description: Saves the state of the shape object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxHeightFieldShape:: save_to_desc(PhysxHeightFieldShapeDesc &shapeDesc) const { diff --git a/panda/src/physx/physxManager.I b/panda/src/physx/physxManager.I index 2a1a497d09..63bb1b0709 100644 --- a/panda/src/physx/physxManager.I +++ b/panda/src/physx/physxManager.I @@ -14,9 +14,9 @@ //////////////////////////////////////////////////////////////////// -// Function: PhysxManager::get_sdk -// Access: Public -// Description: Returns a pointer to the NxPhysicsSDK. +// Function: PhysxManager::get_sdk +// Access: Public +// Description: Returns a pointer to the NxPhysicsSDK. //////////////////////////////////////////////////////////////////// INLINE NxPhysicsSDK *PhysxManager:: get_sdk() const { @@ -25,9 +25,9 @@ get_sdk() const { } //////////////////////////////////////////////////////////////////// -// Function: PhysxManager::vec3_to_nxVec3 -// Access: Public -// Description: Converts from LVector3f to NxVec3. +// Function: PhysxManager::vec3_to_nxVec3 +// Access: Public +// Description: Converts from LVector3f to NxVec3. //////////////////////////////////////////////////////////////////// INLINE NxVec3 PhysxManager:: vec3_to_nxVec3(const LVector3f &v) { @@ -36,9 +36,9 @@ vec3_to_nxVec3(const LVector3f &v) { } //////////////////////////////////////////////////////////////////// -// Function: PhysxManager::nxVec3_to_vec3 -// Access: Public -// Description: Converts from NxVec3 to LVector3f. +// Function: PhysxManager::nxVec3_to_vec3 +// Access: Public +// Description: Converts from NxVec3 to LVector3f. //////////////////////////////////////////////////////////////////// INLINE LVector3f PhysxManager:: nxVec3_to_vec3(const NxVec3 &v) { @@ -47,9 +47,9 @@ nxVec3_to_vec3(const NxVec3 &v) { } //////////////////////////////////////////////////////////////////// -// Function: PhysxManager::vec3_to_nxExtVec3 -// Access: Public -// Description: Converts from LVector3f to NxExtendedVec3. +// Function: PhysxManager::vec3_to_nxExtVec3 +// Access: Public +// Description: Converts from LVector3f to NxExtendedVec3. //////////////////////////////////////////////////////////////////// INLINE NxExtendedVec3 PhysxManager:: vec3_to_nxExtVec3(const LVector3f &v) { @@ -58,9 +58,9 @@ vec3_to_nxExtVec3(const LVector3f &v) { } //////////////////////////////////////////////////////////////////// -// Function: PhysxManager::nxExtVec3_to_vec3 -// Access: Public -// Description: Converts from NxExtendedVec3 to LVector3f. +// Function: PhysxManager::nxExtVec3_to_vec3 +// Access: Public +// Description: Converts from NxExtendedVec3 to LVector3f. //////////////////////////////////////////////////////////////////// INLINE LVector3f PhysxManager:: nxExtVec3_to_vec3(const NxExtendedVec3 &v) { @@ -69,9 +69,9 @@ nxExtVec3_to_vec3(const NxExtendedVec3 &v) { } //////////////////////////////////////////////////////////////////// -// Function: PhysxManager::point3_to_nxVec3 -// Access: Public -// Description: Converts from LPoint3f to NxVec3. +// Function: PhysxManager::point3_to_nxVec3 +// Access: Public +// Description: Converts from LPoint3f to NxVec3. //////////////////////////////////////////////////////////////////// INLINE NxVec3 PhysxManager:: point3_to_nxVec3(const LPoint3f &p) { @@ -80,9 +80,9 @@ point3_to_nxVec3(const LPoint3f &p) { } //////////////////////////////////////////////////////////////////// -// Function: PhysxManager::nxVec3_to_point3 -// Access: Public -// Description: Converts from NxVec3 to LPoint3f. +// Function: PhysxManager::nxVec3_to_point3 +// Access: Public +// Description: Converts from NxVec3 to LPoint3f. //////////////////////////////////////////////////////////////////// INLINE LPoint3f PhysxManager:: nxVec3_to_point3(const NxVec3 &p) { @@ -91,9 +91,9 @@ nxVec3_to_point3(const NxVec3 &p) { } //////////////////////////////////////////////////////////////////// -// Function: PhysxManager::point3_to_nxExtVec3 -// Access: Public -// Description: Converts from LPoint3f to NxExtendedVec3. +// Function: PhysxManager::point3_to_nxExtVec3 +// Access: Public +// Description: Converts from LPoint3f to NxExtendedVec3. //////////////////////////////////////////////////////////////////// INLINE NxExtendedVec3 PhysxManager:: point3_to_nxExtVec3(const LPoint3f &p) { @@ -102,9 +102,9 @@ point3_to_nxExtVec3(const LPoint3f &p) { } //////////////////////////////////////////////////////////////////// -// Function: PhysxManager::nxExtVec3_to_point3 -// Access: Public -// Description: Converts from NxExtendedVec3 to LPoint3f. +// Function: PhysxManager::nxExtVec3_to_point3 +// Access: Public +// Description: Converts from NxExtendedVec3 to LPoint3f. //////////////////////////////////////////////////////////////////// INLINE LPoint3f PhysxManager:: nxExtVec3_to_point3(const NxExtendedVec3 &p) { @@ -113,9 +113,9 @@ nxExtVec3_to_point3(const NxExtendedVec3 &p) { } //////////////////////////////////////////////////////////////////// -// Function: PhysxManager::quat_to_nxQuat -// Access: Public -// Description: Converts from LQuaternionf to NxQuat. +// Function: PhysxManager::quat_to_nxQuat +// Access: Public +// Description: Converts from LQuaternionf to NxQuat. //////////////////////////////////////////////////////////////////// INLINE NxQuat PhysxManager:: quat_to_nxQuat(const LQuaternionf &q) { @@ -126,9 +126,9 @@ quat_to_nxQuat(const LQuaternionf &q) { } //////////////////////////////////////////////////////////////////// -// Function: PhysxManager::nxQuat_to_quat -// Access: Public -// Description: Converts from NxQuat to LQuaternionf. +// Function: PhysxManager::nxQuat_to_quat +// Access: Public +// Description: Converts from NxQuat to LQuaternionf. //////////////////////////////////////////////////////////////////// INLINE LQuaternionf PhysxManager:: nxQuat_to_quat(const NxQuat &q) { @@ -137,9 +137,9 @@ nxQuat_to_quat(const NxQuat &q) { } //////////////////////////////////////////////////////////////////// -// Function: PhysxManager::mat4_to_nxMat34 -// Access: Public -// Description: Converts from LMatrix4f to NxMat34. +// Function: PhysxManager::mat4_to_nxMat34 +// Access: Public +// Description: Converts from LMatrix4f to NxMat34. //////////////////////////////////////////////////////////////////// INLINE NxMat34 PhysxManager:: mat4_to_nxMat34(const LMatrix4f &m) { @@ -150,9 +150,9 @@ mat4_to_nxMat34(const LMatrix4f &m) { } //////////////////////////////////////////////////////////////////// -// Function: PhysxManager::nxMat34_to_mat4 -// Access: Public -// Description: Converts from NxMat34 to LMatrix4f. +// Function: PhysxManager::nxMat34_to_mat4 +// Access: Public +// Description: Converts from NxMat34 to LMatrix4f. //////////////////////////////////////////////////////////////////// INLINE LMatrix4f PhysxManager:: nxMat34_to_mat4(const NxMat34 &m) { @@ -161,9 +161,9 @@ nxMat34_to_mat4(const NxMat34 &m) { } //////////////////////////////////////////////////////////////////// -// Function: PhysxManager::mat3_to_nxMat33 -// Access: Public -// Description: Converts from LMatrix3f to NxMat33. +// Function: PhysxManager::mat3_to_nxMat33 +// Access: Public +// Description: Converts from LMatrix3f to NxMat33. //////////////////////////////////////////////////////////////////// INLINE NxMat33 PhysxManager:: mat3_to_nxMat33(const LMatrix3f &m) { @@ -174,9 +174,9 @@ mat3_to_nxMat33(const LMatrix3f &m) { } //////////////////////////////////////////////////////////////////// -// Function: PhysxManager::nxMat33_to_mat3 -// Access: Public -// Description: Converts from NxMat33 to LMatrix3f. +// Function: PhysxManager::nxMat33_to_mat3 +// Access: Public +// Description: Converts from NxMat33 to LMatrix3f. //////////////////////////////////////////////////////////////////// INLINE LMatrix3f PhysxManager:: nxMat33_to_mat3(const NxMat33 &m) { @@ -191,7 +191,7 @@ nxMat33_to_mat3(const NxMat33 &m) { //////////////////////////////////////////////////////////////////// // Function: PhysxManager::update_vec3_from_nxVec3 // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void PhysxManager:: update_vec3_from_nxVec3(LVector3f &v, const NxVec3 &nVec) { @@ -204,7 +204,7 @@ update_vec3_from_nxVec3(LVector3f &v, const NxVec3 &nVec) { //////////////////////////////////////////////////////////////////// // Function: PhysxManager::update_point3_from_nxVec3 // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void PhysxManager:: update_point3_from_nxVec3(LPoint3f &p, const NxVec3 &nVec) { @@ -218,7 +218,7 @@ update_point3_from_nxVec3(LPoint3f &p, const NxVec3 &nVec) { //////////////////////////////////////////////////////////////////// // Function: PhysxManager::ls // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void PhysxManager:: ls() const { @@ -229,7 +229,7 @@ ls() const { //////////////////////////////////////////////////////////////////// // Function: PhysxManager::ls // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void PhysxManager:: ls(ostream &out, int indent_level) const { diff --git a/panda/src/physx/physxMask.I b/panda/src/physx/physxMask.I index b93a166cc5..60d3474d7a 100644 --- a/panda/src/physx/physxMask.I +++ b/panda/src/physx/physxMask.I @@ -1,4 +1,4 @@ -// Filename: physxMask32.cxx +// Filename: physxMask.I // Created by: enn0x (21Oct09) // //////////////////////////////////////////////////////////////////// @@ -37,7 +37,7 @@ INLINE PhysxMask:: //////////////////////////////////////////////////////////////////// // Function: PhysxMask::get_mask // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE NxU32 PhysxMask:: get_mask() const { diff --git a/panda/src/physx/physxMask.cxx b/panda/src/physx/physxMask.cxx index f40cf4c9dc..6f2959a7d4 100644 --- a/panda/src/physx/physxMask.cxx +++ b/panda/src/physx/physxMask.cxx @@ -1,4 +1,4 @@ -// Filename: physxMask32.cxx +// Filename: physxMask.cxx // Created by: enn0x (21Oct09) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/physx/physxMask.h b/panda/src/physx/physxMask.h index 6c0c2e6f1d..611a7466f2 100644 --- a/panda/src/physx/physxMask.h +++ b/panda/src/physx/physxMask.h @@ -1,4 +1,4 @@ -// Filename: physxMask32.h +// Filename: physxMask.h // Created by: enn0x (21Oct09) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/physx/physxMaterial.cxx b/panda/src/physx/physxMaterial.cxx index 11cc39fcbc..747cc64bdd 100644 --- a/panda/src/physx/physxMaterial.cxx +++ b/panda/src/physx/physxMaterial.cxx @@ -21,7 +21,7 @@ TypeHandle PhysxMaterial::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxMaterial::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxMaterial:: link(NxMaterial *materialPtr) { @@ -38,7 +38,7 @@ link(NxMaterial *materialPtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxMaterial::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxMaterial:: unlink() { @@ -54,7 +54,7 @@ unlink() { //////////////////////////////////////////////////////////////////// // Function: PhysxMaterial::release // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxMaterial:: release() { @@ -99,10 +99,10 @@ get_material_index() const { } //////////////////////////////////////////////////////////////////// -// Function : PhysxMaterial::load_from_desc -// Access : Published -// Description : Loads the entire state of the material from a -// descriptor with a single call. +// Function: PhysxMaterial::load_from_desc +// Access: Published +// Description: Loads the entire state of the material from a +// descriptor with a single call. //////////////////////////////////////////////////////////////////// void PhysxMaterial:: load_from_desc(const PhysxMaterialDesc &materialDesc) { @@ -112,10 +112,10 @@ load_from_desc(const PhysxMaterialDesc &materialDesc) { } //////////////////////////////////////////////////////////////////// -// Function : PhysxMaterial::save_to_desc -// Access : Published -// Description : Saves the state of the material object to a -// descriptor. +// Function: PhysxMaterial::save_to_desc +// Access: Published +// Description: Saves the state of the material object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxMaterial:: save_to_desc(PhysxMaterialDesc & materialDesc) const { @@ -127,7 +127,7 @@ save_to_desc(PhysxMaterialDesc & materialDesc) const { //////////////////////////////////////////////////////////////////// // Function: PhysxMaterial::set_restitution // Access: Published -// Description: Sets the coefficient of restitution. +// Description: Sets the coefficient of restitution. // A coefficient of 0 makes the object bounce as // little as possible, higher values up to 1.0 result // in more bounce. @@ -154,7 +154,7 @@ get_restitution() const { //////////////////////////////////////////////////////////////////// // Function: PhysxMaterial::set_static_friction // Access: Published -// Description: Sets the coefficient of static friction. +// Description: Sets the coefficient of static friction. // The coefficient of static friction should be in the // range [0, +inf]. // If the flag MF_anisotropic is set, then this value @@ -183,7 +183,7 @@ get_static_friction() const { //////////////////////////////////////////////////////////////////// // Function: PhysxMaterial::set_dynamic_friction // Access: Published -// Description: Sets the coefficient of dynamic friction. +// Description: Sets the coefficient of dynamic friction. // The coefficient of dynamic friction should be in // [0, +inf]. If set to greater than staticFriction, // the effective value of staticFriction will be @@ -304,7 +304,7 @@ get_flag(PhysxMaterialFlag flag) const { // Function: PhysxMaterial::set_dir_of_anisotropy // Access: Published // Description: Sets the shape space direction (unit vector) of -// anisotropy. This is only used if the flag +// anisotropy. This is only used if the flag // MF_anisotropic is set. //////////////////////////////////////////////////////////////////// void PhysxMaterial:: diff --git a/panda/src/physx/physxMeshHash.I b/panda/src/physx/physxMeshHash.I index 91c2a30acd..28fab7ab55 100644 --- a/panda/src/physx/physxMeshHash.I +++ b/panda/src/physx/physxMeshHash.I @@ -1,4 +1,4 @@ -// Filename: physMeshHash.I +// Filename: physxMeshHash.I // Created by: enn0x (13Sep10) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/physx/physxMeshHash.h b/panda/src/physx/physxMeshHash.h index 1281fc612c..031d6f90b3 100644 --- a/panda/src/physx/physxMeshHash.h +++ b/panda/src/physx/physxMeshHash.h @@ -1,4 +1,4 @@ -// Filename: physMeshHash.h +// Filename: physxMeshHash.h // Created by: enn0x (13Sep10) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/physx/physxOverlapReport.I b/panda/src/physx/physxOverlapReport.I index 4a1894c55d..d9083e4164 100644 --- a/panda/src/physx/physxOverlapReport.I +++ b/panda/src/physx/physxOverlapReport.I @@ -1,4 +1,4 @@ -// Filename: physOverlapReport.I +// Filename: physxOverlapReport.I // Created by: enn0x (21Oct09) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/physx/physxOverlapReport.cxx b/panda/src/physx/physxOverlapReport.cxx index 93d131a3fc..6a64e1fefb 100644 --- a/panda/src/physx/physxOverlapReport.cxx +++ b/panda/src/physx/physxOverlapReport.cxx @@ -1,4 +1,4 @@ -// Filename: physOverlapReport.cxx +// Filename: physxOverlapReport.cxx // Created by: enn0x (21Oct09) // //////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ //////////////////////////////////////////////////////////////////// // Function: PhysxOverlapReport::onEvent // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// bool PhysxOverlapReport:: onEvent(NxU32 nbEntities, NxShape **entities) { @@ -34,7 +34,7 @@ onEvent(NxU32 nbEntities, NxShape **entities) { //////////////////////////////////////////////////////////////////// // Function: PhysxOverlapReport::get_num_overlaps // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// unsigned int PhysxOverlapReport:: get_num_overlaps() const { @@ -45,7 +45,7 @@ get_num_overlaps() const { //////////////////////////////////////////////////////////////////// // Function: PhysxOverlapReport::get_first_overlap // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// PhysxShape *PhysxOverlapReport:: get_first_overlap() { @@ -57,7 +57,7 @@ get_first_overlap() { //////////////////////////////////////////////////////////////////// // Function: PhysxOverlapReport::get_next_overlap // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// PhysxShape *PhysxOverlapReport:: get_next_overlap() { @@ -73,7 +73,7 @@ get_next_overlap() { //////////////////////////////////////////////////////////////////// // Function: PhysxOverlapReport::get_overlap // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// PhysxShape *PhysxOverlapReport:: get_overlap(unsigned int idx) { diff --git a/panda/src/physx/physxOverlapReport.h b/panda/src/physx/physxOverlapReport.h index 45e1cef9b9..4c0db876d0 100644 --- a/panda/src/physx/physxOverlapReport.h +++ b/panda/src/physx/physxOverlapReport.h @@ -1,4 +1,4 @@ -// Filename: physOverlapReport.h +// Filename: physxOverlapReport.h // Created by: enn0x (21Oct09) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/physx/physxPlaneShape.cxx b/panda/src/physx/physxPlaneShape.cxx index 8d33fa8289..92acf14ff9 100644 --- a/panda/src/physx/physxPlaneShape.cxx +++ b/panda/src/physx/physxPlaneShape.cxx @@ -21,7 +21,7 @@ TypeHandle PhysxPlaneShape::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxPlaneShape::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxPlaneShape:: link(NxShape *shapePtr) { @@ -39,7 +39,7 @@ link(NxShape *shapePtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxPlaneShape::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxPlaneShape:: unlink() { @@ -52,10 +52,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxPlaneShape::save_to_desc -// Access : Published -// Description : Saves the state of the shape object to a -// descriptor. +// Function: PhysxPlaneShape::save_to_desc +// Access: Published +// Description: Saves the state of the shape object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxPlaneShape:: save_to_desc(PhysxPlaneShapeDesc &shapeDesc) const { @@ -67,11 +67,11 @@ save_to_desc(PhysxPlaneShapeDesc &shapeDesc) const { //////////////////////////////////////////////////////////////////// // Function: PhysxPlaneShape::set_plane // Access: Published -// Description: Sets the plane equation. +// Description: Sets the plane equation. // - normal: Normal for the plane, in the global -// frame. Range: direction vector +// frame. Range: direction vector // - d: Distance coefficient of the plane equation. -// Range: (-inf,inf) +// Range: (-inf,inf) //////////////////////////////////////////////////////////////////// void PhysxPlaneShape:: set_plane(const LVector3f &normal, float d) { diff --git a/panda/src/physx/physxPointInPlaneJoint.cxx b/panda/src/physx/physxPointInPlaneJoint.cxx index 33f5299ab4..33638f3afa 100644 --- a/panda/src/physx/physxPointInPlaneJoint.cxx +++ b/panda/src/physx/physxPointInPlaneJoint.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxPointInPlaneJoint::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxPointInPlaneJoint::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxPointInPlaneJoint:: link(NxJoint *jointPtr) { @@ -38,7 +38,7 @@ link(NxJoint *jointPtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxPointInPlaneJoint::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxPointInPlaneJoint:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxPointInPlaneJoint::save_to_desc -// Access : Published -// Description : Saves the state of the joint object to a -// descriptor. +// Function: PhysxPointInPlaneJoint::save_to_desc +// Access: Published +// Description: Saves the state of the joint object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxPointInPlaneJoint:: save_to_desc(PhysxPointInPlaneJointDesc &jointDesc) const { @@ -64,10 +64,10 @@ save_to_desc(PhysxPointInPlaneJointDesc &jointDesc) const { } //////////////////////////////////////////////////////////////////// -// Function : PhysxPointInPlaneJoint::load_from_desc -// Access : Published -// Description : Loads the entire state of the joint from a -// descriptor with a single call. +// Function: PhysxPointInPlaneJoint::load_from_desc +// Access: Published +// Description: Loads the entire state of the joint from a +// descriptor with a single call. //////////////////////////////////////////////////////////////////// void PhysxPointInPlaneJoint:: load_from_desc(const PhysxPointInPlaneJointDesc &jointDesc) { diff --git a/panda/src/physx/physxPointOnLineJoint.cxx b/panda/src/physx/physxPointOnLineJoint.cxx index e0de51671a..bd4d8a0df6 100644 --- a/panda/src/physx/physxPointOnLineJoint.cxx +++ b/panda/src/physx/physxPointOnLineJoint.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxPointOnLineJoint::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxPointOnLineJoint::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxPointOnLineJoint:: link(NxJoint *jointPtr) { @@ -38,7 +38,7 @@ link(NxJoint *jointPtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxPointOnLineJoint::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxPointOnLineJoint:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxPointOnLineJoint::save_to_desc -// Access : Published -// Description : Saves the state of the joint object to a -// descriptor. +// Function: PhysxPointOnLineJoint::save_to_desc +// Access: Published +// Description: Saves the state of the joint object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxPointOnLineJoint:: save_to_desc(PhysxPointOnLineJointDesc &jointDesc) const { @@ -64,10 +64,10 @@ save_to_desc(PhysxPointOnLineJointDesc &jointDesc) const { } //////////////////////////////////////////////////////////////////// -// Function : PhysxPointOnLineJoint::load_from_desc -// Access : Published -// Description : Loads the entire state of the joint from a -// descriptor with a single call. +// Function: PhysxPointOnLineJoint::load_from_desc +// Access: Published +// Description: Loads the entire state of the joint from a +// descriptor with a single call. //////////////////////////////////////////////////////////////////// void PhysxPointOnLineJoint:: load_from_desc(const PhysxPointOnLineJointDesc &jointDesc) { diff --git a/panda/src/physx/physxPrismaticJoint.cxx b/panda/src/physx/physxPrismaticJoint.cxx index 0ee94f8955..98831a479d 100644 --- a/panda/src/physx/physxPrismaticJoint.cxx +++ b/panda/src/physx/physxPrismaticJoint.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxPrismaticJoint::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxPrismaticJoint::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxPrismaticJoint:: link(NxJoint *jointPtr) { @@ -38,7 +38,7 @@ link(NxJoint *jointPtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxPrismaticJoint::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxPrismaticJoint:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxPrismaticJoint::save_to_desc -// Access : Published -// Description : Saves the state of the joint object to a -// descriptor. +// Function: PhysxPrismaticJoint::save_to_desc +// Access: Published +// Description: Saves the state of the joint object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxPrismaticJoint:: save_to_desc(PhysxPrismaticJointDesc &jointDesc) const { @@ -64,10 +64,10 @@ save_to_desc(PhysxPrismaticJointDesc &jointDesc) const { } //////////////////////////////////////////////////////////////////// -// Function : PhysxPrismaticJoint::load_from_desc -// Access : Published -// Description : Loads the entire state of the joint from a -// descriptor with a single call. +// Function: PhysxPrismaticJoint::load_from_desc +// Access: Published +// Description: Loads the entire state of the joint from a +// descriptor with a single call. //////////////////////////////////////////////////////////////////// void PhysxPrismaticJoint:: load_from_desc(const PhysxPrismaticJointDesc &jointDesc) { diff --git a/panda/src/physx/physxPulleyJoint.cxx b/panda/src/physx/physxPulleyJoint.cxx index 5ec655bcb5..1a6fa1f75e 100644 --- a/panda/src/physx/physxPulleyJoint.cxx +++ b/panda/src/physx/physxPulleyJoint.cxx @@ -21,7 +21,7 @@ TypeHandle PhysxPulleyJoint::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxPulleyJoint::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxPulleyJoint:: link(NxJoint *jointPtr) { @@ -39,7 +39,7 @@ link(NxJoint *jointPtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxPulleyJoint::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxPulleyJoint:: unlink() { @@ -52,10 +52,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxPulleyJoint::save_to_desc -// Access : Published -// Description : Saves the state of the joint object to a -// descriptor. +// Function: PhysxPulleyJoint::save_to_desc +// Access: Published +// Description: Saves the state of the joint object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxPulleyJoint:: save_to_desc(PhysxPulleyJointDesc &jointDesc) const { @@ -65,10 +65,10 @@ save_to_desc(PhysxPulleyJointDesc &jointDesc) const { } //////////////////////////////////////////////////////////////////// -// Function : PhysxPulleyJoint::load_from_desc -// Access : Published -// Description : Loads the entire state of the joint from a -// descriptor with a single call. +// Function: PhysxPulleyJoint::load_from_desc +// Access: Published +// Description: Loads the entire state of the joint from a +// descriptor with a single call. //////////////////////////////////////////////////////////////////// void PhysxPulleyJoint:: load_from_desc(const PhysxPulleyJointDesc &jointDesc) { @@ -80,7 +80,7 @@ load_from_desc(const PhysxPulleyJointDesc &jointDesc) { //////////////////////////////////////////////////////////////////// // Function: PhysxPulleyJoint::set_motor // Access: Published -// Description: Sets motor parameters for the joint. +// Description: Sets motor parameters for the joint. // // For a positive velTarget, the motor pulls the first // body towards its pulley, for a negative velTarget, @@ -93,18 +93,18 @@ load_from_desc(const PhysxPulleyJointDesc &jointDesc) { // velocity, the motor will actually try to brake. If // you set this to infinity then the motor will keep // speeding up, unless there is some sort of -// resistance on the attached bodies. +// resistance on the attached bodies. // // maxForce - the maximum force the motor can exert. // Zero disables the motor. Default is 0, should // be >= 0. Setting this to a very large value if // velTarget is also very large may not be a good -// idea. +// idea. // // freeSpin - if this flag is set, and if the joint // is moving faster than velTarget, then neither // braking nor additional acceleration will result. -// default: false. +// default: false. // // This automatically enables the motor. //////////////////////////////////////////////////////////////////// @@ -151,7 +151,7 @@ get_flag(PhysxPulleyJointFlag flag) const { //////////////////////////////////////////////////////////////////// // Function: PhysxPulleyJoint::get_motor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// PhysxMotorDesc PhysxPulleyJoint:: get_motor() const { @@ -159,7 +159,7 @@ get_motor() const { nassertr(_error_type == ET_ok, false); PhysxMotorDesc value; - _ptr->getMotor(value._desc); + _ptr->getMotor(value._desc); return value; } diff --git a/panda/src/physx/physxRevoluteJoint.cxx b/panda/src/physx/physxRevoluteJoint.cxx index 5fdbe4d983..a7a853ca9e 100644 --- a/panda/src/physx/physxRevoluteJoint.cxx +++ b/panda/src/physx/physxRevoluteJoint.cxx @@ -23,7 +23,7 @@ TypeHandle PhysxRevoluteJoint::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxRevoluteJoint::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxRevoluteJoint:: link(NxJoint *jointPtr) { @@ -41,7 +41,7 @@ link(NxJoint *jointPtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxRevoluteJoint::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxRevoluteJoint:: unlink() { @@ -54,10 +54,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxRevoluteJoint::save_to_desc -// Access : Published -// Description : Saves the state of the joint object to a -// descriptor. +// Function: PhysxRevoluteJoint::save_to_desc +// Access: Published +// Description: Saves the state of the joint object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxRevoluteJoint:: save_to_desc(PhysxRevoluteJointDesc &jointDesc) const { @@ -67,10 +67,10 @@ save_to_desc(PhysxRevoluteJointDesc &jointDesc) const { } //////////////////////////////////////////////////////////////////// -// Function : PhysxRevoluteJoint::load_from_desc -// Access : Published -// Description : Loads the entire state of the joint from a -// descriptor with a single call. +// Function: PhysxRevoluteJoint::load_from_desc +// Access: Published +// Description: Loads the entire state of the joint from a +// descriptor with a single call. //////////////////////////////////////////////////////////////////// void PhysxRevoluteJoint:: load_from_desc(const PhysxRevoluteJointDesc &jointDesc) { @@ -82,7 +82,7 @@ load_from_desc(const PhysxRevoluteJointDesc &jointDesc) { //////////////////////////////////////////////////////////////////// // Function: PhysxRevoluteJoint::get_angle // Access: Published -// Description: Retrieves the current revolute joint angle. +// Description: Retrieves the current revolute joint angle. // // The relative orientation of the bodies is stored // when the joint is created, or when set_axis() or @@ -173,7 +173,7 @@ get_flag(PhysxRevoluteJointFlag flag) const { //////////////////////////////////////////////////////////////////// // Function: PhysxRevoluteJoint::set_spring // Access: Published -// Description: Sets spring parameters. +// Description: Sets spring parameters. // // The spring is implicitly integrated so no // instability should result for arbitrary spring and @@ -209,7 +209,7 @@ set_spring(const PhysxSpringDesc &spring) { //////////////////////////////////////////////////////////////////// // Function: PhysxRevoluteJoint::set_motor // Access: Published -// Description: Sets motor parameters for the joint. +// Description: Sets motor parameters for the joint. // // For a positive velTarget, the motor pulls the first // body towards its pulley, for a negative velTarget, @@ -222,18 +222,18 @@ set_spring(const PhysxSpringDesc &spring) { // velocity, the motor will actually try to brake. If // you set this to infinity then the motor will keep // speeding up, unless there is some sort of -// resistance on the attached bodies. +// resistance on the attached bodies. // // maxForce - the maximum force the motor can exert. // Zero disables the motor. Default is 0, should // be >= 0. Setting this to a very large value if // velTarget is also very large may not be a good -// idea. +// idea. // // freeSpin - if this flag is set, and if the joint // is moving faster than velTarget, then neither // braking nor additional acceleration will result. -// default: false. +// default: false. // // This automatically enables the motor. //////////////////////////////////////////////////////////////////// @@ -247,7 +247,7 @@ set_motor(const PhysxMotorDesc &motor) { //////////////////////////////////////////////////////////////////// // Function: PhysxRevoluteJoint::set_limits // Access: Published -// Description: Sets angular joint limits. +// Description: Sets angular joint limits. // // If either of these limits are set, any planar // limits in PhysxJoint are ignored. The limits are @@ -288,7 +288,7 @@ set_limits(const PhysxJointLimitDesc &low, const PhysxJointLimitDesc &high) { //////////////////////////////////////////////////////////////////// // Function: PhysxRevoluteJoint::get_motor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// PhysxMotorDesc PhysxRevoluteJoint:: get_motor() const { @@ -296,14 +296,14 @@ get_motor() const { nassertr(_error_type == ET_ok, NULL); PhysxMotorDesc value; - _ptr->getMotor(value._desc); + _ptr->getMotor(value._desc); return value; } //////////////////////////////////////////////////////////////////// // Function: PhysxRevoluteJoint::get_spring // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// PhysxSpringDesc PhysxRevoluteJoint:: get_spring() const { @@ -311,7 +311,7 @@ get_spring() const { nassertr(_error_type == ET_ok, NULL); PhysxSpringDesc value; - _ptr->getSpring(value._desc); + _ptr->getSpring(value._desc); return value; } diff --git a/panda/src/physx/physxScene.cxx b/panda/src/physx/physxScene.cxx index 5462de9739..628cde17c0 100644 --- a/panda/src/physx/physxScene.cxx +++ b/panda/src/physx/physxScene.cxx @@ -39,7 +39,7 @@ PStatCollector PhysxScene::_pcollector_softbody("App:PhysX:Softbody"); //////////////////////////////////////////////////////////////////// // Function: PhysxScene::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxScene:: link(NxScene *scenePtr) { @@ -68,7 +68,7 @@ link(NxScene *scenePtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxScene::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxScene:: unlink() { @@ -171,7 +171,7 @@ unlink() { //////////////////////////////////////////////////////////////////// // Function: PhysxScene::release // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxScene:: release() { @@ -303,7 +303,6 @@ fetch_results() { // Function: PhysxScene::set_timing_variable // Access: Published // Description: Sets simulation timing parameters used in simulate. - //////////////////////////////////////////////////////////////////// void PhysxScene:: set_timing_variable() { @@ -368,7 +367,7 @@ get_gravity() const { //////////////////////////////////////////////////////////////////// // Function: PhysxScene::get_num_actors // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// unsigned int PhysxScene:: get_num_actors() const { @@ -403,7 +402,7 @@ create_actor(PhysxActorDesc &desc) { //////////////////////////////////////////////////////////////////// // Function: PhysxScene::get_actor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// PhysxActor *PhysxScene:: get_actor(unsigned int idx) const { @@ -538,7 +537,7 @@ is_controller_reporting_enabled() const { //////////////////////////////////////////////////////////////////// // Function: PhysxScene::get_num_materials // Access: Published -// Description: Return the number of materials in the scene. +// Description: Return the number of materials in the scene. // // Note that the returned value is not related to // material indices. Those may not be allocated @@ -626,7 +625,7 @@ get_hightest_material_index() const { // Function: PhysxScene::get_material_from_index // Access: Published // Description: Retrieves the material with the given material -// index. +// index. // // There is always at least one material in the Scene, // the default material (index 0). If the specified @@ -675,7 +674,7 @@ get_material(unsigned int idx) const { //////////////////////////////////////////////////////////////////// // Function: PhysxScene::get_num_controllers // Access: Published -// Description: Return the number of controllers in the scene. +// Description: Return the number of controllers in the scene. //////////////////////////////////////////////////////////////////// unsigned int PhysxScene:: get_num_controllers() const { @@ -1076,7 +1075,7 @@ raycast_any_shape(const PhysxRay &ray, NxGroupsMask *groupsPtr = groups ? &(groups->_mask) : NULL; - return _ptr->raycastAnyShape(ray._ray, (NxShapesType)shapesType, + return _ptr->raycastAnyShape(ray._ray, (NxShapesType)shapesType, mask.get_mask(), ray._length, groupsPtr); } @@ -1107,7 +1106,7 @@ raycast_closest_shape(const PhysxRay &ray, hints |= NX_RAYCAST_FACE_NORMAL; } - _ptr->raycastClosestShape(ray._ray, (NxShapesType)shapesType, hit, + _ptr->raycastClosestShape(ray._ray, (NxShapesType)shapesType, hit, mask.get_mask(), ray._length, hints, groupsPtr); @@ -1163,7 +1162,7 @@ raycast_any_bounds(const PhysxRay &ray, NxGroupsMask *groupsPtr = groups ? &(groups->_mask) : NULL; - return _ptr->raycastAnyBounds(ray._ray, (NxShapesType)shapesType, + return _ptr->raycastAnyBounds(ray._ray, (NxShapesType)shapesType, mask.get_mask(), ray._length, groupsPtr); } @@ -1192,7 +1191,7 @@ raycast_closest_bounds(const PhysxRay &ray, PhysxShapesType shapesType, PhysxMas hints |= NX_RAYCAST_FACE_NORMAL; } - _ptr->raycastClosestBounds(ray._ray, (NxShapesType)shapesType, hit, + _ptr->raycastClosestBounds(ray._ray, (NxShapesType)shapesType, hit, mask.get_mask(), ray._length, hints, groupsPtr); @@ -1237,7 +1236,7 @@ raycast_all_bounds(const PhysxRay &ray, // Function: PhysxScene::overlap_sphere_shapes // Access: Published // Description: Returns the set of shapes overlapped by the -// world-space sphere. +// world-space sphere. // You can test against static and/or dynamic objects // by adjusting 'shapeType'. //////////////////////////////////////////////////////////////////// @@ -1262,7 +1261,7 @@ overlap_sphere_shapes(const LPoint3f ¢er, float radius, // Function: PhysxScene::overlap_capsule_shapes // Access: Published // Description: Returns the set of shapes overlapped by the -// world-space capsule. +// world-space capsule. // You can test against static and/or dynamic objects // by adjusting 'shapeType'. //////////////////////////////////////////////////////////////////// @@ -1288,7 +1287,7 @@ overlap_capsule_shapes(const LPoint3f &p0, const LPoint3f &p1, float radius, //////////////////////////////////////////////////////////////////// // Function: PhysxScene::set_actor_pair_flag // Access: Published -// Description: Sets the pair flags for the given pair of actors. +// Description: Sets the pair flags for the given pair of actors. // // Calling this on an actor that has no shape(s) has // no effect. The two actor references must not @@ -1308,7 +1307,7 @@ set_actor_pair_flag(PhysxActor &actorA, PhysxActor &actorB, NxActor *ptrA = actorA.ptr(); NxActor *ptrB = actorB.ptr(); - NxU32 flags = _ptr->getActorPairFlags(*ptrA, *ptrB); + NxU32 flags = _ptr->getActorPairFlags(*ptrA, *ptrB); if (value == true) { flags |= flag; @@ -1325,7 +1324,7 @@ set_actor_pair_flag(PhysxActor &actorA, PhysxActor &actorB, // Access: Published // Description: Retrieves a single flag for the given pair of // actors. -// +// // The two actor references must not reference the // same actor. //////////////////////////////////////////////////////////////////// @@ -1337,7 +1336,7 @@ get_actor_pair_flag(PhysxActor &actorA, PhysxActor &actorB, NxActor *ptrA = actorA.ptr(); NxActor *ptrB = actorB.ptr(); - NxU32 flags = _ptr->getActorPairFlags(*ptrA, *ptrB); + NxU32 flags = _ptr->getActorPairFlags(*ptrA, *ptrB); return (flags && flag) ? true : false; } @@ -1358,7 +1357,7 @@ set_shape_pair_flag(PhysxShape &shapeA, PhysxShape &shapeB, bool value) { NxShape *ptrA = shapeA.ptr(); NxShape *ptrB = shapeB.ptr(); - NxU32 flags = _ptr->getShapePairFlags(*ptrA, *ptrB); + NxU32 flags = _ptr->getShapePairFlags(*ptrA, *ptrB); if (value == true) { flags |= NX_IGNORE_PAIR; @@ -1387,7 +1386,7 @@ get_shape_pair_flag(PhysxShape &shapeA, PhysxShape &shapeB) { NxShape *ptrA = shapeA.ptr(); NxShape *ptrB = shapeB.ptr(); - NxU32 flags = _ptr->getShapePairFlags(*ptrA, *ptrB); + NxU32 flags = _ptr->getShapePairFlags(*ptrA, *ptrB); return (flags && NX_IGNORE_PAIR) ? true : false; } @@ -1396,7 +1395,7 @@ get_shape_pair_flag(PhysxShape &shapeA, PhysxShape &shapeB) { // Function: PhysxScene::set_actor_group_pair_flag // Access: Published // Description: With this method one can set contact reporting -// flags between actors belonging to a pair of groups. +// flags between actors belonging to a pair of groups. // // It is possible to assign each actor to a group // using PhysxActor::set_group(). This is a different @@ -1424,7 +1423,7 @@ set_actor_group_pair_flag(unsigned int g1, unsigned int g2, nassertv(_error_type == ET_ok); - NxU32 flags = _ptr->getActorGroupPairFlags(g1, g2); + NxU32 flags = _ptr->getActorGroupPairFlags(g1, g2); if (value == true) { flags |= flag; } @@ -1445,7 +1444,7 @@ get_actor_group_pair_flag(unsigned int g1, unsigned int g2, PhysxContactPairFlag flag) { nassertr(_error_type == ET_ok, false); - NxU32 flags = _ptr->getActorGroupPairFlags(g1, g2); + NxU32 flags = _ptr->getActorGroupPairFlags(g1, g2); return (flags && flag) ? true : false; } @@ -1606,7 +1605,7 @@ get_filter_op2() const { // Function: PhysxScene::set_group_collision_flag // Access: Published // Description: Specifies if collision should be performed by a -// pair of shape groups. +// pair of shape groups. // // It is possible to assign each shape to a collision // groups using PhysxShape::set_group(). With this @@ -1674,9 +1673,9 @@ is_hardware_scene() const { //////////////////////////////////////////////////////////////////// // Function: PhysxScene::set_dominance_group_pair // Access: Published -// Description: Specifies the dominance behavior of constraints +// Description: Specifies the dominance behavior of constraints // between two actors with two certain dominance -// groups. +// groups. // // It is possible to assign each actor to a dominance // groups using PhysxActor::set_dominance_group(). diff --git a/panda/src/physx/physxSceneStats2.I b/panda/src/physx/physxSceneStats2.I index 2fb52af751..a1d1bc35dd 100644 --- a/panda/src/physx/physxSceneStats2.I +++ b/panda/src/physx/physxSceneStats2.I @@ -1,4 +1,4 @@ -// Filename: physxSceneStats2.cxx +// Filename: physxSceneStats2.I // Created by: enn0x (20Oct09) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/physx/physxShape.cxx b/panda/src/physx/physxShape.cxx index 76d7bd1bf9..9d958448a7 100644 --- a/panda/src/physx/physxShape.cxx +++ b/panda/src/physx/physxShape.cxx @@ -37,7 +37,7 @@ TypeHandle PhysxShape::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxShape::release // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxShape:: release() { @@ -51,7 +51,7 @@ release() { //////////////////////////////////////////////////////////////////// // Function: PhysxShape::factory // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// PhysxShape *PhysxShape:: factory(NxShapeType shapeType) { @@ -120,7 +120,7 @@ set_name(const char *name) { //////////////////////////////////////////////////////////////////// // Function: PhysxShape::get_name // Access: Published -// Description: Returns the name string. +// Description: Returns the name string. //////////////////////////////////////////////////////////////////// const char *PhysxShape:: get_name() const { @@ -134,16 +134,17 @@ get_name() const { // Access: Published // Description: Sets the specified shape flag. // -// The shape may be turned into a trigger by setting -// one or more of the TriggerFlags to true. A trigger -// shape will not collide with other shapes. Instead, -// if a shape enters the trigger's volume, a trigger -// event will be sent. Trigger events can be listened -// to by DirectObjects. -// The following trigger events can be sent: -// - physx-trigger-enter -// - physx-trigger-stay -// - physx-trigger-leave +// The shape may be turned into a trigger by setting +// one or more of the TriggerFlags to true. A trigger +// shape will not collide with other shapes. Instead, +// if a shape enters the trigger's volume, a trigger +// event will be sent. Trigger events can be listened +// to by DirectObjects. +// +// The following trigger events can be sent: +// - physx-trigger-enter +// - physx-trigger-stay +// - physx-trigger-leave //////////////////////////////////////////////////////////////////// void PhysxShape:: set_flag(PhysxShapeFlag flag, bool value) { @@ -169,7 +170,7 @@ get_flag(PhysxShapeFlag flag) const { //////////////////////////////////////////////////////////////////// // Function: PhysxShape::set_skin_width // Access: Published -// Description: Sets the skin width. +// Description: Sets the skin width. // The skin width must be non-negative. //////////////////////////////////////////////////////////////////// void PhysxShape:: @@ -197,7 +198,7 @@ get_skin_width() const { //////////////////////////////////////////////////////////////////// // Function: PhysxShape::set_group // Access: Published -// Description: Sets which collision group this shape is part of. +// Description: Sets which collision group this shape is part of. // // Default group is 0. Maximum possible group is 31. // Collision groups are sets of shapes which may or @@ -217,7 +218,7 @@ set_group(unsigned short group) { //////////////////////////////////////////////////////////////////// // Function: PhysxShape::get_group // Access: Published -// Description: Retrieves the collision group set for this shape. +// Description: Retrieves the collision group set for this shape. // The collision group is an integer between 0 and // 31. //////////////////////////////////////////////////////////////////// @@ -255,7 +256,7 @@ set_local_pos(const LPoint3f &pos) { // Function: PhysxShape::get_local_pos // Access: Published // Description: Retrieve the position of the shape in actor space, -// i.e. relative to the actor it is owned by. +// i.e. relative to the actor it is owned by. //////////////////////////////////////////////////////////////////// LPoint3f PhysxShape:: get_local_pos() const { @@ -291,7 +292,7 @@ set_local_mat(const LMatrix4f &mat) { // Function: PhysxShape::get_local_mat // Access: Published // Description: Retrieve the transform of the shape in actor space, -// i.e. relative to the actor it is owned by. +// i.e. relative to the actor it is owned by. //////////////////////////////////////////////////////////////////// LMatrix4f PhysxShape:: get_local_mat() const { @@ -305,7 +306,7 @@ get_local_mat() const { // Function: PhysxShape::get_material_index // Access: Published // Description: Returns the material index currently assigned to -// the shape. +// the shape. //////////////////////////////////////////////////////////////////// unsigned short PhysxShape:: get_material_index() const { @@ -330,7 +331,7 @@ set_material(const PhysxMaterial &material) { //////////////////////////////////////////////////////////////////// // Function: PhysxShape::set_material_index // Access: Published -// Description: Assigns a material index to the shape. +// Description: Assigns a material index to the shape. // // The material index can be retrieved by calling // PhysxMaterial::get_material_index(). If the material @@ -442,7 +443,7 @@ check_overlap_sphere(const PhysxSphere &world_sphere) const { //////////////////////////////////////////////////////////////////// // Function: PhysxShape::raycast // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// PhysxRaycastHit PhysxShape:: raycast(const PhysxRay &worldRay, bool firstHit, bool smoothNormal) const { @@ -465,7 +466,7 @@ raycast(const PhysxRay &worldRay, bool firstHit, bool smoothNormal) const { //////////////////////////////////////////////////////////////////// // Function: PhysxShape::set_ccd_skeleton // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxShape:: set_ccd_skeleton(PhysxCcdSkeleton *skel) { @@ -479,7 +480,7 @@ set_ccd_skeleton(PhysxCcdSkeleton *skel) { //////////////////////////////////////////////////////////////////// // Function: PhysxShape::get_ccd_skeleton // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// PhysxCcdSkeleton *PhysxShape:: get_ccd_skeleton() const { diff --git a/panda/src/physx/physxSphereForceFieldShape.cxx b/panda/src/physx/physxSphereForceFieldShape.cxx index e91b8402e2..a5f482b058 100644 --- a/panda/src/physx/physxSphereForceFieldShape.cxx +++ b/panda/src/physx/physxSphereForceFieldShape.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxSphereForceFieldShape::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxSphereForceFieldShape::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxSphereForceFieldShape:: link(NxForceFieldShape *shapePtr) { @@ -38,7 +38,7 @@ link(NxForceFieldShape *shapePtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxSphereForceFieldShape::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxSphereForceFieldShape:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxSphereForceFieldShape::save_to_desc -// Access : Published -// Description : Saves the state of the shape object to a -// descriptor. +// Function: PhysxSphereForceFieldShape::save_to_desc +// Access: Published +// Description: Saves the state of the shape object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxSphereForceFieldShape:: save_to_desc(PhysxSphereForceFieldShapeDesc &shapeDesc) const { @@ -66,7 +66,7 @@ save_to_desc(PhysxSphereForceFieldShapeDesc &shapeDesc) const { //////////////////////////////////////////////////////////////////// // Function: PhysxSphereForceFieldShape::set_radius // Access: Published -// Description: Sets the sphere radius. +// Description: Sets the sphere radius. //////////////////////////////////////////////////////////////////// void PhysxSphereForceFieldShape:: set_radius(float radius) { diff --git a/panda/src/physx/physxSphereShape.cxx b/panda/src/physx/physxSphereShape.cxx index 427717f80b..5cd52b1723 100644 --- a/panda/src/physx/physxSphereShape.cxx +++ b/panda/src/physx/physxSphereShape.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxSphereShape::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxSphereShape::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxSphereShape:: link(NxShape *shapePtr) { @@ -38,7 +38,7 @@ link(NxShape *shapePtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxSphereShape::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxSphereShape:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxSphereShape::save_to_desc -// Access : Published -// Description : Saves the state of the shape object to a -// descriptor. +// Function: PhysxSphereShape::save_to_desc +// Access: Published +// Description: Saves the state of the shape object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxSphereShape:: save_to_desc(PhysxSphereShapeDesc &shapeDesc) const { @@ -66,7 +66,7 @@ save_to_desc(PhysxSphereShapeDesc &shapeDesc) const { //////////////////////////////////////////////////////////////////// // Function: PhysxSphereShape::set_radius // Access: Published -// Description: Sets the sphere radius. +// Description: Sets the sphere radius. //////////////////////////////////////////////////////////////////// void PhysxSphereShape:: set_radius(float radius) { diff --git a/panda/src/physx/physxSphericalJoint.cxx b/panda/src/physx/physxSphericalJoint.cxx index 227f6c470c..a755ac7402 100644 --- a/panda/src/physx/physxSphericalJoint.cxx +++ b/panda/src/physx/physxSphericalJoint.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxSphericalJoint::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxSphericalJoint::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxSphericalJoint:: link(NxJoint *jointPtr) { @@ -38,7 +38,7 @@ link(NxJoint *jointPtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxSphericalJoint::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxSphericalJoint:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxSphericalJoint::save_to_desc -// Access : Published -// Description : Saves the state of the joint object to a -// descriptor. +// Function: PhysxSphericalJoint::save_to_desc +// Access: Published +// Description: Saves the state of the joint object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxSphericalJoint:: save_to_desc(PhysxSphericalJointDesc &jointDesc) const { @@ -64,10 +64,10 @@ save_to_desc(PhysxSphericalJointDesc &jointDesc) const { } //////////////////////////////////////////////////////////////////// -// Function : PhysxSphericalJoint::load_from_desc -// Access : Published -// Description : Loads the entire state of the joint from a -// descriptor with a single call. +// Function: PhysxSphericalJoint::load_from_desc +// Access: Published +// Description: Loads the entire state of the joint from a +// descriptor with a single call. //////////////////////////////////////////////////////////////////// void PhysxSphericalJoint:: load_from_desc(const PhysxSphericalJointDesc &jointDesc) { diff --git a/panda/src/physx/physxTriangleMeshShape.cxx b/panda/src/physx/physxTriangleMeshShape.cxx index 41e286fc28..ccd76c9b12 100644 --- a/panda/src/physx/physxTriangleMeshShape.cxx +++ b/panda/src/physx/physxTriangleMeshShape.cxx @@ -20,7 +20,7 @@ TypeHandle PhysxTriangleMeshShape::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxTriangleMeshShape::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxTriangleMeshShape:: link(NxShape *shapePtr) { @@ -38,7 +38,7 @@ link(NxShape *shapePtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxTriangleMeshShape::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxTriangleMeshShape:: unlink() { @@ -51,10 +51,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxTriangleMeshShape::save_to_desc -// Access : Published -// Description : Saves the state of the shape object to a -// descriptor. +// Function: PhysxTriangleMeshShape::save_to_desc +// Access: Published +// Description: Saves the state of the shape object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxTriangleMeshShape:: save_to_desc(PhysxTriangleMeshShapeDesc &shapeDesc) const { diff --git a/panda/src/physx/physxWheelShape.cxx b/panda/src/physx/physxWheelShape.cxx index 10a6278870..20fb355002 100644 --- a/panda/src/physx/physxWheelShape.cxx +++ b/panda/src/physx/physxWheelShape.cxx @@ -21,7 +21,7 @@ TypeHandle PhysxWheelShape::_type_handle; //////////////////////////////////////////////////////////////////// // Function: PhysxWheelShape::link // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxWheelShape:: link(NxShape *shapePtr) { @@ -39,7 +39,7 @@ link(NxShape *shapePtr) { //////////////////////////////////////////////////////////////////// // Function: PhysxWheelShape::unlink // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PhysxWheelShape:: unlink() { @@ -52,10 +52,10 @@ unlink() { } //////////////////////////////////////////////////////////////////// -// Function : PhysxWheelShape::save_to_desc -// Access : Published -// Description : Saves the state of the shape object to a -// descriptor. +// Function: PhysxWheelShape::save_to_desc +// Access: Published +// Description: Saves the state of the shape object to a +// descriptor. //////////////////////////////////////////////////////////////////// void PhysxWheelShape:: save_to_desc(PhysxWheelShapeDesc &shapeDesc) const { @@ -67,7 +67,7 @@ save_to_desc(PhysxWheelShapeDesc &shapeDesc) const { //////////////////////////////////////////////////////////////////// // Function: PhysxWheelShape::set_radius // Access: Published -// Description: Sets the sphere radius. +// Description: Sets the sphere radius. //////////////////////////////////////////////////////////////////// void PhysxWheelShape:: set_radius(float radius) { @@ -144,7 +144,7 @@ get_inverse_wheel_mass() const { // Function: PhysxWheelShape::set_motor_torque // Access: Published // Description: Set the sum engine torque on the wheel axle. -// Positive or negative depending on direction +// Positive or negative depending on direction //////////////////////////////////////////////////////////////////// void PhysxWheelShape:: set_motor_torque(float torque) { @@ -249,7 +249,7 @@ get_steer_angle_rad() const { // Access: Published // Description: Set the current axle rotation speed. // Note: WSF_axle_speed_override flag must be raised -// for this to have effect! +// for this to have effect! //////////////////////////////////////////////////////////////////// void PhysxWheelShape:: set_axle_speed(float speed) { diff --git a/panda/src/physx/physxWheelShape.h b/panda/src/physx/physxWheelShape.h index 313648e01e..ea875fb8f9 100644 --- a/panda/src/physx/physxWheelShape.h +++ b/panda/src/physx/physxWheelShape.h @@ -25,7 +25,7 @@ class PhysxSpringDesc; //////////////////////////////////////////////////////////////////// // Class : PhysxWheelShape -// Description : A special shape used for simulating a car wheel. +// Description : A special shape used for simulating a car wheel. // The -Y axis should be directed toward the ground. // // A ray is cast from the shape's origin along the -Y @@ -33,12 +33,12 @@ class PhysxSpringDesc; // distance is: // // - less than wheelRadius from the shape origin: -// a hard contact is created +// a hard contact is created // - between wheelRadius and (suspensionTravel + // wheelRadius): a soft suspension contact is -// created +// created // - greater than (suspensionTravel + wheelRadius): -// no contact is created. +// no contact is created. // // Thus at the point of greatest possible suspension // compression the wheel axle will pass through at @@ -67,7 +67,6 @@ class PhysxSpringDesc; // on the car. //////////////////////////////////////////////////////////////////// class EXPCL_PANDAPHYSX PhysxWheelShape : public PhysxShape { - PUBLISHED: INLINE PhysxWheelShape(); INLINE ~PhysxWheelShape(); @@ -95,7 +94,6 @@ PUBLISHED: float get_axle_speed() const; bool get_wheel_flag(PhysxWheelShapeFlag flag) const; -//////////////////////////////////////////////////////////////////// public: INLINE NxShape *ptr() const { return (NxShape *)_ptr; }; @@ -105,14 +103,13 @@ public: private: NxWheelShape *_ptr; -//////////////////////////////////////////////////////////////////// public: static TypeHandle get_class_type() { return _type_handle; } static void init_type() { PhysxShape::init_type(); - register_type(_type_handle, "PhysxWheelShape", + register_type(_type_handle, "PhysxWheelShape", PhysxShape::get_class_type()); } virtual TypeHandle get_type() const { diff --git a/panda/src/physx/physx_includes.h b/panda/src/physx/physx_includes.h index 0f8c4f2e79..fceeb7fbe7 100644 --- a/panda/src/physx/physx_includes.h +++ b/panda/src/physx/physx_includes.h @@ -1,4 +1,4 @@ -// Filename: ode_includes.h +// Filename: physx_includes.h // Created by: joswilso (30Jan07) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmimage/pfmFile_ext.cxx b/panda/src/pnmimage/pfmFile_ext.cxx index 29b5949f75..790e38de8e 100644 --- a/panda/src/pnmimage/pfmFile_ext.cxx +++ b/panda/src/pnmimage/pfmFile_ext.cxx @@ -1,4 +1,4 @@ -// Filename: pfmFile_ext.I +// Filename: pfmFile_ext.cxx // Created by: rdb (26Feb14) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmtext/freetypeFace.h b/panda/src/pnmtext/freetypeFace.h index 5e8e16e9c3..ee200eff89 100644 --- a/panda/src/pnmtext/freetypeFace.h +++ b/panda/src/pnmtext/freetypeFace.h @@ -1,4 +1,4 @@ -// Filename: freetypeFont.h +// Filename: freetypeFace.h // Created by: gogg (16Nov09) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmtext/pnmTextMaker.cxx b/panda/src/pnmtext/pnmTextMaker.cxx index 809033d2cf..e74737a038 100644 --- a/panda/src/pnmtext/pnmTextMaker.cxx +++ b/panda/src/pnmtext/pnmTextMaker.cxx @@ -1,7 +1,7 @@ -// Filename: textMaker.cxx +// Filename: pnmTextMaker.cxx // Created by: drose (03Apr02) // -////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // PANDA 3D SOFTWARE // Copyright (c) Carnegie Mellon University. All rights reserved. // @@ -95,7 +95,7 @@ generate_into(const wstring &text, PNMImage &dest_image, int x, int y) { // First, measure the total width in pixels. int width = calc_width(text); - int xp = x; + int xp = x; int yp = y; switch (_align) { diff --git a/panda/src/putil/uniqueIdAllocator.cxx b/panda/src/putil/uniqueIdAllocator.cxx index 35c4eb2aeb..24940e22f2 100644 --- a/panda/src/putil/uniqueIdAllocator.cxx +++ b/panda/src/putil/uniqueIdAllocator.cxx @@ -11,7 +11,6 @@ // with this source code in a file named "LICENSE." // //////////////////////////////////////////////////////////////////// -// #include "pandabase.h" #include "pnotify.h" @@ -77,7 +76,7 @@ UniqueIdAllocator(PN_uint32 min, PN_uint32 max) //////////////////////////////////////////////////////////////////// // Function: UniqueIdAllocator::Destructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// UniqueIdAllocator:: ~UniqueIdAllocator() { diff --git a/panda/src/putil/uniqueIdAllocator.h b/panda/src/putil/uniqueIdAllocator.h index 47dbf9e0af..6de368250b 100644 --- a/panda/src/putil/uniqueIdAllocator.h +++ b/panda/src/putil/uniqueIdAllocator.h @@ -11,7 +11,6 @@ // with this source code in a file named "LICENSE." // //////////////////////////////////////////////////////////////////// -// #ifndef _UNIQUEIDALLOCATOR_H //[ #define _UNIQUEIDALLOCATOR_H @@ -55,7 +54,7 @@ PUBLISHED: void output(ostream &out) const; void write(ostream &out) const; -public: +public: static const PN_uint32 IndexEnd; static const PN_uint32 IndexAllocated; diff --git a/panda/src/rocket/rocketSystemInterface.cxx b/panda/src/rocket/rocketSystemInterface.cxx index 2f0d3acce6..7f49ef02e8 100644 --- a/panda/src/rocket/rocketSystemInterface.cxx +++ b/panda/src/rocket/rocketSystemInterface.cxx @@ -1,4 +1,4 @@ -// Filename: rocketSystemInterface.h +// Filename: rocketSystemInterface.cxx // Created by: rdb (03Nov11) // //////////////////////////////////////////////////////////////////// diff --git a/panda/src/tinydisplay/tinyOsxGraphicsWindow.mm b/panda/src/tinydisplay/tinyOsxGraphicsWindow.mm index 876de6450d..a28a6e76d8 100644 --- a/panda/src/tinydisplay/tinyOsxGraphicsWindow.mm +++ b/panda/src/tinydisplay/tinyOsxGraphicsWindow.mm @@ -1,3 +1,5 @@ +// Filename: tinyOsxGraphicsWindow.mm +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -33,18 +35,14 @@ #include "pmutex.h" //#include "mutexHolder.h" -//////////////////////////////////// -\ -Mutex & OSXGloablMutex() { - static Mutex m("OSXWIN_Mutex"); - return m; +Mutex &OSXGloablMutex() { + static Mutex m("OSXWIN_Mutex"); + return m; } - -struct work1 -{ - volatile bool work_done; +struct work1 { + volatile bool work_done; }; #define PANDA_CREATE_WINDOW 101 @@ -68,9 +66,6 @@ static void Post_Event_Wait(unsigned short type, unsigned int data1 , unsigned i } - -////////////////////////// Global Objects ..... - TypeHandle TinyOsxGraphicsWindow::_type_handle; TinyOsxGraphicsWindow * TinyOsxGraphicsWindow::FullScreenWindow = NULL; @@ -156,7 +151,7 @@ event_handler(EventHandlerCallRef myHandler, EventRef event) { case kEventClassMouse: result = handleWindowMouseEvents (myHandler, event); break; - + case kEventClassWindow: switch (kind) { case kEventWindowCollapsing: @@ -201,7 +196,7 @@ event_handler(EventHandlerCallRef myHandler, EventRef event) { } } break; - + case kEventWindowBoundsChanged: // called for resize and moves (drag) DoResize(); break; @@ -248,7 +243,7 @@ void TinyOsxGraphicsWindow::user_close_request() { //////////////////////////////////////////////////////////////////// // Function: TinyOsxGraphicsWindow::SystemCloseWindow -// Access: private +// Access: Private // Description: The Windows is closed by a OS resource not by a internal request // //////////////////////////////////////////////////////////////////// @@ -260,7 +255,7 @@ void TinyOsxGraphicsWindow::SystemCloseWindow() { //////////////////////////////////////////////////////////////////// // Function: windowEvtHndlr -// Access: file scope static +// Access: file scope Static // Description: The C callback for Window Events .. // // We only hook this up for non fullscreen window... so we only @@ -287,7 +282,7 @@ static pascal OSStatus windowEvtHndlr(EventHandlerCallRef myHandler, EventRef return eventNotHandledErr; } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: TinyOsxGraphicsWindow::DoResize // Access: // Description: The C callback for Window Events .. @@ -319,7 +314,7 @@ void TinyOsxGraphicsWindow::DoResize(void) { } }; -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: appEvtHndlr // Access: // Description: The C callback for APlication Events.. @@ -395,7 +390,7 @@ static pascal OSStatus appEvtHndlr (EventHandlerCallRef myHandler, EventRef even return result; } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: TinyOsxGraphicsWindow::handleTextInput // Access: // Description: Trap Unicode Input. @@ -426,9 +421,9 @@ OSStatus TinyOsxGraphicsWindow::handleTextInput (EventHandlerCallRef myHandler, return ret; } -/////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: TinyOsxGraphicsWindow::ReleaseSystemResources -// Access: private.. +// Access: Private // Description: Clean up the OS level messes.. //////////////////////////////////////////////////////////////////// void TinyOsxGraphicsWindow::ReleaseSystemResources() { @@ -753,17 +748,15 @@ void TinyOsxGraphicsWindow::close_window() { GraphicsWindow::close_window(); } -////////////////////////////////////////////////////////// // HACK ALLERT ************ Undocumented OSX calls... // I can not find any other way to get the mouse focus to a window in OSX.. -// //extern "C" { // struct CPSProcessSerNum // { // UInt32 lo; // UInt32 hi; // }; -/// + //extern OSErr CPSGetCurrentProcess(CPSProcessSerNum *psn); //extern OSErr CPSEnableForegroundOperation( struct CPSProcessSerNum *psn); //extern OSErr CPSSetProcessName ( struct CPSProcessSerNum *psn, char *processname); @@ -891,7 +884,7 @@ bool TinyOsxGraphicsWindow::OSOpenWindow(WindowProperties &req_properties) { // A minimized window can't be fullscreen. wants_fullscreen = false; } - + if (wants_fullscreen) { tinydisplay_cat.info() << "Creating full screen\n"; @@ -921,14 +914,14 @@ bool TinyOsxGraphicsWindow::OSOpenWindow(WindowProperties &req_properties) { _properties.set_fullscreen(true); _properties.set_minimized(false); _properties.set_foreground(true); - - _is_fullscreen = true; + + _is_fullscreen = true; FullScreenWindow = this; req_properties.clear_fullscreen(); } else { int x_origin = 10; int y_origin = 50; - if (req_properties.has_origin()) { + if (req_properties.has_origin()) { y_origin = req_properties.get_y_origin(); x_origin = req_properties.get_x_origin(); } @@ -939,7 +932,7 @@ bool TinyOsxGraphicsWindow::OSOpenWindow(WindowProperties &req_properties) { x_size = req_properties.get_x_size(); y_size = req_properties.get_y_size(); } - + // A coordinate of -2 means to center the window on screen. if (y_origin == -2 || x_origin == -2) { if (y_origin == -2) { @@ -1111,7 +1104,7 @@ bool TinyOsxGraphicsWindow::OSOpenWindow(WindowProperties &req_properties) { //////////////////////////////////////////////////////////////////// // Function: TinyOsxGraphicsWindow::process_events() -// Access: virtual, protected +// Access: Virtual, Protected // Description: Required Event upcall . Used to dispatch Window and Aplication Events // back into panda // @@ -1154,15 +1147,14 @@ supports_pixel_zoom() const { //////////////////////////////////////////////////////////////////// // Function: TinyOsxGraphicsWindow::handleKeyInput() -// Access: virtual, protected +// Access: Virtual, Protected // Description: Required Event upcall . Used to dispatch Window and Aplication Events // back into panda -// //////////////////////////////////////////////////////////////////// -// key input handler OSStatus TinyOsxGraphicsWindow::handleKeyInput (EventHandlerCallRef myHandler, EventRef event, Boolean keyDown) { + // key input handler - if (tinydisplay_cat.is_debug()) { + if (tinydisplay_cat.is_debug()) { UInt32 keyCode; GetEventParameter (event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode); @@ -1693,10 +1685,10 @@ void TinyOsxGraphicsWindow::set_properties_now(WindowProperties &properties) { properties.get_y_size() != _properties.get_y_size()))) { need_full_rebuild = true; } - + // If we are fullscreen and requesting a minimize change - if (_properties.get_fullscreen() && - (properties.has_minimized() && + if (_properties.get_fullscreen() && + (properties.has_minimized() && (properties.get_minimized() != _properties.get_minimized()))) { need_full_rebuild = true; } @@ -1776,8 +1768,9 @@ void TinyOsxGraphicsWindow::set_properties_now(WindowProperties &properties) { return; } -///////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: TinyOsxGraphicsWindow::LocalPointToSystemPoint +//////////////////////////////////////////////////////////////////// void TinyOsxGraphicsWindow::LocalPointToSystemPoint(Point &qdLocalPoint) { if (_osx_window != NULL) { GrafPtr savePort; diff --git a/panda/src/vision/arToolKit.I b/panda/src/vision/arToolKit.I index 9b421ed7aa..e9d3a1ea1e 100644 --- a/panda/src/vision/arToolKit.I +++ b/panda/src/vision/arToolKit.I @@ -14,7 +14,7 @@ //////////////////////////////////////////////////////////////////// // Function: ARToolKit::set_threshold -// Access: private +// Access: Private // Description: As part of its analysis, the ARToolKit occasionally // converts images to black and white by thresholding // them. The threshold is set to 0.5 by default, but diff --git a/panda/src/vision/arToolKit.cxx b/panda/src/vision/arToolKit.cxx index ed886dd2ee..9bd40652b1 100644 --- a/panda/src/vision/arToolKit.cxx +++ b/panda/src/vision/arToolKit.cxx @@ -175,7 +175,7 @@ make(NodePath camera, const Filename ¶mfile, double marker_size) { //////////////////////////////////////////////////////////////////// // Function: ARToolKit::cleanup -// Access: private +// Access: Private // Description: Pre-destructor deallocation and cleanup. //////////////////////////////////////////////////////////////////// void ARToolKit:: diff --git a/panda/src/wgldisplay/wglGraphicsBuffer.I b/panda/src/wgldisplay/wglGraphicsBuffer.I index c03c4e87f8..9f97d81710 100644 --- a/panda/src/wgldisplay/wglGraphicsBuffer.I +++ b/panda/src/wgldisplay/wglGraphicsBuffer.I @@ -1,4 +1,4 @@ -// Filename: wglGraphicsWindow.I +// Filename: wglGraphicsBuffer.I // Created by: drose (08Feb04) // //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/daeegg/daeMaterials.cxx b/pandatool/src/daeegg/daeMaterials.cxx index 9d234489ab..0074e8caad 100644 --- a/pandatool/src/daeegg/daeMaterials.cxx +++ b/pandatool/src/daeegg/daeMaterials.cxx @@ -92,7 +92,7 @@ void DaeMaterials::add_material_instance(const FCDMaterialInstance* instance) { daeegg_cat.spam() << "Processing effect, material semantic is " << semantic << endl; // Set the material parameters egg_material->set_amb(TO_COLOR(effect_common->GetAmbientColor())); - ////We already process transparency using blend modes + // We already process transparency using blend modes //LVecBase4 diffuse = TO_COLOR(effect_common->GetDiffuseColor()); //diffuse.set_w(diffuse.get_w() * (1.0f - effect_common->GetOpacity())); //egg_material->set_diff(diffuse); diff --git a/pandatool/src/dxfegg/dxfToEggConverter.h b/pandatool/src/dxfegg/dxfToEggConverter.h index de9044c695..7bbdf7b5d6 100644 --- a/pandatool/src/dxfegg/dxfToEggConverter.h +++ b/pandatool/src/dxfegg/dxfToEggConverter.h @@ -1,4 +1,4 @@ -// Filename: DXFToEggConverter.h +// Filename: dxfToEggConverter.h // Created by: drose (04May04) // //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/fltprogs/eggToFlt.cxx b/pandatool/src/fltprogs/eggToFlt.cxx index d771f8d826..33cbbee7a2 100644 --- a/pandatool/src/fltprogs/eggToFlt.cxx +++ b/pandatool/src/fltprogs/eggToFlt.cxx @@ -40,7 +40,7 @@ //////////////////////////////////////////////////////////////////// // Function: EggToFlt::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// EggToFlt:: EggToFlt() : @@ -118,7 +118,7 @@ dispatch_attr(const string &opt, const string &arg, void *var) { << " requires either \"none\", \"new\", or \"all\".\n"; return false; } - + return true; } @@ -128,7 +128,7 @@ dispatch_attr(const string &opt, const string &arg, void *var) { // Description: //////////////////////////////////////////////////////////////////// void EggToFlt:: -traverse(EggNode *egg_node, FltBead *flt_node, +traverse(EggNode *egg_node, FltBead *flt_node, FltGeometry::BillboardType billboard) { if (egg_node->is_of_type(EggPolygon::get_class_type()) || egg_node->is_of_type(EggPoint::get_class_type())) { @@ -182,11 +182,11 @@ convert_primitive(EggPrimitive *egg_primitive, FltBead *flt_node, if (egg_primitive->is_of_type(EggPoint::get_class_type())) { // A series of points, instead of a polygon. flt_face->_draw_type = FltFace::DT_omni_light; - + } else if (egg_primitive->get_bface_flag()) { // A polygon whose backface is visible. flt_face->_draw_type = FltFace::DT_solid_no_cull; - + } else { // A normal polygon. flt_face->_draw_type = FltFace::DT_solid_cull_backface; @@ -241,17 +241,17 @@ convert_primitive(EggPrimitive *egg_primitive, FltBead *flt_node, // Function: EggToFlt::convert_group // Access: Private // Description: Converts an egg group to the corresponding flt group, -// and adds it to the indicated parent node. Also -// recurses on the children of the egg group. +// and adds it to the indicated parent node. Also +// recurses on the children of the egg group. //////////////////////////////////////////////////////////////////// void EggToFlt:: -convert_group(EggGroup *egg_group, FltBead *flt_node, +convert_group(EggGroup *egg_group, FltBead *flt_node, FltGeometry::BillboardType billboard) { ostringstream egg_syntax; FltGroup *flt_group = new FltGroup(_flt_header); flt_node->add_child(flt_group); - + flt_group->set_id(egg_group->get_name()); switch (egg_group->get_billboard_type()) { @@ -273,11 +273,11 @@ convert_group(EggGroup *egg_group, FltBead *flt_node, default: break; } - + if (egg_group->has_transform()) { apply_transform(egg_group, flt_group); } - + if (egg_group->get_switch_flag()) { if (egg_group->get_switch_fps() != 0.0) { // A sequence animation. @@ -301,7 +301,7 @@ convert_group(EggGroup *egg_group, FltBead *flt_node, egg_group->write_render_mode(egg_syntax, 2); apply_egg_syntax(egg_syntax.str(), flt_group); - + EggGroup::iterator ci; for (ci = egg_group->begin(); ci != egg_group->end(); ++ci) { traverse(*ci, flt_group, billboard); @@ -324,7 +324,7 @@ apply_transform(EggTransform *egg_transform, FltBead *flt_node) { switch (egg_transform->get_component_type(i)) { case EggTransform::CT_translate2d: { - FltTransformTranslate *translate = + FltTransformTranslate *translate = new FltTransformTranslate(_flt_header); LVector2d v2 = egg_transform->get_component_vec2(i); translate->set(LPoint3d::zero(), LVector3d(v2[0], v2[1], 0.0)); @@ -334,7 +334,7 @@ apply_transform(EggTransform *egg_transform, FltBead *flt_node) { case EggTransform::CT_translate3d: { - FltTransformTranslate *translate = + FltTransformTranslate *translate = new FltTransformTranslate(_flt_header); translate->set(LPoint3d::zero(), egg_transform->get_component_vec3(i)); flt_node->add_transform_step(translate); @@ -343,7 +343,7 @@ apply_transform(EggTransform *egg_transform, FltBead *flt_node) { case EggTransform::CT_rotate2d: { - FltTransformRotateAboutEdge *rotate = + FltTransformRotateAboutEdge *rotate = new FltTransformRotateAboutEdge(_flt_header); rotate->set(LPoint3d::zero(), LPoint3d(0.0, 0.0, 1.0), egg_transform->get_component_number(i)); @@ -353,7 +353,7 @@ apply_transform(EggTransform *egg_transform, FltBead *flt_node) { case EggTransform::CT_rotx: { - FltTransformRotateAboutEdge *rotate = + FltTransformRotateAboutEdge *rotate = new FltTransformRotateAboutEdge(_flt_header); rotate->set(LPoint3d::zero(), LPoint3d(1.0, 0.0, 0.0), egg_transform->get_component_number(i)); @@ -363,7 +363,7 @@ apply_transform(EggTransform *egg_transform, FltBead *flt_node) { case EggTransform::CT_roty: { - FltTransformRotateAboutEdge *rotate = + FltTransformRotateAboutEdge *rotate = new FltTransformRotateAboutEdge(_flt_header); rotate->set(LPoint3d::zero(), LPoint3d(0.0, 1.0, 0.0), egg_transform->get_component_number(i)); @@ -373,7 +373,7 @@ apply_transform(EggTransform *egg_transform, FltBead *flt_node) { case EggTransform::CT_rotz: { - FltTransformRotateAboutEdge *rotate = + FltTransformRotateAboutEdge *rotate = new FltTransformRotateAboutEdge(_flt_header); rotate->set(LPoint3d::zero(), LPoint3d(0.0, 0.0, 1.0), egg_transform->get_component_number(i)); @@ -383,7 +383,7 @@ apply_transform(EggTransform *egg_transform, FltBead *flt_node) { case EggTransform::CT_rotate3d: { - FltTransformRotateAboutEdge *rotate = + FltTransformRotateAboutEdge *rotate = new FltTransformRotateAboutEdge(_flt_header); rotate->set(LPoint3d::zero(), egg_transform->get_component_vec3(i), egg_transform->get_component_number(i)); @@ -419,7 +419,7 @@ apply_transform(EggTransform *egg_transform, FltBead *flt_node) { case EggTransform::CT_matrix3: { - FltTransformGeneralMatrix *matrix = + FltTransformGeneralMatrix *matrix = new FltTransformGeneralMatrix(_flt_header); const LMatrix3d &m = egg_transform->get_component_mat3(i); LMatrix4d mat4(m(0, 0), m(0, 1), 0.0, m(0, 2), @@ -433,7 +433,7 @@ apply_transform(EggTransform *egg_transform, FltBead *flt_node) { case EggTransform::CT_matrix4: { - FltTransformGeneralMatrix *matrix = + FltTransformGeneralMatrix *matrix = new FltTransformGeneralMatrix(_flt_header); matrix->set_matrix(egg_transform->get_component_mat4(i)); flt_node->add_transform_step(matrix); @@ -477,7 +477,7 @@ void EggToFlt:: apply_egg_syntax(const string &egg_syntax, FltRecord *flt_record) { if (!egg_syntax.empty()) { ostringstream out; - out << " {\n" + out << " {\n" << egg_syntax << "}"; flt_record->set_comment(out.str()); diff --git a/pandatool/src/maxegg/maxEgg.cxx b/pandatool/src/maxegg/maxEgg.cxx index 39ba6e6b20..22183b7925 100644 --- a/pandatool/src/maxegg/maxEgg.cxx +++ b/pandatool/src/maxegg/maxEgg.cxx @@ -1,10 +1,10 @@ /* - MaxEgg.cpp + MaxEgg.cpp Created by Steven "Sauce" Osman, 01/??/03 Modified by Ken Strickland, 02/25/03 Carnegie Mellon University, Entertainment Technology Center - This file implements the classes that are used in the Panda 3D file + This file implements the classes that are used in the Panda 3D file exporter for 3D Studio Max. */ @@ -265,7 +265,7 @@ const double meshVerts[252][3] = { {0.259722, -0.299638, 3.11175}, {0.0207683, 0.0, 3.20912} }; - + //Disable the forcing int to true or false performance warning #pragma warning(disable: 4800) @@ -303,26 +303,26 @@ IObjParam *MaxEggPlugin::iObjParams; dialog box that appears at the beginning of the conversion process. */ -INT_PTR CALLBACK MaxEggPluginOptionsDlgProc( HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam ) +INT_PTR CALLBACK MaxEggPluginOptionsDlgProc( HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam ) { MaxOptionsDialog *tempEgg; int sel, res; //We pass in our plugin through the lParam variable. Let's convert it back. - MaxEggPlugin *imp = (MaxEggPlugin*)GetWindowLongPtr(hWnd,GWLP_USERDATA); + MaxEggPlugin *imp = (MaxEggPlugin*)GetWindowLongPtr(hWnd,GWLP_USERDATA); if ( !imp && message != WM_INITDIALOG ) return FALSE; - switch(message) + switch(message) { // When we start, center the window. case WM_INITDIALOG: // this line is very necessary to pass the plugin as the lParam - SetWindowLongPtr(hWnd,GWLP_USERDATA,lParam); + SetWindowLongPtr(hWnd,GWLP_USERDATA,lParam); SetDlgFont( hWnd, imp->iObjParams->GetAppHFont() ); MaxEggPlugin::hMaxEggParams = hWnd; return TRUE; break; - + case WM_MOUSEACTIVATE: imp->iObjParams->RealizeParamPanel(); return TRUE; break; @@ -332,28 +332,28 @@ INT_PTR CALLBACK MaxEggPluginOptionsDlgProc( HWND hWnd, UINT message, case WM_MOUSEMOVE: imp->iObjParams->RollupMouseMessage(hWnd,message,wParam,lParam); return TRUE; break; - + // A control was modified case WM_COMMAND: //The modified control is found in the lower word of the wParam long. switch( LOWORD(wParam) ) { case IDC_OVERWRITE_CHECK: - imp->autoOverwrite = + imp->autoOverwrite = (IsDlgButtonChecked(hWnd, IDC_OVERWRITE_CHECK) == BST_CHECKED); return TRUE; break; case IDC_PVIEW_CHECK: - imp->pview = + imp->pview = (IsDlgButtonChecked(hWnd, IDC_PVIEW_CHECK) == BST_CHECKED); return TRUE; break; case IDC_LOGGING: - imp->logOutput = + imp->logOutput = (IsDlgButtonChecked(hWnd, IDC_LOGGING) == BST_CHECKED); return TRUE; break; case IDC_ADD_EGG: tempEgg = new MaxOptionsDialog(); tempEgg->SetMaxInterface(imp->iObjParams); tempEgg->SetAnimRange(); - res = DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_EGG_DETAILS), + res = DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_EGG_DETAILS), hWnd, MaxOptionsDialogProc, (LPARAM)tempEgg); if (res == TRUE) { imp->SaveCheckState(); @@ -369,7 +369,7 @@ INT_PTR CALLBACK MaxEggPluginOptionsDlgProc( HWND hWnd, UINT message, if (tempEgg) { tempEgg->SetAnimRange(); tempEgg->CullBadNodes(); - DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_EGG_DETAILS), + DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_EGG_DETAILS), hWnd, MaxOptionsDialogProc, (LPARAM)tempEgg); } imp->SaveCheckState(); @@ -413,7 +413,7 @@ void MaxEggPlugin::AddEgg(MaxOptionsDialog *newEgg) { delete [] eggList; eggList = newList; } - + eggList[numEggs++] = newEgg; } @@ -431,18 +431,18 @@ void MaxEggPlugin::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev for (int i=0; iSetMaxInterface(ip); } - + if ( !hMaxEggParams ) { - hMaxEggParams = ip->AddRollupPage(hInstance, + hMaxEggParams = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_PANEL), - MaxEggPluginOptionsDlgProc, - GetString(IDS_PARAMS), + MaxEggPluginOptionsDlgProc, + GetString(IDS_PARAMS), (LPARAM)this ); ip->RegisterDlgWnd(hMaxEggParams); } else { SetWindowLongPtr( hMaxEggParams, GWLP_USERDATA, (LPARAM)this ); } - + UpdateUI(); } @@ -471,7 +471,7 @@ void MaxEggPlugin::UpdateUI() { if (ListView_GetColumnWidth(lv, 1) <= 0 || ListView_GetColumnWidth(lv, 1) > 10000) { // Columns have not been setup, so initialize the control - ListView_SetExtendedListViewStyleEx(lv, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT, + ListView_SetExtendedListViewStyleEx(lv, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); pCol.fmt = LVCFMT_LEFT; @@ -509,11 +509,11 @@ void MaxEggPlugin::UpdateUI() { } // Set the "Overwrite Existing Files" and "Pview" checkboxes - CheckDlgButton(hMaxEggParams, IDC_OVERWRITE_CHECK, + CheckDlgButton(hMaxEggParams, IDC_OVERWRITE_CHECK, autoOverwrite ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hMaxEggParams, IDC_PVIEW_CHECK, + CheckDlgButton(hMaxEggParams, IDC_PVIEW_CHECK, pview ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hMaxEggParams, IDC_LOGGING, + CheckDlgButton(hMaxEggParams, IDC_LOGGING, logOutput ? BST_CHECKED : BST_UNCHECKED); } @@ -602,32 +602,32 @@ void MaxEggPlugin::BuildMesh() mesh.setSmoothFlags(0); mesh.setNumTVerts (0); mesh.setNumTVFaces (0); - - for (i=0; i<252; i++) + + for (i=0; i<252; i++) mesh.setVert(i, meshVerts[i][0]*10, meshVerts[i][1]*10, meshVerts[i][2]*10); for (i=0; i<84; i++) { mesh.faces[i].setEdgeVisFlags(1, 1, 0); mesh.faces[i].setSmGroup(0); mesh.faces[i].setVerts(i*3, i*3+1, i*3+2); } - + mesh.InvalidateGeomCache(); mesh.BuildStripsAndEdges(); - + meshBuilt = TRUE; } -/////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // The creation callback - sets the initial position of the helper in the scene. -/////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// -class MaxEggPluginCreateMouseCallBack: public CreateMouseCallBack +class MaxEggPluginCreateMouseCallBack: public CreateMouseCallBack { public: int proc( ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat ); }; -int MaxEggPluginCreateMouseCallBack::proc(ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat ) +int MaxEggPluginCreateMouseCallBack::proc(ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat ) { if (msg==MOUSE_POINT||msg==MOUSE_MOVE) { switch(point) { @@ -640,21 +640,21 @@ int MaxEggPluginCreateMouseCallBack::proc(ViewExp *vpt,int msg, int point, int f break; } } else if (msg == MOUSE_ABORT) { - return CREATE_ABORT; + return CREATE_ABORT; } return CREATE_CONTINUE; } static MaxEggPluginCreateMouseCallBack MaxEggCreateMouseCB; -CreateMouseCallBack* MaxEggPlugin::GetCreateMouseCallBack() +CreateMouseCallBack* MaxEggPlugin::GetCreateMouseCallBack() { return &MaxEggCreateMouseCB; } -/////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// //Boilerplate functions for dealing with the display of the plugin -/////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// -void MaxEggPlugin::GetMat(TimeValue t, INode* inode, ViewExp* vpt, Matrix3& tm) +void MaxEggPlugin::GetMat(TimeValue t, INode* inode, ViewExp* vpt, Matrix3& tm) { tm = inode->GetObjectTM(t); tm.NoScale(); @@ -667,7 +667,7 @@ void MaxEggPlugin::GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSe box = mesh.getBoundingBox(tm); } -void MaxEggPlugin::GetLocalBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box ) +void MaxEggPlugin::GetLocalBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box ) { Matrix3 m = inode->GetObjectTM(t); Point3 pt; @@ -683,11 +683,11 @@ void MaxEggPlugin::GetWorldBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box GetMat(t,inode,vpt,tm); nv = mesh.getNumVerts(); box.Init(); - for (i=0; isetTransform(m); gw->clearHitCode(); - if (mesh.select( gw, mtl, &hitRegion, flags & HIT_ABORTONHIT )) + if (mesh.select( gw, mtl, &hitRegion, flags & HIT_ABORTONHIT )) return TRUE; return FALSE; } -int MaxEggPlugin::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) +int MaxEggPlugin::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) { Matrix3 m; GraphicsWindow *gw = vpt->getGW(); Material *mtl = gw->getMaterial(); - + GetMat(t,inode,vpt,m); gw->setTransform(m); DWORD rlim = gw->getRndLimits(); gw->setRndLimits(GW_WIREFRAME|GW_BACKCULL); - if (inode->Selected()) + if (inode->Selected()) gw->setColor( LINE_COLOR, GetSelColor()); else if(!inode->IsFrozen()) gw->setColor( LINE_COLOR, GetUIColor(COLOR_TAPE_OBJ)); @@ -722,7 +722,7 @@ int MaxEggPlugin::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) return 0; } -RefResult MaxEggPlugin::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message ) +RefResult MaxEggPlugin::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message ) { UpdateUI(); return REF_SUCCEED; @@ -733,22 +733,22 @@ ObjectState MaxEggPlugin::Eval(TimeValue time) return ObjectState(this); } -Interval MaxEggPlugin::ObjectValidity(TimeValue t) +Interval MaxEggPlugin::ObjectValidity(TimeValue t) { Interval ivalid; ivalid.SetInfinite(); return ivalid; } -RefTargetHandle MaxEggPlugin::Clone(RemapDir& remap) +RefTargetHandle MaxEggPlugin::Clone(RemapDir& remap) { MaxEggPlugin* newob = new MaxEggPlugin(); return(newob); } -/////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Loading and saving the plugin -/////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// IOResult MaxEggPlugin::Save(ISave *isave) { SaveCheckState(); @@ -757,14 +757,14 @@ IOResult MaxEggPlugin::Save(ISave *isave) { ChunkSave(isave, CHUNK_OVERWRITE_FLAG, autoOverwrite); ChunkSave(isave, CHUNK_PVIEW_FLAG, pview); ChunkSave(isave, CHUNK_LOG_OUTPUT, logOutput); - + return IO_OK; } IOResult MaxEggPlugin::Load(ILoad *iload) { IOResult res = iload->OpenChunk(); MaxOptionsDialog *temp; - + while (res == IO_OK) { switch(iload->CurChunkID()) { case CHUNK_OVERWRITE_FLAG: autoOverwrite = ChunkLoadBool(iload); break; @@ -780,7 +780,7 @@ IOResult MaxEggPlugin::Load(ILoad *iload) { iload->CloseChunk(); res = iload->OpenChunk(); } - + return IO_OK; } @@ -795,7 +795,7 @@ extern ClassDesc* GetMaxEggPluginDesc(); HINSTANCE hInstance; int controlsInit = FALSE; -// This function is called by Windows when the DLL is loaded. This +// This function is called by Windows when the DLL is loaded. This // function may also be called many times during time critical operations // like rendering. Therefore developers need to be careful what they // do inside this function. In the code below, note how after the DLL is @@ -843,7 +843,7 @@ __declspec( dllexport ) ClassDesc* LibClassDesc(int i) } } -// This function returns a pre-defined constant indicating the version of +// This function returns a pre-defined constant indicating the version of // the system under which it was compiled. It is used to allow the system // to catch obsolete DLLs. __declspec( dllexport ) ULONG LibVersion() diff --git a/pandatool/src/maxegg/maxEggLoader.cxx b/pandatool/src/maxegg/maxEggLoader.cxx index 5129045100..bb5fd067e1 100644 --- a/pandatool/src/maxegg/maxEggLoader.cxx +++ b/pandatool/src/maxegg/maxEggLoader.cxx @@ -1,4 +1,4 @@ -// Filename: maxEggImport.cxx +// Filename: maxEggLoader.cxx // Created by: jyelon (15Jul05) // //////////////////////////////////////////////////////////////////// @@ -55,7 +55,7 @@ class MaxEggLoader public: bool ConvertEggData(EggData *data, bool merge, bool model, bool anim); bool ConvertEggFile(const char *name, bool merge, bool model, bool anim); - + public: void TraverseEggNode(EggNode *node, EggGroup *context); MaxEggMesh *GetMesh(EggVertexPool *pool); @@ -82,11 +82,11 @@ Point3 MakeMaxPoint(LVector3d vec) return Point3(vec[0], vec[1], vec[2]); } -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // MaxEggTex // -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class MaxEggTex { @@ -126,11 +126,11 @@ MaxEggTex *MaxEggLoader::GetTex(const Filename &fn) return res; } -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // MaxEggJoint // -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class MaxEggJoint { @@ -306,11 +306,11 @@ void MaxEggJoint::CreateMaxBone(void) } } -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // MaxEggMesh // -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// typedef pair MaxEggWeight; @@ -359,7 +359,7 @@ typedef phash_map CVertTable; class MaxEggMesh { public: - + string _name; TriObject *_obj; Mesh *_mesh; @@ -372,11 +372,11 @@ public: int _tvert_count; int _cvert_count; int _face_count; - + VertTable _vert_tab; TVertTable _tvert_tab; CVertTable _cvert_tab; - + int GetVert(EggVertex *vert, EggGroup *context); int GetTVert(const LTexCoordd &uv); int GetCVert(const LColor &col); @@ -403,11 +403,11 @@ int MaxEggMesh::GetVert(EggVertex *vert, EggGroup *context) if (context != 0) vtx._weights.push_back(MaxEggWeight(1.0, context)); } - + VertTable::const_iterator vti = _vert_tab.find(vtx); if (vti != _vert_tab.end()) return vti->_index; - + if (_vert_count == _mesh->numVerts) { int nsize = _vert_count*2 + 100; _mesh->setNumVerts(nsize, _vert_count?TRUE:FALSE); @@ -500,7 +500,7 @@ EggGroup *MaxEggMesh::GetControlJoint(void) VertTable::const_iterator vert = _vert_tab.begin(); if (vert == _vert_tab.end()) return 0; switch (vert->_weights.size()) { - case 0: + case 0: for (++vert; vert != _vert_tab.end(); ++vert) if (vert->_weights.size() != 0) return CTRLJOINT_DEFORM; @@ -566,14 +566,14 @@ void MaxEggLoader::CreateSkinModifier(MaxEggMesh *M) } } -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // TraverseEggData // // We have an EggData in memory, and now we're going to copy that // over into the max scene graph. // -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// void MaxEggLoader::TraverseEggNode(EggNode *node, EggGroup *context) { @@ -721,11 +721,11 @@ bool MaxEggLoader::ConvertEggFile(const char *name, bool merge, bool model, bool return ConvertEggData(&data, merge, model, anim); } -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // The two global functions that form the API of this module. // -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// bool MaxLoadEggData(EggData *data, bool merge, bool model, bool anim) { diff --git a/pandatool/src/maxprogs/maxEggImport.cxx b/pandatool/src/maxprogs/maxEggImport.cxx index f72092300f..e9bb2559ac 100644 --- a/pandatool/src/maxprogs/maxEggImport.cxx +++ b/pandatool/src/maxprogs/maxEggImport.cxx @@ -37,21 +37,21 @@ #include #include -class MaxEggImporter : public SceneImport +class MaxEggImporter : public SceneImport { public: // GUI-related methods MaxEggImporter(); ~MaxEggImporter(); - int ExtCount(); // Number of extensions supported + int ExtCount(); // Number of extensions supported const TCHAR * Ext(int n); // Extension #n (i.e. "EGG") - const TCHAR * LongDesc(); // Long ASCII description (i.e. "Egg Importer") + const TCHAR * LongDesc(); // Long ASCII description (i.e. "Egg Importer") const TCHAR * ShortDesc(); // Short ASCII description (i.e. "Egg") const TCHAR * AuthorName(); // ASCII Author name - const TCHAR * CopyrightMessage();// ASCII Copyright message + const TCHAR * CopyrightMessage();// ASCII Copyright message const TCHAR * OtherMessage1(); // Other message #1 const TCHAR * OtherMessage2(); // Other message #2 - unsigned int Version(); // Version number * 100 (i.e. v3.01 = 301) + unsigned int Version(); // Version number * 100 (i.e. v3.01 = 301) void ShowAbout(HWND hWnd); // Show DLL's "About..." box int DoImport(const TCHAR *name,ImpInterface *ei,Interface *i, BOOL suppressPrompts); @@ -99,22 +99,22 @@ const TCHAR * MaxEggImporter::ShortDesc() return _T("Panda3D Egg"); } -const TCHAR * MaxEggImporter::AuthorName() +const TCHAR * MaxEggImporter::AuthorName() { return _T("Joshua Yelon"); } -const TCHAR * MaxEggImporter::CopyrightMessage() +const TCHAR * MaxEggImporter::CopyrightMessage() { return _T("Copyight (c) 2005 Josh Yelon"); } -const TCHAR * MaxEggImporter::OtherMessage1() +const TCHAR * MaxEggImporter::OtherMessage1() { return _T(""); } -const TCHAR * MaxEggImporter::OtherMessage2() +const TCHAR * MaxEggImporter::OtherMessage2() { return _T(""); } @@ -128,7 +128,7 @@ static INT_PTR CALLBACK AboutBoxDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR { switch (msg) { case WM_INITDIALOG: - CenterWindow(hWnd, GetParent(hWnd)); + CenterWindow(hWnd, GetParent(hWnd)); break; case WM_COMMAND: switch (LOWORD(wParam)) { @@ -141,7 +141,7 @@ static INT_PTR CALLBACK AboutBoxDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR return FALSE; } return TRUE; -} +} void MaxEggImporter::ShowAbout(HWND hWnd) { @@ -152,12 +152,12 @@ void MaxEggImporter::ShowAbout(HWND hWnd) static INT_PTR CALLBACK ImportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - MaxEggImporter *imp = (MaxEggImporter*) GetWindowLongPtr(hWnd, GWLP_USERDATA); + MaxEggImporter *imp = (MaxEggImporter*) GetWindowLongPtr(hWnd, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: imp = (MaxEggImporter*)lParam; SetWindowLongPtr(hWnd, GWLP_USERDATA, lParam); - CenterWindow(hWnd, GetParent(hWnd)); + CenterWindow(hWnd, GetParent(hWnd)); CheckDlgButton(hWnd, IDC_MERGE, imp->_merge); CheckDlgButton(hWnd, IDC_IMPORTMODEL, imp->_importmodel); CheckDlgButton(hWnd, IDC_IMPORTANIM, imp->_importanim); @@ -165,9 +165,9 @@ static INT_PTR CALLBACK ImportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: - imp->_merge = IsDlgButtonChecked(hWnd, IDC_MERGE); - imp->_importmodel = IsDlgButtonChecked(hWnd, IDC_IMPORTMODEL); - imp->_importanim = IsDlgButtonChecked(hWnd, IDC_IMPORTANIM); + imp->_merge = IsDlgButtonChecked(hWnd, IDC_MERGE); + imp->_importmodel = IsDlgButtonChecked(hWnd, IDC_IMPORTMODEL); + imp->_importanim = IsDlgButtonChecked(hWnd, IDC_IMPORTANIM); EndDialog(hWnd, 1); break; case IDCANCEL: @@ -179,7 +179,7 @@ static INT_PTR CALLBACK ImportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM return FALSE; } return TRUE; -} +} int MaxEggImporter::DoImport(const TCHAR *name,ImpInterface *ii,Interface *i, BOOL suppressPrompts) { // Prompt the user with our dialogbox. @@ -201,7 +201,7 @@ int MaxEggImporter::DoImport(const TCHAR *name,ImpInterface *ii,Interface *i, BO return 1; } -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // Plugin Initialization // @@ -209,14 +209,14 @@ int MaxEggImporter::DoImport(const TCHAR *name,ImpInterface *ii,Interface *i, BO // of the classes defined in this DLL, and provides a means for // Max to create instances of those classes. // -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// HINSTANCE hInstance; BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { static int controlsInit = FALSE; hInstance = hinstDLL; - + if (!controlsInit) { controlsInit = TRUE; // It appears that InitCustomControls is deprecated in 2012. @@ -227,7 +227,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { #endif InitCommonControls(); } - + return (TRUE); } @@ -237,26 +237,26 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { class MaxEggImporterClassDesc: public ClassDesc { public: int IsPublic() {return 1;} - void *Create(BOOL loading = FALSE) {return new MaxEggImporter;} + void *Create(BOOL loading = FALSE) {return new MaxEggImporter;} const TCHAR *ClassName() {return _T("MaxEggImporter");} - SClass_ID SuperClassID() {return SCENE_IMPORT_CLASS_ID;} + SClass_ID SuperClassID() {return SCENE_IMPORT_CLASS_ID;} Class_ID ClassID() {return Class_ID(PANDAEGGIMP_CLASS_ID1,PANDAEGGIMP_CLASS_ID2);} const TCHAR *Category() {return _T("Chrutilities");} }; static MaxEggImporterClassDesc MaxEggImporterDesc; -__declspec( dllexport ) const TCHAR* LibDescription() +__declspec( dllexport ) const TCHAR* LibDescription() { return _T("Panda3D Egg Importer"); } -__declspec( dllexport ) int LibNumberClasses() +__declspec( dllexport ) int LibNumberClasses() { return 1; } -__declspec( dllexport ) ClassDesc* LibClassDesc(int i) +__declspec( dllexport ) ClassDesc* LibClassDesc(int i) { switch(i) { case 0: return &MaxEggImporterDesc; @@ -264,7 +264,7 @@ __declspec( dllexport ) ClassDesc* LibClassDesc(int i) } } -__declspec( dllexport ) ULONG LibVersion() +__declspec( dllexport ) ULONG LibVersion() { return VERSION_3DSMAX; } diff --git a/pandatool/src/maxprogs/maxImportRes.rc b/pandatool/src/maxprogs/maxImportRes.rc index e76861e36a..a8041e52d7 100644 --- a/pandatool/src/maxprogs/maxImportRes.rc +++ b/pandatool/src/maxprogs/maxImportRes.rc @@ -3,16 +3,16 @@ #include "maxImportRes.h" #define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" -///////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // English (U.S.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) @@ -21,13 +21,13 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) #endif //_WIN32 -///////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // DESIGNINFO // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO +GUIDELINES DESIGNINFO BEGIN IDD_ABOUTBOX, DIALOG BEGIN @@ -49,23 +49,23 @@ END #ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "maxImportRes.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" "\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "\r\n" "\0" @@ -74,7 +74,7 @@ END #endif // APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // Dialog // @@ -99,24 +99,24 @@ BEGIN CONTROL "Merge with Current Scene",IDC_MERGE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,15,20,106,10 GROUPBOX "Input Options",IDC_STATIC,5,7,126,64 - CONTROL "Import Model",IDC_IMPORTMODEL,"Button",BS_AUTOCHECKBOX | + CONTROL "Import Model",IDC_IMPORTMODEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,41,73,10 CONTROL "Import Animation",IDC_IMPORTANIM,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,15,54,73,10 END #endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // -///////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED diff --git a/pandatool/src/mayaegg/mayaEggLoader.cxx b/pandatool/src/mayaegg/mayaEggLoader.cxx index 89ef439417..9c4d091461 100644 --- a/pandatool/src/mayaegg/mayaEggLoader.cxx +++ b/pandatool/src/mayaegg/mayaEggLoader.cxx @@ -1,4 +1,4 @@ -// Filename: mayaEggImport.cxx +// Filename: mayaEggLoader.cxx // Created by: jyelon (20Jul05) // //////////////////////////////////////////////////////////////////// @@ -91,8 +91,8 @@ class MayaEggLoader public: bool ConvertEggData(EggData *data, bool merge, bool model, bool anim, bool respect_normals); bool ConvertEggFile(const char *name, bool merge, bool model, bool anim, bool respect_normals); - - + + public: void TraverseEggNode(EggNode *node, EggGroup *context, string delim); MayaEggMesh *GetMesh(EggVertexPool *pool, EggGroup *parent); @@ -157,9 +157,9 @@ MColor MakeMayaColor(const LColor &vec) return MColor(vec[0], vec[1], vec[2], vec[3]); } -// [gjeon] to create enum attribute, +// [gjeon] to create enum attribute, // fieldNames is a stringArray of enum names, and filedIndex is the default index value -MStatus create_enum_attribute(MObject &node, MString fullName, MString briefName, +MStatus create_enum_attribute(MObject &node, MString fullName, MString briefName, MStringArray fieldNames, unsigned fieldIndex) { MStatus stat; @@ -171,7 +171,7 @@ MStatus create_enum_attribute(MObject &node, MString fullName, MString briefName } MFnEnumAttribute fnAttr; - MObject newAttr = fnAttr.create( fullName, briefName, + MObject newAttr = fnAttr.create( fullName, briefName, 0, &stat ); if ( MS::kSuccess != stat ) { mayaloader_cat.error() @@ -189,10 +189,10 @@ MStatus create_enum_attribute(MObject &node, MString fullName, MString briefName return stat; } - fnAttr.setKeyable( true ); - fnAttr.setReadable( true ); - fnAttr.setWritable( true ); - fnAttr.setStorable( true ); + fnAttr.setKeyable( true ); + fnAttr.setReadable( true ); + fnAttr.setWritable( true ); + fnAttr.setStorable( true ); // Now add the new attribute to this dependency node stat = fnDN.addAttribute(newAttr, MFnDependencyNode::kLocalDynamicAttr); @@ -205,11 +205,11 @@ MStatus create_enum_attribute(MObject &node, MString fullName, MString briefName return stat; } -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // MayaEggTex // -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class MayaEggTex { @@ -219,7 +219,7 @@ public: MObject _file_texture; MObject _shader; MObject _shading_group; - + MFnSingleIndexedComponent _component; void AssignNames(void); }; @@ -301,8 +301,8 @@ MayaEggTex *MayaEggLoader::GetTex(EggTexture* etex) // [gjeon] to create alpha channel connection LoaderOptions options; PT(Texture) tex = TexturePool::load_texture(etex->get_fullpath(), 0, false, options); - if (((tex != NULL) && (tex->get_num_components() == 4)) - || (etex->get_format() == EggTexture::F_alpha) + if (((tex != NULL) && (tex->get_num_components() == 4)) + || (etex->get_format() == EggTexture::F_alpha) || (etex->get_format() == EggTexture::F_luminance_alpha)) dgmod.connect(filetex.findPlug("outTransparency"),shader.findPlug("transparency")); } @@ -318,16 +318,16 @@ MayaEggTex *MayaEggLoader::GetTex(EggTexture* etex) res->_file_texture = filetex.object(); res->_shader = shader.object(); res->_shading_group = sgroup.object(); - + _tex_tab[fn] = res; return res; } -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // MayaEggGroup // -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class MayaEggGroup { @@ -387,7 +387,7 @@ MayaEggGroup *MayaEggLoader::MakeGroup(EggGroup *group, EggGroup *context) MStringArray eggFlags; for (int i = 0; i < context->get_num_object_types(); i++) { eggFlags.append(MString(context->get_object_type(i).c_str())); - } + } for (unsigned i = 0; i < eggFlags.length(); i++) { MString attrName = "eggObjectTypes"; @@ -412,11 +412,11 @@ MayaEggGroup *MayaEggLoader::FindGroup(EggGroup *group) return _group_tab[group]; } -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // MayaEggJoint // -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class MayaEggJoint { @@ -626,17 +626,17 @@ void MayaEggJoint::CreateMayaBone(MayaEggGroup *eggParent) } } ikj.set(mtm); - + _joint = ikj.object(); ikj.getPath(_joint_dag_path); } -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // MayaEggGeom : base abstract class of MayaEggMesh and MayaEggNurbsSurface // -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// typedef pair MayaEggWeight; @@ -647,7 +647,7 @@ struct MayaEggVertex LTexCoordd _uv; vector _weights; double _sumWeights; // [gjeon] to be used in normalizing weights - int _index; + int _index; int _external_index; // masad: use egg's index directly }; @@ -722,16 +722,16 @@ typedef phash_set VertTable; class MayaEggGeom { public: - + EggVertexPool *_pool; MObject _transNode; MObject _shapeNode; EggGroup *_parent; MDagPath _shape_dag_path; - int _vert_count; + int _vert_count; string _name; - + MFloatPointArray _vertexArray; MVectorArray _normalArray; MColorArray _vertColorArray; @@ -740,7 +740,7 @@ public: MStringArray _eggObjectTypes; VertTable _vert_tab; - + bool _renameTrans; int GetVert(EggVertex *vert, EggGroup *context); @@ -784,7 +784,7 @@ int MayaEggGeom::GetVert(EggVertex *vert, EggGroup *context) vtx._weights.push_back(MayaEggWeight(membership, egg_joint)); vtx._sumWeights += membership; // [gjeon] to be used in normalizing weights } - + if (vtx._weights.size()==0) { if (context != 0) { vtx._weights.push_back(MayaEggWeight(1.0, context)); @@ -807,7 +807,7 @@ int MayaEggGeom::GetVert(EggVertex *vert, EggGroup *context) if (vti != _vert_tab.end()) { /* if ((remaining_weight) > 0.01) { mayaloader_cat.warning() << "weight munged to 1.0 by " << remaining_weight << " on: " << context->get_name() << " idx:" << vti->_index << endl; - } */ + } */ if (mayaloader_cat.is_spam()) { ostringstream stream; stream << "(" << vti->_pos << " " << vti->_normal << " " << vti->_uv << ")\n"; @@ -824,13 +824,13 @@ int MayaEggGeom::GetVert(EggVertex *vert, EggGroup *context) } return vti->_index; } - + //_vert_count++; vtx._index = _vert_count++; /* if ((remaining_weight) > 0.01) { mayaloader_cat.warning() << "weight munged to 1.0 by " << remaining_weight << " on: " << context->get_name() << " idx:" << vtx._index << endl; - } */ + } */ _vertexArray.append(MakeMayaPoint(vtx._pos)); if (vert->has_normal()) { @@ -870,7 +870,7 @@ void MayaEggGeom::AssignNames(void) string shape_name = string(dntrans.name().asChar()); string numbers ("0123456789"); size_t found; - + found=shape_name.find_last_not_of(numbers); if (found!=string::npos) shape_name.insert(found+1, "Shape"); @@ -891,7 +891,7 @@ EggGroup *MayaEggGeom::GetControlJoint(void) return 0; } switch (vert->_weights.size()) { - case 0: + case 0: for (++vert; vert != _vert_tab.end(); ++vert) { if (vert->_weights.size() != 0) { return CTRLJOINT_DEFORM; @@ -924,11 +924,11 @@ void MayaEggGeom::AddEggFlag(MString fieldName) { } } -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // MayaEggMesh // -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// typedef phash_map TVertTable; typedef phash_map CVertTable; @@ -948,10 +948,10 @@ public: int _cvert_count; int _face_count; vector _face_tex; - + TVertTable _tvert_tab; CVertTable _cvert_tab; - + int GetTVert(const LTexCoordd &uv); int GetCVert(const LColor &col); int AddFace(unsigned numVertices, MIntArray mvertIndices, MIntArray mtvertIndices, MayaEggTex *tex); @@ -1060,11 +1060,11 @@ void MayaEggMesh::ConnectTextures(void) } -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // MayaEggNurbsSurface // -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class MayaEggNurbsSurface : public MayaEggGeom { public: @@ -1149,7 +1149,7 @@ void MayaEggNurbsSurface::PrintData(void) { if (mayaloader_cat.is_debug()) { mayaloader_cat.debug() << "nurbsSurface : " << _name << endl; - + mayaloader_cat.debug() << "u_form : " << _uForm << endl; mayaloader_cat.debug() << "v_form : " << _vForm << endl; } @@ -1160,7 +1160,7 @@ void MayaEggNurbsSurface::PrintData(void) MPoint cv =_cvArray[i]; mayaloader_cat.debug() << cv[0] << " " << cv[1] << " " << cv[2] << endl; } - + for (unsigned i = 0; i < _uKnotArray.length(); i++) { mayaloader_cat.debug() << _uKnotArray[i] << endl; @@ -1173,11 +1173,11 @@ void MayaEggNurbsSurface::PrintData(void) */ } -/////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // -// MayaAnim: +// MayaAnim: // -/////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class MayaAnim { public: @@ -1211,11 +1211,11 @@ void MayaAnim::PrintData(void) _pool->write(mayaloader_cat.debug(), 0); } -/////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // MayaEggLoader functions // -/////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// void MayaEggLoader::CreateSkinCluster(MayaEggGeom *M) { @@ -1259,11 +1259,11 @@ void MayaEggLoader::CreateSkinCluster(MayaEggGeom *M) cmd = cmd + " "; cmd = cmd + joint.name(); } - + MFnDependencyNode shape(M->_shapeNode); cmd = cmd + " "; cmd = cmd + shape.name(); - + MStatus status; MDGModifier dgmod; if (mayaloader_cat.is_spam()) { @@ -1276,16 +1276,16 @@ void MayaEggLoader::CreateSkinCluster(MayaEggGeom *M) mayaloader_cat.spam() << spamCmd << ": total = " << joints.size() << endl; } status = dgmod.commandToExecute(cmd); - if (status != MStatus::kSuccess) { + if (status != MStatus::kSuccess) { perror("skinCluster commandToExecute"); - return; + return; } status = dgmod.doIt(); if (status != MStatus::kSuccess) { perror("skinCluster doIt"); - return; + return; } - + MPlugArray oldplugs; MPlug inPlug; if (shape.typeName() == "mesh") { @@ -1293,7 +1293,7 @@ void MayaEggLoader::CreateSkinCluster(MayaEggGeom *M) } else if (shape.typeName() == "nurbsSurface") { inPlug = shape.findPlug("create"); } else { - // we only support mesh and nurbsSurface + // we only support mesh and nurbsSurface return; } @@ -1305,11 +1305,11 @@ void MayaEggLoader::CreateSkinCluster(MayaEggGeom *M) MIntArray influenceIndices; MFnSingleIndexedComponent component; component.create(MFn::kMeshVertComponent); // [gjeon] Interestingly, we can use MFn::kMeshVertComponent for NURBS surface, too - component.setCompleteData(M->_vert_count); + component.setCompleteData(M->_vert_count); for (unsigned int i=0; i_joint_dag_path, &status); if (status != MStatus::kSuccess) { - perror("skinCluster index"); + perror("skinCluster index"); return; } influenceIndices.append((int)index); @@ -1356,21 +1356,21 @@ void MayaEggLoader::CreateSkinCluster(MayaEggGeom *M) } } -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // TraverseEggData // // We have an EggData in memory, and now we're going to copy that // over into the maya scene graph. // -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// void MayaEggLoader::TraverseEggNode(EggNode *node, EggGroup *context, string delim) { vector vertIndices; vector tvertIndices; vector cvertIndices; - + string delstring = " "; if (node->is_of_type(EggPolygon::get_class_type())) { @@ -1387,7 +1387,7 @@ void MayaEggLoader::TraverseEggNode(EggNode *node, EggGroup *context, string del MayaEggTex *tex = 0; LMatrix3d uvtrans = LMatrix3d::ident_mat(); - + if (poly->has_texture()) { EggTexture *etex = poly->get_texture(0); if (mayaloader_cat.is_spam()) { @@ -1399,7 +1399,7 @@ void MayaEggLoader::TraverseEggNode(EggNode *node, EggGroup *context, string del } else { tex = GetTex(NULL); } - + EggPolygon::const_iterator ci; MayaEggMesh *mesh = GetMesh(poly->get_pool(), context); if (mayaloader_cat.is_spam()) { @@ -1442,7 +1442,7 @@ void MayaEggLoader::TraverseEggNode(EggNode *node, EggGroup *context, string del mesh->_faceColorArray.append(MakeMayaColor(poly->get_color())); } mesh->AddFace(numVertices, mvertIndices, mtvertIndices, tex); - + // [gjeon] to handle double-sided flag if (poly->get_bface_flag()) { mesh->AddEggFlag("double-sided"); @@ -1462,7 +1462,7 @@ void MayaEggLoader::TraverseEggNode(EggNode *node, EggGroup *context, string del case EggGroup::BT_point_camera_relative: mesh->AddEggFlag("billboard-point"); break; - + default: ; } @@ -1488,7 +1488,7 @@ void MayaEggLoader::TraverseEggNode(EggNode *node, EggGroup *context, string del // [gjeon] finding textures MayaEggTex *tex = 0; LMatrix3d uvtrans = LMatrix3d::ident_mat(); - + if (eggNurbsSurface->has_texture()) { EggTexture *etex = eggNurbsSurface->get_texture(0); tex = GetTex(etex); @@ -1512,7 +1512,7 @@ void MayaEggLoader::TraverseEggNode(EggNode *node, EggGroup *context, string del surface->_cvArray.append(MakeMPoint(vtx->get_pos3())); } } - + // [gjeon] building u knotArray for (int i = 1; i < eggNurbsSurface->get_num_u_knots()-1; i++) { surface->_uKnotArray.append(eggNurbsSurface->get_u_knot(i)); @@ -1619,12 +1619,12 @@ void MayaEggLoader::TraverseEggNode(EggNode *node, EggGroup *context, string del mayaloader_cat.debug() << delim+delstring << "found an EggXfmSAnim: " << node->get_name() << endl; } } - + EggGroupNode::const_iterator ci; for (ci = group->begin(); ci != group->end(); ++ci) { TraverseEggNode(*ci, context, delim+delstring); } - } + } } bool MayaEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool anim, bool respect_normals) @@ -1634,7 +1634,7 @@ bool MayaEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool a return false; } - /* + /* if ((anim) || (!model)) { mayaloader_cat.error() << "Currently, only model-loading is implemented.\n"; return false; @@ -1652,7 +1652,7 @@ bool MayaEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool a TexTable::const_iterator ti; SurfaceTable::const_iterator si; AnimTable::const_iterator ei; - + if (MGlobal::isYAxisUp()) { data->set_coordinate_system(CS_yup_right); } else { @@ -1663,7 +1663,7 @@ bool MayaEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool a mayaloader_cat.debug() << "root node: " << data->get_type() << endl; } TraverseEggNode(data, NULL, ""); - + MStatus status; MFnSet collision_set; @@ -1681,7 +1681,7 @@ bool MayaEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool a // MStatus status; MFnMesh mfn; MString cset; - + MayaEggGroup *parentNode = FindGroup(mesh->_parent); MObject parent = MObject::kNullObj; if (parentNode) { @@ -1755,7 +1755,7 @@ bool MayaEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool a } } - // lets try to set normals per vertex + // lets try to set normals per vertex if (respect_normals) { status = mfn.setVertexNormals(mesh->_normalArray, mesh->_vertNormalIndices, MSpace::kTransform); if (status != MStatus::kSuccess) { @@ -1766,7 +1766,7 @@ bool MayaEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool a if (mayaloader_cat.is_spam()) { mayaloader_cat.spam() << "vertex normals set." << endl; } - + // lets try to set colors per vertex /* MDGModifier dgmod; @@ -1796,7 +1796,7 @@ bool MayaEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool a // MStatus status; MFnNurbsSurface mfnNurbsSurface; - + MayaEggGroup *parentNode = FindGroup(surface->_parent); MObject parent = MObject::kNullObj; if (parentNode) { @@ -1819,7 +1819,7 @@ bool MayaEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool a surface->_transNode = parent; } - // [gjeon] add eggFlag attributes if any exists + // [gjeon] add eggFlag attributes if any exists for (unsigned i = 0; i < surface->_eggObjectTypes.length(); i++) { MString attrName = "eggObjectTypes"; attrName += (int)(i + 1); @@ -1897,9 +1897,9 @@ bool MayaEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool a if (mayaloader_cat.is_spam()) { mayaloader_cat.spam() << "went past tex AssignNames" << endl; } - + if (mayaloader_cat.is_debug()) { - mayaloader_cat.debug() << "-fri: " << _frame_rate << " -sf: " << _start_frame + mayaloader_cat.debug() << "-fri: " << _frame_rate << " -sf: " << _start_frame << " -ef: " << _end_frame << endl; } @@ -1946,7 +1946,7 @@ bool MayaEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool a MTransformationMatrix matrix( mMat ); MVector trans = matrix.translation(MSpace::kTransform, &status); - + double rot[3]; MTransformationMatrix::RotationOrder order = MTransformationMatrix::kXYZ; status = matrix.getRotation(rot, order); @@ -2018,7 +2018,7 @@ bool MayaEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool a // ResumeSetKeyMode(); // ResumeAnimate(); - + mayaloader_cat.info() << "Egg import successful\n"; return true; } @@ -2194,13 +2194,13 @@ MObject MayaEggLoader::GetDependencyNode(string givenName) } else name = givenName; - /* - //masad: I do not think you want to return a mesh node + /* + //masad: I do not think you want to return a mesh node //because keyframes should only apply to joint nodes. MeshTable::const_iterator ci; for (ci = _mesh_tab.begin(); ci != _mesh_tab.end(); ++ci) { MayaEggMesh *mesh = (*ci).second; - + string meshName = mesh->_pool->get_name(); int nsize = meshName.size(); if ((nsize > 6) && (meshName.rfind(".verts")==(nsize-6))) { @@ -2227,16 +2227,16 @@ MObject MayaEggLoader::GetDependencyNode(string givenName) node = joint->_joint; return node; } - } - + } + return node; } -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // // The two global functions that form the API of this module. // -//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// bool MayaLoadEggData(EggData *data, bool merge, bool model, bool anim, bool respect_normals) { diff --git a/pandatool/src/mayaprogs/mayaEggImport.cxx b/pandatool/src/mayaprogs/mayaEggImport.cxx index 3f0334b20d..3b93365e91 100644 --- a/pandatool/src/mayaprogs/mayaEggImport.cxx +++ b/pandatool/src/mayaprogs/mayaEggImport.cxx @@ -22,7 +22,7 @@ // //////////////////////////////////////////////////////////////////// -#include +#include #include #include "dtoolbase.h" @@ -47,7 +47,7 @@ #include "mayaEggLoader.h" #include "notifyCategoryProxy.h" -////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// class MayaEggImporter : public MPxFileTranslator { @@ -55,15 +55,15 @@ public: MayaEggImporter () {}; virtual ~MayaEggImporter () {}; static void* creator(); - + MStatus reader ( const MFileObject& file, const MString& optionsString, FileAccessMode mode); - + MStatus writer ( const MFileObject& file, const MString& optionsString, FileAccessMode mode ); - + bool haveReadMethod () const { return true; } bool haveWriteMethod () const { return false; } MString defaultExtension () const { return "egg"; } @@ -104,15 +104,15 @@ MStatus MayaEggImporter::reader ( const MFileObject& file, if (theOption.length() < 1) { continue; } - + if (theOption[0] == flagModel && theOption.length() > 1) { model = atoi(theOption[1].asChar()) ? true:false; } else if (theOption[0] == flagAnim && theOption.length() > 1) { anim = atoi(theOption[1].asChar()) ? true:false; - } + } } } - + if ((mode != kImportAccessMode)&&(mode != kOpenAccessMode)) return MS::kFailure; @@ -145,7 +145,7 @@ MPxFileTranslator::MFileKind MayaEggImporter::identifyFile ( { const char * name = fileName.name().asChar(); int nameLength = strlen(name); - + if ((nameLength > 4) && !strcmp(name+nameLength-4, ".egg")) return kCouldBeMyFileType; else @@ -155,11 +155,11 @@ MPxFileTranslator::MFileKind MayaEggImporter::identifyFile ( EXPCL_MISC MStatus initializePlugin( MObject obj ) { MFnPlugin plugin( obj, "Alias", "3.0", "Any"); - + // Register the translator with the system return plugin.registerFileTranslator( "Panda3D Egg Import", "none", MayaEggImporter::creator, - + "eggImportOptions", "merge=1;model=1;anim=0;"); } diff --git a/pandatool/src/mayaprogs/mayaToEgg_client.cxx b/pandatool/src/mayaprogs/mayaToEgg_client.cxx index 4b84d332c0..676ea65abb 100644 --- a/pandatool/src/mayaprogs/mayaToEgg_client.cxx +++ b/pandatool/src/mayaprogs/mayaToEgg_client.cxx @@ -1,4 +1,4 @@ -// Filename: mayaToEgg.cxx +// Filename: mayaToEgg_client.cxx // Adapted by: cbrunner (09Nov09) // //////////////////////////////////////////////////////////////////// @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) { Filename cwd = ExecutionEnvironment::get_cwd(); string s_cwd = (string)cwd.to_os_specific(); NetDatagram datagram; - + // First part of the datagram is the argc datagram.add_uint8(argc); @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) { // Lastly, add the current working dir as a string to the datagram datagram.add_string(s_cwd); - + // Send it and close the connection prog.cWriter->send(datagram, con); con->flush(); diff --git a/pandatool/src/mayaprogs/mayapath.cxx b/pandatool/src/mayaprogs/mayapath.cxx index dfeb68fc5c..2ecb63c1df 100644 --- a/pandatool/src/mayaprogs/mayapath.cxx +++ b/pandatool/src/mayaprogs/mayapath.cxx @@ -58,7 +58,7 @@ #define TOSTRING(x) QUOTESTR(x) #if defined(_WIN32) -// Filename::dso_filename changes .so to .dll automatically. +// Note: Filename::dso_filename changes .so to .dll automatically. static const Filename openmaya_filename = "bin/OpenMaya.so"; #elif defined(IS_OSX) static const Filename openmaya_filename = "MacOS/libOpenMaya.dylib"; diff --git a/pandatool/src/objegg/objToEggConverter.h b/pandatool/src/objegg/objToEggConverter.h index 66fb6d7f37..7362cbf44d 100644 --- a/pandatool/src/objegg/objToEggConverter.h +++ b/pandatool/src/objegg/objToEggConverter.h @@ -1,4 +1,4 @@ -// Filename: ObjToEggConverter.h +// Filename: objToEggConverter.h // Created by: drose (07Dec10) // //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/pstatserver/pStatServer.cxx b/pandatool/src/pstatserver/pStatServer.cxx index 7946317682..fcf321ace0 100644 --- a/pandatool/src/pstatserver/pStatServer.cxx +++ b/pandatool/src/pstatserver/pStatServer.cxx @@ -120,7 +120,7 @@ poll() { reader->poll(); reader->idle(); - + ri = rnext; } } @@ -290,7 +290,7 @@ find_user_guide_bar(double from_height, double to_height) const { //////////////////////////////////////////////////////////////////// // Function: PStatServer::user_guide_bars_changed -// Access: Priate +// Access: Private // Description: Called when the user guide bars have been changed. //////////////////////////////////////////////////////////////////// void PStatServer:: diff --git a/pandatool/src/softegg/soft2Egg.c b/pandatool/src/softegg/soft2Egg.c index 149877db8c..a7f0764c48 100644 --- a/pandatool/src/softegg/soft2Egg.c +++ b/pandatool/src/softegg/soft2Egg.c @@ -1,6 +1,6 @@ // Filename: soft2Egg.c // Created by: masad (26Sep03) -// +// //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE @@ -12,10 +12,6 @@ // //////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////// -// Includes -//////////////////////////////////////////////////////////////////// - #include #ifdef __cplusplus @@ -69,7 +65,7 @@ class soft2egg : public EggBase tex_filename = NULL; search_prefix = NULL; result = SI_SUCCESS; - + skeleton = new EggGroup(); foundRoot = FALSE; animRoot = NULL; @@ -127,7 +123,7 @@ class soft2egg : public EggBase void MakeSurfaceCurve( SAA_Scene *, SAA_Elem *, EggGroup *, EggNurbsSurface *&, int , SAA_SubElem *, bool ); - EggNurbsCurve *MakeUVNurbsCurve( int, long *, double *, double *, + EggNurbsCurve *MakeUVNurbsCurve( int, long *, double *, double *, EggGroup *, char * ); EggNurbsCurve *MakeNurbsCurve( SAA_Scene *, SAA_Elem *, EggGroup *, @@ -140,12 +136,12 @@ class soft2egg : public EggBase void MakeAnimTable( SAA_Scene *, SAA_Elem *, char * ); void MakeVertexOffsets( SAA_Scene *, SAA_Elem *, SAA_ModelType type, int, int, SAA_DVector *, float (*)[4], char * ); - void MakeMorphTable( SAA_Scene *, SAA_Elem *, SAA_Elem *, int, char *, + void MakeMorphTable( SAA_Scene *, SAA_Elem *, SAA_Elem *, int, char *, float ); void MakeLinearMorphTable( SAA_Scene *, SAA_Elem *, int, char *, float ); - void MakeWeightedMorphTable( SAA_Scene *, SAA_Elem *, SAA_Elem *, int, + void MakeWeightedMorphTable( SAA_Scene *, SAA_Elem *, SAA_Elem *, int, int, char *, float ); - void MakeExpressionMorphTable( SAA_Scene *, SAA_Elem *, SAA_Elem *, int, + void MakeExpressionMorphTable( SAA_Scene *, SAA_Elem *, SAA_Elem *, int, int, char *, float ); void MakeTexAnim( SAA_Scene *, SAA_Elem *, char * ); @@ -184,7 +180,7 @@ class soft2egg : public EggBase int shift_textures; int ignore_tex_offsets; int use_prefix; - + bool foundRoot; bool geom_as_joint; bool make_anim; @@ -212,7 +208,7 @@ class soft2egg : public EggBase // classes to describe the current program. //////////////////////////////////////////////////////////////////// void soft2egg:: -Help() +Help() { cerr << "soft2egg takes a SoftImage scene or model\n" @@ -246,10 +242,10 @@ Usage() { // the current program. //////////////////////////////////////////////////////////////////// void soft2egg:: -ShowOpts() +ShowOpts() { cerr << - " -r - Used to provide soft with the resource\n" + " -r - Used to provide soft with the resource\n" " Defaults to 'c:/Softimage/SOFT_3.9.2/3D/test'.\n" // " Defaults to '/ful/ufs/soft371_mips2/3D/rsrc'.\n" " -d - Database path.\n" @@ -289,11 +285,11 @@ ShowOpts() // Description: //////////////////////////////////////////////////////////////////// boolean soft2egg:: -HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) +HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) { boolean okflag = true; - switch (flag) + switch (flag) { case 'r': // Set the resource path for soft. if ( strcmp( optarg, "" ) ) @@ -321,7 +317,7 @@ HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) fprintf( outStream, "loading scene %s\n", scene_name ); } break; - + case 'm': // Check if its a model. if ( strcmp( optarg, "" ) ) { @@ -330,7 +326,7 @@ HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) fprintf( outStream, "loading model %s\n", model_name ); } break; - + case 't': // Get converted texture path. if ( strcmp( optarg, "" ) ) { @@ -340,12 +336,12 @@ HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) } break; - case 'T': // Specify texture list filename. + case 'T': // Specify texture list filename. if ( strcmp( optarg, "") ) { // Get the name. tex_filename = optarg; - fprintf( outStream, "creating texture list file: %s\n", + fprintf( outStream, "creating texture list file: %s\n", tex_filename ); } break; @@ -356,7 +352,7 @@ HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) fprintf( outStream, "NURBS step: %d\n", nurbs_step ); } break; - + case 'M': // Set model output file name. if ( strcmp( optarg, "" ) ) { @@ -364,7 +360,7 @@ HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) fprintf( outStream, "Model output filename: %s\n", eggFileName ); } break; - + case 'A': // Set anim output file name. if ( strcmp( optarg, "" ) ) { @@ -372,7 +368,7 @@ HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) fprintf( outStream, "Anim output filename: %s\n", animFileName ); } break; - + case 'N': // Set egg model name. if ( strcmp( optarg, "" ) ) { @@ -385,16 +381,16 @@ HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) if ( strcmp( optarg, "" ) ) { search_prefix = optarg; - fprintf( outStream, "Only converting models with prefix: %s\n", + fprintf( outStream, "Only converting models with prefix: %s\n", search_prefix ); } break; - + case 'h': // print help message Help(); exit(1); break; - + case 'c': // Cancel morph animation conversion make_morph = FALSE; fprintf( outStream, "canceling morph conversion\n" ); @@ -404,28 +400,28 @@ HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) make_duv = FALSE; fprintf( outStream, "canceling uv animation conversion\n" ); break; - + case 'D': // Omit the Dart flag make_dart = FALSE; fprintf( outStream, "making a non-character model\n" ); break; - + case 'k': // Enable soft skinning //make_soft = TRUE; //fprintf( outStream, "enabling soft skinning\n" ); fprintf( outStream, "-k flag no longer necessary\n" ); break; - + case 'n': // Generate egg NURBS output make_nurbs = TRUE; fprintf( outStream, "outputting egg NURBS info\n" ); break; - + case 'p': // Generate egg polygon output make_poly = TRUE; fprintf( outStream, "outputting egg polygon info\n" ); break; - + case 'P': // Generate static pose from given frame if ( strcmp( optarg, "" ) ) { @@ -435,7 +431,7 @@ HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) pose_frame ); } break; - + case 'a': // Compile animation tables. make_anim = TRUE; fprintf( outStream, "attempting to compile anim tables\n" ); @@ -451,12 +447,12 @@ HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) fprintf( outStream, "shifting NURBS parameters...\n" ); break; - case 'i': // Ignore Soft uv texture offsets + case 'i': // Ignore Soft uv texture offsets ignore_tex_offsets = TRUE; fprintf( outStream, "ignoring texture offsets...\n" ); break; - case 'u': // Use Soft prefix in model names + case 'u': // Use Soft prefix in model names use_prefix = TRUE; fprintf( outStream, "using prefix in model names...\n" ); break; @@ -474,7 +470,7 @@ HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) if ( strcmp( optarg, "" ) ) { anim_start = atoi(optarg); - fprintf( outStream, "animation starting at frame: %d\n", + fprintf( outStream, "animation starting at frame: %d\n", anim_start ); } break; @@ -486,7 +482,7 @@ HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) fprintf( outStream, "animation ending at frame: %d\n", anim_end ); } break; - + case 'f': /// Set animation frame rate. if ( strcmp( optarg, "" ) ) { @@ -494,7 +490,7 @@ HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) fprintf( outStream, "animation frame rate: %d\n", anim_rate ); } break; - + default: okflag = EggBase::HandleGetopts(flag, optarg, optind, argc, argv); } @@ -507,10 +503,10 @@ HandleGetopts(char flag, char *optarg, int &optind, int argc, char **argv) //////////////////////////////////////////////////////////////////// // Function: isNum // Access: Public, Virtual -// Description: Take a float and make sure it is of the body. +// Description: Take a float and make sure it is of the body. //////////////////////////////////////////////////////////////////// int soft2egg:: -isNum( float num ) +isNum( float num ) { return( ( num < HUGE_VAL ) && finite( num ) ); } @@ -520,7 +516,7 @@ isNum( float num ) // Function: GetRootName // Access: Public // Description: Given a string, return a copy of the string up to -// the first occurence of '-'. +// the first occurrence of '-'. //////////////////////////////////////////////////////////////////// char *soft2egg:: GetRootName( const char *name ) @@ -551,8 +547,8 @@ GetRootName( const char *name ) //////////////////////////////////////////////////////////////////// // Function: RemovePathName // Access: Public -// Description: Given a string, return a copy of the string after -// the last occurence of '/ +// Description: Given a string, return a copy of the string after +// the last occurence of '/ //////////////////////////////////////////////////////////////////// char *soft2egg:: RemovePathName( const char *name ) @@ -581,9 +577,9 @@ RemovePathName( const char *name ) //////////////////////////////////////////////////////////////////// // Function: GetSliderName // Access: Public -// Description: Given a string, return that part of the string after +// Description: Given a string, return that part of the string after // the first occurence of '-' and before the last -// occurance of '.' +// occurance of '.' //////////////////////////////////////////////////////////////////// char *soft2egg:: GetSliderName( const char *name ) @@ -618,15 +614,15 @@ GetSliderName( const char *name ) return( end ); } - + return( (char *)name ); } //////////////////////////////////////////////////////////////////// // Function: GetName // Access: Public -// Description: Given an element, return a copy of the element's -// name WITHOUT prefix. +// Description: Given an element, return a copy of the element's +// name WITHOUT prefix. //////////////////////////////////////////////////////////////////// char *soft2egg:: GetName( SAA_Scene *scene, SAA_Elem *element ) @@ -635,18 +631,18 @@ GetName( SAA_Scene *scene, SAA_Elem *element ) char *name; // get the name - SAA_elementGetNameLength( scene, element, &nameLen ); + SAA_elementGetNameLength( scene, element, &nameLen ); name = (char *)malloc(sizeof(char)*++nameLen); SAA_elementGetName( scene, element, nameLen, name ); - + return name; } //////////////////////////////////////////////////////////////////// // Function: GetFullName // Access: Public -// Description: Given an element, return a copy of the element's -// name complete with prefix. +// Description: Given an element, return a copy of the element's +// name complete with prefix. //////////////////////////////////////////////////////////////////// char *soft2egg:: GetFullName( SAA_Scene *scene, SAA_Elem *element ) @@ -655,15 +651,15 @@ GetFullName( SAA_Scene *scene, SAA_Elem *element ) char *name; // get the name - SAA_elementGetNameLength( scene, element, &nameLen ); + SAA_elementGetNameLength( scene, element, &nameLen ); name = (char *)malloc(sizeof(char)*++nameLen); SAA_elementGetName( scene, element, nameLen, name ); - + int prefixLen; char *prefix; // get the prefix - SAA_elementGetPrefixLength( scene, element, &prefixLen ); + SAA_elementGetPrefixLength( scene, element, &prefixLen ); prefix = (char *)malloc(sizeof(char)*++prefixLen); SAA_elementGetPrefix( scene, element, prefixLen, prefix ); @@ -674,7 +670,7 @@ GetFullName( SAA_Scene *scene, SAA_Elem *element ) //free( name ); //free( prefix ); - + return fullNameStrm.str(); } @@ -682,7 +678,7 @@ GetFullName( SAA_Scene *scene, SAA_Elem *element ) // Function: GetModelNoteInfo // Access: Public // Description: Given an element, return a string containing the -// contents of its MODEL NOTE entry +// contents of its MODEL NOTE entry //////////////////////////////////////////////////////////////////// char *soft2egg:: GetModelNoteInfo( SAA_Scene *scene, SAA_Elem *model ) @@ -701,7 +697,7 @@ GetModelNoteInfo( SAA_Scene *scene, SAA_Elem *model ) modelNote = (char *)malloc(sizeof(char)*(size + 1)); // get ModelNote data from this model - SAA_elementGetUserData( scene, model, "MNOT", size, + SAA_elementGetUserData( scene, model, "MNOT", size, &bigEndian, (void *)modelNote ); //strip off newline, if present @@ -712,8 +708,8 @@ GetModelNoteInfo( SAA_Scene *scene, SAA_Elem *model ) modelNote[size] = '\0'; if ( verbose >= 1 ) - fprintf( outStream, "\nmodelNote = %s\n", - modelNote ); + fprintf( outStream, "\nmodelNote = %s\n", + modelNote ); } return modelNote; @@ -724,7 +720,7 @@ GetModelNoteInfo( SAA_Scene *scene, SAA_Elem *model ) // Function: MakeTableName // Access: Public // Description: Given a string, and a number, return a new string -// consisting of "string.number". +// consisting of "string.number". //////////////////////////////////////////////////////////////////// char *soft2egg:: MakeTableName( const char *name, int number ) @@ -738,20 +734,20 @@ MakeTableName( const char *name, int number ) //////////////////////////////////////////////////////////////////// // Function: FindModelByName // Access: Public -// Description: Given a string, find the model in the scene -// whose name corresponds to the given string. +// Description: Given a string, find the model in the scene +// whose name corresponds to the given string. //////////////////////////////////////////////////////////////////// SAA_Elem *soft2egg:: -FindModelByName( char *name, SAA_Scene *scene, SAA_Elem *models, +FindModelByName( char *name, SAA_Scene *scene, SAA_Elem *models, int numModels ) { char *foundName; SAA_Elem *foundModel = NULL; - + for ( int model = 0; model < numModels; model++ ) { foundName = GetName( scene, &models[model] ); - + if ( !strcmp( name, foundName ) ) { if ( verbose >= 1 ) @@ -760,13 +756,13 @@ FindModelByName( char *name, SAA_Scene *scene, SAA_Elem *models, foundModel = &models[model]; return( foundModel ); - } - } + } + } fprintf( outStream, "findModelByName: failed to find model named: '%s'\n", name ); - return ( foundModel ); + return ( foundModel ); } @@ -774,7 +770,7 @@ FindModelByName( char *name, SAA_Scene *scene, SAA_Elem *models, // Function: DepointellizeName // Access: Public // Description: Given a string, return the string up to the first -// period. +// period. //////////////////////////////////////////////////////////////////// char *soft2egg:: DepointellizeName( char *name ) @@ -786,7 +782,7 @@ DepointellizeName( char *name ) sprintf( newName, "%s", name ); endPtr = strchr( newName, '.' ); - if ( endPtr != NULL ) + if ( endPtr != NULL ) *endPtr = '\0'; return ( newName ); @@ -798,7 +794,7 @@ DepointellizeName( char *name ) // Access: Public // Description: Given a string, return a copy of the string without // the leading file path, and make an rgb file of the -// same name in the tex_path directory. +// same name in the tex_path directory. //////////////////////////////////////////////////////////////////// char *soft2egg:: ConvertTexture( SAA_Scene *scene, SAA_Elem *texture ) @@ -817,7 +813,7 @@ ConvertTexture( SAA_Scene *scene, SAA_Elem *texture ) // make sure we are not being passed a NULL image, an empty image // string or the default image created by egg2soft - if ( (fileName != NULL) && strlen( fileName ) && strcmp( fileName, + if ( (fileName != NULL) && strlen( fileName ) && strcmp( fileName, "/fat/people/gregw/new_test/PICTURES/default") && ( strstr( fileName, "noIcon" ) == NULL) ) { @@ -848,14 +844,14 @@ ConvertTexture( SAA_Scene *scene, SAA_Elem *texture ) } fileNameExt = (char *)malloc(sizeof(char)*(strlen(fileName)+5)); - sprintf( fileNameExt, "%s.pic", fileName ); + sprintf( fileNameExt, "%s.pic", fileName ); if ( verbose >= 1 ) fprintf( outStream, "Looking for texture file: '%s'\n", fileNameExt ); // try to make conversion of file int found_file = ( access( fileNameExt, F_OK ) == 0); - + if ( found_file ) { if ( tex_path ) @@ -863,24 +859,24 @@ ConvertTexture( SAA_Scene *scene, SAA_Elem *texture ) texNamePath = (char *)malloc(sizeof(char)*(strlen(tex_path) + strlen(texName) + 2)); - sprintf( texNamePath, "%s/%s", tex_path, texName ); + sprintf( texNamePath, "%s/%s", tex_path, texName ); if ( texFile ) texFile << texNamePath << ": " << fileNameExt << "\n"; - // make sure conversion doesn't already exist - if ( (access( texNamePath, F_OK ) != 0) && !texFile ) + // make sure conversion doesn't already exist + if ( (access( texNamePath, F_OK ) != 0) && !texFile ) { char *command = (char *)malloc(sizeof(char)* (strlen(fileNameExt) + strlen(texNamePath) + 20)); - sprintf( command, "image-resize -1 %s %s", + sprintf( command, "image-resize -1 %s %s", fileNameExt, texNamePath ); if ( verbose >=1 ) fprintf( outStream, "executing %s\n", command ); - - system( command ); + + system( command ); //free( command ); } @@ -899,7 +895,7 @@ ConvertTexture( SAA_Scene *scene, SAA_Elem *texture ) } else { - fprintf( outStream, "Warning: Couldn't find texture file: %s\n", + fprintf( outStream, "Warning: Couldn't find texture file: %s\n", fileNameExt ); } @@ -920,34 +916,34 @@ ConvertTexture( SAA_Scene *scene, SAA_Elem *texture ) //////////////////////////////////////////////////////////////////// // Function: FindClosestTriVert // Access: Public -// Description: Given an egg vertex pool, map each vertex therein to -// a vertex within an array of SAA model vertices of -// size numVert. Mapping is done by closest proximity. +// Description: Given an egg vertex pool, map each vertex therein to +// a vertex within an array of SAA model vertices of +// size numVert. Mapping is done by closest proximity. //////////////////////////////////////////////////////////////////// int *soft2egg:: FindClosestTriVert( EggVertexPool *vpool, SAA_DVector *vertices, int numVert ) { - int *vertMap = NULL; + int *vertMap = NULL; int vpoolSize = vpool->NumVertices(); int i,j; float thisDist; float closestDist; int closest; - + vertMap = (int *)malloc(sizeof(int)*vpoolSize); // for each vertex in vpool for ( i = 0; i < vpoolSize; i++ ) { - // find closest model vertex - for ( j = 0; j < numVert-1; j++ ) + // find closest model vertex + for ( j = 0; j < numVert-1; j++ ) { // calculate distance - thisDist = sqrtf( - powf( vpool->Vertex(i)->position[0] - vertices[j].x , 2 ) + - powf( vpool->Vertex(i)->position[1] - vertices[j].y , 2 ) + - powf( vpool->Vertex(i)->position[2] - vertices[j].z , 2 ) ); + thisDist = sqrtf( + powf( vpool->Vertex(i)->position[0] - vertices[j].x , 2 ) + + powf( vpool->Vertex(i)->position[1] - vertices[j].y , 2 ) + + powf( vpool->Vertex(i)->position[2] - vertices[j].z , 2 ) ); // remember this if its the closest so far if ( !j || ( thisDist < closestDist ) ) @@ -955,17 +951,17 @@ FindClosestTriVert( EggVertexPool *vpool, SAA_DVector *vertices, int numVert ) closest = j; closestDist = thisDist; } - } + } vertMap[i] = closest; if ( verbose >= 2 ) { - fprintf( outStream, "mapping v %d of %d:( %f, %f, %f )\n", i, - vpoolSize, vpool->Vertex(i)->position[0], + fprintf( outStream, "mapping v %d of %d:( %f, %f, %f )\n", i, + vpoolSize, vpool->Vertex(i)->position[0], vpool->Vertex(i)->position[1], - vpool->Vertex(i)->position[2] ); + vpool->Vertex(i)->position[2] ); fprintf( outStream, "to cv %d of %d:( %f, %f, %f )\tdelta = %f\n", - closest, numVert-1, vertices[closest].x, vertices[closest].y, + closest, numVert-1, vertices[closest].x, vertices[closest].y, vertices[closest].z, closestDist ); } } @@ -978,8 +974,8 @@ FindClosestTriVert( EggVertexPool *vpool, SAA_DVector *vertices, int numVert ) // Function: MakeIndexMap // Access: Public // Description: Given an array of indices that is a map from one -// set of vertices to another, return an array that -// performs the reverse mapping of the indices array +// set of vertices to another, return an array that +// performs the reverse mapping of the indices array //////////////////////////////////////////////////////////////////// int *soft2egg:: MakeIndexMap( int *indices, int numIndices, int mapSize ) @@ -987,7 +983,7 @@ MakeIndexMap( int *indices, int numIndices, int mapSize ) int i, j; // allocate map array - int *map = (int *)malloc(sizeof(int)*mapSize); + int *map = (int *)malloc(sizeof(int)*mapSize); if ( map != NULL ) { @@ -1007,7 +1003,7 @@ MakeIndexMap( int *indices, int numIndices, int mapSize ) } j++; } - if ( !found) + if ( !found) { if ( verbose >= 2 ) fprintf( outStream, "Warning: orphan vertex (%d)\n", i ); @@ -1018,17 +1014,15 @@ MakeIndexMap( int *indices, int numIndices, int mapSize ) } else fprintf( outStream, "Not enough Memory for index Map...\n"); - return( map ); } - //////////////////////////////////////////////////////////////////// // Function: findShapeVert // Access: Public // Description: given a vertex, find its corresponding shape vertex -// and return its index. +// and return its index. //////////////////////////////////////////////////////////////////// int soft2egg:: findShapeVert( SAA_DVector vertex, SAA_DVector *vertices, int numVert ) @@ -1038,8 +1032,8 @@ findShapeVert( SAA_DVector vertex, SAA_DVector *vertices, int numVert ) for ( i = 0; i < numVert && !found ; i++ ) { - if ( ( vertex.x == vertices[i].x ) && - ( vertex.y == vertices[i].y ) && + if ( ( vertex.x == vertices[i].x ) && + ( vertex.y == vertices[i].y ) && ( vertex.z == vertices[i].z ) ) { found = 1; @@ -1047,8 +1041,7 @@ findShapeVert( SAA_DVector vertex, SAA_DVector *vertices, int numVert ) if ( verbose >= 2) fprintf( outStream, "found shape vert at index %d\n", i ); } - - } + } if (!found ) i = -1; @@ -1105,7 +1098,7 @@ LoadSoft() strcat( eggFileName, "-mod.egg" ); } - // open an output file for the geometry if necessary + // open an output file for the geometry if necessary if ( make_poly || make_nurbs ) { unlink( eggFileName ); @@ -1113,8 +1106,8 @@ LoadSoft() if ( !eggFile ) { - fprintf( outStream, "Couldn't open output file: %s\n", - eggFileName ); + fprintf( outStream, "Couldn't open output file: %s\n", + eggFileName ); exit( 1 ); } } @@ -1124,9 +1117,9 @@ LoadSoft() { unlink( tex_filename ); texFile.open( tex_filename, ios::out, 0666 ); - + if ( !texFile ) - { + { fprintf( outStream, "Couldn't open output file: %s\n", tex_filename ); exit( 1 ); @@ -1145,14 +1138,14 @@ LoadSoft() SAA_updatelistEvalScene( &scene, time ); if ( make_pose ) SAA_sceneFreeze( &scene ); - } + } int numModels; SAA_Elem *models; - SAA_sceneGetNbModels( &scene, &numModels ); + SAA_sceneGetNbModels( &scene, &numModels ); fprintf( outStream, "Scene has %d model(s)...\n", numModels ); - + if ( numModels ) { // allocate array of models @@ -1161,9 +1154,8 @@ LoadSoft() if ( models != NULL ) { char *rootName = GetRootName( eggFileName ); - - - if ( eggGroupName == NULL ) + + if ( eggGroupName == NULL ) dart = _data.CreateGroup( NULL, rootName ); else dart = _data.CreateGroup( NULL, eggGroupName ); @@ -1173,12 +1165,12 @@ LoadSoft() AnimGroup *rootTable; - rootTable = animData.CreateTable( NULL, eggFileName ); + rootTable = animData.CreateTable( NULL, eggFileName ); if ( eggGroupName == NULL ) animRoot = animData.CreateBundle( rootTable, rootName ); else - animRoot = animData.CreateBundle( rootTable, + animRoot = animData.CreateBundle( rootTable, eggGroupName ); // propagate commet to anim data @@ -1233,7 +1225,7 @@ LoadSoft() // split if ( strstr( fullname, search_prefix ) != NULL ) { - // for every skel part: get soft skin info + // for every skel part: get soft skin info if ( isSkeleton ) MakeSoftSkin( &scene, &models[i], models, numModels, name ); @@ -1269,8 +1261,8 @@ LoadSoft() // make sure all elements have unique names _data.UniquifyNames(); - - // write out the geometry data if requested + + // write out the geometry data if requested //if ( make_poly || make_nurbs ) //{ eggFile << _data << "\n"; @@ -1298,8 +1290,8 @@ LoadSoft() if ( !animFile ) { - fprintf( outStream, "Couldn't open output file: %s\n", - animFileName ); + fprintf( outStream, "Couldn't open output file: %s\n", + animFileName ); exit( 1 ); } @@ -1309,7 +1301,7 @@ LoadSoft() // get all the animation frame info if not specified // on the command line - if (anim_start == -1000) + if (anim_start == -1000) SAA_sceneGetPlayCtrlStartFrame( &scene, &anim_start ); if (anim_end == -1000) @@ -1322,7 +1314,7 @@ LoadSoft() //fprintf( outStream, "frameStep = %d\n", frameStep ); // start at first frame and go to last - for ( frame = anim_start; frame <= anim_end; + for ( frame = anim_start; frame <= anim_end; frame += 1) { SAA_frame2Seconds( &scene, frame, &time ); @@ -1366,18 +1358,18 @@ LoadSoft() int size; // check for uv texture animation - SAA_elementGetUserDataSize( &scene, &models[i], + SAA_elementGetUserDataSize( &scene, &models[i], "TEX_OFFSETS", &size ); // if so, update for this frame if desired - if ( ( size != 0 ) && make_duv ) + if ( ( size != 0 ) && make_duv ) MakeTexAnim( &scene, &models[i], name ); // if we have a skeleton or something that acts // like one - build anim tables if ( isSkeleton || ( strstr( name, "joint") != NULL ) ) - MakeAnimTable( &scene, &models[i], name ); + MakeAnimTable( &scene, &models[i], name ); //free( name ); } @@ -1403,8 +1395,8 @@ LoadSoft() { if ( eggFileName == NULL ) - { - eggFileName = + { + eggFileName = (char *)malloc(sizeof(char)*(strlen( model_name )+13)); sprintf( eggFileName, "%s", DepointellizeName( model_name ) ); @@ -1413,16 +1405,16 @@ LoadSoft() strcat( eggFileName, "-mod.egg" ); } - eggFile.open( eggFileName ); + eggFile.open( eggFileName ); if ( !eggFile ) { - fprintf( outStream, "Couldn't open output file: %s\n", - eggFileName ); + fprintf( outStream, "Couldn't open output file: %s\n", + eggFileName ); exit( 1 ); } - if ((result = + if ((result = SAA_elementLoad(&database, &scene, model_name, &model)) == SI_SUCCESS) { @@ -1440,7 +1432,7 @@ LoadSoft() // Function: MakeEgg // Access: Public // Description: Make egg geometry from a given model. This include -// textures, tex coords, colors, normals, and joints. +// textures, tex coords, colors, normals, and joints. //////////////////////////////////////////////////////////////////// void soft2egg:: MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, @@ -1457,7 +1449,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, int numTexGlb = 0; int i, j; float matrix[4][4]; - float *uScale = NULL; + float *uScale = NULL; float *vScale = NULL; float *uOffset = NULL; float *vOffset = NULL; @@ -1479,15 +1471,13 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, SAA_GeomType gtype = SAA_GEOM_ORIGINAL; SAA_Boolean visible; - ///////////////////////////////////////////////// // find out what type of node we're dealing with - ///////////////////////////////////////////////// result = SAA_modelGetType( scene, model, &type ); if ( verbose >= 1 ) { if ( type == SAA_MNILL ) - fprintf( outStream, "encountered null\n"); + fprintf( outStream, "encountered null\n"); else if ( type == SAA_MPTCH ) fprintf( outStream, "encountered patch\n" ); else if ( type == SAA_MFACE ) @@ -1506,13 +1496,11 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, fprintf( outStream, "encountered nurb curve\n" ); else if ( type == SAA_MNSRF ) fprintf( outStream, "encountered nurbs surf\n" ); - else + else fprintf( outStream, "encountered unknown type: %d\n", type ); } - ///////////////////////////// // Get the name of the model - ///////////////////////////// // Get the FULL name of the model fullname = GetFullName( scene, model ); @@ -1520,7 +1508,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, if ( use_prefix ) { // Get the FULL name of the trim curve - name = fullname; + name = fullname; } else { @@ -1533,31 +1521,29 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, fflush( outStream ); - // get the model's matrix + // get the model's matrix SAA_modelGetMatrix( scene, model, SAA_COORDSYS_GLOBAL, matrix ); if ( verbose >= 2 ) { fprintf( outStream, "model matrix = %f %f %f %f\n", matrix[0][0], - matrix[0][1], matrix[0][2], matrix[0][3] ); + matrix[0][1], matrix[0][2], matrix[0][3] ); fprintf( outStream, "model matrix = %f %f %f %f\n", matrix[1][0], - matrix[1][1], matrix[1][2], matrix[1][3] ); + matrix[1][1], matrix[1][2], matrix[1][3] ); fprintf( outStream, "model matrix = %f %f %f %f\n", matrix[2][0], - matrix[2][1], matrix[2][2], matrix[2][3] ); + matrix[2][1], matrix[2][2], matrix[2][3] ); fprintf( outStream, "model matrix = %f %f %f %f\n", matrix[3][0], - matrix[3][1], matrix[3][2], matrix[3][3] ); + matrix[3][1], matrix[3][2], matrix[3][3] ); } - - /////////////////////////////////////////////////////////////////////// + // check to see if this is a branch we don't want to descend - this // will prevent creating geometry for animation control structures - /////////////////////////////////////////////////////////////////////// - if ( (strstr( name, "con-" ) == NULL) && - (strstr( name, "con_" ) == NULL) && - (strstr( name, "fly_" ) == NULL) && - (strstr( name, "fly-" ) == NULL) && + if ( (strstr( name, "con-" ) == NULL) && + (strstr( name, "con_" ) == NULL) && + (strstr( name, "fly_" ) == NULL) && + (strstr( name, "fly-" ) == NULL) && (strstr( name, "camRIG" ) == NULL) && - (strstr( name, "bars" ) == NULL) && + (strstr( name, "bars" ) == NULL) && // split (strstr( fullname, search_prefix ) != NULL) ) { @@ -1565,23 +1551,21 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, // if making a pose - get deformed geometry if ( make_pose ) gtype = SAA_GEOM_DEFORMED; - + // Get the number of key shapes SAA_modelGetNbShapes( scene, model, &numShapes ); if ( verbose >= 1 ) fprintf( outStream, "MakeEgg: num shapes: %d\n", numShapes); - /////////////////////////////////////////////////////////////////////// // if multiple key shapes exist create table entries for each - /////////////////////////////////////////////////////////////////////// if ( (numShapes > 0) && make_morph ) { has_morph = 1; // make sure root morph table exists if ( morphRoot == NULL ) - morphRoot = animData.CreateTable( animRoot, "morph" ); - + morphRoot = animData.CreateTable( animRoot, "morph" ); + char *tableName; // create morph table entry for each key shape @@ -1589,32 +1573,30 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, for ( i = 1; i < numShapes; i++ ) { tableName = MakeTableName( name, i ); - SAnimTable *table = new SAnimTable( ); + SAnimTable *table = new SAnimTable( ); table->name = tableName; table->fps = anim_rate; morphRoot->children.push_back( table ); if ( verbose >= 1 ) - fprintf( outStream, "created table named: '%s'\n", tableName ); + fprintf( outStream, "created table named: '%s'\n", tableName ); } //free( tableName ); } - SAA_modelGetNodeVisibility( scene, model, &visible ); + SAA_modelGetNodeVisibility( scene, model, &visible ); if ( verbose >= 1 ) - fprintf( outStream, "model visibility: %d\n", visible ); - - /////////////////////////////////////////////////////////////////////// + fprintf( outStream, "model visibility: %d\n", visible ); + // Only create egg polygon data if: the node is visible, and its not - // a NULL or a Joint, and we're outputing polys (or if we are outputing - // NURBS and the model is a poly mesh or a face) - /////////////////////////////////////////////////////////////////////// - if ( visible && + // a NULL or a Joint, and we're outputing polys (or if we are outputing + // NURBS and the model is a poly mesh or a face) + if ( visible && (type != SAA_MNILL) && - (type != SAA_MJNT) && - ((make_poly || - (make_nurbs && ((type == SAA_MSMSH) || (type == SAA_MFACE )) )) - || (!make_poly && !make_nurbs && make_duv && + (type != SAA_MJNT) && + ((make_poly || + (make_nurbs && ((type == SAA_MSMSH) || (type == SAA_MFACE )) )) + || (!make_poly && !make_nurbs && make_duv && ((type == SAA_MSMSH) || (type == SAA_MFACE )) )) ) { @@ -1625,8 +1607,8 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, // If the model is a PATCH in soft, set its step before tesselating else if ( type == SAA_MPTCH ) SAA_patchSetStep( scene, model, nurbs_step, nurbs_step ); - - // Get the number of triangles + + // Get the number of triangles result = SAA_modelGetNbTriangles( scene, model, gtype, id, &numTri); if ( verbose >= 1 ) fprintf( outStream, "triangles: %d\n", numTri); @@ -1634,11 +1616,11 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, if ( result != SI_SUCCESS ) { if ( verbose >= 1 ) { - fprintf( outStream, + fprintf( outStream, "Error: couldn't get number of triangles!\n" ); fprintf( outStream, "\tbailing on model: '%s'\n", name ); } - return; + return; } // check to see if surface is also skeleton... @@ -1657,14 +1639,14 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, MakeJoint( scene, lastJoint, lastAnim, model, name ); } - + // model is not a null and has no triangles! if ( !numTri ) { if ( verbose >= 1 ) - fprintf( outStream, "no triangles!\n"); + fprintf( outStream, "no triangles!\n"); } - else + else { // allocate array of triangles triangles = (SAA_SubElem *)malloc(sizeof(SAA_SubElem)*numTri); @@ -1680,8 +1662,8 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, materials = (SAA_Elem *)malloc(sizeof(SAA_Elem)*numTri); if ( materials != NULL ) { - // read each triangle's material into array - SAA_triangleGetMaterials( scene, model, numTri, triangles, + // read each triangle's material into array + SAA_triangleGetMaterials( scene, model, numTri, triangles, materials ); } else @@ -1692,17 +1674,17 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, // find out how many local textures per triangle for ( i = 0; i < numTri; i++ ) - { - result = SAA_materialRelationGetT2DLocNbElements( scene, + { + result = SAA_materialRelationGetT2DLocNbElements( scene, &materials[i], FALSE, &relinfo, &numTexTri[i] ); - // polytex + // polytex if ( result == SI_SUCCESS ) numTexLoc += numTexTri[i]; } // don't need this anymore... - //free( numTexTri ); + //free( numTexTri ); // get local textures if present if ( numTexLoc ) @@ -1714,11 +1696,11 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, { // and read all referenced local textures into array SAA_materialRelationGetT2DLocElements( scene, &materials[i], - TEX_PER_MAT , &textures[i] ); + TEX_PER_MAT , &textures[i] ); } if ( verbose >= 1 ) - fprintf( outStream, "numTexLoc = %d\n", numTexLoc); + fprintf( outStream, "numTexLoc = %d\n", numTexLoc); } // if no local textures, try to get global textures else @@ -1732,15 +1714,15 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, textures = (SAA_Elem *)malloc(sizeof(SAA_Elem)); // get the referenced texture - SAA_modelRelationGetT2DGlbElements( scene, model, - TEX_PER_MAT, textures ); + SAA_modelRelationGetT2DGlbElements( scene, model, + TEX_PER_MAT, textures ); if ( verbose >= 1 ) - fprintf( outStream, "numTexGlb = %d\n", numTexGlb); + fprintf( outStream, "numTexGlb = %d\n", numTexGlb); } } - // allocate array of control vertices + // allocate array of control vertices cvertices = (SAA_SubElem *)malloc(sizeof(SAA_SubElem)*numTri*3); if ( cvertices != NULL ) { @@ -1751,13 +1733,13 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, if ( verbose >= 2 ) { cvertPos = (SAA_DVector *)malloc(sizeof(SAA_DVector)*numTri*3); - SAA_ctrlVertexGetPositions( scene, model, numTri*3, + SAA_ctrlVertexGetPositions( scene, model, numTri*3, cvertices, cvertPos); for ( i=0; i < numTri*3; i++ ) { - fprintf( outStream, "cvert[%d] = %f %f %f %f\n", i, - cvertPos[i].x, cvertPos[i].y, cvertPos[i].z, + fprintf( outStream, "cvert[%d] = %f %f %f %f\n", i, + cvertPos[i].x, cvertPos[i].y, cvertPos[i].z, cvertPos[i].w ); } } @@ -1774,10 +1756,10 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, for ( i=0; i < numTri*3; i++ ) indices[i] = 0; - SAA_ctrlVertexGetIndices( scene, model, numTri*3, + SAA_ctrlVertexGetIndices( scene, model, numTri*3, cvertices, indices ); - - if ( verbose >= 2 ) + + if ( verbose >= 2 ) for ( i=0; i < numTri*3; i++ ) fprintf( outStream, "indices[%d] = %d\n", i, indices[i] ); } @@ -1801,7 +1783,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, for ( i=0; i < numVert; i++ ) { fprintf( outStream, "vertices[%d] = %f ", i, vertices[i].x ); - fprintf( outStream, "%f %f %f\n", vertices[i].y, + fprintf( outStream, "%f %f %f\n", vertices[i].y, vertices[i].z, vertices[i].w ); } } @@ -1810,7 +1792,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, // we contruct this array to map from the unique vertices // array to the redundant cvertices array - it will save // us from doing repetitive searches later - indexMap = MakeIndexMap( indices, numTri*3, numVert ); + indexMap = MakeIndexMap( indices, numTri*3, numVert ); // allocate array of normals normals = (SAA_DVector *)malloc(sizeof(SAA_DVector)*numTri*3); @@ -1836,15 +1818,15 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, if ( numTexLoc ) { // allocate arrays for u & v coords - uCoords = (float *)malloc(sizeof(float)*numTri*numTexLoc*3); - vCoords = (float *)malloc(sizeof(float)*numTri*numTexLoc*3); - + uCoords = (float *)malloc(sizeof(float)*numTri*numTexLoc*3); + vCoords = (float *)malloc(sizeof(float)*numTri*numTexLoc*3); + // read the u & v coords into the arrays if ( uCoords != NULL && vCoords != NULL) { for ( i = 0; i < numTri*numTexLoc*3; i++ ) uCoords[i] = vCoords[i] = 0.0f; - + SAA_ctrlVertexGetUVTxtCoords( scene, model, numTri*3, cvertices, numTexLoc*3, uCoords, vCoords ); } @@ -1854,7 +1836,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, if ( verbose >= 2 ) { for ( i=0; i= 2 ) - fprintf( outStream, " tritex[%d] named: %s\n", i, + + if ( verbose >= 2 ) + fprintf( outStream, " tritex[%d] named: %s\n", i, texNameArray[i] ); SAA_texture2DGetUVSwap( scene, &textures[i], &uv_swap ); @@ -1898,9 +1880,9 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, SAA_texture2DGetVOffset( scene, &textures[i], &vOffset[i] ); if ( verbose >= 2 ) - { + { fprintf(outStream, "tritex[%d] uScale: %f vScale: %f\n", i, uScale[i], vScale[i] ); - fprintf(outStream, " uOffset: %f vOffset: %f\n", + fprintf(outStream, " uOffset: %f vOffset: %f\n", uOffset[i], vOffset[i] ); } @@ -1914,9 +1896,9 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, uRepeat, vRepeat ); } } - else + else { - if ( verbose >= 2 ) + if ( verbose >= 2 ) { fprintf( outStream, "Invalid texture...\n"); fprintf( outStream, " tritex[%d] named: (null)\n", i ); @@ -1928,7 +1910,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, //for ( i = 0; i < numTri; i++ ) //{ //if ( texNameArray[i] != NULL ) - //fprintf( outStream, " tritex[%d] named: %s\n", i, + //fprintf( outStream, " tritex[%d] named: %s\n", i, //texNameArray[i] ); //else //fprintf( outStream, " tritex[%d] named: (null)\n", i ); @@ -1941,8 +1923,8 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, // check to see if texture is present SAA_elementIsValid( scene, textures, &valid ); - - // texture present - get the name and uv info + + // texture present - get the name and uv info if ( valid ) { SAA_texture2DGetUVSwap( scene, textures, &uv_swap ); @@ -1952,19 +1934,19 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, fprintf( outStream, " swapping u and v...\n" ); // allocate arrays for u & v coords - uCoords = (float *)malloc(sizeof(float)*numTri*numTexGlb*3); - vCoords = (float *)malloc(sizeof(float)*numTri*numTexGlb*3); + uCoords = (float *)malloc(sizeof(float)*numTri*numTexGlb*3); + vCoords = (float *)malloc(sizeof(float)*numTri*numTexGlb*3); for ( i = 0; i < numTri*numTexGlb*3; i++ ) { uCoords[i] = vCoords[i] = 0.0f; - } - + } + // read the u & v coords into the arrays if ( uCoords != NULL && vCoords != NULL) { - SAA_triCtrlVertexGetGlobalUVTxtCoords( scene, model, - numTri*3, cvertices, numTexGlb, textures, + SAA_triCtrlVertexGetGlobalUVTxtCoords( scene, model, + numTri*3, cvertices, numTexGlb, textures, uCoords, vCoords ); } else @@ -1973,17 +1955,17 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, if ( verbose >= 2 ) { for ( i=0; i= 1 ) - fprintf( outStream, " global tex named: %s\n", + if ( verbose >= 1 ) + fprintf( outStream, " global tex named: %s\n", texNameArray ); - + // allocate arrays of texture info uScale = ( float *)malloc(sizeof(float)); vScale = ( float *)malloc(sizeof(float)); @@ -1995,11 +1977,11 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, SAA_texture2DGetUOffset( scene, textures, uOffset ); SAA_texture2DGetVOffset( scene, textures, vOffset ); - if ( verbose >= 1 ) + if ( verbose >= 1 ) { - fprintf( outStream, " global tex uScale: %f vScale: %f\n", + fprintf( outStream, " global tex uScale: %f vScale: %f\n", *uScale, *vScale ); - fprintf( outStream, " uOffset: %f vOffset: %f\n", + fprintf( outStream, " uOffset: %f vOffset: %f\n", *uOffset, *vOffset ); } @@ -2015,14 +1997,14 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, else fprintf( outStream, "Invalid texture...\n"); } - // make the egg vertex pool + // make the egg vertex pool EggVertexPool *pool = _data.CreateVertexPool( parent, name ); for ( i = 0; i < numVert; i++ ) { - pfVec3 eggVert; - pfVec3 eggNorm; - + pfVec3 eggVert; + pfVec3 eggNorm; + //convert to global coords SAA_DVector local = vertices[i]; SAA_DVector global; @@ -2060,13 +2042,13 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, } else { u = (uCoords[indexMap[i]] - uOffset[indexMap[i]/3]) / uScale[indexMap[i]/3]; - + v = 1.0f - ((vCoords[indexMap[i]] - vOffset[indexMap[i]/3]) / vScale[indexMap[i]/3]); } - + if ( isNum(u) && isNum(v) ) - { + { if ( uv_swap == TRUE ) pool->Vertex(i)->attrib.SetUV( v, u ); else @@ -2076,7 +2058,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, else if ( numTexGlb && (uCoords != NULL && vCoords !=NULL ) ) { float u, v; - + if ( ignore_tex_offsets ) { u = uCoords[indexMap[i]]; v = 1.0f - vCoords[indexMap[i]]; @@ -2086,15 +2068,14 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, } if ( isNum(u) && isNum(v) ) - { + { if ( uv_swap == TRUE ) pool->Vertex(i)->attrib.SetUV( v, u ); else pool->Vertex(i)->attrib.SetUV( u, v ); } - } - + // if we've encountered textures and we desire duv anims if (( numTexLoc || numTexGlb ) && make_duv ) { @@ -2102,13 +2083,13 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, SAA_Elem *tex; // grab the current texture - if ( numTexLoc ) + if ( numTexLoc ) tex = &textures[0]; else tex = textures; // find how many expressions for this shape - SAA_elementGetNbExpressions( scene, tex, NULL, FALSE, + SAA_elementGetNbExpressions( scene, tex, NULL, FALSE, &numExp ); // if it has expressions we'll assume its animated @@ -2129,23 +2110,23 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, // make sure root morph table exists if ( morphRoot == NULL ) - morphRoot = animData.CreateTable( animRoot, - "morph" ); + morphRoot = animData.CreateTable( animRoot, + "morph" ); // create morph table entry for each duv - SAnimTable *uTable = new SAnimTable( ); + SAnimTable *uTable = new SAnimTable( ); uTable->name = uName.str(); uTable->fps = anim_rate; morphRoot->children.push_back( uTable ); if ( verbose >= 1 ) - fprintf( outStream, "created duv table named: %s\n", uName.str() ); + fprintf( outStream, "created duv table named: %s\n", uName.str() ); - SAnimTable *vTable = new SAnimTable( ); + SAnimTable *vTable = new SAnimTable( ); vTable->name = vName.str(); vTable->fps = anim_rate; morphRoot->children.push_back( vTable ); if ( verbose >= 1 ) - fprintf( outStream, "created duv table named: %s\n", vName.str() ); + fprintf( outStream, "created duv table named: %s\n", vName.str() ); float texOffsets[4]; @@ -2165,7 +2146,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, } // remember original texture offsets future reference - SAA_elementSetUserData( scene, model, "TEX_OFFSETS", + SAA_elementSetUserData( scene, model, "TEX_OFFSETS", sizeof( texOffsets ), TRUE, (void **)&texOffsets ); } @@ -2173,10 +2154,10 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, EggMorphOffset *duvV; // generate base duv's for this vertex - duvU = new EggMorphOffset( uName.str(), 1.0 , 0.0 ); + duvU = new EggMorphOffset( uName.str(), 1.0 , 0.0 ); pool->Vertex(i)->attrib.uv_morphs.push_back( *duvU ); - - duvV = new EggMorphOffset( vName.str(), 0.0 , 1.0 ); + + duvV = new EggMorphOffset( vName.str(), 0.0 , 1.0 ); pool->Vertex(i)->attrib.uv_morphs.push_back( *duvV ); } // if ( numExp ) @@ -2187,7 +2168,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, // if model has key shapes, generate vertex offsets if ( has_morph && make_morph ) - MakeVertexOffsets( scene, model, type, numShapes, numVert, + MakeVertexOffsets( scene, model, type, numShapes, numVert, vertices, matrix, name ); @@ -2212,7 +2193,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, //lastJoint->vrefs.AddUniqueNode( *vref ); //if ( verbose >= 1 ) - //fprintf( outStream, "hard-skinning %s (%d vertices)\n", + //fprintf( outStream, "hard-skinning %s (%d vertices)\n", //name, i+1 ); //} //} @@ -2248,12 +2229,12 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, if ( strstr( modelNoteStr, "bface" ) != NULL ) poly->flags |= EG_BFACE; } - + // check to see if material is present SAA_Boolean valid; SAA_elementIsValid( scene, &materials[i/3], &valid ); - // material present - get the color + // material present - get the color if ( valid ) { SAA_materialGetDiffuse( scene, &materials[i/3], &r, &g, &b ); @@ -2277,14 +2258,14 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, { // append unique identifier to texname for // this particular object - uniqueTexName << name << "-" + uniqueTexName << name << "-" << RemovePathName(texNameArray[i/3]); - tref = _data.CreateTexture( texNameArray[i/3], - uniqueTexName.str() ); + tref = _data.CreateTexture( texNameArray[i/3], + uniqueTexName.str() ); if ( verbose >= 1 ) - fprintf( outStream, " tritex[%d] named: %s\n", i/3, + fprintf( outStream, " tritex[%d] named: %s\n", i/3, texNameArray[i/3] ); } } @@ -2297,7 +2278,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, uniqueTexName << name << "-" << RemovePathName(*texNameArray); - tref = _data.CreateTexture( *texNameArray, + tref = _data.CreateTexture( *texNameArray, uniqueTexName.str() ); if ( verbose >= 1 ) @@ -2352,10 +2333,8 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, } else { - /////////////////////////////////////// // check to see if its a nurbs surface - /////////////////////////////////////// - if ( (type == SAA_MNSRF) && ( visible ) && (( make_nurbs ) + if ( (type == SAA_MNSRF) && ( visible ) && (( make_nurbs ) || ( !make_nurbs && !make_poly && make_duv )) ) { // check to see if NURBS is also skeleton... @@ -2384,35 +2363,35 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, eggNurbsSurf->v_order = vDegree + 1; if ( verbose >= 1 ) { - fprintf( outStream, "nurbs degree: %d u, %d v\n", + fprintf( outStream, "nurbs degree: %d u, %d v\n", uDegree, vDegree ); - fprintf( outStream, "nurbs order: %d u, %d v\n", + fprintf( outStream, "nurbs order: %d u, %d v\n", uDegree + 1, vDegree + 1 ); } SAA_Boolean uClosed = FALSE; SAA_Boolean vClosed = FALSE; - SAA_nurbsSurfaceGetClosed( scene, model, &uClosed, &vClosed); + SAA_nurbsSurfaceGetClosed( scene, model, &uClosed, &vClosed); if ( verbose >= 1 ) - { + { if ( uClosed ) fprintf( outStream, "nurbs is closed in u...\n"); if ( vClosed ) fprintf( outStream, "nurbs is closed in v...\n"); - } - + } + int uRows, vRows; SAA_nurbsSurfaceGetNbVertices( scene, model, &uRows, &vRows ); if ( verbose >= 1 ) - fprintf( outStream, "nurbs vertices: %d u, %d v\n", + fprintf( outStream, "nurbs vertices: %d u, %d v\n", uRows, vRows ); - + int uCurves, vCurves; SAA_nurbsSurfaceGetNbCurves( scene, model, &uCurves, &vCurves ); if ( verbose >= 1 ) - fprintf( outStream, "nurbs curves: %d u, %d v\n", + fprintf( outStream, "nurbs curves: %d u, %d v\n", uCurves, vCurves ); if ( shift_textures ) @@ -2436,28 +2415,28 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, if ( strstr( modelNoteStr, "bface" ) != NULL ) eggNurbsSurf->flags |= EG_BFACE; } - + int numKnotsU, numKnotsV; - + SAA_nurbsSurfaceGetNbKnots( scene, model, &numKnotsU, &numKnotsV ); if ( verbose >= 1 ) - fprintf( outStream, "nurbs knots: %d u, %d v\n", + fprintf( outStream, "nurbs knots: %d u, %d v\n", numKnotsU, numKnotsV ); - double *knotsU, *knotsV; + double *knotsU, *knotsV; knotsU = (double *)malloc(sizeof(double)*numKnotsU); knotsV = (double *)malloc(sizeof(double)*numKnotsV); - SAA_nurbsSurfaceGetKnots( scene, model, gtype, 0, + SAA_nurbsSurfaceGetKnots( scene, model, gtype, 0, numKnotsU, numKnotsV, knotsU, knotsV ); if ( verbose >= 2 ) fprintf( outStream, "u knots:\n" ); - AddKnots( eggNurbsSurf->u_knots, knotsU, numKnotsU, uClosed, uDegree ); + AddKnots( eggNurbsSurf->u_knots, knotsU, numKnotsU, uClosed, uDegree ); if ( verbose >= 2 ) fprintf( outStream, "v knots:\n" ); - AddKnots( eggNurbsSurf->v_knots, knotsV, numKnotsV, vClosed, vDegree); + AddKnots( eggNurbsSurf->v_knots, knotsV, numKnotsV, vClosed, vDegree); //free( knotsU ); //free( knotsV ); @@ -2467,16 +2446,16 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, eggNurbsSurf->v_subdiv = (vRows-1)*nurbs_step; SAA_modelGetNbVertices( scene, model, &numVert ); - - if ( verbose >= 2 ) - fprintf( outStream, "%d CV's\n", numVert ); + + if ( verbose >= 2 ) + fprintf( outStream, "%d CV's\n", numVert ); // get the CV's vertices = (SAA_DVector *)malloc(sizeof(SAA_DVector)*numVert); SAA_modelGetVertices( scene, model, gtype, 0, numVert, vertices ); - // create pool of NURBS vertices + // create pool of NURBS vertices EggVertexPool *pool = _data.CreateVertexPool( parent, name ); eggNurbsSurf->SetVertexPool( pool ); @@ -2489,8 +2468,8 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, { if ( verbose >= 2 ) { - fprintf( outStream, "original cv[%d] = %f %f %f %f\n", k, - vertices[k].x, vertices[k].y, vertices[k].z, + fprintf( outStream, "original cv[%d] = %f %f %f %f\n", k, + vertices[k].x, vertices[k].y, vertices[k].z, vertices[k].w ); } @@ -2521,48 +2500,48 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, //if ( verbose >= 2 ) //{ - //fprintf( outStream, "global cv[%d] = %f %f %f %f\n", k, - //vertices[k].x, vertices[k].y, vertices[k].z, + //fprintf( outStream, "global cv[%d] = %f %f %f %f\n", k, + //vertices[k].x, vertices[k].y, vertices[k].z, //vertices[k].w ); //} - //eggVert.set( vertices[k].x, vertices[k].y, vertices[k].z, + //eggVert.set( vertices[k].x, vertices[k].y, vertices[k].z, //vertices[k].w ); if ( verbose >= 2 ) { - fprintf( outStream, "global cv[%d] = %f %f %f %f\n", k, - global.x, global.y, global.z, + fprintf( outStream, "global cv[%d] = %f %f %f %f\n", k, + global.x, global.y, global.z, global.w ); } - eggVert.set( global.x, global.y, global.z, + eggVert.set( global.x, global.y, global.z, global.w ); // populate vertex pool pool->AddVertex( eggVert, k ); - // add vref's to NURBS info - eggNurbsSurf->AddVertex( k ); + // add vref's to NURBS info + eggNurbsSurf->AddVertex( k ); //add each vert in pool to vref for hard skinning vref->indices.push_back( EggVertexIndex( k ) ); - - // check to see if the NURB is closed in u + + // check to see if the NURB is closed in u if ( uClosed ) { // add first uDegree verts to end of row if ( (k % uRows) == ( uRows - 1) ) - for ( int i = 0; i < uDegree; i++ ) + for ( int i = 0; i < uDegree; i++ ) { - // add vref's to NURBS info - eggNurbsSurf->AddVertex( i+((k/uRows)*uRows) ); + // add vref's to NURBS info + eggNurbsSurf->AddVertex( i+((k/uRows)*uRows) ); - //add each vert to vref - vref->indices.push_back( + //add each vert to vref + vref->indices.push_back( EggVertexIndex( i+((k/uRows)*uRows) ) ); } - } + } } // if hard skinned or this nurb is also a joint @@ -2571,30 +2550,30 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, // all hard skinning now done in CleanUpSoftSkin. //if (!make_soft || geom_as_joint) //{ - //add the new cv references to the last - //joint for hard skinning only + //add the new cv references to the last + //joint for hard skinning only //if ( lastJoint != NULL ) //{ //lastJoint->vrefs.AddUniqueNode( *vref ); - //geom_as_joint = 0; - //if ( verbose >= 1 ) + //geom_as_joint = 0; + //if ( verbose >= 1 ) //fprintf( outStream, "Doing NURBS hard skinning...\n"); //} //} - // check to see if the NURB is closed in v + // check to see if the NURB is closed in v if ( vClosed && !uClosed ) { // add first vDegree rows of verts to end of list - for ( int i = 0; i < vDegree*uRows; i++ ) - eggNurbsSurf->AddVertex( i ); + for ( int i = 0; i < vDegree*uRows; i++ ) + eggNurbsSurf->AddVertex( i ); } - // check to see if the NURB is closed in u and v + // check to see if the NURB is closed in u and v else if ( vClosed && uClosed ) { // add the first (degree) v verts and a few // extra - for good measure - for ( i = 0; i < vDegree; i++ ) + for ( i = 0; i < vDegree; i++ ) { // add first vDegree rows of verts to end of list for ( j = 0; j < uRows; j++ ) @@ -2614,10 +2593,10 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, pfVec4 nurbColor; SAA_modelRelationGetMatNbElements( scene, model, FALSE, &relinfo, - &numNurbMats ); + &numNurbMats ); if ( verbose >= 1 ) - fprintf( outStream, "nurbs surf has %d materials\n", + fprintf( outStream, "nurbs surf has %d materials\n", numNurbMats ); if ( numNurbMats ) @@ -2625,9 +2604,9 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, float r,g,b,a; materials = (SAA_Elem *)malloc(sizeof(SAA_Elem)*numNurbMats); - - SAA_modelRelationGetMatElements( scene, model, relinfo, - numNurbMats, materials ); + + SAA_modelRelationGetMatElements( scene, model, relinfo, + numNurbMats, materials ); SAA_materialGetDiffuse( scene, &materials[0], &r, &g, &b ); SAA_materialGetTransparency( scene, &materials[0], &a ); @@ -2636,7 +2615,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, nurbCref = _data.CreateColor(nurbColor); eggNurbsSurf->attrib.SetCRef(nurbCref); - + //get the texture of the NURBS surface from the material int numNurbTexLoc = 0; int numNurbTexGlb = 0; @@ -2653,12 +2632,12 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, if ( numNurbTexLoc ) { if ( verbose >= 1 ) - fprintf( outStream, "%s had %d local tex\n", name, + fprintf( outStream, "%s had %d local tex\n", name, numNurbTexLoc ); // get the referenced texture SAA_materialRelationGetT2DLocElements( scene, &materials[0], - TEX_PER_MAT, &nurbTex ); + TEX_PER_MAT, &nurbTex ); } // if no locals, try to get globals @@ -2670,17 +2649,17 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, if ( numNurbTexGlb ) { if ( verbose >= 1 ) - fprintf( outStream, "%s had %d global tex\n", name, + fprintf( outStream, "%s had %d global tex\n", name, numNurbTexGlb ); // get the referenced texture - SAA_modelRelationGetT2DGlbElements( scene, - model, TEX_PER_MAT, &nurbTex ); + SAA_modelRelationGetT2DGlbElements( scene, + model, TEX_PER_MAT, &nurbTex ); } } // add tex ref's if we found any textures - if ( numNurbTexLoc || numNurbTexGlb) + if ( numNurbTexLoc || numNurbTexGlb) { char *texName = NULL; char *uniqueTexName = NULL; @@ -2688,19 +2667,19 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, pfMatrix nurbTexMat; - // convert the texture to .rgb and adjust name + // convert the texture to .rgb and adjust name texName = ConvertTexture( scene, &nurbTex ); // append unique identifier to texname for // this particular object uniqueTexName = (char *)malloc(sizeof(char)* (strlen(name)+strlen(texName)+3) ); - sprintf( uniqueTexName, "%s-%s", name, + sprintf( uniqueTexName, "%s-%s", name, RemovePathName(texName) ); if ( verbose >= 1 ) { - fprintf( outStream, "creating tref %s\n", + fprintf( outStream, "creating tref %s\n", uniqueTexName ); } @@ -2756,15 +2735,15 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, //call printMat if ( verbose >= 2 ) - { + { fprintf( outStream, "nurb tex matrix = %f %f %f %f\n", nurbTexMat[0][0], - nurbTexMat[0][1], nurbTexMat[0][2], nurbTexMat[0][3] ); + nurbTexMat[0][1], nurbTexMat[0][2], nurbTexMat[0][3] ); fprintf( outStream, "nurb tex matrix = %f %f %f %f\n", nurbTexMat[1][0], - nurbTexMat[1][1], nurbTexMat[1][2], nurbTexMat[1][3] ); + nurbTexMat[1][1], nurbTexMat[1][2], nurbTexMat[1][3] ); fprintf( outStream, "nurb tex matrix = %f %f %f %f\n", nurbTexMat[2][0], - nurbTexMat[2][1], nurbTexMat[2][2], nurbTexMat[2][3] ); + nurbTexMat[2][1], nurbTexMat[2][2], nurbTexMat[2][3] ); fprintf( outStream, "nurb tex matrix = %f %f %f %f\n", nurbTexMat[3][0], - nurbTexMat[3][1], nurbTexMat[3][2], nurbTexMat[3][3] ); + nurbTexMat[3][1], nurbTexMat[3][2], nurbTexMat[3][3] ); } @@ -2781,7 +2760,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, int numExp; // find how many expressions for this shape - SAA_elementGetNbExpressions( scene, &nurbTex, NULL, FALSE, + SAA_elementGetNbExpressions( scene, &nurbTex, NULL, FALSE, &numExp ); // if it has expressions we'll assume its animated @@ -2800,23 +2779,23 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, // make sure root morph table exists if ( morphRoot == NULL ) - morphRoot = animData.CreateTable( animRoot, - "morph" ); + morphRoot = animData.CreateTable( animRoot, + "morph" ); // create morph table entry for each duv - SAnimTable *uTable = new SAnimTable( ); + SAnimTable *uTable = new SAnimTable( ); uTable->name = uName.str(); uTable->fps = anim_rate; morphRoot->children.push_back( uTable ); if ( verbose >= 1 ) - fprintf( outStream, "created duv table named: %s\n", uName.str() ); + fprintf( outStream, "created duv table named: %s\n", uName.str() ); - SAnimTable *vTable = new SAnimTable( ); + SAnimTable *vTable = new SAnimTable( ); vTable->name = vName.str(); vTable->fps = anim_rate; morphRoot->children.push_back( vTable ); if ( verbose >= 1 ) - fprintf( outStream, "created duv table named: %s\n", vName.str() ); + fprintf( outStream, "created duv table named: %s\n", vName.str() ); float texOffsets[4]; @@ -2826,10 +2805,10 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, texOffsets[3] = *vScale; // remember original texture offsets future reference - SAA_elementSetUserData( scene, model, "TEX_OFFSETS", + SAA_elementSetUserData( scene, model, "TEX_OFFSETS", sizeof( texOffsets ), TRUE, (void **)&texOffsets ); - // create UV's and duv's for each vertex + // create UV's and duv's for each vertex for( i = 0; i < numVert; i++ ) { pfVec2 tmpUV; @@ -2839,12 +2818,12 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, //create uv's so we can store duv's eggNurbsSurf->CalcActualUV( i, tmpUV ); pool->Vertex(i)->attrib.SetUV( tmpUV[0], tmpUV[1] ); - + // generate base duv's for this vertex - duvU = new EggMorphOffset(uName.str(), 1.0 , 0.0); + duvU = new EggMorphOffset(uName.str(), 1.0 , 0.0); pool->Vertex(i)->attrib.uv_morphs.push_back(*duvU); - - duvV = new EggMorphOffset(vName.str(), 0.0 , 1.0); + + duvV = new EggMorphOffset(vName.str(), 0.0 , 1.0); pool->Vertex(i)->attrib.uv_morphs.push_back(*duvV); } @@ -2860,22 +2839,20 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, } else { - // no material present - default to white + // no material present - default to white nurbColor.set( 1.0, 1.0, 1.0, 1.0 ); } - ////////////////////////////////////////// // check NURBS surface for trim curves - ////////////////////////////////////////// int numTrims; bool isTrim = TRUE; SAA_SubElem *trims; - + SAA_nurbsSurfaceGetNbTrimCurves( scene, model, SAA_TRIMTYPE_TRIM, &numTrims ); if ( verbose >= 1 ) - fprintf( outStream, "nurbs surf has %d trim curves\n", + fprintf( outStream, "nurbs surf has %d trim curves\n", numTrims ); if ( numTrims) @@ -2884,27 +2861,25 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, if ( trims ) { - SAA_nurbsSurfaceGetTrimCurves( scene, model, - gtype, 0, SAA_TRIMTYPE_TRIM, numTrims, + SAA_nurbsSurfaceGetTrimCurves( scene, model, + gtype, 0, SAA_TRIMTYPE_TRIM, numTrims, trims ); - MakeSurfaceCurve( scene, model, parent, eggNurbsSurf, + MakeSurfaceCurve( scene, model, parent, eggNurbsSurf, numTrims, trims, isTrim ); } //free( trims ); } - ////////////////////////////////////////// // check NURBS surface for surface curves - ////////////////////////////////////////// isTrim = FALSE; - SAA_nurbsSurfaceGetNbTrimCurves( scene, model, + SAA_nurbsSurfaceGetNbTrimCurves( scene, model, SAA_TRIMTYPE_PROJECTION, &numTrims ); if ( verbose >= 1 ) - fprintf( outStream, "nurbs surf has %d surface curves\n", + fprintf( outStream, "nurbs surf has %d surface curves\n", numTrims ); if ( numTrims) @@ -2913,11 +2888,11 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, if ( trims ) { - SAA_nurbsSurfaceGetTrimCurves( scene, model, - gtype, 0, SAA_TRIMTYPE_PROJECTION, + SAA_nurbsSurfaceGetTrimCurves( scene, model, + gtype, 0, SAA_TRIMTYPE_PROJECTION, numTrims, trims ); - MakeSurfaceCurve( scene, model, parent, eggNurbsSurf, + MakeSurfaceCurve( scene, model, parent, eggNurbsSurf, numTrims, trims, isTrim ); } @@ -2925,25 +2900,24 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, } // push the NURBS into the egg data - parent->children.push_back( eggNurbsSurf ); + parent->children.push_back( eggNurbsSurf ); // if model has key shapes, generate vertex offsets if ( has_morph && make_morph ) - MakeVertexOffsets( scene, model, type, numShapes, numVert, + MakeVertexOffsets( scene, model, type, numShapes, numVert, vertices, matrix, name ); //free( vertices ); } - ///////////////////////////////////// + // check to see if its a NURBS curve - ///////////////////////////////////// else if ( (type == SAA_MNCRV) && ( visible ) && ( make_nurbs ) ) { // ignore for now // make the NURBS curve and push it into the egg data - //parent->children.push_back( MakeNurbsCurve( scene, model, parent, + //parent->children.push_back( MakeNurbsCurve( scene, model, parent, //matrix, name ) ); } else if ( type == SAA_MJNT ) @@ -2952,13 +2926,12 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, if ( verbose >= 1 ) fprintf( outStream, "encountered IK joint: %s\n", name ); } - ///////////////////// + // it must be a NULL - ///////////////////// - else + else { SAA_AlgorithmType algo; - + SAA_modelGetAlgorithm( scene, model, &algo ); if ( verbose >= 1 ) fprintf( outStream, "null algorithm: %d\n", algo ); @@ -2994,11 +2967,10 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, if ( verbose >= 1 ) fprintf( outStream, "animating Standard null!!!\n" ); } - } else if ( verbose >= 1 ) - fprintf( outStream, "encountered some other NULL: %d\n", + fprintf( outStream, "encountered some other NULL: %d\n", algo ); } } @@ -3023,7 +2995,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, { if ( verbose >= 1 ) fprintf( outStream, "\negging child %d...\n", thisChild); - MakeEgg( parent, lastJoint, lastAnim, scene, + MakeEgg( parent, lastJoint, lastAnim, scene, &children[thisChild] ); } } @@ -3036,7 +3008,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, else if ( verbose >= 1 ) fprintf( outStream, "Don't descend this branch!\n" ); - + // we are done for the most part - start cleaning up memory //free( name ); } @@ -3044,12 +3016,12 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, //////////////////////////////////////////////////////////////////// // Function: MakeSurfaceCurve -// Access: Public +// Access: Public // Description: Given a scene and lists of u and v samples create a -// an egg NURBS curve of degree two from the samples +// an egg NURBS curve of degree two from the samples //////////////////////////////////////////////////////////////////// void soft2egg:: -MakeSurfaceCurve( SAA_Scene *scene, SAA_Elem *model, EggGroup *parent, +MakeSurfaceCurve( SAA_Scene *scene, SAA_Elem *model, EggGroup *parent, EggNurbsSurface *&nurbsSurf, int numTrims, SAA_SubElem *trims, bool isTrim ) { @@ -3081,12 +3053,12 @@ MakeSurfaceCurve( SAA_Scene *scene, SAA_Elem *model, EggGroup *parent, vSamples = (double *)malloc(sizeof(double)*totalSamples); SAA_surfaceCurveGetLinearSamples( scene, model, numTrims, trims, - numSamples, uSamples, vSamples ); + numSamples, uSamples, vSamples ); if ( verbose >= 2 ) for ( long li = 0; li < totalSamples; li++ ) - fprintf( outStream, "master list cv[%ld] = %f, %f\n", li, - uSamples[li], vSamples[li] ); + fprintf( outStream, "master list cv[%ld] = %f, %f\n", li, + uSamples[li], vSamples[li] ); trimCurves = (SAA_Elem *)malloc(sizeof(SAA_Elem)*numTrims); @@ -3095,7 +3067,7 @@ MakeSurfaceCurve( SAA_Scene *scene, SAA_Elem *model, EggGroup *parent, // if it's a trim create a trim to assign trim curves to EggNurbsSurface::Trim *eggTrim = new EggNurbsSurface::Trim(); - // for each trim curve, make an egg curve and + // for each trim curve, make an egg curve and // add it to the trims of the NURBS surface for ( i = 0; i < numTrims; i++ ) { @@ -3114,14 +3086,14 @@ MakeSurfaceCurve( SAA_Scene *scene, SAA_Elem *model, EggGroup *parent, { // add to trim list EggNurbsSurface::Loop *eggLoop = new EggNurbsSurface::Loop(); - eggLoop->push_back( MakeUVNurbsCurve( i, numSamples, uSamples, + eggLoop->push_back( MakeUVNurbsCurve( i, numSamples, uSamples, vSamples, parent, name ) ); eggTrim->push_back( *eggLoop ); } else // add to curve list nurbsSurf->curves.push_back( MakeUVNurbsCurve( i, numSamples, uSamples, vSamples, parent, name ) ); - } + } if ( isTrim ) // pus trim list onto trims list @@ -3135,12 +3107,12 @@ MakeSurfaceCurve( SAA_Scene *scene, SAA_Elem *model, EggGroup *parent, //////////////////////////////////////////////////////////////////// // Function: MakeUVNurbsCurve -// Access: Public +// Access: Public // Description: Given a scene and lists of u and v samples create a -// an egg NURBS curve of degree two from the samples +// an egg NURBS curve of degree two from the samples //////////////////////////////////////////////////////////////////// EggNurbsCurve *soft2egg:: -MakeUVNurbsCurve( int numCurve, long *numSamples, double *uSamples, +MakeUVNurbsCurve( int numCurve, long *numSamples, double *uSamples, double *vSamples, EggGroup *parent, char *name ) { EggNurbsCurve *eggNurbsCurve = new EggNurbsCurve( name ); @@ -3154,9 +3126,9 @@ MakeUVNurbsCurve( int numCurve, long *numSamples, double *uSamples, //set sub_div so we can see it in perfly //eggNurbsCurve->subdiv = numSamples[numCurve]/4; // perfly chokes on big numbers - keep it reasonable - eggNurbsCurve->subdiv = 150; + eggNurbsCurve->subdiv = 150; - //create pool of NURBS vertices + //create pool of NURBS vertices EggVertexPool *pool = _data.CreateVertexPool( parent, name ); eggNurbsCurve->SetVertexPool( pool ); @@ -3166,7 +3138,7 @@ MakeUVNurbsCurve( int numCurve, long *numSamples, double *uSamples, for ( int o = 0; o < numCurve; o++ ) offset += numSamples[o]; - + for ( int k = 0; k= 2 ) - fprintf( outStream, "cv[%d] = %f %f %f\n", k, eggVert[0], - eggVert[1], eggVert[2] ); + fprintf( outStream, "cv[%d] = %f %f %f\n", k, eggVert[0], + eggVert[1], eggVert[2] ); //populate vertex pool pool->AddVertex( eggVert, k ); - //add vref's to NURBS info - eggNurbsCurve->AddVertex( k ); + //add vref's to NURBS info + eggNurbsCurve->AddVertex( k ); } // create numSamples[numCurve]+2 knots @@ -3204,12 +3176,12 @@ MakeUVNurbsCurve( int numCurve, long *numSamples, double *uSamples, //////////////////////////////////////////////////////////////////// // Function: MakeNurbsCurve -// Access: Public +// Access: Public // Description: Given a scene and a NURBS curve model create the -// the appropriate egg structures +// the appropriate egg structures //////////////////////////////////////////////////////////////////// EggNurbsCurve *soft2egg:: -MakeNurbsCurve( SAA_Scene *scene, SAA_Elem *model, EggGroup *parent, +MakeNurbsCurve( SAA_Scene *scene, SAA_Elem *model, EggGroup *parent, float matrix[4][4], char *name ) { EggNurbsCurve *eggNurbsCurve = new EggNurbsCurve( name ); @@ -3223,24 +3195,24 @@ MakeNurbsCurve( SAA_Scene *scene, SAA_Elem *model, EggGroup *parent, eggNurbsCurve->order = degree + 1; if ( verbose >= 2 ) fprintf( outStream, "nurbs curve order: %d\n", degree + 1 ); - + SAA_nurbsCurveSetStep( scene, model, nurbs_step ); SAA_Boolean closed = FALSE; - SAA_nurbsCurveGetClosed( scene, model, &closed ); + SAA_nurbsCurveGetClosed( scene, model, &closed ); if ( closed ) if ( verbose >= 2 ) fprintf( outStream, "nurbs curve is closed...\n"); int numKnots; - + SAA_nurbsCurveGetNbKnots( scene, model, &numKnots ); if ( verbose >= 2 ) fprintf( outStream, "nurbs curve knots: %d\n", numKnots ); - double *knots; + double *knots; knots = (double *)malloc(sizeof(double)*numKnots); - SAA_nurbsCurveGetKnots( scene, model, SAA_GEOM_ORIGINAL, 0, + SAA_nurbsCurveGetKnots( scene, model, SAA_GEOM_ORIGINAL, 0, numKnots, knots ); AddKnots( eggNurbsCurve->knots, knots, numKnots, closed, degree ); @@ -3262,7 +3234,7 @@ MakeNurbsCurve( SAA_Scene *scene, SAA_Elem *model, EggGroup *parent, SAA_modelGetVertices( scene, model, SAA_GEOM_ORIGINAL, 0, numCV, cvArray ); - //create pool of NURBS vertices + //create pool of NURBS vertices EggVertexPool *pool = _data.CreateVertexPool( parent, name ); eggNurbsCurve->SetVertexPool( pool ); @@ -3285,8 +3257,8 @@ MakeNurbsCurve( SAA_Scene *scene, SAA_Elem *model, EggGroup *parent, //populate vertex pool pool->AddVertex( eggVert, k ); - //add vref's to NURBS info - eggNurbsCurve->AddVertex( k ); + //add vref's to NURBS info + eggNurbsCurve->AddVertex( k ); } if ( closed ) @@ -3296,7 +3268,7 @@ MakeNurbsCurve( SAA_Scene *scene, SAA_Elem *model, EggGroup *parent, { eggNurbsCurve->AddVertex( k ); if ( verbose >= 2 ) - fprintf( outStream, "adding cv[%d] = %f %f %f %f\n", k, + fprintf( outStream, "adding cv[%d] = %f %f %f %f\n", k, cvArray[k].x, cvArray[k].y, cvArray[k].z, cvArray[k].w ); } } @@ -3316,26 +3288,26 @@ MakeNurbsCurve( SAA_Scene *scene, SAA_Elem *model, EggGroup *parent, //////////////////////////////////////////////////////////////////// // Function: AddKnots -// Access: Public +// Access: Public // Description: Given a parametric surface, and its knots, create -// the appropriate egg structure by filling in Soft's -// implicit knots and assigning the rest to eggKnots. +// the appropriate egg structure by filling in Soft's +// implicit knots and assigning the rest to eggKnots. //////////////////////////////////////////////////////////////////// void soft2egg:: -AddKnots( perf_vector &eggKnots, double *knots, int numKnots, - SAA_Boolean closed, int degree ) +AddKnots( perf_vector &eggKnots, double *knots, int numKnots, + SAA_Boolean closed, int degree ) { int k = 0; double lastKnot = knots[0]; double *newKnots; // add initial implicit knot(s) - if ( closed ) + if ( closed ) { int i = 0; newKnots = (double *)malloc(sizeof(double)*degree); - // need to add (degree) number of knots + // need to add (degree) number of knots for ( k = numKnots - 1; k >= numKnots - degree; k-- ) { // we have to know these in order to calculate @@ -3348,7 +3320,7 @@ AddKnots( perf_vector &eggKnots, double *knots, int numKnots, { eggKnots.push_back( newKnots[k] ); if ( verbose >= 2 ) - fprintf( outStream, "knots[%d] = %f\n", k, newKnots[k] ); + fprintf( outStream, "knots[%d] = %f\n", k, newKnots[k] ); } //free( newKnots ); @@ -3357,7 +3329,7 @@ AddKnots( perf_vector &eggKnots, double *knots, int numKnots, { eggKnots.push_back( knots[k] ); if ( verbose >= 2 ) - fprintf( outStream, "knots[%d] = %f\n", k, knots[k] ); + fprintf( outStream, "knots[%d] = %f\n", k, knots[k] ); } // add the regular complement of knots @@ -3365,22 +3337,22 @@ AddKnots( perf_vector &eggKnots, double *knots, int numKnots, { eggKnots.push_back( knots[k] ); if ( verbose >= 2 ) - fprintf( outStream, "knots[%d] = %f\n", k+1, knots[k] ); + fprintf( outStream, "knots[%d] = %f\n", k+1, knots[k] ); } lastKnot = knots[numKnots-1]; // add trailing implicit knots - if ( closed ) + if ( closed ) { - // need to add (degree) number of knots + // need to add (degree) number of knots for ( k = 1; k <= degree; k++ ) { eggKnots.push_back( lastKnot + (knots[k] - knots[k-1]) ); if ( verbose >= 2 ) - fprintf( outStream, "knots[%d] = %f\n", k, - lastKnot + (knots[k] - knots[k-1]) ); + fprintf( outStream, "knots[%d] = %f\n", k, + lastKnot + (knots[k] - knots[k-1]) ); lastKnot = lastKnot + (knots[k] - knots[k-1]); } } @@ -3388,18 +3360,18 @@ AddKnots( perf_vector &eggKnots, double *knots, int numKnots, { eggKnots.push_back( knots[k-1] ); if ( verbose >= 2 ) - fprintf( outStream, "knots[%d] = %f\n", k+1, knots[k-1] ); + fprintf( outStream, "knots[%d] = %f\n", k+1, knots[k-1] ); } } //////////////////////////////////////////////////////////////////// // Function: MakeJoint -// Access: Public -// Description: Given a name, a parent and a model create a new -// a new EggJoint for that model. +// Access: Public +// Description: Given a name, a parent and a model create a new +// a new EggJoint for that model. //////////////////////////////////////////////////////////////////// void soft2egg:: -MakeJoint( SAA_Scene *scene, EggJoint *&lastJoint, AnimGroup *&lastAnim, +MakeJoint( SAA_Scene *scene, EggJoint *&lastJoint, AnimGroup *&lastAnim, SAA_Elem *model, char *name ) { float matrix[4][4]; @@ -3416,7 +3388,7 @@ MakeJoint( SAA_Scene *scene, EggJoint *&lastJoint, AnimGroup *&lastAnim, { if ( strstr( lastJoint->name.Str(), "scale" ) != NULL ) { - scale_joint = 1; + scale_joint = 1; if ( verbose >= 1 ) fprintf( outStream, "scale joint flag set!\n" ); } @@ -3456,7 +3428,7 @@ MakeJoint( SAA_Scene *scene, EggJoint *&lastJoint, AnimGroup *&lastAnim, Matrix[3][2] = matrix[3][2]; Matrix[3][3] = matrix[3][3]; - joint = _data.CreateJoint( lastJoint, name ); + joint = _data.CreateJoint( lastJoint, name ); joint->transform = Matrix; } // if we already have a root attach this joint to it @@ -3494,13 +3466,13 @@ MakeJoint( SAA_Scene *scene, EggJoint *&lastJoint, AnimGroup *&lastAnim, if ( verbose >= 1 ) fprintf( outStream, "attaching orphan chain to root\n" ); - joint = _data.CreateJoint( rootJnt, name ); + joint = _data.CreateJoint( rootJnt, name ); joint->transform = Matrix; - lastAnim = rootAnim; + lastAnim = rootAnim; } // if root, make a seperate tree for skeleton and // create required Table for the Egg heirarchy - else + else { if ( verbose >= 1 ) fprintf( outStream, "getting global transform\n" ); @@ -3537,7 +3509,7 @@ MakeJoint( SAA_Scene *scene, EggJoint *&lastJoint, AnimGroup *&lastAnim, fprintf( outStream, "setting skeleton root\n" ); rootJnt->flags |= EF_TRANSFORM; - joint = _data.CreateJoint( rootJnt, name ); + joint = _data.CreateJoint( rootJnt, name ); joint->transform = Matrix; foundRoot = TRUE; if ( verbose >= 1 ) @@ -3545,13 +3517,13 @@ MakeJoint( SAA_Scene *scene, EggJoint *&lastJoint, AnimGroup *&lastAnim, // make skeleton table AnimGroup *skeletonTable; - skeletonTable = animData.CreateTable( animRoot, "" ); - rootAnim = animData.CreateTable( skeletonTable, "root" ); - XfmSAnimTable *table = new XfmSAnimTable( ); + skeletonTable = animData.CreateTable( animRoot, "" ); + rootAnim = animData.CreateTable( skeletonTable, "root" ); + XfmSAnimTable *table = new XfmSAnimTable( ); table->name = "xform"; table->fps = anim_rate; rootAnim->children.push_back( table ); - lastAnim = rootAnim; + lastAnim = rootAnim; } joint->flags |= EF_TRANSFORM; @@ -3559,7 +3531,7 @@ MakeJoint( SAA_Scene *scene, EggJoint *&lastJoint, AnimGroup *&lastAnim, //if ( make_anim) //{ AnimGroup *anim = animData.CreateTable( lastAnim, name ); - XfmSAnimTable *table = new XfmSAnimTable( ); + XfmSAnimTable *table = new XfmSAnimTable( ); if ( verbose >= 1 ) fprintf( outStream, "created anim table: %s\n", "xform" ); table->name = "xform"; @@ -3575,10 +3547,10 @@ MakeJoint( SAA_Scene *scene, EggJoint *&lastJoint, AnimGroup *&lastAnim, //////////////////////////////////////////////////////////////////// // Function: MakeSoftSkin -// Access: Public +// Access: Public // Description: Given a skeleton part find its envelopes (if any) -// get the vertices associated with the envelopes and -// their weights and make vertex ref's for the joint +// get the vertices associated with the envelopes and +// their weights and make vertex ref's for the joint //////////////////////////////////////////////////////////////////// void soft2egg:: MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, @@ -3592,7 +3564,7 @@ MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, fprintf( outStream, "\n>found skeleton part( %s )!\n", name ); SAA_skeletonGetNbEnvelopes( scene, model, &numEnv ); - + if ( numEnv ) { // it's got envelopes - must be soft skinned @@ -3666,14 +3638,14 @@ MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, { totalEnvVertices += numEnvVertices[i]; if ( verbose >= 1 ) - fprintf( outStream, "numEnvVertices[%d] = %d\n", + fprintf( outStream, "numEnvVertices[%d] = %d\n", i, numEnvVertices[i] ); } if ( verbose >= 1 ) - fprintf( outStream, "total env verts = %d\n", - totalEnvVertices ); + fprintf( outStream, "total env verts = %d\n", + totalEnvVertices ); if ( totalEnvVertices ) { @@ -3684,7 +3656,7 @@ MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, SAA_envelopeGetCtrlVertices( scene, model, numEnv, envelopes, numEnvVertices, envVertices); - + // loop through for each envelope for ( i = 0; i < numEnv; i++ ) { @@ -3705,15 +3677,15 @@ MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, vertArrayOffset += numEnvVertices[j]; if ( verbose >= 1 ) - fprintf( outStream, - "envVertArray offset = %d\n", + fprintf( outStream, + "envVertArray offset = %d\n", vertArrayOffset ); // get the weights of the envelope vertices - SAA_ctrlVertexGetEnvelopeWeights( - scene, model, &envelopes[i], - numEnvVertices[i], - &envVertices[vertArrayOffset], weights ); + SAA_ctrlVertexGetEnvelopeWeights( + scene, model, &envelopes[i], + numEnvVertices[i], + &envVertices[vertArrayOffset], weights ); // Get the name of the envelope model if ( use_prefix ) @@ -3731,8 +3703,8 @@ MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, fprintf( outStream, "envelope name %s\n", envName ); // find out if envelope geometry is poly or nurb - //SAA_modelGetType( scene, - //FindModelByName( envName, scene, + //SAA_modelGetType( scene, + //FindModelByName( envName, scene, //models, numModels ), &type ); SAA_modelGetType( scene, &envelopes[i], &type ); @@ -3753,23 +3725,23 @@ MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, envVtxIndices = (int *)malloc(sizeof(int)*numEnvVertices[i]); // Get the envelope vertex indices - SAA_ctrlVertexGetIndices( scene, &envelopes[i], numEnvVertices[i], + SAA_ctrlVertexGetIndices( scene, &envelopes[i], numEnvVertices[i], &envVertices[vertArrayOffset], envVtxIndices ); // find out how many vertices the model has int modelNumVert; SAA_modelGetNbVertices( scene, &envelopes[i], &modelNumVert ); - + SAA_DVector *modelVertices = NULL; modelVertices = (SAA_DVector *)malloc(sizeof(SAA_DVector)*modelNumVert); // get the model vertices SAA_modelGetVertices( scene, &envelopes[i], - SAA_GEOM_ORIGINAL, 0, modelNumVert, + SAA_GEOM_ORIGINAL, 0, modelNumVert, modelVertices ); - - // create array of global model coords + + // create array of global model coords SAA_DVector *globalModelVertices = NULL; globalModelVertices = (SAA_DVector *)malloc(sizeof(SAA_DVector)*modelNumVert); float matrix[4][4]; @@ -3782,20 +3754,20 @@ MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, // populate array of global model verts for ( j = 0; j < modelNumVert; j++ ) { - _VCT_X_MAT( globalModelVertices[j], + _VCT_X_MAT( globalModelVertices[j], modelVertices[j], matrix ); } // find the egg vertex pool that corresponds // to this envelope model - EggVertexPool *envPool = + EggVertexPool *envPool = (EggVertexPool *)(_data.pools.FindName( envName )); // If we are outputting triangles: // create an array that maps from a referenced - // vertex in the envelope to a corresponding + // vertex in the envelope to a corresponding // vertex in the egg vertex pool - //if ( (type == SAA_MNSRF) && !make_nurbs ) - if ( !make_nurbs || (type == SAA_MSMSH) ) + //if ( (type == SAA_MNSRF) && !make_nurbs ) + if ( !make_nurbs || (type == SAA_MSMSH) ) { vpoolMap = FindClosestTriVert( envPool, globalModelVertices, modelNumVert ); @@ -3804,16 +3776,16 @@ MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, if ( envPool != NULL ) { - + // find the egg joint that corresponds to this model - EggJoint *joint = + EggJoint *joint = (EggJoint *)(skeleton->FindDescendent( name )); - // this doesn't seem to be necessary 4/7/99 + // this doesn't seem to be necessary 4/7/99 //EggJoint *parent = (EggJoint *)joint->parent; - //assert(parent->IsA(NT_EggJoint)); + //assert(parent->IsA(NT_EggJoint)); - // for every envelope vertex + // for every envelope vertex for (j = 0; j < numEnvVertices[i]; j++) { double scaledWeight = weights[j]/ 100.0f; @@ -3822,14 +3794,14 @@ MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, if (( envVtxIndices[j] < modelNumVert ) && ( envVtxIndices[j] >= 0 )) { - if ( (type == SAA_MNSRF) && make_nurbs ) - { + if ( (type == SAA_MNSRF) && make_nurbs ) + { // assign all referenced control vertices joint->AddVertex( envPool->Vertex(envVtxIndices[j]), scaledWeight ); if ( verbose >= 2 ) - fprintf( outStream, - "%d: adding vref to cv %d with weight %f\n", + fprintf( outStream, + "%d: adding vref to cv %d with weight %f\n", j, envVtxIndices[j], scaledWeight ); envPool->Vertex(envVtxIndices[j])->AddJoint( joint, scaledWeight ); @@ -3838,22 +3810,22 @@ MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, envPool->Vertex(envVtxIndices[j])->multipleJoints = 1; } else - { + { //assign all the tri verts associated - // with this control vertex to joint - for ( k = 0; k < envPool->NumVertices(); k++ ) + // with this control vertex to joint + for ( k = 0; k < envPool->NumVertices(); k++ ) { - if ( vpoolMap[k] == envVtxIndices[j] ) + if ( vpoolMap[k] == envVtxIndices[j] ) { - // add each vert in pool to last + // add each vert in pool to last // joint for soft skinning - joint->AddVertex(envPool->Vertex(k), + joint->AddVertex(envPool->Vertex(k), scaledWeight); if ( verbose >= 2 ) - fprintf( outStream, - "%d: adding vref from cv %d to vert %d with weight %f(vpool)\n", + fprintf( outStream, + "%d: adding vref from cv %d to vert %d with weight %f(vpool)\n", j, envVtxIndices[j], k, scaledWeight ); envPool->Vertex(k)->AddJoint( joint, scaledWeight ); @@ -3866,19 +3838,18 @@ MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, } else if ( verbose >= 2 ) - fprintf( outStream, + fprintf( outStream, "%d: Omitted vref from cv %d with weight %f (out of range 0 to %d )\n", j, envVtxIndices[j], scaledWeight, modelNumVert ); - } } - else + else if ( verbose >= 2 ) fprintf( outStream, "Couldn't find vpool %s!\n", envName ); - //free( modelVertices ); - //free( globalModelVertices ); + //free( modelVertices ); + //free( globalModelVertices ); //free( envVtxIndices ); //free( envName ); } //if (weights) @@ -3890,7 +3861,7 @@ MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, else fprintf( outStream, "Not enough memory for envelope vertices...\n"); //free( envVertices ); - } // if (totalEnvVertices) + } // if (totalEnvVertices) else if ( verbose >= 1 ) fprintf( outStream, "No envelope vertices present...\n"); @@ -3917,10 +3888,10 @@ MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, //////////////////////////////////////////////////////////////////// // Function: CleanUpSoftSkin -// Access: Public -// Description: Given a model, make sure all its vertices have been -// soft assigned. If not hard assign to the last -// joint we saw. +// Access: Public +// Description: Given a model, make sure all its vertices have been +// soft assigned. If not hard assign to the last +// joint we saw. //////////////////////////////////////////////////////////////////// void soft2egg:: CleanUpSoftSkin( SAA_Scene *scene, SAA_Elem *model, char *name ) @@ -3930,9 +3901,7 @@ CleanUpSoftSkin( SAA_Scene *scene, SAA_Elem *model, char *name ) SAA_ModelType type; SAA_Boolean skel; - ///////////////////////////////////////////////// // find out what type of node we're dealing with - ///////////////////////////////////////////////// SAA_modelGetType( scene, model, &type ); char *parentName; @@ -3951,9 +3920,9 @@ CleanUpSoftSkin( SAA_Scene *scene, SAA_Elem *model, char *name ) SAA_modelIsSkeleton( scene, model, &skel ); // if not look for the last skeleton part - if ( skel ) + if ( skel ) parentName = name; - else do + else do { SAA_elementGetHierarchyLevel( scene, searchNode, &level ); @@ -4017,7 +3986,7 @@ CleanUpSoftSkin( SAA_Scene *scene, SAA_Elem *model, char *name ) fprintf( outStream, "setting joint to %s\n", parentName ); //find the vpool for this model - EggVertexPool *vPool = + EggVertexPool *vPool = (EggVertexPool *)(_data.pools.FindName( name )); if (vPool != NULL) @@ -4028,15 +3997,15 @@ CleanUpSoftSkin( SAA_Scene *scene, SAA_Elem *model, char *name ) if ( verbose >= 1 ) - fprintf( outStream, "found vpool %s w/ %d verts\n", + fprintf( outStream, "found vpool %s w/ %d verts\n", name, numVerts ); - - for ( i = 0; i < numVerts; i++ ) + + for ( i = 0; i < numVerts; i++ ) { if ( vPool->Vertex(i)->multipleJoints != 1 ) { if ( verbose >= 1 ) - { + { fprintf( outStream, "vpool %s vert %d", name, i ); fprintf( outStream, " not assigned!\n" ); } @@ -4045,15 +4014,15 @@ CleanUpSoftSkin( SAA_Scene *scene, SAA_Elem *model, char *name ) joint->AddVertex( vPool->Vertex(i), 1.0f ); } else - { + { membership = vPool->Vertex(i)->NetMembership(); if ( verbose >= 1 ) { - fprintf( outStream, "vpool %s vert %d", name, + fprintf( outStream, "vpool %s vert %d", name, i ); - fprintf( outStream, " has membership %f\n", + fprintf( outStream, " has membership %f\n", membership ); } @@ -4080,17 +4049,17 @@ CleanUpSoftSkin( SAA_Scene *scene, SAA_Elem *model, char *name ) } } -////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: MakeAnimTable -// Access: Public -// Description: Given a scene and a skeleton part ,get all the -// position, rotation, and scale for the skeleton -// part for this frame and write them out as Egg -// animation tables. +// Access: Public +// Description: Given a scene and a skeleton part ,get all the +// position, rotation, and scale for the skeleton +// part for this frame and write them out as Egg +// animation tables. //////////////////////////////////////////////////////////////////// void soft2egg:: MakeAnimTable( SAA_Scene *scene, SAA_Elem *skeletonPart, char *name ) -{ +{ if ( skeletonPart != NULL ) { @@ -4105,26 +4074,26 @@ MakeAnimTable( SAA_Scene *scene, SAA_Elem *skeletonPart, char *name ) fprintf( outStream, "\n\nanimating child %s\n", name ); SAA_elementGetUserDataSize( scene, skeletonPart, "GLOBAL", &size ); - - if ( size != 0 ) - SAA_elementGetUserData( scene, skeletonPart, "GLOBAL", + + if ( size != 0 ) + SAA_elementGetUserData( scene, skeletonPart, "GLOBAL", sizeof( SAA_Boolean), &bigEndian, (void *)&globalFlag ); - + if ( globalFlag ) { if ( verbose >= 1 ) fprintf( outStream, " using global matrix\n" ); //get SAA orientation - SAA_modelGetRotation( scene, skeletonPart, SAA_COORDSYS_GLOBAL, - &p, &h, &r ); + SAA_modelGetRotation( scene, skeletonPart, SAA_COORDSYS_GLOBAL, + &p, &h, &r ); //get SAA translation - SAA_modelGetTranslation( scene, skeletonPart, SAA_COORDSYS_GLOBAL, - &x, &y, &z ); + SAA_modelGetTranslation( scene, skeletonPart, SAA_COORDSYS_GLOBAL, + &x, &y, &z ); //get SAA scaling - SAA_modelGetScaling( scene, skeletonPart, SAA_COORDSYS_GLOBAL, + SAA_modelGetScaling( scene, skeletonPart, SAA_COORDSYS_GLOBAL, &i, &j, &k ); } else @@ -4133,22 +4102,22 @@ MakeAnimTable( SAA_Scene *scene, SAA_Elem *skeletonPart, char *name ) fprintf( outStream, "using local matrix\n" ); //get SAA orientation - SAA_modelGetRotation( scene, skeletonPart, SAA_COORDSYS_LOCAL, - &p, &h, &r ); + SAA_modelGetRotation( scene, skeletonPart, SAA_COORDSYS_LOCAL, + &p, &h, &r ); //get SAA translation - SAA_modelGetTranslation( scene, skeletonPart, SAA_COORDSYS_LOCAL, - &x, &y, &z ); + SAA_modelGetTranslation( scene, skeletonPart, SAA_COORDSYS_LOCAL, + &x, &y, &z ); //get SAA scaling - SAA_modelGetScaling( scene, skeletonPart, SAA_COORDSYS_LOCAL, + SAA_modelGetScaling( scene, skeletonPart, SAA_COORDSYS_LOCAL, &i, &j, &k ); } if ( verbose >= 2 ) fprintf( outStream, "\nanim data: %f %f %f\n\t%f %f %f\n\t%f %f %f\n", - i, j, k, h, p, r, x, y, z ); + i, j, k, h, p, r, x, y, z ); // find the appropriate anim table for this skeleton part AnimGroup *thisGroup; @@ -4163,16 +4132,16 @@ MakeAnimTable( SAA_Scene *scene, SAA_Elem *skeletonPart, char *name ) thisTable = (XfmSAnimTable *)(thisGroup->FindDescendent( "xform" )); if ( thisTable != NULL ) - { + { thisTable->sub_tables[0].AddElement( i ); - thisTable->sub_tables[1].AddElement( j ); - thisTable->sub_tables[2].AddElement( k ); - thisTable->sub_tables[3].AddElement( p ); - thisTable->sub_tables[4].AddElement( h ); - thisTable->sub_tables[5].AddElement( r ); - thisTable->sub_tables[6].AddElement( x ); - thisTable->sub_tables[7].AddElement( y ); - thisTable->sub_tables[8].AddElement( z ); + thisTable->sub_tables[1].AddElement( j ); + thisTable->sub_tables[2].AddElement( k ); + thisTable->sub_tables[3].AddElement( p ); + thisTable->sub_tables[4].AddElement( h ); + thisTable->sub_tables[5].AddElement( r ); + thisTable->sub_tables[6].AddElement( x ); + thisTable->sub_tables[7].AddElement( y ); + thisTable->sub_tables[8].AddElement( z ); } else fprintf( outStream, "Couldn't allocate anim table\n" ); @@ -4186,17 +4155,16 @@ MakeAnimTable( SAA_Scene *scene, SAA_Elem *skeletonPart, char *name ) if ( verbose >= 2 ) fprintf( outStream, "Cannot build anim table - no skeleton\n" ); } - } //////////////////////////////////////////////////////////////////// // Function: MakeVertexOffsets -// Access: Public +// Access: Public // Description: Given a scene, a model , the vertices of its original -// shape and its name find the difference between the -// geometry of its key shapes and the models original -// geometry and add morph vertices to the egg data to -// reflect these changes. +// shape and its name find the difference between the +// geometry of its key shapes and the models original +// geometry and add morph vertices to the egg data to +// reflect these changes. //////////////////////////////////////////////////////////////////// void soft2egg:: MakeVertexOffsets( SAA_Scene *scene, SAA_Elem *model, SAA_ModelType type, @@ -4210,7 +4178,7 @@ MakeVertexOffsets( SAA_Scene *scene, SAA_Elem *model, SAA_ModelType type, SAA_DVector *shapeVerts = NULL; SAA_DVector *uniqueVerts = NULL; - if ( (type == SAA_MNSRF) && make_nurbs ) + if ( (type == SAA_MNSRF) && make_nurbs ) SAA_nurbsSurfaceSetStep( scene, model, nurbs_step, nurbs_step ); SAA_modelGetNbVertices( scene, model, &numCV ); @@ -4221,13 +4189,13 @@ MakeVertexOffsets( SAA_Scene *scene, SAA_Elem *model, SAA_ModelType type, numCV, uniqueVerts ); if ( verbose >= 2 ) - fprintf( outStream, "%d CV's\n", numCV ); + fprintf( outStream, "%d CV's\n", numCV ); if ( verbose >= 2 ) - { + { for ( i = 0; i < numCV; i++ ) - fprintf( outStream, "uniqueVerts[%d] = %f %f %f %f\n", i, - uniqueVerts[i].x, uniqueVerts[i].y, + fprintf( outStream, "uniqueVerts[%d] = %f %f %f %f\n", i, + uniqueVerts[i].x, uniqueVerts[i].y, uniqueVerts[i].z, uniqueVerts[i].w ); } @@ -4238,12 +4206,12 @@ MakeVertexOffsets( SAA_Scene *scene, SAA_Elem *model, SAA_ModelType type, if ( verbose >= 1 ) { - fprintf( outStream, "\nMaking geometry offsets for %s...\n", + fprintf( outStream, "\nMaking geometry offsets for %s...\n", mTableName ); - if ( (type == SAA_MNSRF) && make_nurbs ) + if ( (type == SAA_MNSRF) && make_nurbs ) fprintf( outStream, "calculating NURBS morphs...\n" ); - else + else fprintf( outStream, "calculating triangle morphs...\n" ); } @@ -4253,62 +4221,62 @@ MakeVertexOffsets( SAA_Scene *scene, SAA_Elem *model, SAA_ModelType type, numCV, shapeVerts ); if ( verbose >= 2 ) - { + { for ( j=0; j < numCV; j++ ) { - fprintf( outStream, "shapeVerts[%d] = %f %f %f\n", j, + fprintf( outStream, "shapeVerts[%d] = %f %f %f\n", j, shapeVerts[j].x, shapeVerts[j].y, shapeVerts[j].z ); } } // find the appropriate vertex pool - EggVertexPool *vPool = + EggVertexPool *vPool = (EggVertexPool *)(_data.pools.FindName( name )); // for every original vertex, compare to the corresponding - // key shape vertex and see if a vertex offset is needed + // key shape vertex and see if a vertex offset is needed for ( j=0; j < numOrigVert; j++ ) { double dx, dy, dz; - + if ( (type == SAA_MNSRF) && make_nurbs ) { - //dx = shapeVerts[j].x - (originalVerts[j].x/originalVerts[j].w); - //dy = shapeVerts[j].y - (originalVerts[j].y/originalVerts[j].w); - //dz = shapeVerts[j].z - (originalVerts[j].z/originalVerts[j].w); - dx = shapeVerts[j].x - originalVerts[j].x; - dy = shapeVerts[j].y - originalVerts[j].y; - dz = shapeVerts[j].z - originalVerts[j].z; + //dx = shapeVerts[j].x - (originalVerts[j].x/originalVerts[j].w); + //dy = shapeVerts[j].y - (originalVerts[j].y/originalVerts[j].w); + //dz = shapeVerts[j].z - (originalVerts[j].z/originalVerts[j].w); + dx = shapeVerts[j].x - originalVerts[j].x; + dy = shapeVerts[j].y - originalVerts[j].y; + dz = shapeVerts[j].z - originalVerts[j].z; } - else + else { // we need to map from original vertices // to triangle shape vertices here offset = findShapeVert( originalVerts[j], uniqueVerts, - numCV ); + numCV ); - dx = shapeVerts[offset].x - originalVerts[j].x; - dy = shapeVerts[offset].y - originalVerts[j].y; - dz = shapeVerts[offset].z - originalVerts[j].z; + dx = shapeVerts[offset].x - originalVerts[j].x; + dy = shapeVerts[offset].y - originalVerts[j].y; + dz = shapeVerts[offset].z - originalVerts[j].z; } if ( verbose >= 2 ) { - fprintf( outStream, "oVert[%d] = %f %f %f %f\n", j, - originalVerts[j].x, originalVerts[j].y, + fprintf( outStream, "oVert[%d] = %f %f %f %f\n", j, + originalVerts[j].x, originalVerts[j].y, originalVerts[j].z, originalVerts[j].w ); if ( (type == SAA_MNSRF) && make_nurbs ) { - fprintf( outStream, "global shapeVerts[%d] = %f %f %f %f\n", j, shapeVerts[j].x, shapeVerts[j].y, + fprintf( outStream, "global shapeVerts[%d] = %f %f %f %f\n", j, shapeVerts[j].x, shapeVerts[j].y, shapeVerts[j].z, shapeVerts[j].w ); } else { - fprintf( outStream, - "global shapeVerts[%d] = %f %f %f\n", offset, - shapeVerts[offset].x, - shapeVerts[offset].y, + fprintf( outStream, + "global shapeVerts[%d] = %f %f %f\n", offset, + shapeVerts[offset].x, + shapeVerts[offset].y, shapeVerts[offset].z ); } @@ -4316,27 +4284,26 @@ MakeVertexOffsets( SAA_Scene *scene, SAA_Elem *model, SAA_ModelType type, dx, dy, dz ); } - // if change isn't negligible, make a morph vertex entry + // if change isn't negligible, make a morph vertex entry double total = fabs(dx)+fabs(dy)+fabs(dz); if ( total > 0.00001 ) { if ( vPool != NULL ) { // create offset - EggMorphOffset *dxyz = + EggMorphOffset *dxyz = new EggMorphOffset( mTableName, dx, dy, dz ); EggVertex *eggVert; // get the appropriate egg vertex - eggVert = vPool->Vertex(j); + eggVert = vPool->Vertex(j); // add the offset to the vertex eggVert->morphs.push_back( *dxyz ); } else - fprintf( outStream, "Error: couldn't find vertex pool %s\n", name ); - + fprintf( outStream, "Error: couldn't find vertex pool %s\n", name ); } // if total } //for j } //for i @@ -4345,11 +4312,11 @@ MakeVertexOffsets( SAA_Scene *scene, SAA_Elem *model, SAA_ModelType type, //////////////////////////////////////////////////////////////////// // Function: MakeMorphTable -// Access: Public +// Access: Public // Description: Given a scene, a model, a name and a frame time, -// determine what type of shape interpolation is -// used and call the appropriate function to extract -// the shape weight info for this frame... +// determine what type of shape interpolation is +// used and call the appropriate function to extract +// the shape weight info for this frame... //////////////////////////////////////////////////////////////////// void soft2egg:: MakeMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, @@ -4364,7 +4331,7 @@ MakeMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, if ( numShapes > 0 ) { if ( verbose >= 1 ) - fprintf( outStream, "MakeMorphTable: %s: num shapes: %d\n", + fprintf( outStream, "MakeMorphTable: %s: num shapes: %d\n", name, numShapes); SAA_modelGetShapeInterpolation( scene, model, &type ); @@ -4381,22 +4348,21 @@ MakeMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, } } - } //////////////////////////////////////////////////////////////////// // Function: MakeLinearMorphTable -// Access: Public +// Access: Public // Description: Given a scene, a model, its name, and the time, -// get the shape fcurve for the model and determine -// the shape weights for the given time and use them -// to populate the morph table. +// get the shape fcurve for the model and determine +// the shape weights for the given time and use them +// to populate the morph table. //////////////////////////////////////////////////////////////////// void soft2egg:: MakeLinearMorphTable( SAA_Scene *scene, SAA_Elem *model, int numShapes, char *name, float time ) -{ +{ int i; SAA_Elem fcurve; float curveVal; @@ -4408,8 +4374,8 @@ MakeLinearMorphTable( SAA_Scene *scene, SAA_Elem *model, int numShapes, SAA_modelFcurveGetShape( scene, model, &fcurve ); - SAA_fcurveEval( scene, &fcurve, time, &curveVal ); - + SAA_fcurveEval( scene, &fcurve, time, &curveVal ); + if ( verbose >= 2 ) fprintf( outStream, "at time %f, fcurve for %s = %f\n", time, name, curveVal ); @@ -4429,12 +4395,12 @@ MakeLinearMorphTable( SAA_Scene *scene, SAA_Elem *model, int numShapes, thisTable = (SAnimTable *)(morphRoot->FindDescendent( tableName )); if ( thisTable != NULL ) - { + { if ( i == (int)curveVal ) { if ( curveVal - i == 0 ) { - thisTable->AddElement( 1.0f ); + thisTable->AddElement( 1.0f ); if ( verbose >= 2 ) fprintf( outStream, "adding element 1.0f\n" ); } @@ -4467,24 +4433,24 @@ MakeLinearMorphTable( SAA_Scene *scene, SAA_Elem *model, int numShapes, fprintf( outStream, " to '%s'\n", tableName ); } else - fprintf( outStream, "%d: Couldn't find table '%s'\n", + fprintf( outStream, "%d: Couldn't find table '%s'\n", i, tableName ); - } + } } //////////////////////////////////////////////////////////////////// // Function: MakeWeightedMorphTable -// Access: Public +// Access: Public // Description: Given a scene, a model, a list of all models in the -// scene, the number of models in the scece, the number -// of key shapes for this model, the name of the model -// and the current time, determine what method of -// controlling the shape weights is used and call the -// appropriate routine. +// scene, the number of models in the scece, the number +// of key shapes for this model, the name of the model +// and the current time, determine what method of +// controlling the shape weights is used and call the +// appropriate routine. //////////////////////////////////////////////////////////////////// void soft2egg:: -MakeWeightedMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, +MakeWeightedMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, int numModels, int numShapes, char *name, float time ) { SI_Error result; @@ -4494,7 +4460,7 @@ MakeWeightedMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, char *tableName; // allocate array of weight curves (one for each shape) - weightCurves = ( SAA_Elem *)malloc( sizeof( SAA_Elem ) * numShapes ); + weightCurves = ( SAA_Elem *)malloc( sizeof( SAA_Elem ) * numShapes ); result = SAA_modelFcurveGetShapeWeights( scene, model, numShapes, weightCurves ); @@ -4503,7 +4469,7 @@ MakeWeightedMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, { for ( int i = 1; i < numShapes; i++ ) { - SAA_fcurveEval( scene, &weightCurves[i], time, &curveVal ); + SAA_fcurveEval( scene, &weightCurves[i], time, &curveVal ); // make sure soft gave us a reasonable number if (!isNum(curveVal)) @@ -4518,20 +4484,20 @@ MakeWeightedMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, // find and populate shape table if ( verbose >= 2 ) - fprintf( outStream, "Weight: looking for table '%s'\n", + fprintf( outStream, "Weight: looking for table '%s'\n", tableName ); //find the morph table associated with this key shape thisTable = (SAnimTable *)(morphRoot->FindDescendent( tableName )); if ( thisTable != NULL ) - { - thisTable->AddElement( curveVal ); + { + thisTable->AddElement( curveVal ); if ( verbose >= 2 ) fprintf( outStream, "adding element %f\n", curveVal ); } else - fprintf( outStream, "%d: Couldn't find table '%s'\n", + fprintf( outStream, "%d: Couldn't find table '%s'\n", i, tableName ); } } @@ -4540,16 +4506,16 @@ MakeWeightedMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, //////////////////////////////////////////////////////////////////// // Function: MakeExpressionMorphTable -// Access: Public +// Access: Public // Description: Given a scene, a model and its number of key shapes -// generate a morph table describing transitions btwn -// the key shapes by evaluating the positions of the -// controlling sliders. +// generate a morph table describing transitions btwn +// the key shapes by evaluating the positions of the +// controlling sliders. //////////////////////////////////////////////////////////////////// void soft2egg:: -MakeExpressionMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, +MakeExpressionMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, int numModels, int numShapes, char *name, float time ) -{ +{ int j; SAnimTable *thisTable; char *tableName; @@ -4574,12 +4540,12 @@ MakeExpressionMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, if ( numExp ) { // get the expressions for this shape - expressions = (SAA_Elem *)malloc(sizeof(SAA_Elem)*numExp); + expressions = (SAA_Elem *)malloc(sizeof(SAA_Elem)*numExp); if ( verbose >= 1 ) fprintf( outStream, "getting %d RHS expressions...\n", numExp ); - result = SAA_elementGetExpressions( scene, model, track, FALSE, + result = SAA_elementGetExpressions( scene, model, track, FALSE, numExp, expressions ); if ( !result ) @@ -4590,7 +4556,7 @@ MakeExpressionMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, { // debug see what we got int numvars; - + SAA_expressionGetNbVars( scene, &expressions[j], &numvars ); int *varnamelen; @@ -4601,9 +4567,9 @@ MakeExpressionMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, varstrlen = (int *)malloc(sizeof(int)*numvars); SAA_expressionGetStringLengths( scene, &expressions[j], - numvars, varnamelen, varstrlen, &expstrlen ); + numvars, varnamelen, varstrlen, &expstrlen ); - int *varnamesizes; + int *varnamesizes; int *varstrsizes; varnamesizes = (int *)malloc(sizeof(int)*numvars); @@ -4614,7 +4580,7 @@ MakeExpressionMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, varnamesizes[k] = varnamelen[k] + 1; varstrsizes[k] = varstrlen[k] + 1; } - + int expstrsize = expstrlen + 1; char **varnames; @@ -4631,34 +4597,34 @@ MakeExpressionMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, varstrs[k] = (char *)malloc(sizeof(char)* varstrsizes[k]); } - - char *expstr = (char *)malloc(sizeof(char)* expstrsize ); + + char *expstr = (char *)malloc(sizeof(char)* expstrsize ); SAA_expressionGetStrings( scene, &expressions[j], numvars, varnamesizes, varstrsizes, expstrsize, varnames, varstrs, expstr ); - + if ( verbose >= 2 ) { fprintf( outStream, "expression = '%s'\n", expstr ); fprintf( outStream, "has %d variables\n", numvars ); } } //if verbose - + if ( verbose >= 2 ) fprintf( outStream, "evaling expression...\n" ); - SAA_expressionEval( scene, &expressions[j], time, &expVal ); + SAA_expressionEval( scene, &expressions[j], time, &expVal ); if ( verbose >= 2 ) - fprintf( outStream, "time %f: exp val %f\n", + fprintf( outStream, "time %f: exp val %f\n", time, expVal ); // derive table name from the model name tableName = MakeTableName( name, j ); if ( verbose >= 2 ) - fprintf( outStream, "Exp: looking for table '%s'\n", + fprintf( outStream, "Exp: looking for table '%s'\n", tableName ); //find the morph table associated with this key shape @@ -4666,17 +4632,17 @@ MakeExpressionMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, (morphRoot->FindDescendent( tableName )); if ( thisTable != NULL ) - { - thisTable->AddElement( expVal ); - if ( verbose >= 1 ) + { + thisTable->AddElement( expVal ); + if ( verbose >= 1 ) fprintf( outStream, "%d: adding element %f to %s\n", j, expVal, tableName ); fflush( outStream ); } else { - fprintf( outStream, "%d: Couldn't find table '%s'", j, - tableName ); + fprintf( outStream, "%d: Couldn't find table '%s'", j, + tableName ); fprintf( outStream, " for value %f\n", expVal ); } @@ -4685,9 +4651,9 @@ MakeExpressionMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, else fprintf( outStream, "couldn't get expressions!!!\n" ); } - else + else // no expression, use weight curves - MakeWeightedMorphTable( scene, model, models, numModels, + MakeWeightedMorphTable( scene, model, models, numModels, numShapes, name, time ); } @@ -4695,16 +4661,16 @@ MakeExpressionMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, //////////////////////////////////////////////////////////////////// // Function: MakeTexAnim -// Access: Public +// Access: Public // Description: Given a scene, a POLYGON model, and the name -// of the that model, get the u and v offsets for -// the current frame. +// of the that model, get the u and v offsets for +// the current frame. //////////////////////////////////////////////////////////////////// void soft2egg:: MakeTexAnim( SAA_Scene *scene, SAA_Elem *model, char *modelName ) { if ( verbose >= 1 ) - fprintf( outStream, "\n\nmaking texture animation for %s...\n", + fprintf( outStream, "\n\nmaking texture animation for %s...\n", modelName ); // get the color of the surface @@ -4714,9 +4680,9 @@ MakeTexAnim( SAA_Scene *scene, SAA_Elem *model, char *modelName ) void *relinfo; SAA_modelRelationGetMatNbElements( scene, model, FALSE, &relinfo, - &numMats ); + &numMats ); - if ( verbose >= 2 ) + if ( verbose >= 2 ) fprintf( outStream, "surface has %d materials\n", numMats ); if ( numMats ) @@ -4724,9 +4690,9 @@ MakeTexAnim( SAA_Scene *scene, SAA_Elem *model, char *modelName ) float r,g,b,a; materials = (SAA_Elem *)malloc(sizeof(SAA_Elem)*numMats); - - SAA_modelRelationGetMatElements( scene, model, relinfo, - numMats, materials ); + + SAA_modelRelationGetMatElements( scene, model, relinfo, + numMats, materials ); SAA_materialGetDiffuse( scene, &materials[0], &r, &g, &b ); SAA_materialGetTransparency( scene, &materials[0], &a ); @@ -4747,12 +4713,12 @@ MakeTexAnim( SAA_Scene *scene, SAA_Elem *model, char *modelName ) if ( numTexLoc ) { if ( verbose >= 1 ) - fprintf( outStream, "%s had %d local tex\n", modelName, + fprintf( outStream, "%s had %d local tex\n", modelName, numTexLoc ); // get the referenced texture SAA_materialRelationGetT2DLocElements( scene, &materials[0], - TEX_PER_MAT, &tex ); + TEX_PER_MAT, &tex ); } // if no locals, try to get globals @@ -4767,23 +4733,23 @@ MakeTexAnim( SAA_Scene *scene, SAA_Elem *model, char *modelName ) fprintf( outStream, "%s had %d global tex\n", modelName, numTexGlb ); // get the referenced texture - SAA_modelRelationGetT2DGlbElements( scene, - model, TEX_PER_MAT, &tex ); + SAA_modelRelationGetT2DGlbElements( scene, + model, TEX_PER_MAT, &tex ); } } // add tex ref's if we found any textures - if ( numTexLoc || numTexGlb) + if ( numTexLoc || numTexGlb) { char *fullTexName = NULL; char *texName = NULL; char *uniqueTexName = NULL; int texNameLen; - // get its name + // get its name SAA_texture2DGetPicNameLength( scene, &tex, &texNameLen); fullTexName = (char *)malloc(sizeof(char)*++texNameLen); - SAA_texture2DGetPicName( scene, &tex, texNameLen, + SAA_texture2DGetPicName( scene, &tex, texNameLen, fullTexName ); // append unique identifier to texname for @@ -4792,7 +4758,7 @@ MakeTexAnim( SAA_Scene *scene, SAA_Elem *model, char *modelName ) (strlen(modelName)+strlen(texName)+3) ); sprintf( uniqueTexName, "%s-%s", modelName, texName ); if ( verbose >= 2 ) - fprintf( outStream, "referencing tref %s\n", + fprintf( outStream, "referencing tref %s\n", uniqueTexName ); float uScale; @@ -4823,7 +4789,7 @@ MakeTexAnim( SAA_Scene *scene, SAA_Elem *model, char *modelName ) // find the vpool for this model - EggVertexPool *vPool = + EggVertexPool *vPool = (EggVertexPool *)(_data.pools.FindName( modelName )); // if we found the pool @@ -4831,16 +4797,16 @@ MakeTexAnim( SAA_Scene *scene, SAA_Elem *model, char *modelName ) { // generate duv's for model float oldOffsets[4]; - double u, v, du, dv; + double u, v, du, dv; int size; SAA_Boolean bigEndian; SAA_elementGetUserDataSize( scene, model, "TEX_OFFSETS", &size ); - if ( size != 0 ) + if ( size != 0 ) { // remember original texture offsets future reference - SAA_elementGetUserData( scene, model, "TEX_OFFSETS", + SAA_elementGetUserData( scene, model, "TEX_OFFSETS", size, &bigEndian, (void *)&oldOffsets ); // get the original scales and offsets @@ -4871,52 +4837,49 @@ MakeTexAnim( SAA_Scene *scene, SAA_Elem *model, char *modelName ) SAnimTable *thisTable; //find the duv U table associated with this model - thisTable = (SAnimTable *)(morphRoot->FindDescendent( + thisTable = (SAnimTable *)(morphRoot->FindDescendent( uName.str() )); if ( thisTable != NULL ) - { - thisTable->AddElement( du ); + { + thisTable->AddElement( du ); if ( verbose >= 1 ) - fprintf( outStream, "adding element %f to %s\n", + fprintf( outStream, "adding element %f to %s\n", du, uName.str() ); } else - fprintf( outStream, "Couldn't find uTable %s\n", + fprintf( outStream, "Couldn't find uTable %s\n", uName.str() ); //find the duv V table associated with this model - thisTable = (SAnimTable *)(morphRoot->FindDescendent( + thisTable = (SAnimTable *)(morphRoot->FindDescendent( vName.str() )); if ( thisTable != NULL ) - { - thisTable->AddElement( dv ); + { + thisTable->AddElement( dv ); if ( verbose >= 1 ) - fprintf( outStream, "adding element %f to %s\n", + fprintf( outStream, "adding element %f to %s\n", dv, uName.str() ); } else - fprintf( outStream, "Couldn't find vTable %s\n", + fprintf( outStream, "Couldn't find vTable %s\n", uName.str() ); } } else if ( verbose >= 2 ) fprintf( outStream, "Couldn't find vpool %s\n", modelName ); - } //free( materials ); - } - } #endif //////////////////////////////////////////////////////////////////// // Function: Main -// Access: Private +// Access: Private // Description: Instantiate converter and process a file //////////////////////////////////////////////////////////////////// EXPCL_MISC SI_Error soft2egg(int argc, char *argv[]) { diff --git a/pandatool/src/softegg/softNodeDesc.cxx b/pandatool/src/softegg/softNodeDesc.cxx index 82bd857b95..699e4969ec 100644 --- a/pandatool/src/softegg/softNodeDesc.cxx +++ b/pandatool/src/softegg/softNodeDesc.cxx @@ -25,7 +25,7 @@ TypeHandle SoftNodeDesc::_type_handle; //////////////////////////////////////////////////////////////////// // Function: SoftNodeDesc::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// SoftNodeDesc:: SoftNodeDesc(SoftNodeDesc *parent, const string &name) : @@ -52,11 +52,11 @@ SoftNodeDesc(SoftNodeDesc *parent, const string &name) : numTexLoc = 0; numTexGlb = 0; - uScale = NULL; + uScale = NULL; vScale = NULL; uOffset = NULL; vOffset = NULL; - + valid; uv_swap; // SAA_Boolean visible; @@ -70,7 +70,7 @@ SoftNodeDesc(SoftNodeDesc *parent, const string &name) : //////////////////////////////////////////////////////////////////// // Function: SoftNodeDesc::Destructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// SoftNodeDesc:: ~SoftNodeDesc() { @@ -112,7 +112,7 @@ set_parent(SoftNodeDesc *parent) { if (_parent == parent) softegg_cat.spam() << " parent already set\n"; else { - softegg_cat.spam() << " current parent " << _parent->get_name() << " new parent " + softegg_cat.spam() << " current parent " << _parent->get_name() << " new parent " << parent << endl; } */ @@ -137,7 +137,7 @@ force_set_parent(SoftNodeDesc *parent) { softegg_cat.spam() << " current parent " << _parent->get_name(); _parent = parent; - + if (_parent) softegg_cat.spam() << " new parent " << _parent->get_name() << endl; @@ -245,7 +245,7 @@ mark_joint_parent() { } else softegg_cat.spam() << " ?parent " << get_name() << " joint type " << _joint_type; - + if (_parent != (SoftNodeDesc *)NULL) { _parent->mark_joint_parent(); } @@ -271,13 +271,13 @@ check_joint_parent() { } } -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: SoftNodeTree::check_junk // Access: Public -// Description: check to see if this is a branch we don't want to -// descend - this will prevent creating geometry for +// Description: check to see if this is a branch we don't want to +// descend - this will prevent creating geometry for // animation control structures -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// void SoftNodeDesc:: check_junk(bool parent_junk) { const char *name = get_name().c_str(); @@ -286,10 +286,10 @@ check_junk(bool parent_junk) { _joint_type = JT_junk; softegg_cat.spam() << "junk node " << get_name() << endl; } - if ( (strstr(name, "con-") != NULL) || - (strstr(name, "con_") != NULL) || - (strstr(name, "fly_") != NULL) || - (strstr(name, "fly-") != NULL) || + if ( (strstr(name, "con-") != NULL) || + (strstr(name, "con_") != NULL) || + (strstr(name, "fly_") != NULL) || + (strstr(name, "fly-") != NULL) || (strstr(name, "camRIG") != NULL) || (strstr(name, "cam_rig") != NULL) || (strstr(name, "bars") != NULL) ) @@ -311,13 +311,13 @@ check_junk(bool parent_junk) { } } -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: SoftNodeTree::is_partial // Access: Public -// Description: check to see if this is a selected branch we want to -// descend - this will prevent creating geometry for +// Description: check to see if this is a selected branch we want to +// descend - this will prevent creating geometry for // other parts -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// bool SoftNodeDesc:: is_partial(char *search_prefix) { const char *name = fullname; @@ -333,19 +333,19 @@ is_partial(char *search_prefix) { // if name is not search_prefix, look in its parent if (strstr(name, search_prefix) == NULL) { softegg_cat.debug() << "node " << name << " "; - if (_parent) + if (_parent) return _parent->is_partial(search_prefix); } // neither name nor its parent is search_prefix return true; } -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// // Function: SoftNodeTree::set_parentJoint // Access: Public -// Description: Go through the ancestors and figure out who is the +// Description: Go through the ancestors and figure out who is the // immediate _parentJoint of this node -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// void SoftNodeDesc:: set_parentJoint(SAA_Scene *scene, SoftNodeDesc *lastJoint) { if (is_junk()) @@ -361,7 +361,7 @@ set_parentJoint(SAA_Scene *scene, SoftNodeDesc *lastJoint) { SAA_Boolean isSkeleton = false; if (has_model()) SAA_modelIsSkeleton( scene, get_model(), &isSkeleton ); - + // if already a joint or name has "joint" in it const char *name = get_name().c_str(); if (is_joint() || isSkeleton || strstr(name, "joint") != NULL) { @@ -477,7 +477,7 @@ get_transform(SAA_Scene *scene, EggGroup *egg_group, bool global) { softegg_cat.debug() << _parentJoint->get_name() << endl; else softegg_cat.debug() << _parentJoint << endl; - + softegg_cat.spam() << "model matrix = " << matrix[0][0] << " " << matrix[0][1] << " " << matrix[0][2] << " " << matrix[0][3] << "\n"; softegg_cat.spam() << "model matrix = " << matrix[1][0] << " " << matrix[1][1] << " " << matrix[1][2] << " " << matrix[1][3] << "\n"; @@ -527,32 +527,32 @@ get_joint_transform(SAA_Scene *scene, EggGroup *egg_group, EggXfmSAnim *anim, b softegg_cat.debug() << "using local matrix\n"; //get SAA orientation - SAA_modelGetRotation( scene, skeletonPart, SAA_COORDSYS_LOCAL, + SAA_modelGetRotation( scene, skeletonPart, SAA_COORDSYS_LOCAL, &p, &h, &r ); //get SAA translation - SAA_modelGetTranslation( scene, skeletonPart, SAA_COORDSYS_LOCAL, + SAA_modelGetTranslation( scene, skeletonPart, SAA_COORDSYS_LOCAL, &x, &y, &z ); - + //get SAA scaling - SAA_modelGetScaling( scene, skeletonPart, SAA_COORDSYS_LOCAL, + SAA_modelGetScaling( scene, skeletonPart, SAA_COORDSYS_LOCAL, &i, &j, &k ); } else { softegg_cat.debug() << " using global matrix\n"; //get SAA orientation - SAA_modelGetRotation( scene, skeletonPart, SAA_COORDSYS_GLOBAL, + SAA_modelGetRotation( scene, skeletonPart, SAA_COORDSYS_GLOBAL, &p, &h, &r ); //get SAA translation - SAA_modelGetTranslation( scene, skeletonPart, SAA_COORDSYS_GLOBAL, + SAA_modelGetTranslation( scene, skeletonPart, SAA_COORDSYS_GLOBAL, &x, &y, &z ); //get SAA scaling - SAA_modelGetScaling( scene, skeletonPart, SAA_COORDSYS_GLOBAL, + SAA_modelGetScaling( scene, skeletonPart, SAA_COORDSYS_GLOBAL, &i, &j, &k ); } - + softegg_cat.spam() << "\nanim data: " << i << " " << j << " " << k << endl; softegg_cat.spam() << "\t" << p << " " << h << " " << r << endl; softegg_cat.spam() << "\t" << x << " " << y << " " << z << endl; @@ -589,41 +589,41 @@ void SoftNodeDesc:: load_poly_model(SAA_Scene *scene, SAA_ModelType type) { SI_Error result; const char *name = get_name().c_str(); - + int i; int id = 0; // if making a pose - get deformed geometry if ( stec.make_pose ) gtype = SAA_GEOM_DEFORMED; - + // If the model is a PATCH in soft, set its step before tesselating else if ( type == SAA_MPTCH ) SAA_patchSetStep( scene, _model, stec.nurbs_step, stec.nurbs_step ); - - // Get the number of triangles + + // Get the number of triangles result = SAA_modelGetNbTriangles( scene, _model, gtype, id, &numTri); softegg_cat.spam() << "triangles: " << numTri << "\n"; - + if ( result != SI_SUCCESS ) { softegg_cat.spam() << "Error: couldn't get number of triangles!\n"; softegg_cat.debug() << "\tbailing on model: " << name << "\n"; - return; + return; } - + // check to see if surface is also skeleton... SAA_Boolean isSkeleton = FALSE; - + SAA_modelIsSkeleton( scene, _model, &isSkeleton ); - + // check to see if this surface is used as a skeleton // or is animated via constraint only ( these nodes are // tagged by the animator with the keyword "joint" // somewhere in the nodes name) softegg_cat.spam() << "is Skeleton? " << isSkeleton << "\n"; - + /*************************************************************************************/ - + // model is not a null and has no triangles! if ( !numTri ) { softegg_cat.spam() << "no triangles!\n"; @@ -638,12 +638,12 @@ load_poly_model(SAA_Scene *scene, SAA_ModelType type) { // triangulate model and read the triangles into array SAA_modelGetTriangles( scene, _model, gtype, id, numTri, triangles ); softegg_cat.spam() << "got triangles\n"; - + /***********************************************************************************/ - + // allocate array of materials (Asad: it gives a warning if try to get one triangle // at a time...investigate later - // read each triangle's material into array + // read each triangle's material into array materials = (SAA_Elem*) new SAA_Elem[numTri]; SAA_triangleGetMaterials( scene, _model, numTri, triangles, materials ); if (!materials) { @@ -651,29 +651,29 @@ load_poly_model(SAA_Scene *scene, SAA_ModelType type) { exit(1); } softegg_cat.spam() << "got materials\n"; - + /***********************************************************************************/ - + // allocate array of textures per triangle numTexTri = new int[numTri]; const void *relinfo; - + // find out how many local textures per triangle - for (i = 0; i < numTri; i++) { - result = SAA_materialRelationGetT2DLocNbElements( scene, &materials[i], FALSE, + for (i = 0; i < numTri; i++) { + result = SAA_materialRelationGetT2DLocNbElements( scene, &materials[i], FALSE, &relinfo, &numTexTri[i] ); - // polytex + // polytex if ( result == SI_SUCCESS ) numTexLoc += numTexTri[i]; } - + // don't need this anymore... - //free( numTexTri ); - + //free( numTexTri ); + // get local textures if present if ( numTexLoc ) { softegg_cat.spam() << "numTexLoc = " << numTexLoc << endl; - + // allocate arrays of texture info uScale = new PN_stdfloat[numTri]; vScale = new PN_stdfloat[numTri]; @@ -682,10 +682,10 @@ load_poly_model(SAA_Scene *scene, SAA_ModelType type) { texNameArray = new char *[numTri]; uRepeat = new int[numTri]; vRepeat = new int[numTri]; - + // ASSUME only one texture per material textures = new SAA_Elem[numTri]; - + for ( i = 0; i < numTri; i++ ) { // and read all referenced local textures into array SAA_materialRelationGetT2DLocElements( scene, &materials[i], @@ -695,38 +695,38 @@ load_poly_model(SAA_Scene *scene, SAA_ModelType type) { texNameArray[i] = NULL; // initialize the repeats uRepeat[i] = vRepeat[i] = 0; - + // see if this triangle has texture info if (numTexTri[i] == 0) continue; // check to see if texture is present result = SAA_elementIsValid( scene, &textures[i], &valid ); - + if ( result != SI_SUCCESS ) softegg_cat.spam() << "SAA_elementIsValid failed!!!!\n"; - - // texture present - get the name and uv info + + // texture present - get the name and uv info if ( valid ) { // according to drose, we don't need to convert .pic files to .rgb, // panda can now read the .pic files. texNameArray[i] = stec.GetTextureName(scene, &textures[i]); - + softegg_cat.spam() << " tritex[" << i << "] named: " << texNameArray[i] << endl; - + SAA_texture2DGetUVSwap( scene, &textures[i], &uv_swap ); - + if ( uv_swap == TRUE ) softegg_cat.spam() << " swapping u and v...\n" ; - + SAA_texture2DGetUScale( scene, &textures[i], &uScale[i] ); SAA_texture2DGetVScale( scene, &textures[i], &vScale[i] ); SAA_texture2DGetUOffset( scene, &textures[i], &uOffset[i] ); SAA_texture2DGetVOffset( scene, &textures[i], &vOffset[i] ); - + softegg_cat.spam() << "tritex[" << i << "] uScale: " << uScale[i] << " vScale: " << vScale[i] << endl; softegg_cat.spam() << " uOffset: " << uOffset[i] << " vOffset: " << vOffset[i] << endl; - + SAA_texture2DGetRepeats( scene, &textures[i], &uRepeat[i], &vRepeat[i] ); softegg_cat.spam() << "uRepeat = " << uRepeat[i] << ", vRepeat = " << vRepeat[i] << endl; } @@ -743,17 +743,17 @@ load_poly_model(SAA_Scene *scene, SAA_ModelType type) { // ASSUME only one texture per model textures = new SAA_Elem; // get the referenced texture - SAA_modelRelationGetT2DGlbElements( scene, _model, - TEX_PER_MAT, textures ); + SAA_modelRelationGetT2DGlbElements( scene, _model, + TEX_PER_MAT, textures ); softegg_cat.spam() << "numTexGlb = " << numTexGlb << endl; // check to see if texture is present SAA_elementIsValid( scene, textures, &valid ); - if ( valid ) { // texture present - get the name and uv info + if ( valid ) { // texture present - get the name and uv info SAA_texture2DGetUVSwap( scene, textures, &uv_swap ); - + if ( uv_swap == TRUE ) softegg_cat.spam() << " swapping u and v...\n"; - + // according to drose, we don't need to convert .pic files to .rgb, // panda can now read the .pic files. texNameArray = new char *[1]; @@ -761,23 +761,23 @@ load_poly_model(SAA_Scene *scene, SAA_ModelType type) { uRepeat = new int; vRepeat = new int; - + softegg_cat.spam() << " global tex named: " << *texNameArray << endl; - + // allocate arrays of texture info uScale = new PN_stdfloat; vScale = new PN_stdfloat; uOffset = new PN_stdfloat; vOffset = new PN_stdfloat; - + SAA_texture2DGetUScale( scene, textures, uScale ); SAA_texture2DGetVScale( scene, textures, vScale ); SAA_texture2DGetUOffset( scene, textures, uOffset ); SAA_texture2DGetVOffset( scene, textures, vOffset ); - + softegg_cat.spam() << " global tex uScale: " << *uScale << " vScale: " << *vScale << endl; softegg_cat.spam() << " uOffset: " << *uOffset << " vOffset: " << *vOffset << endl; - + SAA_texture2DGetRepeats( scene, textures, uRepeat, vRepeat ); softegg_cat.spam() << "uRepeat = " << *uRepeat << ", vRepeat = " << *vRepeat << endl; } @@ -801,15 +801,15 @@ void SoftNodeDesc:: load_nurbs_model(SAA_Scene *scene, SAA_ModelType type) { SI_Error result; const char *name = get_name().c_str(); - + // if making a pose - get deformed geometry if ( stec.make_pose ) gtype = SAA_GEOM_DEFORMED; - + // If the model is a NURBS in soft, set its step before tesselating if ( type == SAA_MNSRF ) SAA_nurbsSurfaceSetStep( scene, _model, stec.nurbs_step, stec.nurbs_step ); - + // get the materials /***********************************************************************************/ const void *relinfo; @@ -825,49 +825,49 @@ load_nurbs_model(SAA_Scene *scene, SAA_ModelType type) { softegg_cat.info() << "Out Of Memory on allocating materials\n"; exit(1); } - - SAA_modelRelationGetMatElements( scene, get_model(), relinfo, - numNurbMats, materials ); - + + SAA_modelRelationGetMatElements( scene, get_model(), relinfo, + numNurbMats, materials ); + softegg_cat.spam() << "got materials\n"; // get the textures /***********************************************************************************/ numNurbTexLoc = 0; numNurbTexGlb = 0; - + // find out how many local textures per NURBS surface // ASSUME it only has one material SAA_materialRelationGetT2DLocNbElements( scene, &materials[0], FALSE, &relinfo, &numNurbTexLoc ); - + // if present, get local textures if ( numNurbTexLoc ) { softegg_cat.spam() << name << " had " << numNurbTexLoc << " local tex\n"; nassertv(numNurbTexLoc == 1); - + textures = new SAA_Elem[numNurbTexLoc]; - + // get the referenced texture SAA_materialRelationGetT2DLocElements( scene, &materials[0], TEX_PER_MAT, &textures[0] ); - + } // if no locals, try to get globals else { SAA_modelRelationGetT2DGlbNbElements( scene, get_model(), FALSE, &relinfo, &numNurbTexGlb ); - + if ( numNurbTexGlb ) { softegg_cat.spam() << name << " had " << numNurbTexGlb << " global tex\n"; nassertv(numNurbTexGlb == 1); - + textures = new SAA_Elem[numNurbTexGlb]; - + // get the referenced texture SAA_modelRelationGetT2DGlbElements( scene, get_model(), TEX_PER_MAT, &textures[0] ); } } - + if ( numNurbTexLoc || numNurbTexGlb) { - + // allocate the texture name array texNameArray = new char *[1]; // allocate arrays of texture info @@ -877,34 +877,34 @@ load_nurbs_model(SAA_Scene *scene, SAA_ModelType type) { vOffset = new PN_stdfloat; uRepeat = new int; vRepeat = new int; - + // check to see if texture is present result = SAA_elementIsValid( scene, &textures[0], &valid ); - + if ( result != SI_SUCCESS ) softegg_cat.spam() << "SAA_elementIsValid failed!!!!\n"; - - // texture present - get the name and uv info + + // texture present - get the name and uv info if ( valid ) { // according to drose, we don't need to convert .pic files to .rgb, // panda can now read the .pic files. texNameArray[0] = stec.GetTextureName(scene, &textures[0]); - + softegg_cat.spam() << " tritex[0] named: " << texNameArray[0] << endl; - + SAA_texture2DGetUVSwap( scene, &textures[0], &uv_swap ); - + if ( uv_swap == TRUE ) softegg_cat.spam() << " swapping u and v...\n" ; - + SAA_texture2DGetUScale( scene, &textures[0], uScale ); SAA_texture2DGetVScale( scene, &textures[0], vScale ); SAA_texture2DGetUOffset( scene, &textures[0], uOffset ); SAA_texture2DGetVOffset( scene, &textures[0], vOffset ); - + softegg_cat.spam() << "tritex[0] uScale: " << *uScale << " vScale: " << *vScale << endl; softegg_cat.spam() << " uOffset: " << *uOffset << " vOffset: " << *vOffset << endl; - + SAA_texture2DGetRepeats( scene, &textures[0], uRepeat, vRepeat ); softegg_cat.spam() << "uRepeat = " << *uRepeat << ", vRepeat = " << *vRepeat << endl; } @@ -913,7 +913,7 @@ load_nurbs_model(SAA_Scene *scene, SAA_ModelType type) { softegg_cat.spam() << " tritex[0] named: (null)\n"; } } - + softegg_cat.spam() << "got textures\n"; } } @@ -929,8 +929,8 @@ find_shape_vert(LPoint3d p3d, SAA_DVector *vertices, int numVert) { int i, found = 0; for (i = 0; i < numVert && !found ; i++) { - if ((p3d[0] == vertices[i].x) && - (p3d[1] == vertices[i].y) && + if ((p3d[0] == vertices[i].x) && + (p3d[1] == vertices[i].y) && (p3d[2] == vertices[i].z)) { found = 1; softegg_cat.spam() << "found shape vert at index " << i << endl; @@ -947,11 +947,11 @@ find_shape_vert(LPoint3d p3d, SAA_DVector *vertices, int numVert) { //////////////////////////////////////////////////////////////////// // Function: make_vertex_offsets -// Access: Public +// Access: Public // Description: Given a scene, a model , the vertices of its original -// shape and its name find the difference between the -// geometry of its key shapes and the models original -// geometry and add morph vertices to the egg data to +// shape and its name find the difference between the +// geometry of its key shapes and the models original +// geometry and add morph vertices to the egg data to // reflect these changes. //////////////////////////////////////////////////////////////////// void SoftNodeDesc:: @@ -994,16 +994,16 @@ make_vertex_offsets(int numShapes) { // iterate through for each key shape (except original) for ( i = 1; i < numShapes; i++ ) { - + sprintf(tableName, "%s.%d", get_name().c_str(), i); softegg_cat.spam() << "\nMaking geometry offsets for " << tableName << "...\n"; if ((type == SAA_MNSRF) && stec.make_nurbs) softegg_cat.spam() << "calculating NURBS morphs...\n"; - else + else softegg_cat.spam() << "calculating triangle morphs...\n"; - + // get the shape verts shapeVerts = new SAA_DVector[numCV]; SAA_modelGetVertices( scene, model, SAA_GEOM_SHAPE, i+1, numCV, shapeVerts ); @@ -1011,26 +1011,26 @@ make_vertex_offsets(int numShapes) { for ( j=0; j < numCV; j++ ) { // convert vertices to global _VCT_X_MAT( shapeVerts[j], shapeVerts[j], matrix); - - softegg_cat.spam() << "shapeVerts[" << j << "] = " << shapeVerts[j].x << " " + + softegg_cat.spam() << "shapeVerts[" << j << "] = " << shapeVerts[j].x << " " << shapeVerts[j].y << " " << shapeVerts[j].z << endl; } softegg_cat.spam() << endl; // for every original vertex, compare to the corresponding - // key shape vertex and see if a vertex offset is needed + // key shape vertex and see if a vertex offset is needed j = 0; for (vi = vpool->begin(); vi != vpool->end(); ++vi, ++j) { double dx, dy, dz; EggVertex *vert = (*vi); LPoint3d p3d = vert->get_pos3(); - + softegg_cat.spam() << "oVert[" << j << "] = " << p3d[0] << " " << p3d[1] << " " << p3d[2] << endl; if ((type == SAA_MNSRF) && stec.make_nurbs) { - dx = shapeVerts[j].x - p3d[0]; - dy = shapeVerts[j].y - p3d[1]; - dz = shapeVerts[j].z - p3d[2]; + dx = shapeVerts[j].x - p3d[0]; + dy = shapeVerts[j].y - p3d[1]; + dz = shapeVerts[j].z - p3d[2]; softegg_cat.spam() << "global shapeVerts[" << j << "] = " << shapeVerts[j].x << " " << shapeVerts[j].y << " " << shapeVerts[j].z << " " << shapeVerts[j].w << endl; @@ -1040,9 +1040,9 @@ make_vertex_offsets(int numShapes) { // to triangle shape vertices here offset = find_shape_vert(p3d, uniqueVerts, numCV); - dx = shapeVerts[offset].x - p3d[0]; - dy = shapeVerts[offset].y - p3d[1]; - dz = shapeVerts[offset].z - p3d[2]; + dx = shapeVerts[offset].x - p3d[0]; + dy = shapeVerts[offset].y - p3d[1]; + dz = shapeVerts[offset].z - p3d[2]; softegg_cat.spam() << "global shapeVerts[" << offset << "] = " << shapeVerts[offset].x << " " << shapeVerts[offset].y << " " << shapeVerts[offset].z << endl; @@ -1050,7 +1050,7 @@ make_vertex_offsets(int numShapes) { softegg_cat.spam() << j << ": dx = " << dx << ", dy = " << dy << ", dz = " << dz << endl; - // if change isn't negligible, make a morph vertex entry + // if change isn't negligible, make a morph vertex entry double total = fabs(dx)+fabs(dy)+fabs(dz); if ( total > 0.00001 ) { if ( vpool != NULL ) { @@ -1061,8 +1061,8 @@ make_vertex_offsets(int numShapes) { vert->_dxyzs.insert(*dxyz); } else - softegg_cat.spam() << "Error: couldn't find vertex pool " << vpool_name << endl; - + softegg_cat.spam() << "Error: couldn't find vertex pool " << vpool_name << endl; + } // if total } //for j } //for i @@ -1070,7 +1070,7 @@ make_vertex_offsets(int numShapes) { //////////////////////////////////////////////////////////////////// // Function: make_morph_table -// Access: Public +// Access: Public // Description: Given a scene, a model, a name and a frame time, // determine what type of shape interpolation is // used and call the appropriate function to extract @@ -1082,10 +1082,10 @@ make_morph_table( PN_stdfloat time ) { SAA_Elem *model = NULL; SAA_AnimInterpType type; SAA_Scene *scene = &stec.scene; - + if (has_model()) model = get_model(); - else + else return; // Get the number of key shapes @@ -1114,14 +1114,14 @@ make_morph_table( PN_stdfloat time ) { //////////////////////////////////////////////////////////////////// // Function: make_linear_morph_table -// Access: Public +// Access: Public // Description: Given a scene, a model, its name, and the time, // get the shape fcurve for the model and determine // the shape weights for the given time and use them // to populate the morph table. //////////////////////////////////////////////////////////////////// void SoftNodeDesc:: -make_linear_morph_table(int numShapes, PN_stdfloat time) { +make_linear_morph_table(int numShapes, PN_stdfloat time) { int i; PN_stdfloat curveVal; char tableName[_MAX_PATH]; @@ -1135,8 +1135,8 @@ make_linear_morph_table(int numShapes, PN_stdfloat time) { SAA_modelFcurveGetShape( scene, model, &fcurve ); - SAA_fcurveEval( scene, &fcurve, time, &curveVal ); - + SAA_fcurveEval( scene, &fcurve, time, &curveVal ); + softegg_cat.spam() << "at time " << time << ", fcurve for " << get_name() << " = " << curveVal << endl; PN_stdfloat nextVal = 0.0f; @@ -1154,7 +1154,7 @@ make_linear_morph_table(int numShapes, PN_stdfloat time) { if ( anim != NULL ) { if ( i == (int)curveVal ) { if ( curveVal - i == 0 ) { - anim->add_data(1.0f ); + anim->add_data(1.0f ); softegg_cat.spam() << "adding element 1.0f\n"; } else { @@ -1174,7 +1174,7 @@ make_linear_morph_table(int numShapes, PN_stdfloat time) { softegg_cat.spam() << "adding element 0.0f\n"; } } - + softegg_cat.spam() <<" to '" << tableName << "'\n"; } else @@ -1184,9 +1184,9 @@ make_linear_morph_table(int numShapes, PN_stdfloat time) { //////////////////////////////////////////////////////////////////// // Function: make_weighted_morph_table -// Access: Public +// Access: Public // Description: Given a scene, a model, a list of all models in the -// scene, the number of models in the scece, the number +// scene, the number of models in the scece, the number // of key shapes for this model, the name of the model // and the current time, determine what method of // controlling the shape weights is used and call the @@ -1204,31 +1204,31 @@ make_weighted_morph_table(int numShapes, PN_stdfloat time) { SAA_Scene *scene = &stec.scene; // allocate array of weight curves (one for each shape) - weightCurves = new SAA_Elem[numShapes]; + weightCurves = new SAA_Elem[numShapes]; result = SAA_modelFcurveGetShapeWeights(scene, model, numShapes, weightCurves); if ( result == SI_SUCCESS ) { for ( int i = 1; i < numShapes; i++ ) { - SAA_fcurveEval( scene, &weightCurves[i], time, &curveVal ); + SAA_fcurveEval( scene, &weightCurves[i], time, &curveVal ); // make sure soft gave us a reasonable number //if (!isNum(curveVal)) //curveVal = 0.0f; - + softegg_cat.spam() << "at time " << time << ", weightCurve[" << i << "] for " << get_name() << " = " << curveVal << endl; - + // derive table name from the model name sprintf(tableName, "%s.%d", get_name().c_str(), i); - + // find and populate shape table softegg_cat.spam() << "Weight: looking for table '" << tableName << "'\n"; - + //find the morph table associated with this key shape anim = stec.find_morph_table(tableName); - - if ( anim != NULL ) { - anim->add_data(curveVal); + + if ( anim != NULL ) { + anim->add_data(curveVal); softegg_cat.spam() << "adding element " << curveVal << endl; } else @@ -1239,15 +1239,15 @@ make_weighted_morph_table(int numShapes, PN_stdfloat time) { //////////////////////////////////////////////////////////////////// // Function: make_expression_morph_table -// Access: Public +// Access: Public // Description: Given a scene, a model and its number of key shapes // generate a morph table describing transitions btwn // the key shapes by evaluating the positions of the -// controlling sliders. +// controlling sliders. //////////////////////////////////////////////////////////////////// void SoftNodeDesc:: make_expression_morph_table(int numShapes, PN_stdfloat time) -{ +{ //int j; int numExp; char *track; @@ -1286,7 +1286,7 @@ make_expression_morph_table(int numShapes, PN_stdfloat time) { // debug see what we got int numvars; - + SAA_expressionGetNbVars( scene, &expressions[j], &numvars ); int *varnamelen; @@ -1297,9 +1297,9 @@ make_expression_morph_table(int numShapes, PN_stdfloat time) varstrlen = (int *)malloc(sizeof(int)*numvars); SAA_expressionGetStringLengths( scene, &expressions[j], - numvars, varnamelen, varstrlen, &expstrlen ); + numvars, varnamelen, varstrlen, &expstrlen ); - int *varnamesizes; + int *varnamesizes; int *varstrsizes; varnamesizes = (int *)malloc(sizeof(int)*numvars); @@ -1310,7 +1310,7 @@ make_expression_morph_table(int numShapes, PN_stdfloat time) varnamesizes[k] = varnamelen[k] + 1; varstrsizes[k] = varstrlen[k] + 1; } - + int expstrsize = expstrlen + 1; char **varnames; @@ -1327,34 +1327,34 @@ make_expression_morph_table(int numShapes, PN_stdfloat time) varstrs[k] = (char *)malloc(sizeof(char)* varstrsizes[k]); } - - char *expstr = (char *)malloc(sizeof(char)* expstrsize ); + + char *expstr = (char *)malloc(sizeof(char)* expstrsize ); SAA_expressionGetStrings( scene, &expressions[j], numvars, varnamesizes, varstrsizes, expstrsize, varnames, varstrs, expstr ); - + if ( verbose >= 2 ) { fprintf( outStream, "expression = '%s'\n", expstr ); fprintf( outStream, "has %d variables\n", numvars ); } } //if verbose - + if ( verbose >= 2 ) fprintf( outStream, "evaling expression...\n" ); - SAA_expressionEval( scene, &expressions[j], time, &expVal ); + SAA_expressionEval( scene, &expressions[j], time, &expVal ); if ( verbose >= 2 ) - fprintf( outStream, "time %f: exp val %f\n", + fprintf( outStream, "time %f: exp val %f\n", time, expVal ); // derive table name from the model name tableName = MakeTableName( name, j ); if ( verbose >= 2 ) - fprintf( outStream, "Exp: looking for table '%s'\n", + fprintf( outStream, "Exp: looking for table '%s'\n", tableName ); //find the morph table associated with this key shape @@ -1362,17 +1362,17 @@ make_expression_morph_table(int numShapes, PN_stdfloat time) (morphRoot->FindDescendent( tableName )); if ( anim != NULL ) - { - anim->AddElement( expVal ); - if ( verbose >= 1 ) + { + anim->AddElement( expVal ); + if ( verbose >= 1 ) fprintf( outStream, "%d: adding element %f to %s\n", j, expVal, tableName ); fflush( outStream ); } else { - fprintf( outStream, "%d: Couldn't find table '%s'", j, - tableName ); + fprintf( outStream, "%d: Couldn't find table '%s'", j, + tableName ); fprintf( outStream, " for value %f\n", expVal ); } diff --git a/pandatool/src/softegg/softToEggConverter.cxx b/pandatool/src/softegg/softToEggConverter.cxx index dffd1c1375..dc96ada47f 100644 --- a/pandatool/src/softegg/softToEggConverter.cxx +++ b/pandatool/src/softegg/softToEggConverter.cxx @@ -41,7 +41,7 @@ const int TEX_PER_MAT = 1; //////////////////////////////////////////////////////////////////// // Function: SoftToEggConverter::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// SoftToEggConverter:: SoftToEggConverter(const string &program_name) : @@ -66,7 +66,7 @@ SoftToEggConverter(const string &program_name) : tex_filename = NULL; search_prefix = NULL; result = SI_SUCCESS; - + // skeleton = new EggGroup(); foundRoot = FALSE; // animRoot = NULL; @@ -95,10 +95,9 @@ SoftToEggConverter(const string &program_name) : } //////////////////////////////////////////////////////////////////// - // Function: SoftToEggConverter::Copy Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// SoftToEggConverter:: SoftToEggConverter(const SoftToEggConverter ©) : @@ -119,7 +118,7 @@ SoftToEggConverter(const SoftToEggConverter ©) : //////////////////////////////////////////////////////////////////// // Function: SoftToEggConverter::Destructor // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// SoftToEggConverter:: ~SoftToEggConverter() { @@ -135,12 +134,12 @@ SoftToEggConverter:: // classes to describe the current program. //////////////////////////////////////////////////////////////////// void SoftToEggConverter:: -Help() +Help() { softegg_cat.info() << "soft2egg takes a SoftImage scene or model\n" "and outputs its contents as an egg file\n"; - + Usage(); } @@ -156,7 +155,7 @@ Usage() { // << _commandName << " [opts] (must specify -m or -s)\n\n" << "soft" << " [opts] (must specify -m or -s)\n\n" << "Options:\n"; - + ShowOpts(); softegg_cat.info() << "\n"; } @@ -169,10 +168,10 @@ Usage() { // the current program. //////////////////////////////////////////////////////////////////// void SoftToEggConverter:: -ShowOpts() +ShowOpts() { softegg_cat.info() << - " -r - Used to provide soft with the resource\n" + " -r - Used to provide soft with the resource\n" " Defaults to '/ful/ufs/soft371_mips2/3D/rsrc'.\n" " -d - Database path.\n" " -s - Indicates that a scene will be converted.\n" @@ -228,7 +227,7 @@ DoGetopts(int &argc, char **&argv) { ++i; } softegg_cat.info() << endl << _commandLine << endl; - + i = 1; while ((i < argc) && (argv[i][0] == '-') && okflag) { softegg_cat.info() << "arg " << i << " is " << argv[i] << "\n"; @@ -245,13 +244,13 @@ DoGetopts(int &argc, char **&argv) { // r:d:s:m:t:P:b:e:f:T:S:M:A:N:v:o:FhknpaxiucCD //////////////////////////////////////////////////////////////////// bool SoftToEggConverter:: -HandleGetopts(int &idx, int argc, char **argv) +HandleGetopts(int &idx, int argc, char **argv) { bool okflag = true; char flag = argv[idx][1]; // skip the '-' from option - - switch (flag) + + switch (flag) { case 'r': // Set the resource path for soft. if ( strcmp( argv[idx+1], "" ) ) { @@ -270,7 +269,7 @@ HandleGetopts(int &idx, int argc, char **argv) } ++idx; break; - + case 's': // Check if its a scene. if ( strcmp( argv[idx+1], "" ) ) { // Get scene name. @@ -279,7 +278,7 @@ HandleGetopts(int &idx, int argc, char **argv) } ++idx; break; - + case 'm': // Check if its a model. if ( strcmp( argv[idx+1], "" ) ) { // Get model name. @@ -288,7 +287,7 @@ HandleGetopts(int &idx, int argc, char **argv) } ++idx; break; - + case 't': // Get converted texture path. if ( strcmp( argv[idx+1], "" ) ) { // Get tex path name. @@ -297,8 +296,8 @@ HandleGetopts(int &idx, int argc, char **argv) } ++idx; break; - - case 'T': // Specify texture list filename. + + case 'T': // Specify texture list filename. if ( strcmp( argv[idx+1], "") ) { // Get the name. tex_filename = argv[idx+1]; @@ -314,7 +313,7 @@ HandleGetopts(int &idx, int argc, char **argv) } ++idx; break; - + case 'M': // Set model output file name. if ( strcmp( argv[idx+1], "" ) ) { eggFileName = argv[idx+1]; @@ -322,7 +321,7 @@ HandleGetopts(int &idx, int argc, char **argv) } ++idx; break; - + case 'A': // Set anim output file name. if ( strcmp( argv[idx+1], "" ) ) { animFileName = argv[idx+1]; @@ -330,7 +329,7 @@ HandleGetopts(int &idx, int argc, char **argv) } ++idx; break; - + case 'N': // Set egg model name. if ( strcmp( argv[idx+1], "" ) ) { eggGroupName = argv[idx+1]; @@ -338,20 +337,20 @@ HandleGetopts(int &idx, int argc, char **argv) } ++idx; break; - + case 'o': // Set search_prefix. if ( strcmp( argv[idx+1], "" ) ) { - search_prefix = argv[idx+1]; + search_prefix = argv[idx+1]; softegg_cat.info() << "Only converting models with prefix: " << search_prefix << endl; } ++idx; break; - + case 'h': // print help message Help(); exit(1); break; - + case 'c': // Cancel morph animation conversion make_morph = FALSE; softegg_cat.info() << "canceling morph conversion\n"; @@ -361,28 +360,28 @@ HandleGetopts(int &idx, int argc, char **argv) make_duv = FALSE; softegg_cat.info() << "canceling uv animation conversion\n"; break; - + case 'D': // Omit the Dart flag make_dart = FALSE; softegg_cat.info() << "making a non-character model\n"; break; - + case 'k': // Enable soft skinning //make_soft = TRUE; //fprintf( outStream, "enabling soft skinning\n" ); softegg_cat.info() << "-k flag no longer necessary\n"; break; - + case 'n': // Generate egg NURBS output make_nurbs = TRUE; softegg_cat.info() << "outputting egg NURBS info\n"; break; - + case 'p': // Generate egg polygon output make_poly = TRUE; softegg_cat.info() << "outputting egg polygon info\n"; break; - + case 'P': // Generate static pose from given frame if ( strcmp( argv[idx+1], "" ) ) { make_pose = TRUE; @@ -391,33 +390,33 @@ HandleGetopts(int &idx, int argc, char **argv) } ++idx; break; - + case 'a': // Compile animation tables. make_anim = TRUE; softegg_cat.info() << "attempting to compile anim tables\n"; break; - + case 'F': // Build a flat skeleton. flatten = TRUE; softegg_cat.info() << "building a flat skeleton!!!\n"; break; - + case 'x': // Shift NURBS parameters to preserve Alias textures. shift_textures = TRUE; softegg_cat.info() << "shifting NURBS parameters...\n"; break; - - case 'i': // Ignore Soft uv texture offsets + + case 'i': // Ignore Soft uv texture offsets ignore_tex_offsets = TRUE; softegg_cat.info() << "ignoring texture offsets...\n"; break; - - case 'u': // Use Soft prefix in model names + + case 'u': // Use Soft prefix in model names use_prefix = TRUE; softegg_cat.info() << "using prefix in model names...\n"; break; - - + + case 'v': // print debug messages. if ( strcmp( argv[idx+1], "" ) ) { verbose = atoi(argv[idx+1]); @@ -425,17 +424,17 @@ HandleGetopts(int &idx, int argc, char **argv) } ++idx; break; - + case 'b': // Set animation start frame. anim_start = atoi(argv[idx]+2); softegg_cat.info() << "animation starting at frame: " << anim_start << endl; break; - + case 'e': /// Set animation end frame. anim_end = atoi(argv[idx]+2); softegg_cat.info() << "animation ending at frame: " << anim_end << endl; break; - + case 'f': /// Set animation frame rate. if ( strcmp( argv[idx+1], "" ) ) { anim_rate = atoi(argv[idx+1]); @@ -498,7 +497,7 @@ find_node(string name) { //////////////////////////////////////////////////////////////////// // Function: GetTextureName // Access: Public -// Description: Given a texture element, return texture name +// Description: Given a texture element, return texture name // with given tex_path //////////////////////////////////////////////////////////////////// char *SoftToEggConverter:: @@ -576,8 +575,8 @@ convert_soft(bool from_selection) { PT(EggData) egg_data = new EggData; set_egg_data(egg_data); softegg_cat.spam() << "eggData " << get_egg_data() << "\n"; - - // append the command line + + // append the command line softegg_cat.info() << _commandLine << endl; get_egg_data()->insert(get_egg_data()->begin(), new EggComment("", _commandLine)); @@ -599,7 +598,7 @@ convert_soft(bool from_selection) { softegg_cat.debug() << "main group name: " << root_name << endl; if (root_name) _character_name = root_name; - + if (make_poly || make_nurbs) { // Specify that the texture names should be relative to the output // file. @@ -635,7 +634,7 @@ convert_soft(bool from_selection) { // reparent_decals(get_egg_data()); softegg_cat.info() << "Converted Softimage file\n"; - + // write out the egg model file _egg_data->write_egg(Filename(animFileName)); softegg_cat.info() << "Wrote Anim file " << animFileName << endl; @@ -678,15 +677,15 @@ open_api() { // cout << "got past scene load" << endl; if ( SAA_updatelistGet( &scene ) == SI_SUCCESS ) { PN_stdfloat time; - + softegg_cat.info() << "setting Scene to frame " << pose_frame << "...\n"; //SAA_sceneSetPlayCtrlCurrentFrame( &scene, pose_frame ); SAA_frame2Seconds( &scene, pose_frame, &time ); SAA_updatelistEvalScene( &scene, time ); if ( make_pose ) SAA_sceneFreeze(&scene); - } - + } + // if no egg filename specified, make up a name if ( eggFileName == NULL ) { string madeName; @@ -744,8 +743,8 @@ convert_char_model() { //////////////////////////////////////////////////////////////////// // Function: SoftToEggConverter::find_morph_table // Access: Public -// Description: Given a tablename, it either creates a new -// eggSAnimData structure (if doesn't exist) or +// Description: Given a tablename, it either creates a new +// eggSAnimData structure (if doesn't exist) or // locates it. //////////////////////////////////////////////////////////////////// EggSAnimData *SoftToEggConverter:: @@ -779,7 +778,7 @@ convert_char_chan() { int end_frame = -1; int frame_inc, frame; double output_frame_rate = anim_rate; - + PN_stdfloat time; EggTable *root_table_node = new EggTable(); @@ -799,10 +798,10 @@ convert_char_chan() { SAA_sceneGetPlayCtrlFrameStep( &scene, &frame_inc ); if (frame_inc != 1) // Hmmm...some files gave me frame_inc of 0, that can't be good frame_inc = 1; - + softegg_cat.info() << "animation start frame: " << start_frame << " end frame: " << end_frame << endl; softegg_cat.info() << "animation frame inc: " << frame_inc << endl; - + _tree._fps = output_frame_rate / frame_inc; // _tree.clear_egg(get_egg_data(), NULL, root_node); _tree.clear_egg(get_egg_data(), NULL, skeleton_node); @@ -1011,28 +1010,28 @@ make_polyset(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType type) { PN_stdfloat *uCoords = NULL; PN_stdfloat *vCoords = NULL; string name = node_desc->get_name(); - - SAA_modelGetNodeVisibility( &scene, node_desc->get_model(), &visible ); - softegg_cat.spam() << "model visibility: " << visible << endl; - - /////////////////////////////////////////////////////////////////////// + + SAA_modelGetNodeVisibility( &scene, node_desc->get_model(), &visible ); + softegg_cat.spam() << "model visibility: " << visible << endl; + +//////////////////////////////////////////////////////////////////// // Only create egg polygon data if: the node is visible, and its not - // a NULL or a Joint, and we're outputing polys (or if we are outputing - // NURBS and the model is a poly mesh or a face) - /////////////////////////////////////////////////////////////////////// - if ( visible && + // a NULL or a Joint, and we're outputing polys (or if we are outputing + // NURBS and the model is a poly mesh or a face) +//////////////////////////////////////////////////////////////////// + if ( visible && (type != SAA_MNILL) && - (type != SAA_MJNT) && - ((make_poly || + (type != SAA_MJNT) && + ((make_poly || (make_nurbs && ((type == SAA_MSMSH) || (type == SAA_MFACE )) )) || - (!make_poly && !make_nurbs && make_duv && + (!make_poly && !make_nurbs && make_duv && ((type == SAA_MSMSH) || (type == SAA_MFACE )) )) ) { // Get the number of key shapes SAA_modelGetNbShapes( &scene, node_desc->get_model(), &numShapes ); softegg_cat.spam() << "process_model_node: num shapes: " << numShapes << endl; - + // load all node data from soft for this node_desc node_desc->load_poly_model(&scene, type); @@ -1040,8 +1039,8 @@ make_polyset(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType type) { EggVertexPool *vpool = new EggVertexPool(vpool_name); vpool->set_highest_index(0); - // add the vertices in the _tree._root node, so that - // they will be written out first in egg file. This + // add the vertices in the _tree._root node, so that + // they will be written out first in egg file. This // solves a problem of soft-skinning trying to access // vertex pool before it is defined. @@ -1054,41 +1053,41 @@ make_polyset(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType type) { // (particularly, for instance, a billboard) then the vertex space // will be different from world space. LMatrix4d vertex_frame_inv = egg_group->get_vertex_frame_inv(); - + // Asad: change from soft2egg.c. Here I am trying to get one triangles vertices not all for (idx=0; idxnumTri; ++idx) { EggPolygon *egg_poly = new EggPolygon; egg_group->add_child(egg_poly); softegg_cat.spam() << "processing polygon " << idx << endl; - + // Is this a double sided polygon? meaning check for back face flag char *modelNoteStr = _tree.GetModelNoteInfo( &scene, node_desc->get_model() ); if ( modelNoteStr != NULL ) { if ( strstr( modelNoteStr, "bface" ) != NULL ) egg_poly->set_bface_flag(TRUE); } - + // read each triangle's control vertices into array SAA_SubElem cvertices[3]; SAA_triangleGetCtrlVertices( &scene, node_desc->get_model(), node_desc->gtype, id, 1, node_desc->triangles+idx, cvertices ); - + // read control vertices in this triangle SAA_DVector cvertPos[3]; SAA_ctrlVertexGetPositions( &scene, node_desc->get_model(), 3, cvertices, cvertPos); - + // read indices of each vertices in this triangle int indices[3]; indices[0] = indices[1] = indices[2] = 0; SAA_ctrlVertexGetIndices( &scene, node_desc->get_model(), 3, cvertices, indices ); - + // read each control vertex's normals into an array SAA_DVector normals[3]; SAA_ctrlVertexGetNormals( &scene, node_desc->get_model(), 3, cvertices, normals ); for (i=0; i<3; ++i) softegg_cat.spam() << "normals[" << i <<"] = " << normals[i].x << " " << normals[i].y << " " << normals[i].z << " " << normals[i].w << "\n"; - + // allocate arrays for u & v coords if (node_desc->textures) { if (node_desc->numTexLoc && node_desc->numTexTri[idx]) { @@ -1096,19 +1095,19 @@ make_polyset(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType type) { // I think there are one texture per triangle hence we need only 3 corrdinates uCoords = new PN_stdfloat[3]; vCoords = new PN_stdfloat[3]; - + // read the u & v coords into the arrays if ( uCoords != NULL && vCoords != NULL) { for ( i = 0; i < 3; i++ ) uCoords[i] = vCoords[i] = 0.0f; - + // TODO: investigate the coord_cnt parameter... SAA_ctrlVertexGetUVTxtCoords( &scene, node_desc->get_model(), 3, cvertices, 3, uCoords, vCoords ); } else softegg_cat.info() << "Not enough Memory for texture coords...\n"; - + #if 1 for ( i=0; i<3; i++ ) softegg_cat.spam() << "texcoords[" << i << "] = ( " << uCoords[i] << " , " << vCoords[i] <<" )\n"; @@ -1118,63 +1117,63 @@ make_polyset(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType type) { // allocate arrays for u & v coords uCoords = new PN_stdfloat[node_desc->numTexGlb*3]; vCoords = new PN_stdfloat[node_desc->numTexGlb*3]; - + for ( i = 0; i < node_desc->numTexGlb*3; i++ ) { uCoords[i] = vCoords[i] = 0.0f; - } - + } + // read the u & v coords into the arrays if ( uCoords != NULL && vCoords != NULL) { - SAA_triCtrlVertexGetGlobalUVTxtCoords( &scene, node_desc->get_model(), 3, cvertices, + SAA_triCtrlVertexGetGlobalUVTxtCoords( &scene, node_desc->get_model(), 3, cvertices, node_desc->numTexGlb, node_desc->textures, uCoords, vCoords ); } else softegg_cat.info() << "Not enough Memory for texture coords...\n"; } } - + for ( i=0; i < 3; i++ ) { EggVertex vert; - + // There are some conversions needed from local matrix to global coords SAA_DVector local = cvertPos[i]; SAA_DVector global = {0}; - + _VCT_X_MAT( global, local, node_desc->matrix ); - + softegg_cat.spam() << "indices[" << i << "] = " << indices[i] << "\n"; softegg_cat.spam() << "cvert[" << i << "] = " << cvertPos[i].x << " " << cvertPos[i].y << " " << cvertPos[i].z << " " << cvertPos[i].w << "\n"; softegg_cat.spam() << " global cvert[" << i << "] = " << global.x << " " << global.y << " " << global.z << " " << global.w << "\n"; - + // LPoint3d p3d(cvertPos[i].x, cvertPos[i].y, cvertPos[i].z); LPoint3d p3d(global.x, global.y, global.z); p3d = p3d * vertex_frame_inv; vert.set_pos(p3d); - + local = normals[i]; _VCT_X_MAT( global, local, node_desc->matrix ); - + softegg_cat.spam() << "normals[" << i <<"] = " << normals[i].x << " " << normals[i].y << " " << normals[i].z << " " << normals[i].w << "\n"; softegg_cat.spam() << " global normals[" << i <<"] = " << global.x << " " << global.y << " " << global.z << " " << global.w << "\n"; - + LVector3d n3d(global.x, global.y, global.z); n3d = n3d * vertex_frame_inv; vert.set_normal(n3d); - + // if texture present set the texture coordinates if (node_desc->textures) { PN_stdfloat u, v; - + if (uCoords && vCoords) { u = uCoords[i]; v = 1.0f - vCoords[i]; - softegg_cat.spam() << "texcoords[" << i << "] = " << u << " " + softegg_cat.spam() << "texcoords[" << i << "] = " << u << " " << v << endl; - + vert.set_uv(LTexCoordd(u, v)); //vert.set_uv(LTexCoordd(uCoords[i], vCoords[i])); } @@ -1185,7 +1184,7 @@ make_polyset(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType type) { // check to see if material is present PN_stdfloat r,g,b,a; SAA_elementIsValid( &scene, &node_desc->materials[idx], &valid ); - // material present - get the color + // material present - get the color if ( valid ) { SAA_materialGetDiffuse( &scene, &node_desc->materials[idx], &r, &g, &b ); SAA_materialGetTransparency( &scene, &node_desc->materials[idx], &a ); @@ -1196,7 +1195,7 @@ make_polyset(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType type) { egg_poly->set_color(LColor(1.0, 1.0, 1.0, 1.0)); softegg_cat.spam() << "default color\n"; } - + /* // keep a one to one copy in this node's vpool EggVertex *t_vert = new EggVertex(vert); @@ -1209,7 +1208,7 @@ make_polyset(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType type) { softegg_cat.spam() << "\n"; } - + // Now apply the shader. if (node_desc->textures != NULL) { if (node_desc->numTexLoc && node_desc->numTexTri[idx]) { @@ -1221,7 +1220,7 @@ make_polyset(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType type) { else { if (!strstr(node_desc->texNameArray[0], "noIcon")) set_shader_attributes(node_desc, *egg_poly, 0); - else + else softegg_cat.spam() << "texname :" << node_desc->texNameArray[0] << endl; } } @@ -1249,21 +1248,21 @@ make_nurb_surface(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType ty PN_stdfloat *uCoords = NULL; PN_stdfloat *vCoords = NULL; string name = node_desc->get_name(); - - SAA_modelGetNodeVisibility( &scene, node_desc->get_model(), &visible ); - softegg_cat.spam() << "model visibility: " << visible << endl; + + SAA_modelGetNodeVisibility( &scene, node_desc->get_model(), &visible ); + softegg_cat.spam() << "model visibility: " << visible << endl; softegg_cat.spam() << "nurbs!!!surface!!!" << endl; - - /////////////////////////////////////// + +//////////////////////////////////////////////////////////////////// // check to see if its a nurbs surface - /////////////////////////////////////// - if ( (type == SAA_MNSRF) && ( visible ) && (( make_nurbs ) +//////////////////////////////////////////////////////////////////// + if ( (type == SAA_MNSRF) && ( visible ) && (( make_nurbs ) || ( !make_nurbs && !make_poly && make_duv )) ) { // Get the number of key shapes SAA_modelGetNbShapes( &scene, node_desc->get_model(), &numShapes ); softegg_cat.spam() << "process_model_node: num shapes: " << numShapes << endl; - + // load all node data from soft for this node_desc node_desc->load_nurbs_model(&scene, type); @@ -1271,8 +1270,8 @@ make_nurb_surface(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType ty EggVertexPool *vpool = new EggVertexPool(vpool_name); vpool->set_highest_index(0); - // add the vertices in the _tree._egg_root node, so that - // they will be written out first in egg file. This + // add the vertices in the _tree._egg_root node, so that + // they will be written out first in egg file. This // solves a problem of soft-skinning trying to access // vertex pool before it is defined. @@ -1307,7 +1306,7 @@ make_nurb_surface(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType ty SAA_Boolean uClosed = FALSE; SAA_Boolean vClosed = FALSE; - SAA_nurbsSurfaceGetClosed( &scene, node_desc->get_model(), &uClosed, &vClosed); + SAA_nurbsSurfaceGetClosed( &scene, node_desc->get_model(), &uClosed, &vClosed); uExtra = vExtra = 2; if ( uClosed ) { @@ -1325,10 +1324,10 @@ make_nurb_surface(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType ty softegg_cat.spam() << "from eggNurbs: num v knots " << eggNurbs->get_num_v_knots() << endl; softegg_cat.spam() << "from eggNurbs: num u cvs " << eggNurbs->get_num_u_cvs() << endl; softegg_cat.spam() << "from eggNurbs: num v cvs " << eggNurbs->get_num_v_cvs() << endl; - + SAA_nurbsSurfaceGetNbVertices( &scene, node_desc->get_model(), &uRows, &vRows ); softegg_cat.spam() << "nurbs vertices: " << uRows << " u, " << vRows << " v\n"; - + SAA_nurbsSurfaceGetNbCurves( &scene, node_desc->get_model(), &uCurves, &vCurves ); softegg_cat.spam() << "nurbs curves: " << uCurves << " u, " << vCurves << " v\n"; @@ -1352,19 +1351,19 @@ make_nurb_surface(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType ty softegg_cat.spam() << "Set backface flag\n"; } } - + double *uKnotArray = new double[uKnots]; double *vKnotArray = new double[vKnots]; - result = SAA_nurbsSurfaceGetKnots( &scene, node_desc->get_model(), node_desc->gtype, 0, + result = SAA_nurbsSurfaceGetKnots( &scene, node_desc->get_model(), node_desc->gtype, 0, uKnots, vKnots, uKnotArray, vKnotArray ); - + if (result != SI_SUCCESS) { softegg_cat.spam() << "Couldn't get knots\n"; exit(1); } - // Lets prepare the softimage knots and then assign to eggKnots - add_knots( Knots, uKnotArray, uKnots, uClosed, uDegree ); + // Lets prepare the softimage knots and then assign to eggKnots + add_knots( Knots, uKnotArray, uKnots, uClosed, uDegree ); softegg_cat.spam() << "u knots: "; for (i = 0; i < (int)Knots.size(); i++) { softegg_cat.spam() << Knots[i] << " "; @@ -1373,7 +1372,7 @@ make_nurb_surface(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType ty softegg_cat.spam() << endl; Knots.resize(0); - add_knots( Knots, vKnotArray, vKnots, vClosed, vDegree ); + add_knots( Knots, vKnotArray, vKnots, vClosed, vDegree ); softegg_cat.spam() << "v knots: "; for (i = 0; i < (int)Knots.size(); i++) { softegg_cat.spam() << Knots[i] << " "; @@ -1384,22 +1383,22 @@ make_nurb_surface(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType ty // lets get the number of vertices from softimage int numVert; SAA_modelGetNbVertices( &scene, node_desc->get_model(), &numVert ); - + softegg_cat.spam() << numVert << " CV's\n"; // get the CV's SAA_DVector *vertices = NULL; vertices = new SAA_DVector[numVert]; - + SAA_modelGetVertices( &scene, node_desc->get_model(), node_desc->gtype, 0, numVert, vertices ); - + LMatrix4d vertex_frame_inv = egg_group->get_vertex_frame_inv(); // create the buffer for EggVertices EggVertex *verts = new EggVertex[numVert]; softegg_cat.spam() << endl << eggNurbs->get_num_cvs() << endl << endl; - + //for ( i = 0; iget_num_cvs(); i++ ) { for ( k = 0; kmatrix ); - + //preserve original weight global.w = vertices[k].w; - + // normalize coords to weight global.x *= global.w; global.y *= global.w; global.z *= global.w; - + /* softegg_cat.spam() << "global cv[" << k << "] = " << global.x << " " << global.y << " " << global.x << " " << global.w << endl; */ - + LPoint4d p4d(global.x, global.y, global.z, global.w); p4d = p4d * vertex_frame_inv; verts[k].set_pos(p4d); @@ -1442,7 +1441,7 @@ make_nurb_surface(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType ty if (node_desc->numNurbMats) { PN_stdfloat r,g,b,a; SAA_elementIsValid( &scene, &node_desc->materials[0], &valid ); - // material present - get the color + // material present - get the color if ( valid ) { SAA_materialGetDiffuse( &scene, &node_desc->materials[0], &r, &g, &b ); SAA_materialGetTransparency( &scene, &node_desc->materials[0], &a ); @@ -1456,25 +1455,25 @@ make_nurb_surface(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType ty } vpool->add_vertex(verts+k, k); eggNurbs->add_vertex(vpool->get_vertex(k)); - + if ( uClosed ) { // add first uDegree verts to end of row if ( (k % uRows) == ( uRows - 1) ) { for ( i = 0; i < uDegree; i++ ) { - // add vref's to NURBS info + // add vref's to NURBS info eggNurbs->add_vertex( vpool->get_vertex(i+((k/uRows)*uRows)) ); } } } } - // check to see if the NURB is closed in v + // check to see if the NURB is closed in v if ( vClosed && !uClosed ) { // add first vDegree rows of verts to end of list - for ( int i = 0; i < vDegree*uRows; i++ ) - eggNurbs->add_vertex( vpool->get_vertex(i) ); + for ( int i = 0; i < vDegree*uRows; i++ ) + eggNurbs->add_vertex( vpool->get_vertex(i) ); } - // check to see if the NURB is closed in u and v + // check to see if the NURB is closed in u and v else if ( vClosed && uClosed ) { // add the first (degree) v verts and a few // extra - for good measure @@ -1482,14 +1481,14 @@ make_nurb_surface(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType ty // add first vDegree rows of verts to end of list for ( j = 0; j < uRows; j++ ) eggNurbs->add_vertex( vpool->get_vertex(j+(i*uRows)) ); - + // if u is closed to we have added uDegree // verts onto the ends of the rows - add them here too for ( k = 0; k < uDegree; k++ ) eggNurbs->add_vertex( vpool->get_vertex(k+(i*uRows)+((k/uRows)*uRows)) ); } } - + // We add the NURBS to the group down here, after all of the vpools // for the trim curves have been added. egg_group->add_child(eggNurbs); @@ -1498,7 +1497,7 @@ make_nurb_surface(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType ty if (node_desc->textures != NULL) { if (!strstr(node_desc->texNameArray[0], "noIcon")) set_shader_attributes(node_desc, *eggNurbs, 0); - else + else softegg_cat.spam() << "texname :" << node_desc->texNameArray[0] << endl; } @@ -1510,24 +1509,24 @@ make_nurb_surface(SoftNodeDesc *node_desc, EggGroup *egg_group, SAA_ModelType ty //////////////////////////////////////////////////////////////////// // Function: add_knots -// Access: Public +// Access: Public // Description: Given a parametric surface, and its knots, create // the appropriate egg structure by filling in Soft's -// implicit knots and assigning the rest to eggKnots. +// implicit knots and assigning the rest to eggKnots. //////////////////////////////////////////////////////////////////// void SoftToEggConverter:: add_knots( vector &eggKnots, double *knots, int numKnots, SAA_Boolean closed, int degree ) { - + int k = 0; double lastKnot = knots[0]; double *newKnots; - + // add initial implicit knot(s) if ( closed ) { int i = 0; newKnots = new double[degree]; - - // need to add (degree) number of knots + + // need to add (degree) number of knots for ( k = numKnots - 1; k >= numKnots - degree; k-- ) { // we have to know these in order to calculate // next knot value so hold them in temp array @@ -1552,10 +1551,10 @@ add_knots( vector &eggKnots, double *knots, int numKnots, SAA_Boolean c } lastKnot = knots[numKnots-1]; - + // add trailing implicit knots if ( closed ) { - // need to add (degree) number of knots + // need to add (degree) number of knots for ( k = 1; k <= degree; k++ ) { eggKnots.push_back( lastKnot + (knots[k] - knots[k-1]) ); softegg_cat.spam() << "knots[" << k << "] = " << lastKnot + (knots[k] - knots[k-1]) << endl; @@ -1571,19 +1570,19 @@ add_knots( vector &eggKnots, double *knots, int numKnots, SAA_Boolean c //////////////////////////////////////////////////////////////////// // Function: FindClosestTriVert // Access: Public -// Description: Given an egg vertex pool, map each vertex therein to +// Description: Given an egg vertex pool, map each vertex therein to // a vertex within an array of SAA model vertices of // size numVert. Mapping is done by closest proximity. //////////////////////////////////////////////////////////////////// int *SoftToEggConverter:: FindClosestTriVert( EggVertexPool *vpool, SAA_DVector *vertices, int numVert ) { int i,j; - int *vertMap = NULL; + int *vertMap = NULL; int vpoolSize = (int)vpool->size(); PN_stdfloat closestDist; PN_stdfloat thisDist; int closest; - + vertMap = new int[vpoolSize]; i = 0; EggVertexPool::iterator vi; @@ -1594,13 +1593,13 @@ FindClosestTriVert( EggVertexPool *vpool, SAA_DVector *vertices, int numVert ) { // softegg_cat.spam() << "vert [" << i << "] " << vpool->get_vertex(i+1); LPoint3d p3d = vert->get_pos3(); - // find closest model vertex + // find closest model vertex for ( j = 0; j < numVert; j++ ) { // calculate distance - thisDist = sqrtf( - powf( p3d[0] - vertices[j].x , 2 ) + - powf( p3d[1] - vertices[j].y , 2 ) + - powf( p3d[2] - vertices[j].z , 2 ) ); + thisDist = sqrtf( + powf( p3d[0] - vertices[j].x , 2 ) + + powf( p3d[1] - vertices[j].y , 2 ) + + powf( p3d[2] - vertices[j].z , 2 ) ); // remember this if its the closest so far if ( !j || ( thisDist < closestDist ) ) { @@ -1614,7 +1613,7 @@ FindClosestTriVert( EggVertexPool *vpool, SAA_DVector *vertices, int numVert ) { << p3d[0] << " " << p3d[1] << " " << p3d[2] << ")\n"; - + softegg_cat.spam() << " to cv " << closest << " of " << numVert-1 << ":( " << vertices[closest].x << " " << vertices[closest].y << " " @@ -1664,7 +1663,7 @@ make_soft_skin() { softegg_cat.spam() << "no soft skinning for joint " << node_desc->get_name() << endl; continue; } - + // it's got envelopes - must be soft skinned softegg_cat.spam() << endl << "found skeleton part( " << node_desc->get_name() << ")!\n"; softegg_cat.spam() << "numEnv = " << numEnv << endl; @@ -1677,12 +1676,12 @@ make_soft_skin() { int thisEnv; SAA_EnvType envType; bool hasEnvVertices = 0; - + SAA_skeletonGetEnvelopes( &scene, model, numEnv, envelopes ); for ( thisEnv = 0; thisEnv < numEnv; thisEnv++ ) { softegg_cat.spam() << "env[" << thisEnv << "]: "; SAA_envelopeGetType( &scene, &envelopes[thisEnv], &envType ); - + if ( envType == SAA_ENVTYPE_NONE ) { softegg_cat.spam() << "envType = none\n"; } @@ -1709,9 +1708,9 @@ make_soft_skin() { SAA_SubElem *envVertices = NULL; int *numEnvVertices; int i,j,k; - + numEnvVertices = new int[numEnv]; - + if ( numEnvVertices != NULL ) { SAA_envelopeGetNbCtrlVertices( &scene, model, numEnv, envelopes, numEnvVertices ); int totalEnvVertices = 0; @@ -1744,18 +1743,18 @@ make_soft_skin() { vertArrayOffset += numEnvVertices[j]; softegg_cat.spam() << "envVertArray offset = " << vertArrayOffset; - /* + /* if (vertArrayOffset == totalEnvVertices) { softegg_cat.spam() << endl; vpoolMap = FindClosestTriVert( vpool, globalModelVertices, modelNumVert ); break; } */ - + // get the weights of the envelope vertices - result = SAA_ctrlVertexGetEnvelopeWeights( &scene, model, &envelopes[i], - numEnvVertices[i], - &envVertices[vertArrayOffset], weights ); + result = SAA_ctrlVertexGetEnvelopeWeights( &scene, model, &envelopes[i], + numEnvVertices[i], + &envVertices[vertArrayOffset], weights ); // Get the name of the envelope model if ( use_prefix ) { @@ -1768,7 +1767,7 @@ make_soft_skin() { } softegg_cat.spam() << " envelop name is [" << envName << "]" << endl; - + if (result != SI_SUCCESS) { softegg_cat.spam() << "warning: this envelop doesn't have any weights\n"; continue; @@ -1787,14 +1786,14 @@ make_soft_skin() { softegg_cat.spam() << "NURBS\n"; else softegg_cat.spam() << "OTHER\n"; - + int *envVtxIndices = NULL; envVtxIndices = new int[numEnvVertices[i]]; - + // Get the envelope vertex indices - result = SAA_ctrlVertexGetIndices( &scene, &envelopes[i], numEnvVertices[i], + result = SAA_ctrlVertexGetIndices( &scene, &envelopes[i], numEnvVertices[i], &envVertices[vertArrayOffset], envVtxIndices ); - + if (result != SI_SUCCESS) { softegg_cat.debug() << "error: choked on get indices\n"; exit(1); @@ -1802,33 +1801,33 @@ make_soft_skin() { // find out how many vertices the model has int modelNumVert; - + SAA_modelGetNbVertices( &scene, &envelopes[i], &modelNumVert ); - + SAA_DVector *modelVertices = NULL; modelVertices = new SAA_DVector[modelNumVert]; - + // get the model vertices SAA_modelGetVertices( &scene, &envelopes[i], - SAA_GEOM_ORIGINAL, 0, modelNumVert, + SAA_GEOM_ORIGINAL, 0, modelNumVert, modelVertices ); - - // create array of global model coords + + // create array of global model coords SAA_DVector *globalModelVertices = NULL; globalModelVertices = new SAA_DVector[modelNumVert]; PN_stdfloat matrix[4][4]; - + // tranform local model vert coords to global - + // first get the global matrix SAA_modelGetMatrix( &scene, &envelopes[i], SAA_COORDSYS_GLOBAL, matrix ); // populate array of global model verts for ( j = 0; j < modelNumVert; j++ ) { - _VCT_X_MAT( globalModelVertices[j], + _VCT_X_MAT( globalModelVertices[j], modelVertices[j], matrix ); } - + // Get the vpool string s_name = envName; SoftNodeDesc *mesh_node = find_node(s_name); @@ -1854,14 +1853,14 @@ make_soft_skin() { } joint = node_desc->get_egg_group(); - // for every envelope vertex + // for every envelope vertex for (j = 0; j < numEnvVertices[i]; j++) { double scaledWeight = weights[j]/ 100.0f; // make sure its in legal range if (( envVtxIndices[j] < modelNumVert ) && ( envVtxIndices[j] >= 0 )) { - if ( (type == SAA_MNSRF) && make_nurbs ) { + if ( (type == SAA_MNSRF) && make_nurbs ) { // assign all referenced control vertices EggVertex *vert = vpool->get_vertex(envVtxIndices[j]); if (!vert) { @@ -1870,7 +1869,7 @@ make_soft_skin() { } joint->ref_vertex( vert, scaledWeight ); softegg_cat.spam() << j << ": adding vref to cv " << envVtxIndices[j] - << " with weight " << scaledWeight << endl; + << " with weight " << scaledWeight << endl; /* envPool->Vertex(envVtxIndices[j])->AddJoint( joint, scaledWeight ); @@ -1879,7 +1878,7 @@ make_soft_skin() { envPool->Vertex(envVtxIndices[j])->multipleJoints = 1; */ } - else { + else { //assign all the tri verts associated // with this control vertex to joint softegg_cat.spam() << j << "--trying to find " << envVtxIndices[j] << endl; @@ -1917,8 +1916,8 @@ make_soft_skin() { } //////////////////////////////////////////////////////////////////// // Function: cleanup_soft_skin -// Access: Public -// Description: Given a model, make sure all its vertices have been +// Access: Public +// Description: Given a model, make sure all its vertices have been // soft assigned. If not hard assign to the last // joint we saw. //////////////////////////////////////////////////////////////////// @@ -1943,9 +1942,9 @@ cleanup_soft_skin() // find out what type of node we're dealing with SAA_modelGetType( &scene, model, &type ); - + softegg_cat.debug() << "Cleaning up model------- " << node_desc->get_name() << endl; - + // this step is weird - I think I want it here but it seems // to break some models. Files like props-props_wh_cookietime.3-0 in // /ful/rnd/pub/vrml/chip/chips_adventure/char/zone1/rooms/warehouse_final @@ -1956,12 +1955,12 @@ cleanup_soft_skin() EggNode *t = _tree.get_egg_root()->find_child(vpool_name); if (t) DCAST_INTO_R(vpool, t, NULL); - + if (!vpool) { //softegg_cat.spam() << "couldn't find vpool " << vpool_name << endl; continue; } - + int numVerts = (int)vpool->size(); softegg_cat.spam() << "found vpool " << vpool_name << " w/ " << numVerts << " verts\n"; @@ -1978,13 +1977,13 @@ cleanup_soft_skin() //softegg_cat.spam() << " checking parent " << parentJ->_parent->get_name() << endl; if (parentJ->_parent->has_model()) SAA_modelIsSkeleton( &scene, parentJ->_parent->get_model(), &isSkeleton ); - + if (isSkeleton) { joint = parentJ->_parent->get_egg_group(); softegg_cat.spam() << "parent to " << parentJ->_parent->get_name() << endl; break; } - + parentJ = parentJ->_parent; } else @@ -1994,7 +1993,7 @@ cleanup_soft_skin() softegg_cat.spam() << node_desc->get_name() << " has no _parentJoint?!" << endl; continue; } - + if (!joint) { softegg_cat.spam() << "parent joint to " << parentJ->_parentJoint->get_name() << endl; joint = parentJ->_parentJoint->get_egg_group(); @@ -2004,12 +2003,12 @@ cleanup_soft_skin() double membership = 1.0f; for ( vi = vpool->begin(); vi != vpool->end(); ++vi) { EggVertex *vert = (*vi); - + // if this vertex has not been soft assigned, then hard assign it to the parentJoint if ( vert->gref_size() == 0 ) { - + softegg_cat.spam() << "vert " << vert->get_external_index() << " not assigned!\n"; - + // hard skin this vertex joint->ref_vertex( vert, 1.0f ); } @@ -2058,7 +2057,7 @@ apply_texture_properties(EggTexture &tex, int uRepeat, int vRepeat) { tex.set_wrap_u(wrap_u); tex.set_wrap_v(wrap_v); - /* + /* LMatrix3d mat = color_def.compute_texture_matrix(); if (!mat.almost_equal(LMatrix3d::ident_mat())) { tex.set_transform(mat); @@ -2076,13 +2075,13 @@ apply_texture_properties(EggTexture &tex, int uRepeat, int vRepeat) { // object, or true if they match. //////////////////////////////////////////////////////////////////// bool SoftToEggConverter:: -compare_texture_properties(EggTexture &tex, +compare_texture_properties(EggTexture &tex, const SoftShaderColorDef &color_def) { bool okflag = true; EggTexture::WrapMode wrap_u = color_def._wrap_u ? EggTexture::WM_repeat : EggTexture::WM_clamp; EggTexture::WrapMode wrap_v = color_def._wrap_v ? EggTexture::WM_repeat : EggTexture::WM_clamp; - + if (wrap_u != tex.determine_wrap_u()) { // Choose the more general of the two. if (wrap_u == EggTexture::WM_repeat) { @@ -2096,7 +2095,7 @@ compare_texture_properties(EggTexture &tex, } okflag = false; } - + LMatrix3d mat = color_def.compute_texture_matrix(); if (!mat.almost_equal(tex.get_transform())) { okflag = false; @@ -2211,24 +2210,20 @@ string_transform_type(const string &arg) { } } -///////////////////////////////////////////////////////////////////////// -// Function: init_soft2egg -// Access: -// Description: Invokes the softToEggConverter class -///////////////////////////////////////////////////////////////////////// -extern "C" int init_soft2egg (int argc, char **argv) -{ +//////////////////////////////////////////////////////////////////// +// Function: init_soft2egg +// Access: +// Description: Invokes the softToEggConverter class +//////////////////////////////////////////////////////////////////// +extern "C" int init_soft2egg(int argc, char **argv) { stec._commandName = argv[0]; stec.rsrc_path = "c:\\Softimage\\SOFT3D_3.9.2\\3D\\rsrc"; - if (stec.DoGetopts(argc, argv)) { - // create a Filename object and convert the file + if (stec.DoGetopts(argc, argv)) { + // Create a Filename object and convert the file Filename softFile(argv[1]); stec.convert_file(softFile); } return 0; } -// -// -//