BLOB.H 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /****************************************************************************
  2. * blob.h
  3. *
  4. * This module contains all defines, typedefs, and prototypes for BLOB.C.
  5. *
  6. * from Persistence of Vision(tm) Ray Tracer
  7. * Copyright 1996,1999 Persistence of Vision Team
  8. *---------------------------------------------------------------------------
  9. * NOTICE: This source code file is provided so that users may experiment
  10. * with enhancements to POV-Ray and to port the software to platforms other
  11. * than those supported by the POV-Ray Team. There are strict rules under
  12. * which you are permitted to use this file. The rules are in the file
  13. * named POVLEGAL.DOC which should be distributed with this file.
  14. * If POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  15. * Team Coordinator by email to team-coord@povray.org or visit us on the web at
  16. * http://www.povray.org. The latest version of POV-Ray may be found at this site.
  17. *
  18. * This program is based on the popular DKB raytracer version 2.12.
  19. * DKBTrace was originally written by David K. Buck.
  20. * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  21. *
  22. *****************************************************************************/
  23. #ifndef BLOB_H
  24. #define BLOB_H
  25. #include "bsphere.h"
  26. /*****************************************************************************
  27. * Global preprocessor defines
  28. ******************************************************************************/
  29. #define BLOB_OBJECT (STURM_OK_OBJECT+HIERARCHY_OK_OBJECT)
  30. /* Do not use the first bit!!! (Used for enter/exit in intersection test) */
  31. #define BLOB_SPHERE 2
  32. #define BLOB_CYLINDER 4
  33. #define BLOB_ELLIPSOID 8
  34. #define BLOB_BASE_HEMISPHERE 16
  35. #define BLOB_APEX_HEMISPHERE 32
  36. #define BLOB_BASE_HEMIELLIPSOID 64
  37. #define BLOB_APEX_HEMIELLIPSOID 128
  38. /* Define max. number of blob components. */
  39. #define MAX_BLOB_COMPONENTS 1000000
  40. /* Generate additional blob statistics. */
  41. #define BLOB_EXTRA_STATS 1
  42. /*****************************************************************************
  43. * Global typedefs
  44. ******************************************************************************/
  45. typedef struct Blob_Struct BLOB;
  46. typedef struct Blob_Element_Struct BLOB_ELEMENT;
  47. typedef struct Blob_Data_Struct BLOB_DATA;
  48. typedef struct Blob_List_Struct BLOB_LIST;
  49. typedef struct Blob_Interval_Struct BLOB_INTERVAL;
  50. struct Blob_Element_Struct
  51. {
  52. short Type; /* Type of component: sphere, hemisphere, cylinder */
  53. int index;
  54. VECTOR O; /* Element's origin */
  55. DBL len; /* Cylinder's length */
  56. DBL rad2; /* Sphere's/Cylinder's radius^2 */
  57. DBL c[3]; /* Component's coeffs */
  58. DBL f[5]; /* Component's final coeffs */
  59. TEXTURE *Texture; /* Component's texture */
  60. TRANSFORM *Trans; /* Component's transformation */
  61. };
  62. struct Blob_Data_Struct
  63. {
  64. int References; /* Number of references */
  65. int Number_Of_Components; /* Number of components */
  66. DBL Threshold; /* Blob threshold */
  67. BLOB_ELEMENT *Entry; /* Array of blob components */
  68. BLOB_INTERVAL* Intervals; /* Intervals used during intersection testing */
  69. BSPHERE_TREE *Tree; /* Bounding hierarchy */
  70. };
  71. struct Blob_Struct
  72. {
  73. OBJECT_FIELDS
  74. TRANSFORM *Trans;
  75. BLOB_DATA *Data; /* Pointer to blob data */
  76. TEXTURE **Element_Texture;
  77. };
  78. struct Blob_List_Struct
  79. {
  80. BLOB_ELEMENT elem; /* Current element */
  81. BLOB_LIST *next; /* Pointer to next element */
  82. };
  83. struct Blob_Interval_Struct
  84. {
  85. int type;
  86. DBL bound;
  87. BLOB_ELEMENT *Element;
  88. };
  89. /*****************************************************************************
  90. * Global variables
  91. ******************************************************************************/
  92. extern METHODS Blob_Methods;
  93. /*****************************************************************************
  94. * Global functions
  95. ******************************************************************************/
  96. void Set_Blob_Solver (OBJECT *obj, int Sturm_Flag);
  97. void Init_Blob_Queue (void);
  98. void BlobDelete (OBJECT *obj);
  99. BLOB *Create_Blob (void);
  100. void Make_Blob (BLOB *blob, DBL threshold, BLOB_LIST *bloblist, int npoints);
  101. BLOB_LIST *Create_Blob_List_Element (void);
  102. void Create_Blob_Element_Texture_List (BLOB *Blob, BLOB_LIST *BlobList, int npoints);
  103. void Determine_Blob_Textures (BLOB *Blob, VECTOR P, int *Count, TEXTURE **Textures, DBL *Weights);
  104. void Test_Blob_Opacity (BLOB *Blob);
  105. void Translate_Blob_Element (BLOB_ELEMENT *Element, VECTOR Vector);
  106. void Rotate_Blob_Element (BLOB_ELEMENT *Element, VECTOR Vector);
  107. void Scale_Blob_Element (BLOB_ELEMENT *Element, VECTOR Vector);
  108. void Invert_Blob_Element (BLOB_ELEMENT *Element);
  109. void Transform_Blob_Element (BLOB_ELEMENT *Element, TRANSFORM *Trans);
  110. void Destroy_Blob_Queue (void);
  111. #endif