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

  1. #if !defined(_COMMON_H)
  2. #define _COMMON_H
  3.  
  4. /**********************************************************************
  5.  *
  6.  * File :     common.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.  * Global data.
  44.  *
  45.  **********************************************************************/
  46.  
  47. /*
  48.  * The application instance handle (from rwview.c).
  49.  */ 
  50. extern HINSTANCE AppInstance;
  51.  
  52. /**********************************************************************
  53.  *
  54.  * Macro functions.
  55.  *
  56.  **********************************************************************/
  57.  
  58. /*
  59.  * Macros to convert real numbers in the range CREAL(0.0) to CREAL(1.0)
  60.  * (which RenderWare uses to represent the value of a color channel) to
  61.  * integers in the range 0 to 255 (which Windows uses to represent the
  62.  * value of the a color channel). We use the Windows style in the user
  63.  * interface because users are more used to 0 to 255.
  64.  */
  65. #define BYTETOREAL(v) (RDiv(INT2REAL((RwInt32)(v)), CREAL(255.0)))
  66. #define REALTOBYTE(r) ((int)(REAL2INT(RMul((r), CREAL(255.0)))))
  67.  
  68. /**********************************************************************
  69.  *
  70.  * Functions.
  71.  *
  72.  **********************************************************************/
  73.  
  74. /*
  75.  * Convert a RenderWare RwRGBColor to a Windows COLORREF.
  76.  */
  77. extern COLORREF    RGBToColorRef(RwRGBColor *rgb);
  78.  
  79. /*
  80.  * Convert a Windows COLORREF to a RenderWare RwRGBColor.
  81.  */
  82. extern RwRGBColor *ColorRefToRGB(COLORREF color, RwRGBColor *rgb); 
  83.  
  84. /**********************************************************************/
  85.  
  86. #endif /* !defined(_COMMON_H) */
  87.