small changes and added add_x() to vectors

This commit is contained in:
Dave Schuyler 2003-09-05 04:31:19 +00:00
parent fb7ca6d692
commit 078f4c50c5
30 changed files with 196 additions and 68 deletions

View File

@ -483,7 +483,7 @@ class Actor(PandaObject, NodePath):
return controls[0].getPlayRate()
def setPlayRate(self, rate, animName, partName=None):
"""getPlayRate(self, float, string, string=None)
"""setPlayRate(self, float, string, string=None)
Set the play rate of given anim for a given part.
If no part is given, set for all parts in dictionary.
@ -508,7 +508,7 @@ class Actor(PandaObject, NodePath):
return None
animControl = controls[0]
return (animControl.getNumFrames() / animControl.getFrameRate())
return animControl.getNumFrames() / animControl.getFrameRate()
def getNumFrames(self, animName=None, partName=None):
""" getNumFrames(animName, partName)

View File

@ -78,7 +78,6 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
# List the cdc in the number and name dictionaries
self.number2cdc[dcClass.getNumber()]=clientDistClass
self.name2cdc[dcClass.getName()]=clientDistClass
return None
def handleGenerateWithRequired(self, di):
# Get the class Id
@ -89,7 +88,6 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
cdc = self.number2cdc[classId]
# Create a new distributed object, and put it in the dictionary
distObj = self.generateWithRequiredFields(cdc, doId, di)
return None
def handleGenerateWithRequiredOther(self, di):
# Get the class Id
@ -100,7 +98,6 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
cdc = self.number2cdc[classId]
# Create a new distributed object, and put it in the dictionary
distObj = self.generateWithRequiredOtherFields(cdc, doId, di)
return None
def handleQuietZoneGenerateWithRequired(self, di):
# Special handler for quiet zone generates -- we need to filter
@ -115,7 +112,6 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
if cdc.constructor.neverDisable:
# Create a new distributed object, and put it in the dictionary
distObj = self.generateWithRequiredFields(cdc, doId, di)
return None
def handleQuietZoneGenerateWithRequiredOther(self, di):
# Special handler for quiet zone generates -- we need to filter
@ -241,7 +237,6 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
ClientRepository.notify.warning("Disable failed. DistObj " +
str(doId) +
" is not in dictionary")
return None
def handleDelete(self, di):
# Get the DO Id
@ -282,7 +277,6 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
else:
ClientRepository.notify.warning(
"Asked to delete non-existent DistObj " + str(doId))
return None
def handleUpdateField(self, di):
# Get the DO Id
@ -300,7 +294,6 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
else:
ClientRepository.notify.warning(
"Asked to update non-existent DistObj " + str(doId))
return None
def handleGoGetLost(self, di):
# The server told us it's about to drop the connection on us.
@ -347,7 +340,6 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
currentLoginStateName +
" game state: " +
currentGameStateName)
return None
def sendSetShardMsg(self, shardId):
datagram = Datagram()
@ -357,7 +349,6 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
datagram.addUint32(shardId)
# send the message
self.send(datagram)
return None
def sendSetZoneMsg(self, zoneId, visibleZoneList=None):
datagram = Datagram()

View File

@ -67,9 +67,7 @@ class Loader:
times before parenting each instance somewhere, or when you
want to load a model and immediately set a transform on it.
But also consider loadModelCopy().
"""
assert(Loader.notify.debug("Loading model once: %s under %s" % (modelPath, underNode)))
if phaseChecker:
phaseChecker(modelPath)
@ -91,7 +89,7 @@ class Loader:
phaseChecker(modelPath)
node = ModelPool.loadModel(modelPath)
if (node != None):
return (NodePath(node.copySubgraph()))
return NodePath(node.copySubgraph())
else:
return None

View File

@ -55,7 +55,6 @@ namespace {
audio_debug("MilesAudioSound "<<get_status_char(_audio)<<" \""<<get_name() \
<<"\" "<< x )
}
#else //][
#define miles_audio_debug(x) ((void)0)
#endif //]

View File

@ -19,10 +19,8 @@
#ifndef VECTOR_PARTGROUPSTAR_H
#define VECTOR_PARTGROUPSTAR_H
#include <pandabase.h>
#include "pandabase.h"
#include "partGroup.h"
#include "pvector.h"
////////////////////////////////////////////////////////////////////
@ -40,7 +38,7 @@
#define TYPE PartGroup *
#define NAME vector_PartGroupStar
#include <vector_src.h>
#include "vector_src.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__

View File

@ -96,7 +96,7 @@ private:
#define TYPE GraphicsWindowInputDevice
#define NAME vector_GraphicsWindowInputDevice
#include <vector_src.h>
#include "vector_src.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__

View File

@ -19,7 +19,7 @@
#ifndef EGGMORPHLIST_H
#define EGGMORPHLIST_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggMorph.h"
@ -73,19 +73,19 @@ private:
#define EXPTP EXPTP_PANDAEGG
#define TYPE LVector3d
#define NAME vector_LVector3d
#include <vector_src.h>
#include "vector_src.h"
#define EXPCL EXPCL_PANDAEGG
#define EXPTP EXPTP_PANDAEGG
#define TYPE LVector2d
#define NAME vector_LVector2d
#include <vector_src.h>
#include "vector_src.h"
#define EXPCL EXPCL_PANDAEGG
#define EXPTP EXPTP_PANDAEGG
#define TYPE LVector4f
#define NAME vector_LVector4f
#include <vector_src.h>
#include "vector_src.h"
// Now export each EggMorphList.

View File

@ -19,7 +19,7 @@
#ifndef VECTOR_PT_EGGMATERIAL_H
#define VECTOR_PT_EGGMATERIAL_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggMaterial.h"
#include "pt_EggMaterial.h"
@ -40,7 +40,7 @@
#define TYPE PT_EggMaterial
#define NAME vector_PT_EggMaterial
#include <vector_src.h>
#include "vector_src.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__

View File

@ -19,7 +19,7 @@
#ifndef VECTOR_PT_EGGTEXTURE_H
#define VECTOR_PT_EGGTEXTURE_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggTexture.h"
#include "pt_EggTexture.h"
@ -40,7 +40,7 @@
#define TYPE PT_EggTexture
#define NAME vector_PT_EggTexture
#include <vector_src.h>
#include "vector_src.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__

View File

@ -19,7 +19,7 @@
#ifndef VECTOR_PT_EGGVERTEX_H
#define VECTOR_PT_EGGVERTEX_H
#include <pandabase.h>
#include "pandabase.h"
#include "eggVertex.h"
#include "pt_EggVertex.h"
@ -40,7 +40,7 @@
#define TYPE PT_EggVertex
#define NAME vector_PT_EggVertex
#include <vector_src.h>
#include "vector_src.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__

View File

@ -19,7 +19,7 @@
#ifndef VECTOR_UCHAR_H
#define VECTOR_UCHAR_H
#include <pandabase.h>
#include "pandabase.h"
#include "pvector.h"
@ -37,7 +37,7 @@
#define TYPE unsigned char
#define NAME vector_uchar
#include <vector_src.h>
#include "vector_src.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__

View File

@ -73,7 +73,7 @@ protected:
#define TYPE LODSwitch
#define NAME LODSwitchVector
#include <vector_src.h>
#include "vector_src.h"
////////////////////////////////////////////////////////////////////
// Class : LOD

View File

@ -19,7 +19,7 @@
#ifndef CMATH_H
#define CMATH_H
#include <pandabase.h>
#include "pandabase.h"
#include <math.h>

View File

@ -19,11 +19,11 @@
#ifndef __LROTATION_H__
#define __LROTATION_H__
#include <pandabase.h>
#include "pandabase.h"
#include "lquaternion.h"
#include "cmath.h"
#include <notify.h>
#include "notify.h"
#include "fltnames.h"
#include "lrotation_src.h"

View File

@ -62,7 +62,7 @@
//
////////////////////////////////////////////////////////////////////
#include <pandabase.h>
#include "pandabase.h"
#include "lvec2_ops.h"
#include "lvec3_ops.h"

View File

@ -218,6 +218,37 @@ set_y(FLOATTYPE value) {
_v.v._1 = value;
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::add_to_cell
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
add_to_cell(int i, FLOATTYPE value) {
nassertv(i >= 0 && i < 2);
_v.data[i] = value;
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::add_x
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
add_x(FLOATTYPE value) {
_v.v._0 = value;
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::add_y
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
add_y(FLOATTYPE value) {
_v.v._1 = value;
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::get_data
// Access: Public

View File

@ -50,10 +50,19 @@ PUBLISHED:
INLINE_LINMATH FLOATTYPE get_cell(int i) const;
INLINE_LINMATH FLOATTYPE get_x() const;
INLINE_LINMATH FLOATTYPE get_y() const;
INLINE_LINMATH void set_cell(int i, FLOATTYPE value);
INLINE_LINMATH void set_x(FLOATTYPE value);
INLINE_LINMATH void set_y(FLOATTYPE value);
// These next functions add to an existing value.
// i.e. foo.set_x(foo.get_x() + value)
// These are useful to reduce overhead in scripting
// languages:
INLINE_LINMATH void add_to_cell(int i, FLOATTYPE value);
INLINE_LINMATH void add_x(FLOATTYPE value);
INLINE_LINMATH void add_y(FLOATTYPE value);
INLINE_LINMATH const FLOATTYPE *get_data() const;
INLINE_LINMATH int get_num_components() const;

View File

@ -250,6 +250,47 @@ set_z(FLOATTYPE value) {
_v.v._2 = value;
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase3::add_to_cell
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase3)::
add_to_cell(int i, FLOATTYPE value) {
nassertv(i >= 0 && i < 3);
_v.data[i] += value;
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase3::add_x
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase3)::
add_x(FLOATTYPE value) {
_v.v._0 += value;
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase3::add_y
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase3)::
add_y(FLOATTYPE value) {
_v.v._1 += value;
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase3::add_z
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase3)::
add_z(FLOATTYPE value) {
_v.v._2 += value;
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase3::get_data
// Access: Public

View File

@ -49,11 +49,21 @@ PUBLISHED:
INLINE_LINMATH FLOATTYPE get_x() const;
INLINE_LINMATH FLOATTYPE get_y() const;
INLINE_LINMATH FLOATTYPE get_z() const;
INLINE_LINMATH void set_cell(int i, FLOATTYPE value);
INLINE_LINMATH void set_x(FLOATTYPE value);
INLINE_LINMATH void set_y(FLOATTYPE value);
INLINE_LINMATH void set_z(FLOATTYPE value);
// These next functions add to an existing value.
// i.e. foo.set_x(foo.get_x() + value)
// These are useful to reduce overhead in scripting
// languages:
INLINE_LINMATH void add_to_cell(int i, FLOATTYPE value);
INLINE_LINMATH void add_x(FLOATTYPE value);
INLINE_LINMATH void add_y(FLOATTYPE value);
INLINE_LINMATH void add_z(FLOATTYPE value);
INLINE_LINMATH const FLOATTYPE *get_data() const;
INLINE_LINMATH int get_num_components() const;

View File

@ -19,12 +19,12 @@
#ifndef LVECBASE4_H
#define LVECBASE4_H
#include <pandabase.h>
#include <typedObject.h>
#include <notify.h>
#include <datagram.h>
#include <datagramIterator.h>
#include <checksumHashGenerator.h>
#include "pandabase.h"
#include "typedObject.h"
#include "notify.h"
#include "datagram.h"
#include "datagramIterator.h"
#include "checksumHashGenerator.h"
#include "cmath.h"
#include "nearly_zero.h"

View File

@ -284,6 +284,57 @@ set_w(FLOATTYPE value) {
_v.v._3 = value;
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::add_to_cell
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
add_to_cell(int i, FLOATTYPE value) {
nassertv(i >= 0 && i < 4);
_v.data[i] += value;
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::add_x
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
add_x(FLOATTYPE value) {
_v.v._0 += value;
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::add_y
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
add_y(FLOATTYPE value) {
_v.v._1 += value;
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::add_z
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
add_z(FLOATTYPE value) {
_v.v._2 += value;
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::add_w
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
add_w(FLOATTYPE value) {
_v.v._3 += value;
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::get_data
// Access: Public

View File

@ -51,12 +51,23 @@ PUBLISHED:
INLINE_LINMATH FLOATTYPE get_y() const;
INLINE_LINMATH FLOATTYPE get_z() const;
INLINE_LINMATH FLOATTYPE get_w() const;
INLINE_LINMATH void set_cell(int i, FLOATTYPE value);
INLINE_LINMATH void set_x(FLOATTYPE value);
INLINE_LINMATH void set_y(FLOATTYPE value);
INLINE_LINMATH void set_z(FLOATTYPE value);
INLINE_LINMATH void set_w(FLOATTYPE value);
// These next functions add to an existing value.
// i.e. foo.set_x(foo.get_x() + value)
// These are useful to reduce overhead in scripting
// languages:
INLINE_LINMATH void add_to_cell(int i, FLOATTYPE value);
INLINE_LINMATH void add_x(FLOATTYPE value);
INLINE_LINMATH void add_y(FLOATTYPE value);
INLINE_LINMATH void add_z(FLOATTYPE value);
INLINE_LINMATH void add_w(FLOATTYPE value);
INLINE_LINMATH const FLOATTYPE *get_data() const;
INLINE_LINMATH int get_num_components() const;

View File

@ -19,7 +19,7 @@
#ifndef LVECTOR3_H
#define LVECTOR3_H
#include <pandabase.h>
#include "pandabase.h"
#include "coordinateSystem.h"
#include "cmath.h"

View File

@ -19,11 +19,11 @@
#ifndef PTA_COLORF_H
#define PTA_COLORF_H
#include <pandabase.h>
#include "pandabase.h"
#include "vector_Colorf.h"
#include <pointerToArray.h>
#include "pointerToArray.h"
////////////////////////////////////////////////////////////////////
// Class : PTA_Colorf

View File

@ -19,10 +19,8 @@
#ifndef VECTOR_COLORF_H
#define VECTOR_COLORF_H
#include <pandabase.h>
#include "pandabase.h"
#include "luse.h"
#include "pvector.h"
////////////////////////////////////////////////////////////////////
@ -39,7 +37,7 @@
#define TYPE Colorf
#define NAME vector_Colorf
#include <vector_src.h>
#include "vector_src.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__

View File

@ -19,10 +19,8 @@
#ifndef VECTOR_LPOINT2F_H
#define VECTOR_LPOINT2F_H
#include <pandabase.h>
#include "pandabase.h"
#include "luse.h"
#include "pvector.h"
////////////////////////////////////////////////////////////////////
@ -39,7 +37,7 @@
#define TYPE LPoint2f
#define NAME vector_LPoint2f
#include <vector_src.h>
#include "vector_src.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__

View File

@ -19,10 +19,8 @@
#ifndef VECTOR_LVECBASE3F_H
#define VECTOR_LVECBASE3F_H
#include <pandabase.h>
#include "pandabase.h"
#include "luse.h"
#include "pvector.h"
////////////////////////////////////////////////////////////////////
@ -39,7 +37,7 @@
#define TYPE LVecBase3f
#define NAME vector_LVecBase3f
#include <vector_src.h>
#include "vector_src.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__

View File

@ -19,10 +19,8 @@
#ifndef VECTOR_NORMALF_H
#define VECTOR_NORMALF_H
#include <pandabase.h>
#include "pandabase.h"
#include "luse.h"
#include "pvector.h"
////////////////////////////////////////////////////////////////////
@ -39,7 +37,7 @@
#define TYPE Normalf
#define NAME vector_Normalf
#include <vector_src.h>
#include "vector_src.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__

View File

@ -19,8 +19,7 @@
#ifndef VECTOR_TEXCOORDF_H
#define VECTOR_TEXCOORDF_H
#include <pandabase.h>
#include "pandabase.h"
#include "vector_LPoint2f.h"
////////////////////////////////////////////////////////////////////

View File

@ -19,10 +19,8 @@
#ifndef VECTOR_VERTEXF_H
#define VECTOR_VERTEXF_H
#include <pandabase.h>
#include "pandabase.h"
#include "luse.h"
#include "pvector.h"
////////////////////////////////////////////////////////////////////
@ -39,7 +37,7 @@
#define TYPE Vertexf
#define NAME vector_Vertexf
#include <vector_src.h>
#include "vector_src.h"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__