1 /* Copyright (C) 1992-1998 The Geometry Center 2 * Copyright (C) 1998-2000 Stuart Levy, Tamara Munzner, Mark Phillips 3 * 4 * This file is part of Geomview. 5 * 6 * Geomview is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU Lesser General Public License as published 8 * by the Free Software Foundation; either version 2, or (at your option) 9 * any later version. 10 * 11 * Geomview is distributed in the hope that it will be useful, but 12 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with Geomview; see the file COPYING. If not, write 18 * to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, 19 * USA, or visit http://www.gnu.org. 20 */ 21 #ifndef _QV_STATE_ 22 #define _QV_STATE_ 23 24 #include <QvElement.h> 25 26 class QvState { 27 28 public: 29 30 // Stack indices, based on type of elements in them: 31 enum StackIndex { 32 CameraIndex, 33 Coordinate3Index, 34 FontStyleIndex, 35 LightIndex, 36 MaterialBindingIndex, 37 MaterialIndex, 38 NormalBindingIndex, 39 NormalIndex, 40 ShapeHintsIndex, 41 Texture2Index, 42 Texture2TransformationIndex, 43 TextureCoordinate2Index, 44 TransformationIndex, 45 46 // This has to be last!!! 47 NumStacks 48 }; 49 50 static const char *stackNames[NumStacks]; // Names of stacks 51 52 int depth; // Current state depth 53 QvElement **stacks; // Stacks of elements 54 55 QvState(); 56 ~QvState(); 57 58 // Adds an element instance to the indexed stack 59 void addElement(StackIndex stackIndex, QvElement *elt); 60 61 // Returns top element on a stack getTopElement(StackIndex stackIndex)62 QvElement * getTopElement(StackIndex stackIndex) 63 { return stacks[stackIndex]; } 64 65 // Pushes/pops the stacks 66 void push(); 67 void pop(); 68 69 // Pops top element off one stack 70 void popElement(StackIndex stackIndex); 71 72 // Prints contents for debugging, mostly 73 void print(); 74 }; 75 76 #endif /* _QV_STATE_ */ 77