[4] | 1 | /********************************************************************************
|
---|
| 2 | * Volatile - Volume Visualization Software for SAGE
|
---|
| 3 | * Copyright (C) 2004 Electronic Visualization Laboratory,
|
---|
| 4 | * University of Illinois at Chicago
|
---|
| 5 | *
|
---|
| 6 | * All rights reserved.
|
---|
| 7 | *
|
---|
| 8 | * Redistribution and use in source and binary forms, with or without
|
---|
| 9 | * modification, are permitted provided that the following conditions are met:
|
---|
| 10 | *
|
---|
| 11 | * * Redistributions of source code must retain the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer.
|
---|
| 13 | * * Redistributions in binary form must reproduce the above
|
---|
| 14 | * copyright notice, this list of conditions and the following disclaimer
|
---|
| 15 | * in the documentation and/or other materials provided with the distribution.
|
---|
| 16 | * * Neither the name of the University of Illinois at Chicago nor
|
---|
| 17 | * the names of its contributors may be used to endorse or promote
|
---|
| 18 | * products derived from this software without specific prior written permission.
|
---|
| 19 | *
|
---|
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
---|
| 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
---|
| 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
---|
| 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
---|
| 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
---|
| 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
---|
| 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
---|
| 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
---|
| 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
---|
| 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
---|
| 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 31 | *
|
---|
| 32 | * Direct questions, comments etc about Volatile to www.evl.uic.edu/cavern/forum
|
---|
| 33 | *********************************************************************************/
|
---|
| 34 |
|
---|
| 35 | #include <string.h>
|
---|
| 36 | #include "vPrimitive.h"
|
---|
| 37 | #include "VectorMath.h"
|
---|
| 38 | #ifdef WIN32
|
---|
| 39 | #include <windows.h> // must be included before any OpenGL
|
---|
| 40 | #endif
|
---|
| 41 |
|
---|
| 42 | #if defined(__APPLE__)
|
---|
| 43 | #include <GLUT/glut.h>
|
---|
| 44 | #else
|
---|
| 45 | #include <GL/glut.h>
|
---|
| 46 | #endif
|
---|
| 47 |
|
---|
| 48 | #include <iostream.h>
|
---|
| 49 |
|
---|
| 50 | vPrimitive::vPrimitive()
|
---|
| 51 | {
|
---|
| 52 | strcpy(name,"");
|
---|
| 53 | identityMatrix(xform.rotn); //init the rotation
|
---|
| 54 | rot = false;
|
---|
| 55 | rotAngle = 0.0f;
|
---|
| 56 | xform.scale = 1; //identity for scale
|
---|
| 57 | xform.trans[0] = xform.trans[1] = xform.trans[2] = 0.0f;
|
---|
| 58 | color[0] = (rand()%100)*0.01f; //upto 2 digits precision
|
---|
| 59 | color[1] = (rand()%100)*0.01f; //upto 2 digits precision
|
---|
| 60 | color[2] = (rand()%100)*0.01f; //upto 2 digits precision
|
---|
| 61 | color[3] = 1.0f;
|
---|
| 62 | track.clear();
|
---|
| 63 | selected = false;
|
---|
| 64 | animate = false;
|
---|
| 65 | enabled = true;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | /*
|
---|
| 69 | int vPrimitive::key(unsigned char k, int x, int y)
|
---|
| 70 | {
|
---|
| 71 | return 0;
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | int vPrimitive::special(int k, int x, int y)
|
---|
| 75 | {
|
---|
| 76 | return 0;
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 |
|
---|
| 80 | int vPrimitive::mouse(int button, int state,
|
---|
| 81 | int x, int y)
|
---|
| 82 | {
|
---|
| 83 | return 1;
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | int vPrimitive::move(int x, int y)
|
---|
| 87 | {
|
---|
| 88 | return 1;
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 | int vPrimitive::release()
|
---|
| 92 | {
|
---|
| 93 | return 0;
|
---|
| 94 | }
|
---|
| 95 | */
|
---|
| 96 |
|
---|