eggSyntax.txt 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448
  1. THE PHILOSOPHY OF EGG FILES (vs. bam files)
  2. Egg files are used by Panda3D to describe many properties of a scene:
  3. simple geometry, including special effects and collision surfaces,
  4. characters including skeletons, morphs, and multiple-joint
  5. assignments, and character animation tables.
  6. Egg files are designed to be the lingua franca of model manipulation
  7. for Panda tools. A number of utilities are provided that read and
  8. write egg files, for instance to convert to or from some other
  9. modeling format, or to apply a transform or optimize vertices. The
  10. egg file philosophy is to describe objects in an abstract way that
  11. facilitates easy manipulation; thus, the format doesn't include
  12. information such as polygon connectivity or triangle meshes. Egg
  13. files are furthermore designed to be human-readable to help a
  14. developer diagnose (and sometimes repair) problems. Also, the egg
  15. syntax is always intended to be backward compatible with previous
  16. versions, so that as the egg syntax is extended, old egg files will
  17. continue to remain valid.
  18. This is a different philosophy than Panda's bam file format, which is
  19. a binary representation of a model and/or animation that is designed
  20. to be loaded quickly and efficiently, and is strictly tied to a
  21. particular version of Panda. The data in a bam file closely mirrors
  22. the actual Panda structures that are used for rendering. Although an
  23. effort is made to keep bam files backward compatible, occasionally
  24. this is not possible and we must introduce a new bam file major
  25. version.
  26. Where egg files are used for model conversion and manipulation of
  27. models, bam files are strictly used for loading models into Panda.
  28. Although you can load an egg file directly, a bam file will be loaded
  29. much more quickly.
  30. Egg files might be generated by outside sources, and thus it makes
  31. sense to document its syntax here. Bam files, on the other hand,
  32. should only be generated by Panda3D, usually by the program egg2bam.
  33. The exact specification of the bam file format, if you should need it,
  34. is documented within the Panda3D code itself.
  35. GENERAL EGG SYNTAX
  36. Egg files consist of a series of sequential and hierarchically-nested
  37. entries. In general, the syntax of each entry is:
  38. <Entry-type> name { contents }
  39. Where the name is optional (and in many cases, ignored anyway) and the
  40. syntax of the contents is determined by the entry-type. The name (and
  41. strings in general) may be either quoted with double quotes or
  42. unquoted. Newlines are treated like any other whitespace, and case is
  43. not significant. The angle brackets are literally a part of the entry
  44. keyword. (Square brackets and ellipses in this document are used to
  45. indicate optional pieces, and are not literally part of the syntax.)
  46. The name field is always syntactically allowed between an entry
  47. keyword and its opening brace, even if it will be ignored. In the
  48. syntax lines given below, the name is not shown if it will be ignored.
  49. Comments may be delimited using either the C++-style // ... or the
  50. C-style /* ... */. C comments do not nest. There is also a <Comment>
  51. entry type, of the form:
  52. <Comment> { text }
  53. <Comment> entries are slightly different, in that tools which read and
  54. write egg files will preserve the text within <Comment> entries, but
  55. they may not preserve comments delimited by // or /* */. Special
  56. characters and keywords within a <Comment> entry should be quoted;
  57. it's safest to quote the entire comment.
  58. LOCAL INFORMATION ENTRIES
  59. These nodes contain information relevant to the current level of
  60. nesting only.
  61. <Scalar> name { value }
  62. <Char*> name { value }
  63. Scalars can appear in various contexts. They are always optional,
  64. and specify some attribute value relevant to the current context.
  65. The scalar name is the name of the attribute; different attribute
  66. names are meaningful in different contexts. The value is either a
  67. numeric or a (quoted or unquoted) string value; the interpretation
  68. as a number or as a string depends on the nature of the named
  69. attribute. Because of a syntactic accident with the way the egg
  70. syntax evolved, <Scalar> and <Char*> are lexically the same and both
  71. can represent either a string or a number. <Char*> is being phased
  72. out; it is suggested that new egg files use only <Scalar>.
  73. GLOBAL INFORMATION ENTRIES
  74. These nodes contain information relevant to the file as a whole. They
  75. can be nested along with geometry nodes, but this nesting is
  76. irrelevant and the only significant placement rule is that they should
  77. appear before they are referenced.
  78. <CoordinateSystem> { string }
  79. This entry indicates the coordinate system used in the egg file; the
  80. egg loader will automatically make a conversion if necessary. The
  81. following strings are valid: Y-up, Z-up, Y-up-right, Z-up-right,
  82. Y-up-left, or Z-up-left. (Y-up is the same as Y-up-right, and Z-up
  83. is the same as Z-up-right.)
  84. By convention, this entry should only appear at the beginning of the
  85. file, although it is technically allowed anywhere. It is an error
  86. to include more than one coordinate system entry in the same file.
  87. If it is omitted, Y-up is assumed.
  88. <Texture> name { filename [scalars] }
  89. This describes a texture file that can be referenced later with
  90. <TRef> { name }. It is not necessary to make a <Texture> entry for
  91. each texture to be used; a texture may also be referenced directly
  92. by the geometry via an abbreviated inline <Texture> entry, but a
  93. separate <Texture> entry is the only way to specify anything other
  94. than the default texture attributes.
  95. If the filename is a relative path, the current egg file's directory
  96. is searched first, and then the texture-path and model-path are
  97. searched.
  98. The following attributes are presently implemented for textures:
  99. <Scalar> format { format-definition }
  100. This defines the load format of the image file. The
  101. format-definition is one of:
  102. RGBA, RGBM, RGBA12, RGBA8, RGBA4,
  103. RGB, RGB12, RGB8, RGB5, RGB332,
  104. LUMINANCE_ALPHA,
  105. RED, GREEN, BLUE, ALPHA, LUMINANCE
  106. The formats whose names end in digits specifically request a
  107. particular texel width. RGB12 and RGBA12 specify 48-bit texels
  108. with or without alpha; RGB8 and RGBA8 specify 32-bit texels, and
  109. RGB5 and RGBA4 specify 16-bit texels. RGB332 specifies 8-bit
  110. texels.
  111. The remaining formats are generic and specify only the semantic
  112. meaning of the channels. The size of the texels is determined by
  113. the width of the components in the image file. RGBA is the most
  114. general; RGB is the same, but without any alpha channel. RGBM is
  115. like RGBA, except that it requests only one bit of alpha, if the
  116. graphics card can provide that, to leave more room for the RGB
  117. components, which is especially important for older 16-bit
  118. graphics cards (the "M" stands for "mask", as in a cutout).
  119. The number of components of the image file should match the format
  120. specified; if it does not, the egg loader will attempt to provide
  121. the closest match that does.
  122. <Scalar> wrap { repeat-definition }
  123. <Scalar> wrapu { repeat-definition }
  124. <Scalar> wrapv { repeat-definition }
  125. This defines the behavior of the texture image outside of the
  126. normal (u,v) range 0.0 - 1.0. It is "REPEAT" to repeat the
  127. texture to infinity, "CLAMP" not to. The wrapping behavior may be
  128. specified independently for each axis via "wrapu" and "wrapv", or
  129. it may be specified for both simultaneously via "wrap".
  130. <Scalar> minfilter { filter-type }
  131. <Scalar> magfilter { filter-type }
  132. <Scalar> magfilteralpha { filter-type }
  133. <Scalar> magfiltercolor { filter-type }
  134. This specifies the type of filter applied when minimizing or
  135. maximizing. Filter-type may be one of:
  136. NEAREST
  137. LINEAR
  138. NEAREST_MIPMAP_NEAREST
  139. LINEAR_MIPMAP_NEAREST
  140. NEAREST_MIPMAP_LINEAR
  141. LINEAR_MIPMAP_LINEAR
  142. There are also some additional filter types that are supported for
  143. historical reasons, but each of those additional types maps to one
  144. of the above. New egg files should use only the above filter
  145. types.
  146. <Scalar> envtype { environment-type }
  147. This specifies the type of texture environment to create; i.e. it
  148. controls the way in which textures apply to models.
  149. Environment-type may be one of:
  150. MODULATE
  151. DECAL
  152. BLEND
  153. REPLACE
  154. ADD
  155. BLEND_COLOR_SCALE
  156. The default environment type is MODULATE, which means the texture
  157. color is multiplied with the base polygon (or vertex) color. This
  158. is the most common texture environment by far. Other environment
  159. types are more esoteric and are especially useful in the presence
  160. of multitexture. See howto.use_multitexture.txt for more on these.
  161. <Scalar> combine-rgb { combine-mode }
  162. <Scalar> combine-alpha { combine-mode }
  163. <Scalar> combine-rgb-source0 { combine-source }
  164. <Scalar> combine-rgb-operand0 { combine-operand }
  165. <Scalar> combine-rgb-source1 { combine-source }
  166. <Scalar> combine-rgb-operand1 { combine-operand }
  167. <Scalar> combine-rgb-source2 { combine-source }
  168. <Scalar> combine-rgb-operand2 { combine-operand }
  169. <Scalar> combine-alpha-source0 { combine-source }
  170. <Scalar> combine-alpha-operand0 { combine-operand }
  171. <Scalar> combine-alpha-source1 { combine-source }
  172. <Scalar> combine-alpha-operand1 { combine-operand }
  173. <Scalar> combine-alpha-source2 { combine-source }
  174. <Scalar> combine-alpha-operand2 { combine-operand }
  175. These options replace the envtype and specify the texture combiner
  176. mode, which is usually used for multitexturing. This specifies
  177. how the texture combines with the base color and/or the other
  178. textures applied previously. You must specify both an rgb and an
  179. alpha combine mode. Some combine-modes use one source/operand
  180. pair, and some use all three; most use just two.
  181. combine-mode may be one of:
  182. REPLACE
  183. MODULATE
  184. ADD
  185. ADD-SIGNED
  186. INTERPOLATE
  187. SUBTRACT
  188. DOT3-RGB
  189. DOT3-RGBA
  190. combine-source may be one of:
  191. TEXTURE
  192. CONSTANT
  193. PRIMARY-COLOR
  194. PREVIOUS
  195. CONSTANT_COLOR_SCALE
  196. combine-operand may be one of:
  197. SRC-COLOR
  198. ONE-MINUS-SRC-COLOR
  199. SRC-ALPHA
  200. ONE-MINUS-SRC-ALPHA
  201. The default values if any of these are omitted are:
  202. <Scalar> combine-rgb { modulate }
  203. <Scalar> combine-alpha { modulate }
  204. <Scalar> combine-rgb-source0 { previous }
  205. <Scalar> combine-rgb-operand0 { src-color }
  206. <Scalar> combine-rgb-source1 { texture }
  207. <Scalar> combine-rgb-operand1 { src-color }
  208. <Scalar> combine-rgb-source2 { constant }
  209. <Scalar> combine-rgb-operand2 { src-alpha }
  210. <Scalar> combine-alpha-source0 { previous }
  211. <Scalar> combine-alpha-operand0 { src-alpha }
  212. <Scalar> combine-alpha-source1 { texture }
  213. <Scalar> combine-alpha-operand1 { src-alpha }
  214. <Scalar> combine-alpha-source2 { constant }
  215. <Scalar> combine-alpha-operand2 { src-alpha }
  216. <Scalar> tex-gen { mode }
  217. This specifies that texture coordinates for the primitives that
  218. reference this texture should be dynamically computed at runtime,
  219. for instance to apply a reflection map or some other effect. The
  220. valid values for mode are:
  221. SPHERE_MAP
  222. CUBE_MAP
  223. WORLD_POSITION
  224. OBJECT_POSITION
  225. EYE_POSITION
  226. <Scalar> stage-name { name }
  227. Specifies the name of the TextureStage object that is created to
  228. render this texture. If this is omitted, a custom TextureStage is
  229. created for this texture if it is required (e.g. because some
  230. other multitexturing parameter has been specified), or the system
  231. default TextureStage is used if multitexturing is not required.
  232. <Scalar> priority { priority-value }
  233. Specifies an integer sort value to rank this texture in priority
  234. among other textures that are applied to the same geometry. This
  235. is only used to eliminate low-priority textures in case more
  236. textures are requested for a particular piece of geometry than the
  237. graphics hardware can render.
  238. <Scalar> blendr { red-value }
  239. <Scalar> blendg { green-value }
  240. <Scalar> blendb { blue-value }
  241. <Scalar> blenda { alpha-value }
  242. Specifies a four-component color that is applied with the color in
  243. case the envtype, above, is "blend".
  244. <Scalar> uv-name { name }
  245. Specifies the name of the texture coordinates that are to be
  246. associated with this texture. If this is omitted, the default
  247. texture coordinates are used.
  248. <Scalar> rgb-scale { scale }
  249. <Scalar> alpha-scale { scale }
  250. Specifies an additional scale factor that will scale the r, g, b
  251. (or a) components after the texture has been applied. This is
  252. only used when a combine mode is in effect. The only legal values
  253. are 1, 2, or 4.
  254. <Scalar> alpha { alpha-type }
  255. This specifies whether and what type of transparency will be
  256. performed. Alpha-type may be one of:
  257. OFF
  258. ON
  259. BLEND
  260. BLEND_NO_OCCLUDE
  261. MS
  262. MS_MASK
  263. If alpha-type is OFF, it means not to enable transparency, even if
  264. the image contains an alpha channel or the format is RGBA. If
  265. alpha-type is ON, it means to enable the default transparency,
  266. even if the image filename does not contain an alpha channel. If
  267. alpha-type is any of the other options, it specifies the type of
  268. transparency to be enabled.
  269. <Scalar> bin { bin-name }
  270. This specifies the bin name order of all polygons with this
  271. texture applied, in the absence of a bin name specified on the
  272. polygon itself. See the description for bin under polygon
  273. attributes.
  274. <Scalar> draw_order { number }
  275. This specifies the fixed drawing order of all polygons with this
  276. texture applied, in the absence of a drawing order specified on
  277. the polygon itself. See the description for draw_order under
  278. polygon attributes.
  279. <Transform> { transform-definition }
  280. This specifies a 2-d transformation that is applied to the UV's of
  281. a surface to generate the texture coordinates.
  282. The transform syntax is similar to that for groups, except it
  283. defines a 2-d 3x3 matrix. The definition may be any sequence of
  284. zero or more of the following. Transformations are post
  285. multiplied in the order they are encountered to produce a net
  286. transformation matrix. Rotations are counterclockwise about the
  287. origin in degrees. Matrices, when specified explicitly, are
  288. row-major.
  289. <Translate> { x y }
  290. <Rotate> { degrees }
  291. <Scale> { x y }
  292. <Scale> { s }
  293. <Matrix3> {
  294. 00 01 02
  295. 10 11 12
  296. 20 21 22
  297. }
  298. The transform definition might also include the following scalar:
  299. <Scalar> animated { 1 }
  300. If this is set, it indicates the matrix may be animated by a
  301. matrix channel, like a joint. At present, this flag is not used;
  302. eventually, it may be used to define an arbitrary texture
  303. coordinate animation.
  304. <Material> name { [scalars] }
  305. This defines a set of material attributes that may later be
  306. referenced with <MRef> { name }.
  307. The following attributes may appear within the material block:
  308. <Scalar> diffr { number }
  309. <Scalar> diffg { number }
  310. <Scalar> diffb { number }
  311. <Scalar> diffa { number }
  312. <Scalar> ambr { number }
  313. <Scalar> ambg { number }
  314. <Scalar> ambb { number }
  315. <Scalar> amba { number }
  316. <Scalar> emitr { number }
  317. <Scalar> emitg { number }
  318. <Scalar> emitb { number }
  319. <Scalar> emita { number }
  320. <Scalar> specr { number }
  321. <Scalar> specg { number }
  322. <Scalar> specb { number }
  323. <Scalar> speca { number }
  324. <Scalar> shininess { number }
  325. <Scalar> local { flag }
  326. These properties collectively define a "material" that controls the
  327. lighting effects that are applied to a surface; a material is only
  328. in effect in the presence of lighting.
  329. The four color groups, diff*, amb*, emit*, and spec* specify the
  330. diffuse, ambient, emission, and specular components of the lighting
  331. equation, respectively. Any of them may be omitted; the omitted
  332. component(s) take their color from the native color of the
  333. primitive, otherwise the primitive color is replaced with the
  334. material color.
  335. The shininess property controls the size of the specular highlight,
  336. and the value ranges from 0 to 128. A larger value creates a
  337. smaller highlight (creating the appearance of a shinier surface).
  338. <VertexPool> name { vertices }
  339. A vertex pool is a set of vertices. All geometry is created by
  340. referring to vertices by number in a particular vertex pool. There
  341. may be one or several vertex pools in an egg file, but all vertices
  342. that make up a single polygon must come from the same vertex pool.
  343. The body of a <VertexPool> entry is simply a list of one or more
  344. <Vertex> entries, as follows:
  345. <Vertex> number { x [y [z [w]]] [attributes] }
  346. A <Vertex> entry is only valid within a vertex pool definition.
  347. The number is the index by which this vertex will be referenced.
  348. It is optional; if it is omitted, the vertices are implicitly
  349. numbered consecutively beginning at one. If the number is
  350. supplied, the vertices need not be consecutive.
  351. Normally, vertices are three-dimensional (with coordinates x, y,
  352. and z); however, in certain cases vertices may have fewer or more
  353. dimensions, up to four. This is particularly true of vertices
  354. used as control vertices of NURBS curves and surfaces. If more
  355. coordinates are supplied than needed, the extra coordinates are
  356. ignored; if fewer are supplied than needed, the missing
  357. coordinates are assumed to be 0.
  358. The vertex's coordinates are always given in world space,
  359. regardless of any transforms before the vertex pool or before the
  360. referencing geometry. If the vertex is referenced by geometry
  361. under a transform, the egg loader will do an inverse transform to
  362. move the vertex into the proper coordinate space without changing
  363. its position in world space. One exception is geometry under an
  364. <Instance> node; in this case the vertex coordinates are given in
  365. the space of the <Instance> node. (Another exception is a
  366. <DynamicVertexPool>; see below.)
  367. In neither case does it make a difference whether the vertex pool
  368. is itself declared under a transform or an <Instance> node. The
  369. only deciding factor is whether the geometry that *uses* the
  370. vertex pool appears under an <Instance> node. It is possible for
  371. a single vertex to be interpreted in different coordinate spaces
  372. by different polygons.
  373. While each vertex must at least have a position, it may also have
  374. a color, normal, pair of UV coordinates, and/or a set of morph
  375. offsets. Furthermore, the color, normal, and UV coordinates may
  376. themselves have morph offsets. Thus, the [attributes] in the
  377. syntax line above may be replaced with zero or more of the
  378. following entries:
  379. <Dxyz> target { x y z }
  380. This specifies the offset of this vertex for the named morph
  381. target. See the "MORPH DESCRIPTION ENTRIES" header, below.
  382. <Normal> { x y z [morph-list] }
  383. This specifies the surface normal of the vertex. If omitted, the
  384. vertex will have no normal. Normals may also be morphed;
  385. morph-list here is thus an optional list of <DNormal> entries,
  386. similar to the above.
  387. <RGBA> { r g b a [morph-list] }
  388. This specifies the four-valued color of the vertex. Each
  389. component is in the range 0.0 to 1.0. A vertex color, if
  390. specified for all vertices of the polygon, overrides the polygon's
  391. color. If neither color is given, the default is white
  392. (1 1 1 1). The morph-list is an optional list of <DRGBA> entries.
  393. <UV> [name] { u v [morph-list] }
  394. This gives the texture coordinates of the vertex. This must be
  395. specified if a texture is to be mapped onto this geometry. As
  396. before, morph-list is an optional list of <DUV> entries.
  397. Unlike the other kinds of attributes, there may be multiple sets
  398. of UV's on each vertex, each with a unique name; this provides
  399. support for multitexturing. The name may be omitted to specify
  400. the default UV's.
  401. <DynamicVertexPool> name { vertices }
  402. A dynamic vertex pool is similar to a vertex pool in most respects,
  403. except that each vertex might be animated by substituting in values
  404. from a <VertexAnim> table. Also, the vertices defined within a
  405. dynamic vertex pool are always given in local coordinates, instead
  406. of world coordinates.
  407. The presence of a dynamic vertex pool makes sense only within a
  408. character model, and a single dynamic vertex pool may not span
  409. multiple characters. Each dynamic vertex pool creates a DynVerts
  410. object within the character by the same name; this name is used
  411. later when matching up the corresponding <VertexAnim>.
  412. At the present time, the DynamicVertexPool is not implemented in
  413. Panda3D.
  414. GEOMETRY ENTRIES
  415. <Polygon> name {
  416. [attributes]
  417. <VertexRef> {
  418. indices
  419. <Ref> { pool-name }
  420. }
  421. }
  422. A polygon consists of a sequence of vertices from a single vertex
  423. pool. Vertices are identified by pool-name and index number within
  424. the pool; indices is a list of vertex numbers within the given
  425. vertex pool. Vertices are listed in counterclockwise order.
  426. Although the vertices must all come from the same vertex pool, they
  427. may have been assigned to arbitrarily many different joints
  428. regardless of joint connectivity (there is no "straddle-polygon"
  429. limitation). See Joints, below.
  430. The polygon syntax is quite verbose, and there isn't any way to
  431. specify a set of attributes that applies to a group of polygons--the
  432. attributes list must be repeated for each polygon. This is why egg
  433. files tend to be very large.
  434. The following attributes may be specified for polygons:
  435. <TRef> { texture-name }
  436. This refers to a named <Texture> entry given earlier. It applies
  437. the given texture to the polygon. This requires that all the
  438. polygon's vertices have been assigned texture coordinates.
  439. This attribute may be repeated multiple times to specify
  440. multitexture. In this case, each named texture is applied to the
  441. polygon, in the order specified.
  442. <Texture> { filename }
  443. This is another way to apply a texture to a polygon. The
  444. <Texture> entry is defined "inline" to the polygon, instead of
  445. referring to a <Texture> entry given earlier. There is no way to
  446. specify texture attributes given this form.
  447. There's no advantage to this syntax for texture mapping. It's
  448. supported only because it's required by some older egg files.
  449. <MRef> { material-name }
  450. This applies the material properties defined in the earlier
  451. <Material> entry to the polygon.
  452. <Normal> { x y z [morph-list] }
  453. This defines a polygon surface normal. The polygon normal will be
  454. used unless all vertices also have a normal. If no normal is
  455. defined, none will be supplied. The polygon normal, like the
  456. vertex normal, may be morphed by specifying a series of <DNormal>
  457. entries.
  458. The polygon normal is used only for lighting and environment
  459. mapping calculations, and is not related to the implicit normal
  460. calculated for CollisionPolygons.
  461. <RGBA> { r g b a [morph-list] }
  462. This defines the polygon's color, which will be used unless all
  463. vertices also have a color. If no color is defined, the default
  464. is white (1 1 1 1). The color may be morphed with a series of
  465. <DRGBA> entries.
  466. <BFace> { boolean-value }
  467. This defines whether the polygon will be rendered double-sided
  468. (i.e. its back face will be visible). By default, this option is
  469. disabled, and polygons are one-sided; specifying a nonzero value
  470. disables backface culling for this particular polygon and allows
  471. it to be viewed from either side.
  472. <Scalar> bin { bin-name }
  473. It is sometimes important to control the order in which objects
  474. are rendered, particularly when transparency is in use. In Panda,
  475. this is achieved via the use of named bins and, within certain
  476. kinds of bins, sometimes an explicit draw_order is also used (see
  477. below).
  478. In the normal (state-sorting) mode, Panda renders its geometry by
  479. first grouping into one or more named bins, and then rendering the
  480. bins in a specified order. The programmer is free to define any
  481. number of bins, named whatever he/she desires.
  482. This scalar specifies which bin this particular polygon is to be
  483. rendered within. If no bin scalar is given, or if the name given
  484. does not match any of the known bins, the polygon will be assigned
  485. to the default bin, which renders all opaque geometry sorted by
  486. state, followed by all transparent geometry sorted back-to-front.
  487. See also draw_order, below.
  488. <Scalar> draw_order { number }
  489. This works in conjunction with bin, above, to further refine the
  490. order in which this polygon is drawn, relative to other geometry
  491. in the same bin. If (and only if) the bin type named in the bin
  492. scalar is a CullBinFixed, this draw_order is used to define the
  493. fixed order that all geometry in the same will be rendered, from
  494. smaller numbers to larger numbers.
  495. If the draw_order scalar is specified but no bin scalar is
  496. specified, the default is a bin named "fixed", which is a
  497. CullBinFixed object that always exists by default.
  498. <Scalar> visibility { hidden | normal }
  499. If the visibility of a primitive is set to "hidden", the primitive
  500. is not generated as a normally visible primitive. If the
  501. Config.prc variable egg-suppress-hidden is set to true, the
  502. primitive is not converted at all; otherwise, it is converted as a
  503. "stashed" node.
  504. This, like the other rendering flags alpha, draw_order, and bin,
  505. may be specified at the group level, within the primitive level,
  506. or even within a texture.
  507. <PointLight> name {
  508. [attributes]
  509. <VertexRef> {
  510. indices
  511. <Ref> { pool-name }
  512. }
  513. }
  514. A PointLight is a set of single points. One point is drawn for each
  515. vertex listed in the <VertexRef>. Normals, textures, and colors may
  516. be specified for PointLights, as well as draw_order, plus one
  517. additional attribute valid only for PointLights and Lines:
  518. <Scalar> thick { number }
  519. This specifies the size of the PointLight (or the width of a
  520. line), in pixels, when it is rendered. This may be a
  521. floating-point number, which is meaningful only when antialiasing
  522. is in effect. The default is 1.0.
  523. <Line> name {
  524. [attributes]
  525. <VertexRef> {
  526. indices
  527. <Ref> { pool-name }
  528. }
  529. }
  530. A Line is a connected set of line segments. The listed N vertices
  531. define a series of N-1 line segments, drawn between vertex 0 and
  532. vertex 1, vertex 1 and vertex 2, etc. The line is not implicitly
  533. closed; if you wish to represent a loop, you must repeat vertex 0 at
  534. the end. As with a PointLight, normals, textures, colors,
  535. draw_order, and the "thick" attribute are all valid.
  536. PARAMETRIC DESCRIPTION ENTRIES
  537. The following entries define parametric curves and surfaces.
  538. Generally, Panda supports these only in the abstract; they're not
  539. geometry in the true sense but do exist in the scene graph and may
  540. have specific meaning to the application. However, Panda can create
  541. visible representations of these parametrics to aid visualization.
  542. These entries might also have meaning to external tools outside of an
  543. interactive Panda session, such as egg-qtess, which can be used to
  544. convert NURBS surfaces to polygons at different levels of resolution.
  545. In general, dynamic attributes such as morphs and joint assignment are
  546. legal for the control vertices of the following parametrics, but Panda
  547. itself doesn't support them and will always create static curves and
  548. surfaces. External tools like egg-qtess, however, may respect them.
  549. <NURBSCurve> {
  550. [attributes]
  551. <Order> { order }
  552. <Knots> { knot-list }
  553. <VertexRef> { indices <Ref> { pool-name } }
  554. }
  555. A NURBS curve is a general parametric curve. It is often used to
  556. represent a motion path, e.g. for a camera or an object.
  557. The order is equal to the degree of the polynomial basis plus 1. It
  558. must be an integer in the range [1,4].
  559. The number of vertices must be equal to the number of knots minus the
  560. order.
  561. Each control vertex of a NURBS is defined in homogeneous space with
  562. four coordinates x y z w (to convert to 3-space, divide x, y, and z
  563. by w). The last coordinate is always the homogeneous coordinate; if
  564. only three coordinates are given, it specifies a curve in two
  565. dimensions plus a homogeneous coordinate (x y w).
  566. The following attributes may be defined:
  567. <Scalar> type { curve-type }
  568. This defines the semanting meaning of this curve, either XYZ, HPR,
  569. or T. If the type is XYZ, the curve will automatically be
  570. transformed between Y-up and Z-up if necessary; otherwise, it will
  571. be left alone.
  572. <Scalar> subdiv { num-segments }
  573. If this scalar is given and nonzero, Panda will create a visible
  574. representation of the curve when the scene is loaded. The number
  575. represents the number of line segments to draw to approximate the
  576. curve.
  577. <RGBA> { r g b a [morph-list] }
  578. This specifies the color of the overall curve.
  579. NURBS control vertices may also be given color and/or morph
  580. attributes, but <Normal> and <UV> entries do not apply to NURBS
  581. vertices.
  582. <NURBSSurface> name {
  583. [attributes]
  584. <Order> { u-order v-order }
  585. <U-knots> { u-knot-list }
  586. <V-knots> { v-knot-list }
  587. <VertexRef> {
  588. indices
  589. <Ref> { pool-name }
  590. }
  591. }
  592. A NURBS surface is an extension of a NURBS curve into two parametric
  593. dimensions, u and v. NURBS surfaces may be given the same set of
  594. attributes assigned to polygons, except for normals: <TRef>,
  595. <Texture>, <MRef>, <RGBA>, and draw_order are all valid attributes
  596. for NURBS. NURBS vertices, similarly, may be colored or morphed,
  597. but <Normal> and <UV> entries do not apply to NURBS vertices. The
  598. attributes may also include <NURBSCurve> and <Trim> entries; see
  599. below.
  600. To have Panda create a visualization of a NURBS surface, the
  601. following two attributes should be defined as well:
  602. <Scalar> U-subdiv { u-num-segments }
  603. <Scalar> V-subdiv { v-num-segments }
  604. These define the number of subdivisions to make in the U and V
  605. directions to represent the surface. A uniform subdivision is
  606. always made, and trim curves are not respected (though they will
  607. be drawn in if the trim curves themselves also have a subiv
  608. parameter). This is only intended as a cheesy visualization.
  609. The same sort of restrictions on order and knots applies to NURBS
  610. surfaces as do to NURBS curves. The order and knot description may
  611. be different in each dimension.
  612. The surface must have u-num * v-num vertices, where u-num is the
  613. number of u-knots minus the u-order, and v-num is the number of
  614. v-knots minus the v-order. All vertices must come from the same
  615. vertex pool. The nth (zero-based) index number defines control
  616. vertex (u, v) of the surface, where n = (v * u-num) + u. Thus, it
  617. is the u coordinate which changes faster.
  618. As with the NURBS curve, each control vertex is defined in
  619. homogeneous space with four coordinates x y z w.
  620. A NURBS may also contain curves on its surface. These are one or
  621. more nested <NURBSCurve> entries included with the attributes; these
  622. curves are defined in the two-dimensional parametric space of the
  623. surface. Thus, these curve vertices should have only two dimensions
  624. plus the homogeneous coordinate: u v w. A curve-on-surface has no
  625. intrinsic meaning to the surface, unless it is defined within a
  626. <Trim> entry, below.
  627. Finally, a NURBS may be trimmed by one or more trim curves. These
  628. are special curves on the surface which exclude certain areas from
  629. the NURBS surface definition. The inside is specified using two
  630. rules: an odd winding rule that states that the inside consists of
  631. all regions for which an infinite ray from any point in the region
  632. will intersect the trim curve an odd number of times, and a curve
  633. orientation rule that states that the inside consists of the regions
  634. to the left as the curve is traced.
  635. Each trim curve contains one or more loops, and each loop contains
  636. one or more NURBS curves. The curves of a loop connect in a
  637. head-to-tail fashion and must be explicitly closed.
  638. The trim curve syntax is as follows:
  639. <Trim> {
  640. <Loop> {
  641. <NURBSCurve> {
  642. <Order> { order }
  643. <Knots> { knot-list }
  644. <VertexRef> { indices <Ref> { pool-name } }
  645. }
  646. [ <NURBSCurve> { ... } ... ]
  647. }
  648. [ <Loop> { ... } ... ]
  649. }
  650. Although the egg syntax supports trim curves, there are at present
  651. no egg processing tools that respect them. For instance, egg-qtess
  652. ignores trim curves and always tesselates the entire NURBS surface.
  653. MORPH DESCRIPTION ENTRIES
  654. Morphs are linear interpolations of attribute values at run time,
  655. according to values read from an animation table. In general, vertex
  656. positions, surface normals, texture coordinates, and colors may be
  657. morphed.
  658. A morph target is defined by giving a net morph offset for a series of
  659. vertex or polygon attributes; this offset is the value that will be
  660. added to the attribute when the morph target has the value 1.0. At
  661. run time, the morph target's value may be animated to any scalar value
  662. (but generally between 0.0 and 1.0); the corresponding fraction of the
  663. offset is added to the attribute each frame.
  664. There is no explicit morph target definition; a morph target exists
  665. solely as the set of all offsets that share the same target name. The
  666. target name may be any arbitrary string; like any name in an egg file,
  667. it should be quoted if it contains special characters.
  668. The following types of morph offsets may be defined, within their
  669. corresponding attribute entries:
  670. <Dxyz> target { x y z }
  671. A position delta, valid within a <Vertex> entry or a <CV> entry.
  672. The given offset vector, scaled by the morph target's value, is
  673. added to the vertex or CV position each frame.
  674. <DNormal> target { x y z }
  675. A normal delta, similar to the position delta, valid within a
  676. <Normal> entry (for vertex or polygon normals). The given offset
  677. vector, scaled by the morph target's value, is added to the normal
  678. vector each frame. The resulting vector may not be automatically
  679. normalized to unit length.
  680. <DUV> target { u v }
  681. A texture-coordinate delta, valid within a <UV> entry (within a
  682. <Vertex> entry). The given 2-valued offset vector, scaled by the
  683. morph target's value, is added to the vertex's texture coordinates
  684. each frame.
  685. <DRGBA> target { r g b a }
  686. A color delta, valid within an <RGBA> entry (for vertex or polygon
  687. colors). The given 4-valued offset vector, scaled by the morph
  688. target's value, is added to the color value each frame.
  689. GROUPING ENTRIES
  690. <Group> name { group-body }
  691. A <Group> node is the primary means of providing structure to the
  692. egg file. Groups can contain vertex pools and polygons, as well as
  693. other groups. The egg loader translates <Group> nodes directly into
  694. PandaNodes in the scene graph (although the egg loader reserves the
  695. right to arbitrarily remove nodes that it deems unimportant--see the
  696. <Model> flag, below to avoid this). In addition, the following
  697. entries can be given specifically within a <Group> node to specify
  698. attributes of the group:
  699. GROUP BINARY ATTRIBUTES
  700. These attributes may be either on or off; they are off by default.
  701. They are turned on by specifying a non-zero "boolean-value".
  702. <DCS> { boolean-value }
  703. DCS stands for Dynamic Coordinate System. This indicates that
  704. show code will expect to be able to read the transform set on this
  705. node at run time, and may need to modify the transform further.
  706. This is a special case of <Model>, below.
  707. <DCS> { dcs-type }
  708. This is another syntax for the <DCS> flag. The dcs-type string
  709. should be one of either "local" or "net", which specifies the kind
  710. of preserve_transform flag that will be set on the corresponding
  711. ModelNode. If the string is "local", it indicates that the local
  712. transform on this node (as well as the net transform) will not be
  713. affected by any flattening operation and will be preserved through
  714. the entire model loading process. If the string is "net", then
  715. only the net transform will be preserved; the local transform may
  716. be adjusted in the event of a flatten operation.
  717. <Model> { boolean-value }
  718. This indicates that the show code might need a pointer to this
  719. particular group. This creates a ModelNode at the corresponding
  720. level, which is guaranteed not to be removed by any flatten
  721. operation. However, its transform might still be changed, but see
  722. also the <DCS> flag, above.
  723. <Dart> { boolean-value }
  724. This indicates that this group begins an animated character. A
  725. Character node, which is the fundamental animatable object of
  726. Panda's high-level Actor class, will be created for this group.
  727. This flag should always be present within the <Group> entry at the
  728. top of any hierarchy of <Joint>'s and/or geometry with morphed
  729. vertices; joints and morphs appearing outside of a hierarchy
  730. identified with a <Dart> flag are undefined.
  731. <Switch> { boolean-value }
  732. This attribute indicates that the child nodes of this group
  733. represent a series of animation frames that should be
  734. consecutively displayed. In the absence of an "fps" scalar for
  735. the group (see below), the egg loader creates a SwitchNode, and it
  736. the responsibility of the show code to perform the switching. If
  737. an fps scalar is defined and is nonzero, the egg loader creates a
  738. SequenceNode instead, which automatically cycles through its
  739. children.
  740. GROUP SCALARS
  741. <Scalar> fps { frame-rate }
  742. This specifies the rate of animation for a SequenceNode (created
  743. when the Switch flag is specified, see above). A value of zero
  744. indicates a SwitchNode should be created instead.
  745. <Scalar> bin { bin-name }
  746. This specifies the bin name for all polygons at or below this node
  747. that do not explicitly set their own bin. See the description of
  748. bin for geometry attributes, above.
  749. <Scalar> draw_order { number }
  750. This specifies the drawing order for all polygons at or below this
  751. node that do not explicitly set their own drawing order. See the
  752. description of draw_order for geometry attributes, above.
  753. <Scalar> visibility { hidden | normal }
  754. If the visibility of a group is set to "hidden", the primitives
  755. nested within that group are not generated as a normally visible
  756. primitive. If the Config.prc variable egg-suppress-hidden is set
  757. to true, the primitives are not converted at all; otherwise, they
  758. are converted as a "stashed" node.
  759. <Scalar> decal { boolean-value }
  760. If this is present and boolean-value is non-zero, it indicates
  761. that the geometry *below* this level is coplanar with the geometry
  762. *at* this level, and the geometry below is to be drawn as a decal
  763. onto the geometry at this level. This means the geometry below
  764. this level will be rendered "on top of" this geometry, but without
  765. the Z-fighting artifacts one might expect without the use of the
  766. decal flag.
  767. <Scalar> decalbase { boolean-value }
  768. This can optionally be used with the "decal" scalar, above. If
  769. present, it should be applied to a sibling of one or more nodes
  770. with the "decal" scalar on. It indicates which of the sibling
  771. nodes should be treated as the base of the decal. In the absence
  772. of this scalar, the parent of all decal nodes is used as the decal
  773. base. This scalar is useful when the modeling package is unable
  774. to parent geometry nodes to other geometry nodes.
  775. <Scalar> collide-mask { value }
  776. <Scalar> from-collide-mask { value }
  777. <Scalar> into-collide-mask { value }
  778. Sets the CollideMasks on the collision nodes and geometry nodes
  779. created at or below this group to the indicated values. These
  780. are bits that indicate which objects can collide with which
  781. other objects. Setting "collide-mask" is equivalent to setting
  782. both "from-collide-mask" and "into-collide-mask" to the same
  783. value.
  784. The value may be an ordinary decimal integer, or a hex number in
  785. the form 0x000, or a binary number in the form 0b000.
  786. OTHER GROUP ATTRIBUTES
  787. <Billboard> { type }
  788. This entry indicates that all geometry defined at or below this
  789. group level is part of a billboard that will rotate to face the
  790. camera. Type is either "axis" or "point", describing the type of
  791. rotation.
  792. Billboards rotate about their local axis. In the case of a Y-up
  793. file, the billboards rotate about the Y axis; in a Z-up file, they
  794. rotate about the Z axis. Point-rotation billboards rotate about
  795. the origin.
  796. There is an implicit <Instance> around billboard geometry. This
  797. means that the geometry within a billboard is not specified in
  798. world coordinates, but in the local billboard space. Thus, a
  799. vertex drawn at point 0,0,0 will appear to be at the pivot point
  800. of the billboard, not at the origin of the scene.
  801. <SwitchCondition> {
  802. <Distance> {
  803. in out [fade] <Vertex> { x y z }
  804. }
  805. }
  806. The subtree beginning at this node and below represents a single
  807. level of detail for a particular model. Sibling nodes represent
  808. the additional levels of detail. The geometry at this node will
  809. be visible when the point (x, y, z) is closer than "in" units, but
  810. further than "out" units, from the camera. "fade" is presently
  811. ignored.
  812. <Collide> name { type [flags] }
  813. This entry indicates that geometry defined at this group level is
  814. actually an invisible collision surface, and is not true geometry.
  815. The geometry is used to define the extents of the collision
  816. surface. If there is no geometry defined at this level, then a
  817. child is searched for with the same collision type specified, and
  818. its geometry is used to define the extent of the collision
  819. surface (unless the "descend" flag is given; see below).
  820. Valid types so far are:
  821. Plane
  822. The geometry represents an infinite plane. The first polygon
  823. found in the group will define the plane.
  824. Polygon
  825. The geometry represents a single polygon. The first polygon is
  826. used.
  827. Polyset
  828. The geometry represents a complex shape made up of several
  829. polygons. This collision type should not be overused, as it
  830. provides the least optimization benefit.
  831. Sphere
  832. The geometry represents a sphere. The vertices in the group are
  833. averaged together to determine the sphere's center and radius.
  834. InvSphere
  835. The geometry represents an inverse sphere. This is the same as
  836. Sphere, with the normal inverted, so that the solid part of an
  837. inverse sphere is the entire world outside of it. Note that an
  838. inverse sphere is in infinitely large solid with a finite hole
  839. cut into it.
  840. Tube
  841. The geometry represents a tube. This is a cylinder-like shape
  842. with hemispherical endcaps; it is sometimes called a capsule or
  843. a lozenge in other packages. The smallest tube shape that will
  844. fit around the vertices is used.
  845. The flags may be any zero or more of:
  846. event
  847. Throws the name of the <Collide> entry, or the name of the
  848. surface if the <Collide> entry has no name, as an event whenever
  849. an avatar strikes the solid. This is the default if the
  850. <Collide> entry has a name.
  851. intangible
  852. Rather than being a solid collision surface, the defined surface
  853. represents a boundary. The name of the surface will be thrown
  854. as an event when an avatar crosses into the interior, and
  855. name-out will be thrown when an avater exits.
  856. descend
  857. Instead of creating only one collision object of the given type,
  858. each group descended from this node that contains geometry will
  859. define a new collision object of the given type. The event
  860. name, if any, will also be inherited from the top node and
  861. shared among all the collision objects.
  862. keep
  863. Don't discard the visible geometry after using it to define a
  864. collision surface; create both an invisible collision surface
  865. and the visible geometry.
  866. level
  867. Stores a special effective normal with the collision solid that
  868. points up, regardless of the actual shape or orientation of the
  869. solid. This can be used to allow an avatar to stand on a
  870. sloping surface without having a tendency to slide downward.
  871. <ObjectType> { type }
  872. This is a short form to indicate one of several pre-canned sets of
  873. attributes. Type may be any word, and a Config definition will be
  874. searched for by the name "egg-object-type-word", where "word" is
  875. the type word. This definition may contain any arbitrary egg
  876. syntax to be parsed in at this group level.
  877. A number of predefined ObjectType definitions are provided:
  878. barrier
  879. This is equivalent to <Collide> { Polyset descend }. The
  880. geometry defined at this root and below defines an invisible
  881. collision solid.
  882. trigger
  883. This is equivalent to <Collide> { Polyset descend intangible }.
  884. The geometry defined at this root and below defines an invisible
  885. trigger surface.
  886. bubble
  887. Equivalent to <Collide> { Sphere keep descend }. A collision
  888. bubble is placed around the geometry, which is otherwise
  889. unchanged.
  890. ghost
  891. Equivalent to <Scalar> collide-mask { 0 }. It means that the
  892. geometry beginning at this node and below should never be
  893. collided with--characters will pass through it.
  894. backstage
  895. This has no equivalent; it is treated as a special case. It
  896. means that the geometry at this node and below should not be
  897. translated. This will normally be used on scale references and
  898. other modeling tools.
  899. There may also be additional predefined egg object types not
  900. listed here; see the *.pp files that are installed into the etc
  901. directory for a complete list.
  902. <Transform> { transform-definition }
  903. This specifies a matrix transform at this group level. This
  904. defines a local coordinate space for this group and its
  905. descendents. Vertices are still specified in world coordinates
  906. (in a vertex pool), but any geometry assigned to this group will
  907. be inverse transformed to move its vertices to the local space.
  908. The transform definition may be any sequence of zero or more of
  909. the following. Transformations are post multiplied in the order
  910. they are encountered to produce a net transformation matrix.
  911. Rotations are defined as a counterclockwise angle in degrees about
  912. a particular axis, either implicit (about the x, y, or z axis), or
  913. arbitrary. Matrices, when specified explicitly, are row-major.
  914. <Translate> { x y z }
  915. <RotX> { degrees }
  916. <RotY> { degrees }
  917. <RotZ> { degrees }
  918. <Rotate> { degrees x y z }
  919. <Scale> { x y z }
  920. <Scale> { s }
  921. <Matrix4> {
  922. 00 01 02 03
  923. 10 11 12 13
  924. 20 21 22 23
  925. 30 31 32 33
  926. }
  927. Note that the <Transform> block defines a 3-d transform when it
  928. appears within the context of a node, while it defines a 2-d
  929. transform (and has correspondingly different entries) when it
  930. appears within the context of a texture.
  931. <VertexRef> { indices <Ref> { pool-name } }
  932. This moves geometry created from the named vertices into the
  933. current group, regardless of the group in which the geometry is
  934. actually defined. See the <Joint> description, below.
  935. <Instance> name { group-body }
  936. An <Instance> node is exactly like a <Group> node, except that
  937. vertices referenced by geometry created under the <Instance> node
  938. are not assumed to be given in world coordinates, but are instead
  939. given in the local space of the <Instance> node itself (including
  940. any transforms given to the node).
  941. In other words, geometry under an <Instance> node is defined in
  942. local coordinates. In principle, similar geometry can be created
  943. under several different <Instance> nodes, and thus can be positioned
  944. in a different place in the scene each instance. This doesn't
  945. necessarily imply the use of shared geometry in the Performer scene
  946. graph, but see the <Ref> syntax, below.
  947. This is particularly useful in conjunction with a <File> entry, to
  948. load external file references at places other than the origin.
  949. A special syntax of <Instance> entries does actually create shared
  950. geometry in the scene graph. However, please note that this special
  951. syntax is not supported by Panda3D at this time. It is documented
  952. here against the day that it will be supported.
  953. The syntax is:
  954. <Instance> name {
  955. <Ref> { group-name }
  956. [ <Ref> { group-name } ... ]
  957. }
  958. In this case, the referenced group name will appear as a duplicate
  959. instance in this part of the tree. Local transforms can be applied
  960. and are relative to the reference group's transform.
  961. <Joint> name { [transform] [ref-list] [joint-list] }
  962. A joint is a highly specialized kind of grouping node. A tree of
  963. joints is used to specify the skeletal structure of an animated
  964. character.
  965. A joint may only contain one of three things. It may contain a
  966. <Transform> entry, as above, which defines the joint's unanimated
  967. (rest) position; it may contain lists of assigned vertices or CV's;
  968. and it may contain other joints.
  969. A tree of <Joint> nodes only makes sense within a character
  970. definition, which is created by applying the <DART> flag to a group.
  971. See <DART>, above.
  972. The vertex assignment is crucial. This is how the geometry of a
  973. character is made to move with the joints. The character's geometry
  974. is actually defined outside the joint tree, and each vertex must be
  975. assigned to one or more joints within the tree.
  976. This is done with zero or more <VertexRef> entries per joint, as the
  977. following:
  978. <VertexRef> { indices [<Scalar> membership { m }] <Ref> { pool-name } }
  979. This is syntactically similar to the way vertices are assigned to
  980. polygons. Each <VertexRef> entry can assign vertices from only one
  981. vertex pool (but there may be many <VertexRef> entries per joint).
  982. Indices is a list of vertex numbers from the specied vertex pool, in
  983. an arbitrary order.
  984. The membership scalar is optional. If specified, it is a value
  985. between 0.0 and 1.0 that indicates the fraction of dominance this
  986. joint has over the vertices. This is used to implement
  987. soft-skinning, so that each vertex may have partial ownership in
  988. several joints.
  989. The <VertexRef> entry may also be given to ordinary <Group> nodes.
  990. In this case, it treats the geometry as if it was parented under the
  991. group in the first place. Non-total membership assignments are
  992. meaningless.
  993. <Bundle> name { table-list }
  994. <Table> name { table-body }
  995. A table is a set of animated values for joints. A tree of tables
  996. with the same structure as the corresponding tree of joints must be
  997. defined for each character to be animated. Such a tree is placed
  998. under a <Bundle> node, which provides a handle within Panda to the
  999. tree as a whole.
  1000. Bundles may only contain tables; tables may contain more tables,
  1001. bundles, or any one of the following (<Scalar> entries are optional,
  1002. and default as shown):
  1003. <S$Anim> name {
  1004. <Scalar> fps { 24 }
  1005. <V> { values }
  1006. }
  1007. This is a table of scalar values, one per frame. This may be
  1008. applied to a morph slider, for instance.
  1009. <Xfm$Anim> name {
  1010. <Scalar> fps { 24 }
  1011. <Scalar> order { sphrt }
  1012. <Scalar> contents { ijkabcphrxyz }
  1013. <V> { values }
  1014. }
  1015. This is a table of matrix transforms, one per frame, such as may
  1016. be applied to a joint. The "contents" string consists of a subset
  1017. of the letters "ijkabcphrxyz", where each letter corresponds to a
  1018. column of the table; <V> is a list of numbers of length(contents)
  1019. * num_frames. Each letter of the contents string corresponds to a
  1020. type of transformation:
  1021. i, j, k - scale in x, y, z directions, respectively
  1022. a, b, c - shear in xy, xz, and yz planes, respectively
  1023. p, h, r - rotate by pitch, heading, roll
  1024. x, y, z - translate in x, y, z directions
  1025. The net transformation matrix specified by each row of the table
  1026. is defined as the net effect of each of the individual columns'
  1027. transform, according to the corresponding letter in the contents
  1028. string. The order the transforms are applied is defined by the
  1029. order string:
  1030. s - all scale and shear transforms
  1031. p, h, r - individual rotate transforms
  1032. t - all translation transforms
  1033. <Xfm$Anim_S$> name {
  1034. <Scalar> fps { 24 }
  1035. <Scalar> order { sphrt }
  1036. <S$Anim> i { ... }
  1037. <S$Anim> j { ... }
  1038. ...
  1039. }
  1040. This is a variant on the <Xfm$Anim> entry, where each column of
  1041. the table is entered as a separate <S$Anim> table. This syntax
  1042. reflects an attempt to simplify the description by not requiring
  1043. repetition of values for columns that did not change value during
  1044. an animation sequence.
  1045. <VertexAnim> name {
  1046. <Scalar> width { table-width }
  1047. <Scalar> fps { 24 }
  1048. <V> { values }
  1049. }
  1050. This is a table of vertex positions, normals, texture coordinates,
  1051. or colors. These values will be subsituted at runtime for the
  1052. corresponding values in a <DynamicVertexPool>. The name of the
  1053. table should be "coords", "norms", "texCoords", or "colors",
  1054. according to the type of values defined. The number table-width
  1055. is the number of floats in each row of the table. In the case of
  1056. a coords or norms table, this must be 3 times the number of
  1057. vertices in the corresponding dynamic vertex pool. (For texCoords
  1058. and colors, this number must be 2 times and 4 times, respectively.)
  1059. MISCELLANEOUS
  1060. <File> { filename }
  1061. This includes a copy of the referenced egg file at the current
  1062. point. This is usually placed under an <Instance> node, so that the
  1063. current transform will apply to the geometry in the external file.
  1064. The extension ".egg" is implied if it is omitted.
  1065. As with texture filenames, the filename may be a relative path, in
  1066. which case the current egg file's directory is searched first, and
  1067. then the model-path is searched.