home *** CD-ROM | disk | FTP | other *** search
/ NEXT Generation 27 / NEXT27.iso / pc / demos / emperor / dx3.exe / SDK / SAMPLES / DS3DVIEW / RLDS3D.H < prev    next >
C/C++ Source or Header  |  1996-08-28  |  9KB  |  346 lines

  1. #ifndef ___RLDS3D_HEADER_FILE
  2. #define ___RLDS3D_HEADER_FILE
  3.  
  4. #include "d3drmwin.h"
  5.  
  6. /*
  7. ** This is an interface between the viewer and the RL/DS3D APIs which provides the
  8. **   functionality required by the viewer in simplified form.
  9. **
  10. ** Note: This is not an object-oriented API since there should only be need for one
  11. **   copy at a time and this way C++ to C conversions should be fairly easy
  12. **
  13. ** DESCRIPTION: The user interfaces the 3D world and objects therein by selecting items
  14. **   with the mouse (on the screen) and performing operations on that item.  The user will
  15. **   also be able to perform operations on the camera and a few global operations applied
  16. **   to all objects.
  17. **
  18. ** USAGE: Create the interface using RLDS3D_Initialize() (returns FALSE if not created)
  19. **   and remove it using RLDS3D_Deinitialize().  The RLDS3D_Render() functionality draws the world
  20. **   on the screen.
  21. */
  22.  
  23. /*
  24. ************************  INITIALIZATION/DEINITIALIZATION ****************************
  25. */
  26.  
  27. /*
  28. ** Initialize will attach itself to the passed window.  Call initialize after
  29. **  getting a handle for your window but before you display it.
  30. **
  31. ** Initialize will initialize the RL API and return false if it fails.  It will
  32. **  also attempt to initialize a DirectSound3D API, but failing this does not
  33. **  justify a failed Initialize (since the 3D sound isn't a necessary part of
  34. **  the viewer)
  35. */
  36.  
  37. BOOL RLDS3D_Initialize(HWND hwndPW, HANDLE this_inst);
  38.  
  39. /*
  40. ** Deinitializes where necessary (assumes program quits after calling this otherwise it'd free up memory, etc...)
  41. */
  42.  
  43. void RLDS3D_Deinitialize();
  44.  
  45. /*
  46. ***************************  ADDING/REMOVING/EDITING OBJECTS  *********************************
  47. */
  48.  
  49. /*
  50. ** Loads XOF file into the RL world (with textures)
  51. */
  52.  
  53. void RLDS3D_LoadXOF(char* file);
  54.  
  55. /*
  56. ** Sets/Gets whether or not boxes are shown around selected item
  57. */
  58.  
  59. BOOL RLDS3D_GetBoxes(void);
  60. void RLDS3D_SetBoxes(BOOL new_val);
  61.  
  62. /*
  63. ** Updates the bounding box around the selected visual (this could be done using a render callback function to compare the
  64. **   frame's scaling and transform functions instead)
  65. */
  66.  
  67. void RLDS3D_UpdateSelectionBox(void);
  68.  
  69. /*
  70. ** Deselects the currently selected 3D visual.
  71. */
  72.  
  73. void RLDS3D_DeselectVisual();
  74.  
  75. /*
  76. ** Given coordinates it selects the first visual under those coordinates in the window's viewport
  77. */
  78.  
  79. void RLDS3D_FindAndSelectVisual(int x, int y, LPBOOL changed = NULL);
  80.  
  81. /*
  82. ** Cuts the current selection to the clipboard
  83. */
  84.  
  85. void RLDS3D_CutVisual();
  86.  
  87. /*
  88. ** Copies the current selection to the clipboard
  89. */
  90.  
  91. void RLDS3D_CopyVisual();
  92.  
  93. /*
  94. ** Pastes the current selection to the window
  95. */
  96.  
  97. void RLDS3D_PasteVisual();
  98.  
  99. /*
  100. ** Deletes the current selection from the world without copying to the clipboard
  101. */
  102.  
  103. void RLDS3D_DeleteVisual();
  104.  
  105. /*
  106. ** Add a directional light
  107. */
  108. void RLDS3D_AddDirectionalLight();
  109.  
  110. /*
  111. ** Add a parallel point light
  112. */
  113. void RLDS3D_AddParallelPointLight();
  114.  
  115. /*
  116. ** Add Point Light
  117. */
  118. void RLDS3D_AddPointLight();
  119.  
  120. /*
  121. ** Add a spotlight
  122. */
  123. void RLDS3D_AddSpotlight();
  124.  
  125. /*
  126. ***********************************  OBJECT MOTION/SCALING/COLOURING  ****************************************
  127. */
  128.  
  129. /*
  130. ** Sets the selected object's colour
  131. */
  132.  
  133. void RLDS3D_SetSelColour();
  134.  
  135. /*
  136. ** Moves the camera relative to itself by providing scalars to multiply against the CAMERA-RELATIVE unit vectors
  137. **   forwards/up/right.
  138. */
  139.  
  140. void RLDS3D_SetCamVelRelToCam(D3DVALUE forward, D3DVALUE up, D3DVALUE right);
  141.  
  142. /*
  143. ** Rotates the camera around its three axis
  144. **
  145. ** forward_axis is roll, up_axis is yaw, right_axis is pitch
  146. ** (Only one affects at a time)
  147. */
  148.  
  149. void RLDS3D_SetCamRotForward(D3DVALUE forward_axis);
  150. void RLDS3D_SetCamRotUp(D3DVALUE up_axis);
  151. void RLDS3D_SetCamRotRight(D3DVALUE right_axis);
  152.  
  153. /*
  154. ** Scales the selected object in the x/y/z axis of it's orientation by the specified values
  155. */
  156.  
  157. void RLDS3D_ScaleSelected(D3DVALUE sx, D3DVALUE sy, D3DVALUE sz);
  158.  
  159. /*
  160. ** Moves the currently selected object in the 3D world relative to the camera
  161. */
  162.  
  163. void RLDS3D_SetSelectedVelRelToCam(D3DVALUE forward, D3DVALUE up, D3DVALUE right);
  164.  
  165. /*
  166. ** Rotates the currently selected object relative to the camera's frame when passed
  167. **   a vector for the axis and an angle of rotation.
  168. ** This is useful because the AXIS which is specified is relative to what appears on the screen with it's origin at the camera
  169. **   (ie: (0,0,1) will be an axis straight into the screen and thus things will spin around the centre of the screen)
  170. */
  171.  
  172. void RLDS3D_SetSelectedRotRelToCam(D3DVALUE AxisX, D3DVALUE AxisY, D3DVALUE AxisZ, D3DVALUE angle);
  173.  
  174. /*
  175. ** Moves the currently selected object by x/y pixels on the screen from it's relative position.  Allows a user
  176. **   to drag objects around the screen using the mouse.  Assumes that the distance from the frame to the screen
  177. **   will remain constant
  178. */
  179.  
  180. void RLDS3D_MoveSelectedPosByScreenCoords(double delta_x, double delta_y);
  181.  
  182. /*
  183. ** Orbits the selected object around the camera
  184. */
  185.  
  186. void RLDS3D_OrbitSelected(void);
  187. void RLDS3D_StopOrbitSelected();
  188.  
  189. /*
  190. ** Bullets it towards the camera
  191. */
  192.  
  193. void RLDS3D_BulletSelected(void);
  194.  
  195. /*
  196. **********************  DIRECTSOUND 3D INTERFACE  ******************************
  197. */
  198.  
  199. /*
  200. ** Stops all sounds from playing
  201. */
  202.  
  203. void RLDS3D_StopAllSounds();
  204.  
  205. /*
  206. ** Removes all of the sounds
  207. */
  208.  
  209. void RLDS3D_RemoveAllSounds();
  210.  
  211. /*
  212. ** Plays the sound associated with the currently selected object
  213. */
  214.  
  215. void RLDS3D_PlaySound(BOOL bIsLooping);
  216.  
  217. /*
  218. ** Stops the sound associated with the currently selected object
  219. */
  220.  
  221. void RLDS3D_StopSelectedSound();
  222.  
  223. /*
  224. ** Removes the sound from the currently selected object
  225. */
  226.  
  227. void RLDS3D_RemoveSound();
  228. /*
  229. ** Attaches a sound (filename provided) to the selected frame
  230. */
  231.  
  232. void RLDS3D_AttachSound(char* filename);
  233.  
  234. /*
  235. ** Global parameter mods
  236. */
  237. void RLDS3D_GetDistanceFactor(D3DVALUE *temp);
  238. void RLDS3D_GetDopplerFactor(D3DVALUE *temp);
  239. void RLDS3D_GetRolloffFactor(D3DVALUE *temp);
  240. void RLDS3D_SetDistanceFactor(D3DVALUE temp);
  241. void RLDS3D_SetDopplerFactor(D3DVALUE temp);
  242. void RLDS3D_SetRolloffFactor(D3DVALUE temp);
  243.  
  244. void RLDS3D_CommitDeferredSettings(void);
  245.  
  246. /*
  247. ** Selected sound parameter modifications
  248. */
  249.  
  250. BOOL RLDS3D_SoundSelected(void);
  251. void RLDS3D_GetSelConeAngles(LPDWORD inner, LPDWORD outer);
  252. void RLDS3D_GetSelConeOutsideVolume(LPLONG temp);
  253. void RLDS3D_GetSelMinimumDistance(D3DVALUE *temp);
  254. void RLDS3D_GetSelMaximumDistance(D3DVALUE *temp);      
  255. void RLDS3D_SetSelConeAngles(DWORD inner, DWORD outer);
  256. void RLDS3D_SetSelConeOutsideVolume(LONG temp);
  257. void RLDS3D_SetSelMinimumDistance(D3DVALUE temp);
  258. void RLDS3D_SetSelMaximumDistance(D3DVALUE temp);
  259.  
  260. /*
  261. *************************************  MISC. MAINTENANCE FUNCTIONS  **************************************
  262. */
  263.  
  264. /*
  265. ** Allows external users access to the RL Device to deal with Windows-related issues
  266. **   (See case WM_ACTIVATE: and case WM_PAINT: in viewer source for examples of HandleActivate() and HandlePaint())
  267. ** Design note: This was done to save time from the conversion from the old version of the viewer rather than
  268. **   having RLDS3D_HandleActivate(), etc.
  269. */
  270.  
  271. LPDIRECT3DRMDEVICE RLDS3D_WinDevice();
  272.  
  273. // Handles window activation (pass the wparam from the winproc)
  274. void RLDS3D_HandleActivate(WPARAM wparam);
  275.  
  276. // Handles paint messages from the window.  Pass this one the paintstructure created using BeginPaint
  277. void RLDS3D_HandlePaint(PAINTSTRUCT* ps);
  278.  
  279. // Tells whether or not something is currently selected
  280.  
  281. BOOL RLDS3D_FrameSelected();
  282.  
  283. /*
  284. ** Renders the scene's next frame into the viewport.
  285. */
  286.  
  287. void RLDS3D_Render(D3DVALUE time_delta);
  288.  
  289. /*
  290.  * Resize the viewport and device when the window size changes.
  291.  */
  292.  
  293. void RLDS3D_ResizeViewport(int width, int height);
  294.  
  295. /*
  296. ** Returns whether or not the 3D Sound API was actually initialized properly
  297. */
  298.  
  299. BOOL RLDS3D_SoundInitialized();
  300.  
  301. /*
  302. ** Sets/Gets the current polygon fill mode
  303. */
  304.  
  305. D3DRMFILLMODE RLDS3D_GetPolygonFillMode(void);
  306. void RLDS3D_SetPolygonFillMode(D3DRMFILLMODE quality);
  307.  
  308. /*
  309. ** Sets/Gets the current polygon shade mode
  310. */
  311.  
  312. void RLDS3D_SetPolygonShadeMode(D3DRMSHADEMODE quality);
  313. D3DRMSHADEMODE RLDS3D_GetPolygonShadeMode(void);
  314.  
  315. /*
  316. ** Sets/Gets the colour model for the viewport (RGB or ramp)
  317. */
  318.  
  319. D3DRMCOLORMODEL RLDS3D_GetColourModel(void);
  320. void RLDS3D_SetColourModel(D3DRMCOLORMODEL model);
  321.  
  322. /*
  323. ** Sets/Gets whether or not the lights affect the visuals
  324. */
  325.  
  326. void RLDS3D_SetLighting(BOOL new_val);
  327. BOOL RLDS3D_GetLighting(void);
  328.  
  329. /*
  330. ** Sets/Gets whether or not dithering is on
  331. */
  332.  
  333. BOOL RLDS3D_GetDither(void);
  334. void RLDS3D_SetDither(BOOL dither);
  335.  
  336. /*
  337. ** Sets/Gets texture quality (only relevant for RGB modes)
  338. */
  339.  
  340. D3DRMTEXTUREQUALITY RLDS3D_GetTextureQuality(void);
  341. void RLDS3D_SetTextureQuality(D3DRMTEXTUREQUALITY new_quality);
  342.  
  343. #endif
  344.  
  345.  
  346.