~ubuntu-branches/ubuntu/lucid/structure-synth/lucid

« back to all changes in this revision

Viewing changes to StructureSynth/Model/PrimitiveRule.h

  • Committer: Bazaar Package Importer
  • Author(s): Miriam Ruiz
  • Date: 2009-04-13 13:28:45 UTC
  • Revision ID: james.westby@ubuntu.com-20090413132845-d7d42t4llxjxq0ez
Tags: upstream-0.9
ImportĀ upstreamĀ versionĀ 0.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#pragma once
 
2
 
 
3
#include "Rule.h"
 
4
 
 
5
namespace StructureSynth {
 
6
        namespace Model {       
 
7
 
 
8
                /// These are the built-in primitives,
 
9
                /// for drawing boxes, spheres and other simple geometric shapes.
 
10
                class PrimitiveRule : public Rule {
 
11
                        public:
 
12
                                enum PrimitiveType { Box, Sphere, Dot, Grid, Cylinder, Line, Mesh, Other } ;
 
13
                                
 
14
                                PrimitiveRule(PrimitiveType type);
 
15
                                virtual void apply(Builder* builder) const;
 
16
        
 
17
                                /// Returns a list over rules that this rule references.
 
18
                                /// (Empty for all PrimitiveRules!)
 
19
                                virtual QList<RuleRef*> getRuleRefs() const { return QList<RuleRef*>(); }
 
20
 
 
21
                                /// 'class' is an identifier used for distinguishing between
 
22
                                /// different forms of the the same PrimiteType.
 
23
                                /// This is used together with Template Renderers.
 
24
                                ///
 
25
                                /// For instance 'box::metal' will be parsed in to a 'box' primitive with a 'metal' class identifier.
 
26
                                void setClass(QString classID) { this->classID = classID; }
 
27
                                QString getClass() { return classID; }
 
28
                    protected:
 
29
                            QString classID;
 
30
                        private:
 
31
                                PrimitiveType type;
 
32
                                
 
33
                };
 
34
 
 
35
                /// Triangle rules are special, since they have explicit coordinate representation.
 
36
                class TriangleRule : public PrimitiveRule {
 
37
                        public:
 
38
                                
 
39
                                TriangleRule(SyntopiaCore::Math::Vector3f p1,
 
40
                                                  SyntopiaCore::Math::Vector3f p2,
 
41
                                                           SyntopiaCore::Math::Vector3f p3);
 
42
 
 
43
                                virtual void apply(Builder* builder) const;
 
44
        
 
45
                        private:
 
46
                                SyntopiaCore::Math::Vector3f p1;
 
47
                                SyntopiaCore::Math::Vector3f p2;
 
48
                                SyntopiaCore::Math::Vector3f p3;
 
49
                                
 
50
                };
 
51
 
 
52
        }
 
53
}
 
54