home *** CD-ROM | disk | FTP | other *** search
/ Learn 3D Graphics Programming on the PC / Learn_3D_Graphics_Programming_on_the_PC_Ferraro.iso / rwwin / pick.h_ / pick.bin
Text File  |  1995-11-14  |  4KB  |  92 lines

  1. #if !defined(_PICK_H)
  2. #define _PICK_H
  3.  
  4. /**********************************************************************
  5.  *
  6.  * File :     pick.h
  7.  *
  8.  * Abstract : The interface to some enhanced picking functionality
  9.  *            which use ray casting to determine the exact position
  10.  *            of the projection of a viewport position onto an
  11.  *            arbitrary plane. These functions can be used to drag
  12.  *            objects directly under the mouse cursor.
  13.  *
  14.  *            This application had been written to be compatible with
  15.  *            both the fixed and floating-point versions of the
  16.  *            RenderWare library, i.e., it uses the macros CREAL,
  17.  *            INT2REAL, RAdd, RDiv, RSub etc. If your application is
  18.  *            intended for the floating-point version of the library
  19.  *            only these macros are not necessary.
  20.  *
  21.  *            Please note that this application is intended for
  22.  *            demonstration purposes only. No support will be
  23.  *            provided for this code and it comes with no warranty.
  24.  *
  25.  **********************************************************************
  26.  *
  27.  * This file is a product of Criterion Software Ltd.
  28.  *
  29.  * This file is provided as is with no warranties of any kind and is
  30.  * provided without any obligation on Criterion Software Ltd. or
  31.  * Canon Inc. to assist in its use or modification.
  32.  *
  33.  * Criterion Software Ltd. will not, under any
  34.  * circumstances, be liable for any lost revenue or other damages arising
  35.  * from the use of this file.
  36.  *
  37.  * Copyright (c) 1994, 1995 Criterion Software Ltd.
  38.  * All Rights Reserved.
  39.  *
  40.  * RenderWare is a trademark of Canon Inc.
  41.  *
  42.  **********************************************************************/
  43.  
  44. /**********************************************************************
  45.  *
  46.  * Type definitions.
  47.  *
  48.  **********************************************************************/
  49.  
  50. /*
  51.  * This type represents a ray which we intersect with a plane to
  52.  * compute a position.
  53.  */
  54. typedef struct
  55. {
  56.     RwV3d p;        /* Origin of the ray.    */
  57.     RwV3d v;        /* Direction of the ray. */
  58. } RwRay;
  59.  
  60. /**********************************************************************
  61.  *
  62.  * Functions.
  63.  *
  64.  **********************************************************************/
  65.  
  66. /*
  67.  * Return t at the point of interestion of the given ray and plane.
  68.  * The plane is defined by a point on the plane (p) and a nornal to the
  69.  * plane (n). Returns TRUE if the ray and plane intersect and FALSE if
  70.  * the ray and plane are parallel.
  71.  */
  72. extern RwBool IntersectRayAndPlane(RwRay *ray, RwV3d *n, RwV3d *p, RwReal *t);
  73.  
  74. /*
  75.  * Given a camera and a viewport position spawn a ray into world space.
  76.  * NOTE: This function does not take into account camera offsets.
  77.  */
  78. extern RwRay *SpawnRay(RwCamera *camera, RwInt32 x, RwInt32 y, RwRay *ray);
  79.  
  80. /*
  81.  * Compute the position (in world coordinates) of the given clump under
  82.  * the given (x, y) position in the viewport of the given camera. The
  83.  * clump will keep a constant orientation and distance with respect to
  84.  * the camera, i.e., this function can be used to drag the clump around
  85.  * on the plane parallel to the camera on which the clump lies.
  86.  */
  87. extern RwV3d *GetClumpPositionUnderPointer(RwClump *clump, RwCamera *camera,
  88.                                            RwInt32 x, RwInt32 y, RwV3d *pos);
  89.  
  90. /**********************************************************************/
  91.  
  92. #endif /* !defined(_PICK_H) */