panda3d cheatsheet.txt 5.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. Panda3D engine cheatsheet suited to my personal needs, not complete yet.
  2. REFERENCE:
  3. https://www.panda3d.org/reference/1.9.4/python/annotated
  4. very well documented
  5. GENERAL:
  6. two native file formats: egg (ASCII, backward compatible), bam (binary, not-backwards compatible),
  7. there are egg2bam and bam2egg programs
  8. Z Y rotation order: HPR (high pitch roll, around Z around X around Y)
  9. | /
  10. |/__ X
  11. with low performance try flattenLight(), flattenMedium(), flattenStrong()
  12. COMPILING:
  13. ARCHITECTURE:
  14. CLASSES:
  15. panda3d.core.NodePath references a scene node as a path in scene graph from the root, provides interface to manipulate the node
  16. NodePath attachNewNode(node) attach new node as a child of the referenced node, this is preferred way of adding nodes to scene graph
  17. clear() set to empty path, no node will be referenced after this
  18. detachNode() detaches the referenced node from its parent (but doesn't delete it)
  19. int flattenLight() applies transforms and similar things to vertices of the referenced node and its children, may improve performance
  20. int flattenMedium() more intense than flattenLight(), also gets rid of groups with one child, may improve performance
  21. int flattenStrong() more intense than flattenMedium(), also merges siblings, but may also lower performance by making one huge node
  22. forceRecomputeBounds() forces recomputation of all the bounding volumes of the referenced node and its children
  23. getAncestor(i) get the ith ancestor (0 is the node itself) withing the node path
  24. NodePath getChild(i) get a nodepath of the nth child of the referenced node
  25. LColor getColor() get the color assigned to the referenced node
  26. NodePath getCommonAncestor(np) return the NodePath of the lowest common ancestor
  27. float getDistance(NodePath) get distance between the referenced node and other NodePath's node
  28. float getH() getP() getR() methods for getting HPR rotation of the referenced node
  29. LMatrix4 getMat() get the transform matrix of the referenced node
  30. str getName() get the referenced node's name
  31. PandaNode getNode(i) get the ith referenced PandaNode (0 is the node itself, 1 is the parent etc.)
  32. int getNumChildren() get the number of the referenced node's children
  33. int getNumNodes() get the number of nodes in the path
  34. NodePath getParent() get the NodePath shortened by one (equivalent to getAncestor(1))
  35. LPoint3 getPos() get the referenced node's position
  36. LVector3 getPosDelta() get the position difference against the previous frame (but must have been set with setFluidPos(...), not setPos(...))
  37. float getSx() getSy() getSz() get scale in given direction
  38. Texture getTexture(stage) get the referenced node'S texture with optional stage
  39. panda3d.core.MemoryBase anything that can be allocated and deleted
  40. |
  41. \_panda3d.core.ReferenceCount object whose references are counted
  42. | | int rgetRefCount() get the number of references
  43. | | ref() increment the reference count
  44. | | bool unref() decrease the reference count
  45. \_panda3d.core.Namable something that has a string name
  46. | str getName() get the name
  47. | setName(name) set the name
  48. |
  49. \_panda3d.core.PandaNode scene graph node
  50. __init__(name) create a new node
  51. addChild(pandaNode c, int s) add a new child node and sort it by s, if added twice, only one remains, use attachNewNode(...) instead of this
  52. clearTransform() clear the node transform to identity
  53. PandaNode combineWith(another) tries to merge this node with another one and return the new node
  54. copyAllProperties(PandaNode) copies all attrs of this node (transform, effects, ...) to another node
  55. RenderAttrib getAttrib(i) get the ith render attribute (alpha, fog, ...) of the node
  56. BoundingVolume getBounds() return the bounding volume of the node, type of the volume can be checked with getBoundsType()
  57. PandaNode getChild(i) get the ith child node
  58. [] getChildren() get list of child nodes
  59. int getInternalVertices() get the number of vertices that will be rendered for the node (but not its children)
  60. int getNestedVertices() get the number of vertices that will be rendered for the node (including children)
  61. int getNumChildren() get the number of child nodes
  62. int getNumParents() get the number of parents
  63. PandaNode getParent(i) get ith parent node
  64. [] getParents() get parent node list
  65. removeAllChildren() removes all children of the node
  66. removeChild(i) remove its child
  67. setAttrib(RenderAttrib) add given render attrib (alpha, fog, ...) to the node, if attrib of the same type exists, it is replaced
  68. setBoundsType(type) set the bounding volume type (BT_default, BT_best, BT_sphere, BT_box, BT_fastest)
  69. setEffect(RenderEffect) add given effect to affect the node rendering, if effect of the same type exists, it is replaced
  70. stealChildren(PandaNode) move all children from other node to this one