home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / msdos / demos / nbird / readxyz.com (.txt) < prev    next >
Encoding:
DOC2COM (Gerald DePyper)  |  1993-10-14  |  19.8 KB  |  361 lines

  1.      -------------------------------------------------------------------
  2.      !  XYZ++  Release 1.1  --  3D graphics class library
  3.      !  Copyright (C) 1993, Nicholas Centanni  All Rights Reserved
  4.      --------------------------------------------- ~October 14, 1993`----
  5.  
  6.  
  7.      -------------------------
  8.      |  OVERVIEW
  9.      -------------------------
  10.        The xyz++ class library is a C++ graphics development object
  11.      library developed for users of Borland C/C++ version 3.1.  It
  12.      includes functions to handle three-dimensional perspective graphics
  13.      in a fast and efficient manner.  With xyz++, adding 3D graphics to
  14.      an application requires surprisingly few lines of code, since the
  15.      bulk of the mathematics is encapsulated neatly into the library
  16.      system.
  17.      
  18.        The 3D Viewer class is fully device-independent, so the system is
  19.      shipped with several additional classes to provide an interface to
  20.      Borland's BGI graphics.  The additional major classes are Graphics,
  21.      Mouse, Keyboard, and Panel (a mini-graphical user interface). These
  22.      classes provide the support necessary to create the various example
  23.      programs included with the package.  The example programs may be
  24.      used by the developer as a learning tool while becoming familiar
  25.      with the system.
  26.  
  27.      
  28.      -------------------------
  29.      |  SOURCE CODE
  30.      -------------------------
  31.        The library source code is included for several reasons:
  32.      
  33.        -- Library source code becomes essential when debugging a program.
  34.      Sometimes it is necessary to trace all the way into a library
  35.      function in order to clearly see what is happening in a specific
  36.      context.  
  37.           
  38.        -- It helps to read the source code for a function in order to
  39.      fully understand its purpose.
  40.      
  41.        -- Even when a system is highly generic, there are those times
  42.      when it becomes necessary to make certain changes to library
  43.      functions in order to produce the best possible end product. 
  44.      
  45.  
  46.      -------------------------
  47.      |  THE VIEWER CLASS
  48.      -------------------------
  49.        The three-dimensional graphics system is added to a program
  50.      by declaring an instance of a class called Viewer.  Once you have
  51.      declared this object, you have access to more than 60 member
  52.      functions for:  changing the position of a viewer in space,
  53.      changing the angle of view, calculating the positions of object
  54.      vertices, and making general calculations for defining planes,
  55.      vectors, and implementing 3D clipping.
  56.  
  57.      
  58.  
  59.        Output can be directed to any number of independent viewing
  60.      rectangles on screen, which allows for multiple views of your scene
  61.      or true stereoscopic rendering.
  62.      
  63.  
  64.      -------------------------
  65.      |  A SIMPLE EXAMPLE
  66.      -------------------------
  67.        To get an idea of how the library functions are used, here is an
  68.      example of the minimal code required to define and plot a single
  69.      point in 3D space:
  70.  
  71.      
  72.      !#include <graphics.h>
  73.      !#include "op_view.h"
  74.      !#include "op_graph.h"
  75.       
  76.      !l_point point = { 20L, 20L, 20L };   |// Define a point in space
  77.      !i_screen pixel;                      |// Define destination pixel
  78.       
  79.      !Viewer viewer;        |// Declare an instance of the Viewer class
  80.      !Graphics graphics;    |// Declare an instance of the BGI class
  81.      
  82.      !void main()
  83.      !{
  84.         registerbgidriver(EGAVGA_driver);
  85.         graphics.on(EGA, EGAHI, "");              |// Start graphics
  86.       
  87.         graphics.define_port(0, 0, 0, 640, 350);  |// Define PORT
  88.         graphics.set_port(0);                     |// Change to PORT
  89.       
  90.         viewer.set_position(100, 100, 100);  |// Define viewer position
  91.         viewer.set_zoom(15);                 |// Set viewing angle
  92.         viewer.set_center(20, 20, 20);       |// Set center of interest
  93.         viewer.view_center();                |// View center of interest
  94.         viewer.new_view();                   |// Prepare for 3D math
  95.         viewer.translate(&point, &pixel);    |// Find screen position
  96.       
  97.         putpixel(pixel.x, pixel.y, WHITE);   |// Plot the point
  98.       
  99.         graphics.off();                      |// Return to text mode
  100.      !}
  101.  
  102.      
  103.      
  104.  
  105.      -------------------------
  106.      |  DISTRIBUTION POLICY
  107.      -------------------------
  108.        The xyz++ graphics class library is copyrighted software, and may
  109.      not be duplicated or distributed, with the exception of the
  110.      installation of the software by a licensed user, to additional
  111.      computers to be used exclusively by that licensed user.  
  112.  
  113.      
  114.  
  115.        You may distribute any product you develop using the xyz++ class
  116.      library, royalty free.  However, under no circumstances may the
  117.      library binaries, or any of the supplied source code be shipped with
  118.      your product, unless a specific arrangement has been made with the
  119.      author to do so.
  120.      
  121.      
  122.      -------------------------
  123.      |  PRICING
  124.      -------------------------
  125.        The current revision of xyz++ (1.1), is being offered at this
  126.      time for $35.00.
  127.      
  128.        Licensed users of this release of xyz++ are eligible to receive 
  129.      unlimited technical support.  Upgrades to the next revision will 
  130.      cost $5.00 (to cover diskettes, shipping and handling only).
  131.      
  132.      
  133.      -------------------------
  134.      |  CONTACTING THE AUTHOR
  135.      -------------------------
  136.        If you have any further questions about NIGHT BIRD or xyz++, feel
  137.      free to leave a message for the author on Compuserve: [70431,2147],
  138.      Internet: nickc@netcom.com, or voice mail: (408) 236-2264.
  139.      
  140.      
  141.      -------------------------
  142.      |  LIBRARY FUNCTIONS
  143.      -------------------------
  144.        The following is a list of all member functions currently
  145.      available in the xyz++ package, with brief descriptions of their
  146.      use.
  147.      
  148.  
  149.      -------------------------
  150.      !  Viewer class
  151.      -------------------------
  152.        set_position            Set viewer position
  153.        get_position            Get viewer position
  154.        get_x, get_y, get_z     Get components of viewer position
  155.        set_center              Define the center of interest
  156.        get_cx, get_cy, get_cz  Get components of the center of interest
  157.        move_east, move_west    Move along the X axis
  158.        move_up, move_down      Move along the Y axis
  159.        move_north, move_south  Move along the Z axis
  160.        move_forward            Move along the current line of sight
  161.        move_left, move_right   Move perpendicular to line of sight
  162.        move                    Calculate movement in a given direction
  163.        orbit                   Circular movement around scene center
  164.        calc_travel             Find components of a movement direction
  165.        calc_distance           Find distance between viewer and center
  166.        calc_radius             Find radius between viewer and center
  167.        get_distance            Get the most recent viewer distance
  168.        clip_angle              Inhibit a given angle between 0 and 360
  169.        set_direction           Set the current viewing direction
  170.        
  171.  
  172.        view_center             View towards the center of interest
  173.        chg_pitch               Turn about the X axis
  174.        chg_heading             Turn about the Y axis
  175.        chg_bank                Turn about the Z axis
  176.        set_zoom                Set the current viewing magnification 
  177.        zoom_in, zoom_out       Increase/decrease viewing magnification
  178.        get_heading             Get viewer HEADING
  179.        get_bank                Get viewer BANK
  180.        get_pitch               Get viewer PITCH
  181.        get_zoom                Get the current viewing magnification
  182.        new_view                Let system know that view has changed
  183.        cos_sin                 Read from a FIXED point SIN/COS table
  184.        translate               Find new ROTATED/SCREEN coordinates
  185.        rotate                  Find new ROTATED coordinates
  186.        project                 Find new SCREEN coordinates
  187.        vector_product          Calculate the product of two vectors
  188.        dot_product             Calculate the dot product of two vectors
  189.        plane                   Calculate the coefficients of a plane
  190.        intersect               Find intersection of a line and a plane
  191.        clip_point              3D clip POINT against viewing window
  192.        clip_line               3D clip LINE against viewing window
  193.        clip_poly               3D clip POLYGON against viewing window
  194.      
  195.  
  196.      -------------------------
  197.      !  Shading class     
  198.      -------------------------
  199.        set_ambient_intensity   Set the intensity value for ambient light
  200.        get_ambient_intensity   Get the intensity value for ambient light
  201.        set_spot_direction      Set the direction of a light source
  202.        set_spot_intensity      Set the brightness of a light source
  203.        define_source           Create a light source
  204.        set_source              Change an existing light source
  205.        set_ambient             Set the value of ambient light
  206.        set_reflectance         Set the reflectance of a surface
  207.        get_shade               Return a shade mapped to a given range
  208.      
  209.  
  210.      -------------------------
  211.      !  Graphics class
  212.      -------------------------
  213.        on                      Start graphics 
  214.        off                     Return to text mode
  215.        define_port             Define a display port
  216.        set_port                Set the desired port for current output
  217.        get_port                Get the dimensions of the current port
  218.        clear_port              Clear the current port with a given color
  219.        border_port             Draw a border around a port
  220.        port_ofs                Calculate the y_offset for a port
  221.        inner_clip              Define an inner clipping region
  222.        set_active              Set the active drawing page
  223.        set_visual              Set the current visual page
  224.        enable_split_screen     Start the SPLIT-VGA 640x480 mode
  225.        reset_pages             Clear the animation system
  226.        set_active, set_visual  Explicitly set the graphics page
  227.        chg_active_page         Toggle the currently active page
  228.        
  229.  
  230.        chg_visual_page         Toggle the currently visual page
  231.        set_active_to_visual    Set the active page to the visual one
  232.        set_visual_to_active    Set the visual page to the active one
  233.        set_active_to_split     Set the active page to split page zero
  234.        paging_on               Activate the animation paging system
  235.        paging_off              Disable the animation paging system
  236.        paging                  Returns the state of the paging system
  237.        clear_screen            Clear the video screen
  238.        wait_retrace            Wait for the next vertical retrace
  239.        blank                   Clear rectangle for text output
  240.        print                   Graphics equivalent of printf()
  241.        set_txt_background      Set the text background color
  242.        prepare_clip_map        Prepare to display clipped bitmaps
  243.        draw_bitmap             Draw a bitmap with no clipping
  244.        clip_bitmap             Draw bitmap with horz & vert clipping
  245.        inset_bevel             Draw a beveled rectangle
  246.        fill_convex_polygon     Fills a polygon of three or more sides
  247.      
  248.  
  249.      -------------------------
  250.      !  Graphics-Font class
  251.      -------------------------
  252.        set_colors              Set the colors for an entire font
  253.        set_spacing             Set the current character spacing
  254.        print                   Display a graphics font string
  255.  
  256.  
  257.      -------------------------
  258.      !  Mouse class
  259.      -------------------------
  260.        activate                Enable the mouse
  261.        graphic_cursor          Change the mouse cursor shape
  262.        prepare_cursor          Prepare for a BGI cursor
  263.        set_hotspot             Set the cursor hot spot
  264.        set_method              Set the mouse display method
  265.        text_cursor             Configure a text mouse
  266.        move_ratio              Set mouse behavior
  267.        range                   Set mouse range
  268.        speed                   Set mouse speed
  269.        clip                    Clip mouse to a rectangular area
  270.        install_handler         Install a mouse interrupt handler
  271.        read                    Read the current mouse state
  272.        pressed                 Has a given mouse button been pressed
  273.        released                Has a given mouse button been released
  274.        set_crt_pageno          Set the current mouse video page
  275.        get_crt_pageno          Get the current mouse video page
  276.        moveto                  Reposition the mouse cursor
  277.        set_port_no             Identify the mouse graphics port
  278.        show                    Display the mouse cursor
  279.        hide                    Hide the mouse cursor
  280.        disable_text_cursor     Hide the text mouse cursor
  281.        gr_cursor               Set the graphics cursor
  282.        bit_cursor              Identify the mouse bitmap
  283.        asm_draw                Draw cursor with ASM bitmap function
  284.        asm_erase               Erase the cursor with the ASM function
  285.        asm_update              Update/Draw cursor with ASM function
  286.        bgi_draw                Draw cursor with BGI bitmap function
  287.        
  288.  
  289.        bgi_erase               Erase the cursor with the BGI function
  290.        bgi_update              Update/Draw cursor with BGI function
  291.      
  292.  
  293.      -------------------------
  294.      !  GUI Panel class
  295.      -------------------------
  296.        add_BMPbutton           Add a bitmap button to the panel
  297.        add_BGIbutton           Add a BGI-drawn button to the panel 
  298.        add_led                 Add a numeric display to the panel
  299.        add_radio               Add a radio button
  300.        add_prompt              Add a text prompt
  301.        button_up               Animate a button in its UP state
  302.        button_down             Animate a button in its DOWN state
  303.        button_inactivate       Gray-out an inactive button
  304.        draw_default_button     Indicate the default button
  305.        default_button          Set the default button
  306.        draw_default_group      Indicate a default control group
  307.        default_group           Set the default control group
  308.        find_default_group      Find the current default control group
  309.        draw                    Draw the current panel controls
  310.        events                  Wait for a panel event
  311.        get_key                 Listen for a keystroke
  312.        send_event              Manually post a panel event
  313.        clear_key               Clear any waiting keystrokes
  314.        define                  Set up a control panel
  315.        display                 Display a control panel and background
  316.        key_read                Process a keystroke
  317.      
  318.  
  319.      -------------------------
  320.      !  Keyboard class
  321.      -------------------------
  322.        check                   Check for a new keypress
  323.        read                    Read a new keystroke
  324.        last                    Return the last read keystroke
  325.         
  326.  
  327.      -------------------------
  328.      |  PACKAGE CONTENTS
  329.      -------------------------
  330.      !  Libraries
  331.        XYZ_6S.LIB    - 3D library for 8086 - small model
  332.        XYZ_6L.LIB    - 3D library for 8086 - large model
  333.        XYZ_3S.LIB    - 3D library for 80386 - small model
  334.        XYZ_3L.LIB    - 3D library for 80386 - large model
  335.        BGI_6S.LIB    - BGI interface library for 8086 - small model
  336.        BGI_6L.LIB    - BGI interface library for 8086 - large model
  337.        BGI_3S.LIB    - BGI interface library for 80386 - small model
  338.        BGI_3L.LIB    - BGI interface library for 80386 - large model
  339.        MAKE_*.BAT    - Set of batch files for building all libraries
  340.      
  341.      !  Examples
  342.        NBIRD.PRJ      - Animates a bird in flight 
  343.        WATER.PRJ      - Simulation of water fountains
  344.        SLOT.PRJ       - Simulation of a slot machine
  345.        REALITY.PRJ    - A sample virtual reality control panel
  346.        
  347.  
  348.        POINT.PRJ      - Plots a single point
  349.        SQUARE.PRJ     - Draw a square in 3D perspective
  350.        SQ_MOVE.PRJ    - Animate a square using the BGI filler
  351.        W_CUBE.PRJ     - Animate a wire-frame cube
  352.        H_CUBE.PRJ     - Animate a solid cube with hidden lines removed
  353.        S_CUBE.PRJ     - Animate a filled cube using the VGA-SPLIT mode
  354.        PANEL.PRJ      - Demonstration of an EGA control panel
  355.      
  356.      !  Documentation
  357.        MANUAL.DOC     - Describes usage of all member functions
  358.      
  359.      
  360.  
  361.