/usr/include/crystalspace-2.0/imesh/genmesh.h is in libcrystalspace-dev 2.0+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | /*
Copyright (C) 2002 by Jorrit Tyberghein
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CS_IMESH_GENMESH_H__
#define __CS_IMESH_GENMESH_H__
/**\file
* General mesh object
*/
#include "csutil/scf_interface.h"
#include "ivideo/rendermesh.h"
struct iDocumentNode;
struct iGenMeshAnimationControl;
struct iGenMeshAnimationControlFactory;
struct iMaterialWrapper;
struct iRenderBuffer;
struct iMeshObject;
struct iString;
/**\addtogroup meshplugins
* @{ */
class csBox3;
class csColor;
class csColor4;
struct csTriangle;
class csVector2;
class csVector3;
class csEllipsoid;
/**
* A submesh of a genmesh factory.
*/
struct iGeneralFactorySubMesh : public virtual iBase
{
SCF_INTERFACE (iGeneralFactorySubMesh, 1, 0, 3);
/// Clear progressive LOD sliding windows
virtual void ClearSlidingWindows() = 0;
/// Get the number of LOD sliding windows for progressive LODs
virtual int GetSlidingWindowSize() const = 0;
/// Add a sliding window for progressive LODs
virtual void AddSlidingWindow(int start_index, int end_index) = 0;
/// Return the start index and end index of the sliding window indicated by index.
virtual void GetSlidingWindow(unsigned int index, int& out_start_index, int& out_end_index) const = 0;
};
/**
* An instance of a submesh of a genmesh factory.
*/
struct iGeneralFactorySubMeshObject : public virtual iBase
{
SCF_INTERFACE (iGeneralFactorySubMeshObject, 1, 0, 3);
/// Force the progressive LOD level. Set to -1 to use auto LODs.
virtual void ForceProgLODLevel(int level) = 0;
/// Get the current forced progressive LOD level. If it's -1, auto LODs are in effect.
virtual int GetForcedProgLODLevel() = 0;
};
/**
* A submesh of a genmesh.
*/
struct iGeneralMeshSubMesh : public virtual iBase
{
SCF_INTERFACE (iGeneralMeshSubMesh, 1, 0, 3);
/// Get the index render buffer
virtual iRenderBuffer* GetIndices () = 0;
/// Set the index renderbuffer
virtual void SetIndices(iRenderBuffer* newIndices) = 0;
/// Get the material
virtual iMaterialWrapper* GetMaterial () const = 0;
/// Get the name (or 0 if none was given)
virtual const char* GetName () const = 0;
/// Get the mixmode (or (uint)~0 if none was specified)
virtual uint GetMixmode () const = 0;
/// Set the material, or 0 to use default.
virtual void SetMaterial (iMaterialWrapper* material) = 0;
/// Get the Z buffer mode (or (csZBufMode)~0 if none was specified)
virtual csZBufMode GetZMode () const = 0;
/// Set the Z buffer mode ((csZBufMode)~0 to use default)
virtual void SetZMode (csZBufMode mode) = 0;
/// Get the render priority (or -1 if none was specified)
virtual CS::Graphics::RenderPriority GetRenderPriority () const = 0;
/// Set the render priority (-1 to use default)
virtual void SetRenderPriority (CS::Graphics::RenderPriority prio) = 0;
/// Set the mixmode (or (uint)~0 to use default)
virtual void SetMixmode (uint mode) = 0;
/**
* Set back-to-front sorting for submesh. If 'false', factory setting will be
* used.
*/
virtual void SetBack2Front (bool enable) = 0;
/// Get back-to-front sorting for submesh.
virtual bool GetBack2Front () const = 0;
};
/**
* The common interface between genmesh meshes and factories.
* This interface is usually not used alone. Generally one
* uses iGeneralMeshState or iGeneralFactoryState.
*/
struct iGeneralMeshCommonState : public virtual iBase
{
SCF_INTERFACE (iGeneralMeshCommonState, 1, 2, 2);
/**
* Set lighting.
* \deprecated Deprecated in 2.0 by change to shader-based lighting.
*/
CS_DEPRECATED_METHOD_MSG("Deprecated by change to shader-based lighting.")
virtual void SetLighting (bool l) = 0;
/**
* Is lighting enabled.
* \deprecated Deprecated in 2.0 by change to shader-based lighting.
*/
CS_DEPRECATED_METHOD_MSG("Deprecated by change to shader-based lighting.")
virtual bool IsLighting () const = 0;
/**
* Set manual colors. If this is set then lighting will be ignored
* and so will the color set with SetColor(). In this case you can
* manipulate the color array manually by calling GetColors().
*/
virtual void SetManualColors (bool m) = 0;
/// Are manual colors enabled?
virtual bool IsManualColors () const = 0;
/**
* Set shadowing. By default genmesh objects will cast shadows
* (during the static lighting phase). You can disable this here.
* \deprecated Deprecated in 2.0 by change to shader-based lighting.
*/
CS_DEPRECATED_METHOD_MSG("Deprecated by change to shader-based lighting.")
virtual void SetShadowCasting (bool m) = 0;
/**
* Is shadow casting enabled?
* \deprecated Deprecated in 2.0 by change to shader-based lighting.
*/
CS_DEPRECATED_METHOD_MSG("Deprecated by change to shader-based lighting.")
virtual bool IsShadowCasting () const = 0;
/**
* Set shadow receiving on. By default this is disabled in which
* case the genmesh object will receive all lighting information
* dynamically but without shadows. If this is enabled then
* the lighting system resembles more the lighting system with
* things which static and pseudo-dynamic lighting. In this
* case there will be shadows on the genmesh instance.
* \deprecated Deprecated in 2.0 by change to shader-based lighting.
*/
CS_DEPRECATED_METHOD_MSG("Deprecated by change to shader-based lighting.")
virtual void SetShadowReceiving (bool m) = 0;
/**
* Is shadow receiving enabled?
* \deprecated Deprecated in 2.0 by change to shader-based lighting.
*/
CS_DEPRECATED_METHOD_MSG("Deprecated by change to shader-based lighting.")
virtual bool IsShadowReceiving () const = 0;
/**\name Custom render buffers
* @{ */
/**
* Adds an independently named render buffer.
*/
virtual bool AddRenderBuffer (const char *name, iRenderBuffer* buffer) = 0;
/**
* Removes an independently named render buffer.
*/
virtual bool RemoveRenderBuffer (const char *name) = 0;
/**
* Get number of independent render buffers
*/
virtual int GetRenderBufferCount () const = 0;
/**
* Get independent render buffer by index
*/
virtual iRenderBuffer* GetRenderBuffer (int index) = 0;
/**
* Get the name of an independent render buffer by index
*/
virtual csRef<iString> GetRenderBufferName (int index) const = 0;
/**
* Get independent render buffer by name
*/
virtual iRenderBuffer* GetRenderBuffer (const char* name) = 0;
/**
* Adds an independently named render buffer.
*/
virtual bool AddRenderBuffer (csRenderBufferName name, iRenderBuffer* buffer) = 0;
/**
* Removes an independently named render buffer.
*/
virtual bool RemoveRenderBuffer (csRenderBufferName name) = 0;
/**
* Get independent render buffer by name
*/
virtual iRenderBuffer* GetRenderBuffer (csRenderBufferName name) = 0;
/** @} */
};
/**
* This interface describes the API for the general mesh object.
*
* Main creators of instances implementing this interface:
* - Genmesh mesh object plugin (crystalspace.mesh.object.genmesh)
* - iMeshObjectFactory::NewInstance()
*
* Main ways to get pointers to this interface:
* - scfQueryInterface() on iMeshWrapper::GetMeshObject()
*
* Main users of this interface:
* - Genmesh Loader plugin (crystalspace.mesh.loader.genmesh)
*
*/
struct iGeneralMeshState : public virtual iGeneralMeshCommonState
{
SCF_INTERFACE (iGeneralMeshState, 2, 0, 1);
/**
* Set the animation control to use for this mesh object.
* See iGenMeshAnimationControl for more information.
*/
virtual void SetAnimationControl (iGenMeshAnimationControl* anim_ctrl) = 0;
/**
* Get the current animation control for this object.
*/
virtual iGenMeshAnimationControl* GetAnimationControl () const = 0;
/**\name SubMesh handling
* @{ */
/**
* Find the index of a submesh. The index can be used with DeleteSubMesh()
* and the GetSubMesh...() methods. Returns 0 if the submesh was not found.
*
* The returned interface can be used for limited per-object variation of
* the submeshes as defined in the factory. Currently the following aspects
* can be overridden:
* - Shader variables (by querying the iShaderVariableContext interface)
*/
virtual iGeneralMeshSubMesh* FindSubMesh (const char* name) const = 0;
/** @} */
/**
* Set the progressive LOD level on all submeshes.
* If a submesh's max prog LOD level is less than level, set it to its maximum.
*/
virtual void ForceProgLODLevel(int level) = 0;
};
/**
* This interface describes the API for the general mesh factory.
* iGeneralFactoryState inherits from iGeneralMeshState. All methods
* from iGeneralMeshState as set on the factory will serve as defaults
* for mesh objects that are created from this factory AFTER the
* default value is set. So changing such a value on the factory will have
* no effect on meshes already created. The material wrapper is an
* exception to this rule. Setting that on the factory will have an
* effect immediatelly on all mesh objects created from that factory
* except for those mesh objects that have their own material set.
*
* Main creators of instances implementing this interface:
* - Genmesh mesh object plugin (crystalspace.mesh.object.genmesh)
* - iMeshObjectType::NewFactory()
*
* Main ways to get pointers to this interface:
* - scfQueryInterface() on iMeshFactoryWrapper::GetMeshObjectFactory()
*
* Main users of this interface:
* - Genmesh Factory Loader plugin (crystalspace.mesh.loader.factory.genmesh)
*
*/
struct iGeneralFactoryState : public virtual iGeneralMeshCommonState
{
SCF_INTERFACE (iGeneralFactoryState, 2, 0, 2);
/// Set the color to use. Will be added to the lighting values.
virtual void SetColor (const csColor& col) = 0;
/// Get the color.
virtual const csColor& GetColor () const = 0;
/**
* Add a vertex. This is one way to fill the vertex and other tables.
* The other way is to use SetVertexCount() and then fill the tables
* manually.
*/
virtual void AddVertex (const csVector3& v,
const csVector2& uv, const csVector3& normal,
const csColor4& color) = 0;
/**
* Set the number of vertices to use for this mesh. The easiest way
* to set the mesh data is to just use AddVertex(). However, you can
* also call SetVertexCount() and then call GetVertices(), GetTexels(),
* ... to set the data that way. Note that you have to call Invalidate()
* after modifying the vertex data this way.
*/
virtual void SetVertexCount (int n) = 0;
/// Get the number of vertices for this mesh.
virtual int GetVertexCount () const = 0;
/**
* Get the array of vertices. It is legal to modify the vertices
* in this array (but don't forget to call Invalidate()). The number of
* vertices in this array will be equal to the number of vertices set.
*/
virtual csVector3* GetVertices () = 0;
/**
* Get the array of texels. It is legal to modify the texels in this
* array (but don't forget to call Invalidate()). The number of texels in
* this array will be equal to the number of vertices set.
*/
virtual csVector2* GetTexels () = 0;
/**
* Get the array of normals. It is legal to modify the normals in this
* array (but don't forget to call Invalidate()). The number of normals
* in this array will be equal to the
* number of vertices set. Note that modifying the normals is only
* useful when manual colors are not enabled and lighting is enabled
* because the normals are used for lighting.
*/
virtual csVector3* GetNormals () = 0;
/**
* Get the array of colors. It is legal to modify the colors in this
* array (but don't forget to call Invalidate()). The number of colors
* in this array will be equal to the number of vertices set. Note
* that modifying the colors will not do a lot if manual colors is
* not enabled (SetManualColors).
*/
virtual csColor4* GetColors () = 0;
/**
* Add a triangle. This is one way to fill the triangle table.
* The other way is to use SetTriangleCount() and then fill the table
* manually.
*/
virtual void AddTriangle (const csTriangle& tri) = 0;
/**
* Set the number of triangles to use for this mesh. The easiest way
* to set the triangle data is to just use AddTriangle(). However, you can
* also call SetTriangleCount() and then call GetTriangles()
* to set the data that way. Note that you have to call Invalidate()
* after modifying the triangle data this way.
*/
virtual void SetTriangleCount (int n) = 0;
/// Get the number of triangles for this mesh.
virtual int GetTriangleCount () const = 0;
/**
* Get the array of triangles. It is legal to modify the triangles in this
* array (but don't forget to call Invalidate()). The number of triangles
* in this array will be equal to the number of triangles set.
*/
virtual csTriangle* GetTriangles () = 0;
/**
* After making a significant change to the vertices or triangles you
* probably want to let this object recalculate the bounding boxes
* and such. This function will invalidate the internal data structures
* so that they are recomputed.
*/
virtual void Invalidate () = 0;
/**
* Automatically calculate normals based on the current mesh.
* \param compress if true (default) then calculate the normals
* based on compressed vertices.
*/
virtual void CalculateNormals (bool compress = true) = 0;
/**
* Compress the vertex table. This should be called after setting
* up the geometry.
*/
virtual void Compress () = 0;
/**
* Generate procedurally a box. This will set the number of vertices
* to eight and generate vertices, texels, normals, and triangles. The
* vertex colors are set to black.
*/
virtual void GenerateBox (const csBox3& box) = 0;
/**
* Generate procedurally a capsule of given length and radius.
* \param l Capsule length.
* \param r Capsule radius.
* \param sides Number of sides.
*/
virtual void GenerateCapsule (float l, float r, uint sides) = 0;
/**
* Generate procedurally a sphere. This will set the apropriate number
* of vertices and generate vertices, texels, normals, and triangles.
* The vertex colors are set to black.
* \param ellips Properties of the ellipsoid to generate.
* \param rim_vertices Number of vertices on a rim.
* \param cyl_mapping if true then use cylindrical texture mapping.
* \param toponly if true then only generate the top half of the sphere.
* \param reversed if true then generate the sphere so it is visible
* from the inside.
*/
virtual void GenerateSphere (const csEllipsoid& ellips, int rim_vertices,
bool cyl_mapping = false,
bool toponly = false,
bool reversed = false) = 0;
//virtual void GeneratePlane (const csPlane3& plane) = 0;
/**
* Enable back to front rendering for the triangles of this genmesh.
* This is useful if this factory represents a transparent genmesh
* or the material that is being used is itself transparent.
*/
virtual void SetBack2Front (bool b2f) = 0;
/**
* Returns whether normals were autogenerated or manual.
*/
virtual bool IsAutoNormals () const = 0;
/**
* Get the value of the back2front flag.
*/
virtual bool IsBack2Front () const = 0;
/**
* Set the animation control factory to use for this factory.
* See iGenMeshAnimationControlFactory for more information.
*/
virtual void SetAnimationControlFactory (
iGenMeshAnimationControlFactory* anim_ctrl) = 0;
/**
* Get the current animation control factory for this factory.
*/
virtual iGenMeshAnimationControlFactory* GetAnimationControlFactory ()
const = 0;
/**\name SubMesh handling
* @{ */
/**
* Remove all submeshes added to this object
*/
virtual void ClearSubMeshes () = 0;
/**
* Add a submesh to this object. A submesh is a subset of the mesh triangles
* rendered with a certain material. When a mesh has one or more submeshes,
* only submeshes are drawn and not original geometry. That means submeshes
* should cover all original triangles to avoid holes in the mesh.
* \remarks SubMeshes added to an instance of a genmesh will override
* the submeshes from the factory (i.e. the submeshes of the factory will
* be completely ignored as soon as the instance has submeshes).
* \param indices Render buffer holding the geometry for the submesh
* in usual render buffer formatting, ie for triangles three vertices for
* every triangle.
* \param material Material to assign to the submesh.
* \param name (Optional) Name to identify the submesh.
* \param mixmode (Optional) Mixmode to override the mesh's mixmode.
* \return The added submesh, if successful.
* \remarks This will change the indices of other submeshes.
*/
virtual iGeneralMeshSubMesh* AddSubMesh (iRenderBuffer* indices,
iMaterialWrapper *material, const char* name, uint mixmode = (uint)~0) = 0;
/**
* Find the index of a submesh. The index can be used with DeleteSubMesh()
* and the GetSubMesh...() methods. Returns 0 if the submesh was not found.
*/
virtual iGeneralMeshSubMesh* FindSubMesh (const char* name) const = 0;
/**
* Delete a submesh.
*/
virtual void DeleteSubMesh (iGeneralMeshSubMesh* mesh) = 0;
/// Get the number of submeshes
virtual size_t GetSubMeshCount () const = 0;
/// Get a specific submesh
virtual iGeneralMeshSubMesh* GetSubMesh (size_t index) const = 0;
/** @} */
/**
* Disable auto-generated normals.
* This does not have an effect on the current normals, but only changes the
* return value of IsAutoNormals(). However, this affects saving of genmesh
* factories, as all vertex normals will be written out explicitly.
*/
virtual void DisableAutoNormals () = 0;
/**
* Generate procedurally a cylinder of given length and radius.
* \param l Cylinder length.
* \param r Cylinder radius.
* \param sides Number of sides.
*/
virtual void GenerateCylinder (float l, float r, uint sides) = 0;
/**\name Progressive LODs
* @{ */
/**
* Get the maximum between all submeshes' progressive LOD levels.
*/
virtual int GetNumProgLODLevels() const = 0;
/**
* Get distances where progressive LOD will be in effect.
* See SetProgLODDistances for parameter details.
*/
virtual void GetProgLODDistances(float& out_min, float& out_max) const = 0;
/**
* Set distances where progressive LOD will be in effect.
* \param min Minimum distance - starting from this distance, the model will begin to become less detailed.
* \param max Maximum distance - at this distance, the model will be at its minimum LOD.
*/
virtual void SetProgLODDistances(float min, float max) = 0;
/** @} */
};
/**
* Implementing this class allows to control the animation of the vertex,
* texel, normal, color and bounding box data of the genmesh.
*
* Note that, when animating the vertex data, it is prefered that the bounding box
* of the object doesn't change too dramatically because this animation is
* called AFTER the visibility culling.
*
* Main creators of instances implementing this interface:
* - iGenMeshAnimationControlFactory::CreateAnimationControl()
*
* Main ways to get pointers to this interface:
* - iGeneralMeshState::GetAnimationControl()
*
* Main users of this interface:
* - Genmesh plugin (crystalspace.mesh.object.genmesh)
*/
struct iGenMeshAnimationControl : public virtual iBase
{
SCF_INTERFACE(iGenMeshAnimationControl, 2, 0, 1);
/// Returns true if this control animates the vertices of the genmesh.
virtual bool AnimatesVertices () const = 0;
/// Returns true if this control animates the texels of the genmesh.
virtual bool AnimatesTexels () const = 0;
/// Returns true if this control animates the normals of the genmesh.
virtual bool AnimatesNormals () const = 0;
/// Returns true if this control animates the colors of the genmesh.
virtual bool AnimatesColors () const = 0;
/**
* General update method. It is called before all other update methods.
* \param current The current time given by the virtual clock
* \param num_verts The count of vertices of the genmesh
* \param version_id The version number of the shape of the genmesh, as returned by
* iObjectModel::GetShapeNumber(). The animation control can use this to optimize the
* animation calculation by caching the animated version of the array and returning
* that one.
*/
virtual void Update (csTicks current, int num_verts,
uint32 version_id) = 0;
/**
* Given the factory vertex data, return the animated vertex data.
* If this control doesn't animate vertices then it will return the
* source array unchanged, otherwise it has to allocate the data array.
* \param current The current time given by the virtual clock
* \param verts The vertices of the factory of the genmesh
* \param num_verts The count of vertices of the genmesh
* \param version_id The version number of the shape of the genmesh, as returned by
* iObjectModel::GetShapeNumber(). The animation control can use this to optimize the
* animation calculation by caching the animated version of the array and returning
* that one.
*/
virtual const csVector3* UpdateVertices (csTicks current,
const csVector3* verts, int num_verts, uint32 version_id) = 0;
/**
* Given the factory texel data, return the animated texel data.
* If this control doesn't animate texels then it will return the
* source array unchanged, otherwise it has to allocate the data array.
* \param current The current time given by the virtual clock
* \param texels The texels of the factory of the genmesh
* \param num_texels The count of texels of the genmesh
* \param version_id The version number of the shape of the genmesh, as returned by
* iObjectModel::GetShapeNumber(). The animation control can use this to optimize the
* animation calculation by caching the animated version of the array and returning
* that one.
*/
virtual const csVector2* UpdateTexels (csTicks current,
const csVector2* texels, int num_texels, uint32 version_id) = 0;
/**
* Given the factory normal data, return the animated normal data.
* If this control doesn't animate normals then it will return the
* source array unchanged, otherwise it has to allocate the data array.
* \param current The current time given by the virtual clock
* \param normals The normals of the factory of the genmesh
* \param num_verts The count of normals of the genmesh
* \param version_id The version number of the shape of the genmesh, as returned by
* iObjectModel::GetShapeNumber(). The animation control can use this to optimize the
* animation calculation by caching the animated version of the array and returning
* that one.
*/
virtual const csVector3* UpdateNormals (csTicks current,
const csVector3* normals, int num_normals, uint32 version_id) = 0;
/**
* Given the factory color data, return the animated color data.
* If this control doesn't animate colors then it will return the
* source array unchanged, otherwise it has to allocate the data array.
* \remarks \a colors may be 0. In this case all color values should be
* assumed to be (0, 0, 0, 1).
* \param current The current time given by the virtual clock
* \param colors The original colors of the genmesh
* \param num_verts The count of colors of the genmesh
* \param version_id The version number of the shape of the genmesh, as returned by
* iObjectModel::GetShapeNumber(). The animation control can use this to optimize the
* animation calculation by caching the animated version of the array and returning
* that one.
*/
virtual const csColor4* UpdateColors (csTicks current,
const csColor4* colors, int num_colors, uint32 version_id) = 0;
/// Returns true if this control animates the bounding box and the radius of the genmesh.
virtual bool AnimatesBBoxRadius () const = 0;
/**
* Given the bounding box of the factory, return the bounding box of the whole genmesh.
* \param current The current time given by the virtual clock
* \param version_id The version number of the shape of the genmesh, as returned by
* iObjectModel::GetShapeNumber(). The animation control can use this to optimize the
* animation calculation by caching the animated version of the array and returning
* that one.
* \param bbox The bounding box of the factory of the genmesh
*/
virtual const csBox3& UpdateBoundingBox (csTicks current, uint32 version_id, const csBox3& bbox) = 0;
/**
* Given the radius of the factory, return the radius of the whole genmesh.
* \param current The current time given by the virtual clock
* \param version_id The version number of the shape of the genmesh, as returned by
* iObjectModel::GetShapeNumber(). The animation control can use this to optimize the
* animation calculation by caching the animated version of the array and returning
* that one.
* \param radius The radius of the factory of the genmesh
*/
virtual const float UpdateRadius (csTicks current, uint32 version_id, const float radius) = 0;
/**
* Return the animated bounding boxes of the given submesh.
* If this control doesn't animate the bounding boxes and radius, then it will simply do nothing and return nullptr.
* \param current The current time given by the virtual clock
* \param version_id The version number of the shape of the genmesh, as returned by
* iObjectModel::GetShapeNumber(). The animation control can use this to optimize the
* animation calculation by caching the animated version of the array and returning
* that one.
*/
virtual const csBox3* UpdateBoundingBoxes (csTicks current, uint32 version_id) = 0;
};
/**
* This class is a factory for creating animation controls.
*
* Main creators of instances implementing this interface:
* - iGenMeshAnimationControlType::CreateAnimationControlFactory()
*
* Main ways to get pointers to this interface:
* - iGeneralFactoryState::GetAnimationControlFactory()
*
* Main users of this interface:
* - Genmesh plugin (crystalspace.mesh.object.genmesh)
*/
struct iGenMeshAnimationControlFactory : public virtual iBase
{
SCF_INTERFACE(iGenMeshAnimationControlFactory, 2, 0, 0);
/**
* Create a new animation control.
*/
virtual csPtr<iGenMeshAnimationControl> CreateAnimationControl (
iMeshObject *mesh) = 0;
/**
* Setup this animation control from a document node.
* Returns 0 on success or an error description on failure.
*/
virtual const char* Load (iDocumentNode* node) = 0;
/**
* Save this animation control to a document node.
* Returns 0 on success or an error description on failure.
*/
virtual const char* Save (iDocumentNode* parent) = 0;
};
/**
* This class is the animation control type.
*
* Main creators of instances implementing this interface:
* - Genmesh animation control plugin (crystalspace.mesh.anim.genmesh)
*
* Main ways to get pointers to this interface:
* - csQueryPluginClass()
* - csLoadPlugin()
*
* Main users of this interface:
* - Genmesh plugin (crystalspace.mesh.object.genmesh)
*
*/
struct iGenMeshAnimationControlType : public virtual iBase
{
SCF_INTERFACE(iGenMeshAnimationControlType, 2, 0, 0);
/**
* Create a new animation control factory.
*/
virtual csPtr<iGenMeshAnimationControlFactory> CreateAnimationControlFactory
() = 0;
};
/** @} */
#endif // __CS_IMESH_GENMESH_H__
|