~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to libri2rib/dictionary.h

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- C++ -*-
 
2
// Aqsis
 
3
// Copyright  1997 - 2001, Paul C. Gregory
 
4
//
 
5
// Contact: pgregory@aqsis.com
 
6
//
 
7
// This library is free software; you can redistribute it and/or
 
8
// modify it under the terms of the GNU Lesser General Public
 
9
// License as published by the Free Software Foundation; either
 
10
// version 2.1 of the License, or (at your option) any later version.
 
11
//
 
12
// This library is distributed in the hope that it will be useful,
 
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
// General Public License for more details.
 
16
//
 
17
// You should have received a copy of the GNU General Public
 
18
// License along with this library; if not, write to the Free Software
 
19
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
20
 
 
21
/** \file
 
22
 *  \brief This dictionary can handle inline declaration as described in RiSpec V3.2
 
23
 *  \author Lionel J. Lacour (intuition01@online.fr)
 
24
 */
 
25
 
 
26
#ifndef RI2RIB_DICTIONARY_H
 
27
#define RI2RIB_DICTIONARY_H 1
 
28
 
 
29
#include <vector>
 
30
#include <string>
 
31
#include "aqsis.h"
 
32
#include "ri.h"
 
33
 
 
34
START_NAMESPACE( libri2rib )
 
35
 
 
36
enum EqTokenClass { CONSTANT, UNIFORM, VARYING, VERTEX, FACEVARYING };
 
37
enum EqTokenType { FLOAT, POINT, VECTOR, NORMAL, COLOR, STRING, MATRIX, HPOINT, INTEGER };
 
38
typedef unsigned int TqTokenId;
 
39
 
 
40
struct SqTokenEntry
 
41
{
 
42
    SqTokenEntry ( std::string n, EqTokenClass tc, EqTokenType tt, TqUint qt, TqBool inln )
 
43
            : name( n ), tclass( tc ), ttype( tt ), in_line( inln ), quantity( qt )
 
44
    {}
 
45
    ~SqTokenEntry()
 
46
    {}
 
47
 
 
48
    std::string name;
 
49
    EqTokenClass tclass;
 
50
    EqTokenType ttype;
 
51
    TqBool in_line;
 
52
    TqUint quantity;
 
53
 
 
54
#ifdef DEBUG
 
55
    void printClassType ();
 
56
#endif
 
57
};
 
58
 
 
59
 
 
60
class CqDictionary
 
61
{
 
62
private:
 
63
    std::vector<SqTokenEntry> te;
 
64
    TqUint getTypeSize ( EqTokenType );
 
65
    TqUint getQuantity ( TqTokenId );
 
66
    void isValid ( TqTokenId );
 
67
 
 
68
public:
 
69
    CqDictionary();
 
70
    ~CqDictionary()
 
71
    {}
 
72
 
 
73
    TqTokenId addToken ( std::string n, EqTokenClass tc, EqTokenType tt, TqUint qnt = 1, TqBool inln = false );
 
74
    TqTokenId getTokenId ( std::string n );
 
75
    TqUint allocSize ( TqTokenId id, TqUint vertex, TqUint varying, TqUint uniform, TqUint facevarying = 0 );
 
76
    EqTokenType getType ( TqTokenId id );
 
77
 
 
78
#ifdef DEBUG
 
79
    void stats ();
 
80
#endif
 
81
};
 
82
 
 
83
 
 
84
END_NAMESPACE( libri2rib )
 
85
#endif