vrecko
virtual reality framework
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
abstractinterpret.h
Go to the documentation of this file.
1
#ifndef ABSTRACTINTERPRET_H_
2
#define ABSTRACTINTERPRET_H_
3
4
#include <vector>
5
6
#include "
configuration.h
"
7
#include "
lsgeode.h
"
8
#include "
parseablestring.h
"
9
#include "
turtlestack.h
"
10
11
using
std::vector;
12
using
std::string;
13
14
namespace
AP_LSystem {
15
class
AbstractInterpret
16
{
17
protected
:
21
vector< LSGeode *>
m_Geodes
;
22
osg::Group *
m_Owner
;
23
TurtleStack
m_Turtles
;
24
public
:
25
AbstractInterpret
( )
26
{
27
m_Owner
= NULL;
28
Randomizer::init
();
29
}
30
37
int
switchGeode
( std::vector<Parameter> & p )
38
{
39
switch
( p.size() )
40
{
41
case
0:
42
m_Turtles
.
pop
();
43
break
;
44
case
1:
45
if
(p[0].
type
!=
Parameter::LS_UBYTE
)
46
return
LS_ERR_PAR_BADTYPE
;
47
m_Turtles
.
push
(
m_Geodes
[*(static_cast<unsigned char*>(p[0].value))] );
48
break
;
49
default
:
50
return
LS_ERR_PAR_INVALIDCOUNT
;
51
}
52
53
return
LS_OK
;
54
}
55
59
void
createGeodes
()
60
{
61
unsigned
int
count =
Configuration::get
()->
getLSystemCount
();
62
LSGeode
* pGeode;
63
for
(
unsigned
int
i = 0; i < count; i++)
64
{
65
pGeode =
new
LSGeode
( i );
66
67
if
(
m_Owner
)
68
{
69
m_Owner
->addChild( (osg::Group *)pGeode );
70
}
71
else
72
{
73
vrecko::logger
.
warningLog
(
"No parent node. LSGeode not added!"
);
74
}
75
76
m_Geodes
.push_back( pGeode );
77
}
78
vrecko::logger
.
debugLog
(
"%d LSGeodes successfuly created and binded with scene graph."
, count );
79
}
80
86
static
const
char
*
errorText
(
int
error )
87
{
88
switch
( error )
89
{
90
case
LS_OK
:
91
return
"OK. No error."
;
92
case
LS_NOTIMPLEMENTED
:
93
return
"Method is not defined"
;
94
case
LS_ERR_PAR_BADTYPE
:
95
return
"Bad type of module parameter"
;
96
case
LS_ERR_PAR_INVALIDCOUNT
:
97
return
"Invalid number of parameters"
;
98
case
LS_ERR_DRAWFORWARD_NEGATIVEDISTANCE
:
99
return
"Negative value of step distance"
;
100
case
LS_ERR_STACK_UNKNOWN_TURTLE_TYPE
:
101
return
"Unknown turtle type"
;
102
case
LS_ERR_STACK_NULL_LSGEODE
:
103
return
"NULL geode"
;
104
default
:
105
return
"Unknown error code"
;
106
}
107
}
108
114
virtual
int
parse
(
ParseableString
* word ) = 0;
115
};
116
}
117
118
#endif
include
vreckoAP
Garden
abstractinterpret.h
Generated on Tue Feb 19 2013 10:23:43 for vrecko by
1.8.3.1