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
Wrap
Text File
|
1995-11-14
|
4KB
|
92 lines
#if !defined(_PICK_H)
#define _PICK_H
/**********************************************************************
*
* File : pick.h
*
* Abstract : The interface to some enhanced picking functionality
* which use ray casting to determine the exact position
* of the projection of a viewport position onto an
* arbitrary plane. These functions can be used to drag
* objects directly under the mouse cursor.
*
* This application had been written to be compatible with
* both the fixed and floating-point versions of the
* RenderWare library, i.e., it uses the macros CREAL,
* INT2REAL, RAdd, RDiv, RSub etc. If your application is
* intended for the floating-point version of the library
* only these macros are not necessary.
*
* Please note that this application is intended for
* demonstration purposes only. No support will be
* provided for this code and it comes with no warranty.
*
**********************************************************************
*
* This file is a product of Criterion Software Ltd.
*
* This file is provided as is with no warranties of any kind and is
* provided without any obligation on Criterion Software Ltd. or
* Canon Inc. to assist in its use or modification.
*
* Criterion Software Ltd. will not, under any
* circumstances, be liable for any lost revenue or other damages arising
* from the use of this file.
*
* Copyright (c) 1994, 1995 Criterion Software Ltd.
* All Rights Reserved.
*
* RenderWare is a trademark of Canon Inc.
*
**********************************************************************/
/**********************************************************************
*
* Type definitions.
*
**********************************************************************/
/*
* This type represents a ray which we intersect with a plane to
* compute a position.
*/
typedef struct
{
RwV3d p; /* Origin of the ray. */
RwV3d v; /* Direction of the ray. */
} RwRay;
/**********************************************************************
*
* Functions.
*
**********************************************************************/
/*
* Return t at the point of interestion of the given ray and plane.
* The plane is defined by a point on the plane (p) and a nornal to the
* plane (n). Returns TRUE if the ray and plane intersect and FALSE if
* the ray and plane are parallel.
*/
extern RwBool IntersectRayAndPlane(RwRay *ray, RwV3d *n, RwV3d *p, RwReal *t);
/*
* Given a camera and a viewport position spawn a ray into world space.
* NOTE: This function does not take into account camera offsets.
*/
extern RwRay *SpawnRay(RwCamera *camera, RwInt32 x, RwInt32 y, RwRay *ray);
/*
* Compute the position (in world coordinates) of the given clump under
* the given (x, y) position in the viewport of the given camera. The
* clump will keep a constant orientation and distance with respect to
* the camera, i.e., this function can be used to drag the clump around
* on the plane parallel to the camera on which the clump lies.
*/
extern RwV3d *GetClumpPositionUnderPointer(RwClump *clump, RwCamera *camera,
RwInt32 x, RwInt32 y, RwV3d *pos);
/**********************************************************************/
#endif /* !defined(_PICK_H) */