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

  1. #if !defined(_RWVIEW_H)
  2. #define _RWVIEW_H
  3.  
  4. /**********************************************************************
  5.  *
  6.  * File :     rwview.h
  7.  *
  8.  * Abstract : Common definitions shared by all modules in the
  9.  *            RenderWare 3D Object Viewer.
  10.  *
  11.  *            This application had been written to be compatible with
  12.  *            both the fixed and floating-point versions of the
  13.  *            RenderWare library, i.e., it uses the macros CREAL,
  14.  *            INT2REAL, RAdd, RDiv, RSub etc. If your application is
  15.  *            intended for the floating-point version of the library
  16.  *            only these macros are not necessary.
  17.  *
  18.  *            Please note that this application is intended for
  19.  *            demonstration purposes only. No support will be
  20.  *            provided for this code and it comes with no warranty.
  21.  *
  22.  **********************************************************************
  23.  *
  24.  * This file is a product of Criterion Software Ltd.
  25.  *
  26.  * This file is provided as is with no warranties of any kind and is
  27.  * provided without any obligation on Criterion Software Ltd. or
  28.  * Canon Inc. to assist in its use or modification.
  29.  *
  30.  * Criterion Software Ltd. will not, under any
  31.  * circumstances, be liable for any lost revenue or other damages arising
  32.  * from the use of this file.
  33.  *
  34.  * Copyright (c) 1994, 1995 Criterion Software Ltd.
  35.  * All Rights Reserved.
  36.  *
  37.  * RenderWare is a trademark of Canon Inc.
  38.  *
  39.  **********************************************************************/
  40.  
  41. /**********************************************************************
  42.  *
  43.  * Header files.
  44.  *
  45.  **********************************************************************/
  46.  
  47. /**********************************************************************
  48.  *
  49.  * Global data.
  50.  *
  51.  **********************************************************************/
  52.  
  53. /*
  54.  * The application instance handle (from rwview.c).
  55.  */ 
  56. extern HINSTANCE AppInstance;
  57.  
  58. /**********************************************************************
  59.  *
  60.  * Macro functions.
  61.  *
  62.  **********************************************************************/
  63.  
  64. /*
  65.  * Macros to convert real numbers in the range CREAL(0.0) to CREAL(1.0)
  66.  * (which RenderWare uses to represent the value of a color channel) to
  67.  * integers in the range 0 to 255 (which Windows uses to represent the
  68.  * value of the a color channel). We use the Windows style in the user
  69.  * interface because users are more used to 0 to 255.
  70.  */
  71. #define BYTETOREAL(v) (RDiv(INT2REAL((RwInt32)(v)), CREAL(255.0)))
  72. #define REALTOBYTE(r) ((int)(REAL2INT(RMul((r), CREAL(255.0)))))
  73.  
  74. /*
  75.  * A macro to convert a RenderWare RwRGBColor to a Windows COLORREF.
  76.  */
  77. #define RWTOCOLORREF(rgb) \
  78.     (PALETTERGB(REALTOBYTE((rgb)->r), REALTOBYTE((rgb)->g), REALTOBYTE((rgb)->b)))
  79.  
  80. /**********************************************************************
  81.  *
  82.  * Functions.
  83.  *
  84.  **********************************************************************/
  85.  
  86. /*
  87.  * Convert a RenderWare RwRGBColor to a Windows COLORREF.
  88.  */
  89. extern COLORREF    RGBToColorRef(RwRGBColor *rgb);
  90.  
  91. /*
  92.  * Convert a Windows COLORREF to a RenderWare RwRGBColor.
  93.  */
  94. extern RwRGBColor *ColorRefToRGB(COLORREF color, RwRGBColor *rgb); 
  95.  
  96. /**********************************************************************/
  97.  
  98. #endif /* !defined(_RWVIEW_H) */
  99.