lwobjimp.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * LWSDK Header File
  3. * Copyright 1999, NewTek, Inc.
  4. *
  5. * LWOBJIMP.H -- LightWave Object Importers
  6. *
  7. * When LightWave encounters a foreign object file which it cannot parse,
  8. * it will call an "ObjectLoader" class server to import it. All the
  9. * loaders defined for the host will be activated in sequence, and the
  10. * first one to recognize the file will load it.
  11. */
  12. #ifndef LWSDK_OBJIMP_H
  13. #define LWSDK_OBJIMP_H
  14. #include <lwmonitor.h>
  15. #include <lwmeshes.h>
  16. #define LWOBJECTIMPORT_CLASS "ObjectLoader"
  17. #define LWOBJECTIMPORT_VERSION 3
  18. /*
  19. * The activation function of the server is passed an LWObjectImport
  20. * structure as its local data which includes the filename of the object
  21. * to load. The loader attempts to parse the input file and calls the
  22. * embedded callbacks to insert the data into LightWave. It indicates
  23. * its success or failure by setting the 'result' field, and the optional
  24. * failedBuf.
  25. *
  26. * result set by the server to one of the LWOBJIM values below.
  27. *
  28. * filename the filename of the object to load.
  29. *
  30. * monitor progress monitor that can be used to track the import
  31. * process.
  32. *
  33. * failedBuf string buffer for the server to store a human-readable
  34. * error message if the result code is LWOBJIM_FAILED.
  35. *
  36. * data private data pointer to be passed to all the embedded
  37. * function callbacks.
  38. *
  39. * done called when object import is complete.
  40. *
  41. * layer start a new layer in the import data. The layer is
  42. * defined by an index number and a name string.
  43. *
  44. * pivot set the pivot point for the current layer.
  45. *
  46. * parent set the index of the parent layer for the current layer.
  47. *
  48. * lFlags set the flag bits for the current layer. The low-order bit
  49. * is set if this is a hidden layer.
  50. *
  51. * point add a new point to the current layer. The point is given
  52. * by an XYZ position and the function returns a void pointer
  53. * as point identifier.
  54. *
  55. * vmap select a VMAP for assigning data to points, creating a new
  56. * VMAP if it does not yet exist. The VMAP is defined by a
  57. * type, dimension and name.
  58. *
  59. * vmapVal set a vector for a point into the currently selected VMAP.
  60. * The vector should have the same dimension as the VMAP.
  61. *
  62. * vmapPDV set a vector for a point with reference to a specific polygon.
  63. * This is the "polygon discontinuous value" for the point.
  64. *
  65. * polygon add a new polygon to the current layer. The polygon is
  66. * defined by a type code, type-specific flags and a list of
  67. * point identifiers.
  68. *
  69. * polTag associate a tag string to the given polygon. The tag
  70. * string has a type, the most common being 'SURF'.
  71. *
  72. * surface add a new surface to this object. The surface is defined by
  73. * the base name, the reference name, and a block of raw surface
  74. * data.
  75. */
  76. typedef struct st_LWObjectImport {
  77. int result;
  78. const char *filename;
  79. LWMonitor *monitor;
  80. char *failedBuf;
  81. int failedLen;
  82. void *data;
  83. void (*done) (void *);
  84. void (*layer) (void *, int lNum, const char *name);
  85. void (*pivot) (void *, const LWFVector pivot);
  86. void (*parent) (void *, int lNum);
  87. void (*lFlags) (void *, int flags);
  88. LWPntID (*point) (void *, const LWFVector xyz);
  89. void (*vmap) (void *, LWID type, int dim, const char *name);
  90. void (*vmapVal) (void *, LWPntID point, const float *val);
  91. LWPolID (*polygon) (void *, LWID type, int flags, int numPts, const LWPntID *);
  92. void (*polTag) (void *, LWPolID polygon, LWID type, const char *tag);
  93. void (*surface) (void *, const char *, const char *, int, void *);
  94. void (*vmapPDV) (void *, LWPntID point, LWPolID polygon, const float *val);
  95. } LWObjectImport;
  96. /*
  97. * The server must set the 'result' field to one of these following values
  98. * before it returns.
  99. *
  100. * OK indicates successful parsing of the object file.
  101. *
  102. * BADFILE indicates that the loader could not open the file.
  103. *
  104. * NOREC indicates that the loader could open the file but could
  105. * not recognize the format.
  106. *
  107. * ABORTED indicates the that the user manually aborted the load.
  108. *
  109. * Any other failure is indicated by the generic FAILED value. In this case,
  110. * the loader may also place a human-readable error message into the buffer
  111. * pointed to by `failedBuf,' provided that `failedLen' is non-zero.
  112. */
  113. #define LWOBJIM_OK 0
  114. #define LWOBJIM_NOREC 1
  115. #define LWOBJIM_BADFILE 2
  116. #define LWOBJIM_ABORTED 3
  117. #define LWOBJIM_FAILED 99
  118. #endif