AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
[Define to path of game asset directory.])
-CONFIGFILES="\$HOME/.yoinkrc:/etc/yoinkrc:$DATADIR/yoinkrc"
+CONFIGFILES="\$HOME/.yoinkrc:/etc/yoinkrc"
AC_DEFINE_UNQUOTED([YOINK_CONFIGFILES], ["$CONFIGFILES"],
- [Define to colon-delimited config file paths.])
+ [Define to colon-delimited configuration file paths.])
#
+++ /dev/null
-<?xml version="1.0" standalone="yes"?>
-<scene name="Test" playfield_bounds="0 0 -100 1280 500 100"
- maximum_bounds="-800 0 -300 2400 1000 600">
-
-<!-- Left end tower block -->
-
- <!-- Front -->
-
- <reset_transform/>
- <translate>-5 0 5</translate>
- <scale>32</scale>
-
- <texture>TowerBlock1</texture>
- <tilemap width="5">
- 2 2 2 2 2
- 1 0 0 1 0
- 1 0 0 1 0
- 1 0 0 1 0
- 1 0 0 1 0
- 1 0 0 1 0
- 1 0 0 1 0
- 1 0 0 1 0
- 1 0 0 1 0
- 1 0 0 1 0
- 1 0 0 1 0
- 1 0 0 1 0
- 1 0 0 1 0
- 1 0 0 1 0
- 4 4 4 4 4
- </tilemap>
-
- <!-- Right side -->
-
- <reset_transform/>
- <rotate axis="y">90</rotate>
- <translate>0 0 5</translate>
- <scale>32</scale>
-
- <texture>TowerBlock1</texture>
- <tilemap surface_type="right" width="5">
- 2 2 2 2 2
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 6
- 4 5 5 5 4
- </tilemap>
-
- <!-- Top -->
-
- <reset_transform/>
- <rotate axis="x">90</rotate>
- <translate>-5 15 0</translate>
- <scale>32</scale>
-
- <texture>TowerBlock1</texture>
- <tilemap surface_type="top" width="5">
- 3 3 3 3 3
- 3 3 3 3 3
- 3 3 3 3 3
- 3 3 3 3 3
- 3 3 3 3 3
- </tilemap>
-
-<!-- Leftmost background tower block -->
-
- <!-- Front -->
-
- <reset_transform/>
- <scale>32</scale>
-
- <texture>TowerBlock1</texture>
- <tilemap width="7" detail_level="1">
- 2 2 2 2 2 2 2
- 0 1 0 0 0 1 0
- 0 1 0 0 0 1 0
- 0 1 0 0 6 1 0
- 0 1 0 0 0 1 0
- 0 1 0 0 0 1 0
- 0 1 0 0 0 1 0
- 4 4 5 5 5 4 4
- </tilemap>
-
- <!-- Right side -->
-
- <reset_transform/>
- <rotate axis="y">90</rotate>
- <translate>7 0 0</translate>
- <scale>32</scale>
-
- <texture>TowerBlock1</texture>
- <tilemap width="6" detail_level="1">
- 2 2 2 2 2 2
- 0 1 0 0 1 0
- 0 1 0 0 1 0
- 0 1 0 0 1 0
- 0 1 0 0 1 0
- 0 1 0 0 1 0
- 0 1 0 0 1 0
- 4 4 4 4 4 4
- </tilemap>
-
- <!-- Top -->
-
- <reset_transform/>
- <rotate axis="x">90</rotate>
- <translate>-2 8 -6</translate>
- <scale>32</scale>
-
- <texture>TowerBlock1</texture>
- <tilemap width="9" detail_level="1">
- 3 3 3 3 3 3 3 3 3
- 3 3 3 3 3 3 3 3 3
- 3 3 3 3 3 3 3 3 3
- 3 3 3 3 3 3 3 3 3
- 3 3 3 3 3 3 3 3 3
- 3 3 3 3 3 3 3 3 3
- </tilemap>
-
-<!-- Foreground building with pitched roof -->
-
- <!-- Left wall -->
-
- <reset_transform/>
- <rotate axis="y">-90</rotate>
- <translate>10 0 1</translate>
- <scale>32</scale>
-
- <texture>Building</texture>
- <tilemap surface_type="left" width="4">
- -1 9 11 -1
- 9 10 12 11
- 15 7 7 16
- 3 5 6 4
- 3 6 5 4
- </tilemap>
-
- <!-- Right wall -->
-
- <reset_transform/>
- <rotate axis="y">-90</rotate>
- <translate>13 0 1</translate>
- <scale>32</scale>
-
- <texture>Building</texture>
- <tilemap surface_type="right" width="4">
- -1 9 11 -1
- 9 10 12 11
- 15 7 7 16
- 3 5 6 4
- 3 8 5 4
- </tilemap>
-
- <!-- Front wall -->
-
- <reset_transform/>
- <translate>10 0 5</translate>
- <scale>32</scale>
-
- <texture>Building</texture>
- <tilemap width="3">
- 15 7 16
- 3 5 4
- 3 6 4
- </tilemap>
-
- <!-- Pitched roof -->
-
- <reset_transform/>
- <rotate axis="x">135</rotate>
- <scale>1 1.5 1.5</scale>
- <translate>10 5 3</translate>
- <scale>32</scale>
-
- <texture>Building</texture>
- <tilemap width="3">
- 13 13 13
- 13 13 13
- </tilemap>
-
- <!-- Finial -->
-
- <reset_transform/>
- <translate>10 5 3</translate>
- <scale>32</scale>
-
- <texture>Building</texture>
- <tilemap width="3">
- 18 18 18
- </tilemap>
-
- <!-- Cheaty invisible platform -->
-
- <reset_transform/>
- <translate>10 4 3</translate>
- <scale>32</scale>
-
- <texture>Building</texture>
- <tilemap surface_type="top" width="3">
- -1 -1 -1
- </tilemap>
-
-<!-- The ground -->
-
- <!-- Courtyard -->
-
- <reset_transform/>
- <rotate axis="x">90</rotate>
- <translate>-3 0 0</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <tilemap surface_type="top" width="13">
- 1 1 1 1 1 1 1 1 1 1 1 1 1
- 1 1 1 1 1 1 1 1 1 1 1 1 1
- -1 -1 -1 1 0 0 0 0 0 0 0 0 1
- -1 -1 -1 1 0 0 0 0 0 0 0 0 1
- -1 -1 -1 1 0 0 0 0 0 0 0 0 1
- -1 -1 -1 1 0 0 0 0 0 0 0 0 1
- -1 -1 -1 1 1 1 1 1 1 1 1 1 1
- </tilemap>
-
- <!-- Front grass -->
-
- <reset_transform/>
- <scale>8 1 1</scale>
- <translate>1 -0.5 5</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="8" detail_level="2"/>
-
- <!-- Back grass -->
-
- <reset_transform/>
- <scale>8 1 1</scale>
- <translate>1 -0.5 1</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="8" detail_level="2"/>
-
- <!-- Left grass -->
-
- <reset_transform/>
- <scale>4 1 1</scale>
- <rotate axis="y">-90</rotate>
- <translate>1 -0.5 1</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="4" detail_level="2"/>
-
- <!-- Right grass -->
-
- <reset_transform/>
- <scale>4 1 1</scale>
- <rotate axis="y">-90</rotate>
- <translate>9 -0.5 1</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="4" detail_level="2"/>
-
- <!-- Fence behind house -->
-
- <reset_transform/>
- <scale>11 1 1</scale>
- <translate>7 0 0</translate>
- <scale>32</scale>
-
- <texture>Scenery</texture>
- <billboard tile="4" u_scale="11" detail_level="2"/>
-
-<!-- Background building with pitched roof -->
-
- <!-- Front wall -->
-
- <reset_transform/>
- <translate>19 0 0</translate>
- <scale>32</scale>
-
- <texture>Building</texture>
- <tilemap width="4" detail_level="1">
- -1 9 11 -1
- 9 10 12 11
- 15 7 7 16
- 3 6 5 4
- 3 5 6 4
- 3 8 5 4
- </tilemap>
-
- <!-- Left wall -->
-
- <reset_transform/>
- <rotate axis="y">-90</rotate>
- <translate>19 0 -3</translate>
- <scale>32</scale>
-
- <texture>Building</texture>
- <tilemap surface_type="left" width="3" detail_level="1">
- 15 1 16
- 3 7 4
- 3 5 4
- 3 0 4
- </tilemap>
-
- <!-- Right wall -->
-
- <reset_transform/>
- <rotate axis="y">-90</rotate>
- <translate>23 0 -3</translate>
- <scale>32</scale>
-
- <texture>Building</texture>
- <tilemap surface_type="right" width="3" detail_level="1">
- 15 0 16
- 3 7 4
- 3 6 4
- 3 2 4
- </tilemap>
-
- <!-- Left pitched roof -->
-
- <reset_transform/>
- <rotate axis="x">135</rotate>
- <scale>1 1.5 1.5</scale>
- <rotate axis="y">-90</rotate>
- <translate>21 6 -3</translate>
- <scale>32</scale>
-
- <texture>Building</texture>
- <tilemap width="3" detail_level="1">
- 13 13 13
- 13 13 13
- </tilemap>
-
- <!-- Right pitched roof -->
-
- <reset_transform/>
- <rotate axis="x">-135</rotate>
- <scale>1 1.5 1.5</scale>
- <rotate axis="y">-90</rotate>
- <translate>21 6 -3</translate>
- <scale>32</scale>
-
- <texture>Building</texture>
- <tilemap width="3" detail_level="1">
- 13 13 13
- 13 13 13
- </tilemap>
-
- <!-- Finial -->
-
- <reset_transform/>
- <rotate axis="y">-90</rotate>
- <translate>21 6 -3</translate>
- <scale>32</scale>
-
- <texture>Building</texture>
- <tilemap width="3" detail_level="1">
- 18 18 18
- </tilemap>
-
-<!-- More ground to the right -->
-
- <!-- Ground under house -->
-
- <reset_transform/>
- <rotate axis="x">90</rotate>
- <translate>10 0 0</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <tilemap surface_type="top" width="3">
- 1 1 1
- 1 1 1
- -1 -1 -1
- -1 -1 -1
- -1 -1 -1
- -1 -1 -1
- 1 1 1
- </tilemap>
-
- <!-- Left part of centre courtyard -->
-
- <reset_transform/>
- <rotate axis="x">90</rotate>
- <translate>13 0 0</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <tilemap surface_type="top" width="8">
- 1 1 1 1 1 1 1 1
- 1 1 1 1 1 1 1 1
- 1 0 0 0 0 0 0 0
- 1 0 0 0 0 0 1 1
- 0 0 0 0 0 0 1 1
- 1 0 0 0 0 0 0 0
- 1 1 1 1 1 0 0 0
- </tilemap>
-
- <!-- Front grass -->
-
- <reset_transform/>
- <scale>12 1 1</scale>
- <translate>14 -0.5 5</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="12" detail_level="2"/>
-
- <!-- Back grass -->
-
- <reset_transform/>
- <scale>4 1 1</scale>
- <translate>14 -0.5 1</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="4" detail_level="2"/>
-
- <!-- Front grass next to door -->
-
- <reset_transform/>
- <scale>1 1 1</scale>
- <translate>13 -0.5 3</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="1" detail_level="2"/>
-
- <!-- Back grass next to door -->
-
- <reset_transform/>
- <scale>1 1 1</scale>
- <translate>13 -0.5 2</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="1" detail_level="2"/>
-
- <!-- Left grass -->
-
- <reset_transform/>
- <rotate axis="y">-90</rotate>
- <translate>14 -0.5 1</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <tilemap width="4" detail_level="2">
- 2 -1 2 2
- </tilemap>
-
- <!-- Grass left of house -->
-
- <reset_transform/>
- <rotate axis="y">-90</rotate>
- <scale>1 1 1</scale>
- <translate>18 -0.5 0</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="1" detail_level="2"/>
-
- <!-- Grass right of house -->
-
- <reset_transform/>
- <rotate axis="y">-90</rotate>
- <scale>1 1 1</scale>
- <translate>24 -0.5 0</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="1" detail_level="2"/>
-
- <!-- Front grass in centre -->
-
- <reset_transform/>
- <scale>4 1 1</scale>
- <translate>19 -0.5 4</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="4" detail_level="2"/>
-
- <!-- Back grass in centre -->
-
- <reset_transform/>
- <scale>4 1 1</scale>
- <translate>19 -0.5 2</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="4" detail_level="2"/>
-
- <!-- Left grass in centre -->
-
- <reset_transform/>
- <scale>2 1 1</scale>
- <rotate axis="y">-90</rotate>
- <translate>19 -0.5 2</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="2" detail_level="2"/>
-
- <!-- Right grass in centre -->
-
- <reset_transform/>
- <scale>2 1 1</scale>
- <rotate axis="y">-90</rotate>
- <translate>23 -0.5 2</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="2" detail_level="2"/>
-
-<!-- Still more ground -->
-
- <!-- Right part of centre courtyard -->
-
- <reset_transform/>
- <rotate axis="x">90</rotate>
- <translate>21 0 0</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <tilemap surface_type="top" width="7">
- 1 1 1 1 1 0 0
- 1 1 1 1 1 0 0
- 0 0 0 0 0 0 0
- 1 1 0 0 0 0 0
- 1 1 0 0 0 0 0
- 0 0 0 0 0 0 0
- 0 0 0 1 1 1 1
- </tilemap>
-
- <!-- Fence to right of back house -->
-
- <reset_transform/>
- <scale>4 1 1</scale>
- <translate>24 0 0</translate>
- <scale>32</scale>
-
- <texture>Scenery</texture>
- <billboard tile="4" u_scale="4" detail_level="2"/>
-
- <!-- Grass in front of fence -->
-
- <reset_transform/>
- <scale>4 1 1</scale>
- <translate>24 -0.5 1</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="4" detail_level="2"/>
-
- <!-- Grass to left of tower block -->
-
- <reset_transform/>
- <scale>2 1 1</scale>
- <rotate axis="y">-90</rotate>
- <translate>26 -0.5 5</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="2" detail_level="2"/>
-
- <!-- Grass to right of tower block -->
-
- <reset_transform/>
- <scale>2 1 1</scale>
- <rotate axis="y">-90</rotate>
- <translate>35 -0.5 5</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="2" detail_level="2"/>
-
- <!-- Next bit of grass -->
-
- <reset_transform/>
- <scale>5 1 1</scale>
- <translate>35 -0.5 5</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="5" detail_level="2"/>
-
- <!-- Back grass -->
-
- <reset_transform/>
- <scale>6 1 1</scale>
- <translate>34 -0.5 1</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="6" detail_level="2"/>
-
- <!-- Extra bit of back grass -->
-
- <reset_transform/>
- <scale>1 1 1</scale>
- <rotate axis="y">-90</rotate>
- <translate>34 -0.5 0</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <billboard tile="2" u_scale="1" detail_level="2"/>
-
- <!-- Ground around tower block -->
-
- <reset_transform/>
- <rotate axis="x">90</rotate>
- <translate>28 0 4</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <tilemap surface_type="top" width="5">
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- </tilemap>
-
- <!-- Rightmost ground -->
-
- <reset_transform/>
- <rotate axis="x">90</rotate>
- <translate>33 0 0</translate>
- <scale>32</scale>
- <texture>Scenery</texture>
- <tilemap surface_type="top" width="10">
- 0 0 1 1 1 1 1 1 1 1
- 0 0 1 1 1 1 1 1 1 1
- 0 0 0 0 0 0 0 -1 -1 -1
- 0 0 0 0 0 0 0 -1 -1 -1
- 0 0 0 0 0 0 0 -1 -1 -1
- 0 0 0 0 0 0 0 -1 -1 -1
- 0 1 1 1 1 1 1 -1 -1 -1
- </tilemap>
-
-<!-- Right foreground tower block -->
-
- <!-- Front -->
-
- <reset_transform/>
- <translate>28 0 4</translate>
- <scale>32</scale>
-
- <texture>TowerBlock1</texture>
- <tilemap width="5">
- 2 2 2 2 2
- 0 0 0 0 0
- 0 0 0 0 6
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 6 0
- 4 4 4 4 4
- </tilemap>
-
- <!-- Right side -->
-
- <reset_transform/>
- <rotate axis="y">90</rotate>
- <translate>33 0 4</translate>
- <scale>32</scale>
-
- <texture>TowerBlock1</texture>
- <tilemap surface_type="right" width="6">
- 2 2 2 2 2 2
- 0 1 0 0 1 0
- 0 1 0 0 1 0
- 0 1 0 0 1 0
- 0 1 0 0 1 0
- 0 1 0 0 1 0
- 5 4 5 5 4 5
- </tilemap>
-
- <!-- Left side -->
-
- <reset_transform/>
- <rotate axis="y">90</rotate>
- <translate>28 0 4</translate>
- <scale>32</scale>
-
- <texture>TowerBlock1</texture>
- <tilemap surface_type="left" width="6">
- 2 2 2 2 2 2
- 0 1 6 0 1 0
- 0 1 0 0 1 0
- 0 1 0 0 1 0
- 0 1 0 0 1 0
- 0 1 0 0 1 0
- 5 4 5 5 4 5
- </tilemap>
-
- <!-- Top -->
-
- <reset_transform/>
- <rotate axis="x">90</rotate>
- <translate>28 7 -2</translate>
- <scale>32</scale>
-
- <texture>TowerBlock1</texture>
- <tilemap surface_type="top" width="5">
- 3 3 3 3 3
- 3 3 3 3 3
- 3 3 3 3 3
- 3 3 3 3 3
- 3 3 3 3 3
- 3 3 3 3 3
- </tilemap>
-
-<!-- Right end tower block -->
-
- <!-- Front -->
-
- <reset_transform/>
- <translate>40 0 5</translate>
- <scale>32</scale>
-
- <texture>TowerBlock1</texture>
- <tilemap width="5">
- 2 2 2 2 2
- 0 1 0 0 1
- 0 1 0 0 1
- 0 1 0 0 1
- 0 1 0 0 1
- 6 1 0 0 1
- 0 1 0 0 1
- 0 1 0 0 1
- 0 1 0 0 1
- 0 1 0 0 1
- 0 1 0 0 1
- 6 1 0 0 1
- 0 1 0 0 1
- 0 1 0 0 1
- 4 4 4 4 4
- </tilemap>
-
- <!-- Left side -->
-
- <reset_transform/>
- <rotate axis="y">90</rotate>
- <translate>40 0 5</translate>
- <scale>32</scale>
-
- <texture>TowerBlock1</texture>
- <tilemap surface_type="left" width="5">
- 2 2 2 2 2
- 6 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 6 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 6 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 0 0 0 0 0
- 4 5 5 5 4
- </tilemap>
-
- <!-- Top -->
-
- <reset_transform/>
- <rotate axis="x">90</rotate>
- <translate>40 15 0</translate>
- <scale>32</scale>
-
- <texture>TowerBlock1</texture>
- <tilemap surface_type="top" width="5">
- 3 3 3 3 3
- 3 3 3 3 3
- 3 3 3 3 3
- 3 3 3 3 3
- 3 3 3 3 3
- </tilemap>
-
-<!-- Background -->
-
- <reset_transform/>
- <translate>-0.3 -0.17 -900</translate>
- <scale>3200 1600 1</scale>
- <texture>BackgroundFar</texture>
- <billboard fog="false"/>
-
- <translate>0 0 300</translate>
- <texture>BackgroundNear</texture>
- <billboard blend="true" fog="false"/>
-
-<!-- Trees -->
-
- <texture>Trees</texture>
-
- <!-- Left courtyard -->
-
- <reset_transform/>
- <scale>96</scale>
- <translate>250 -2.5 16</translate>
-
- <billboard tile="1" detail_level="1"/>
-
- <!-- Centre courtyard -->
-
- <reset_transform/>
- <scale>96</scale>
- <translate>610 -2.5 85</translate>
-
- <billboard tile="0"/>
-
- <reset_transform/>
- <scale>96</scale>
- <translate>650 -2.5 115</translate>
-
- <billboard tile="1"/>
-
- <!-- Right courtyard -->
-
- <reset_transform/>
- <scale>96</scale>
- <translate>1080 -2.5 10</translate>
-
- <billboard tile="1" detail_level="1"/>
-
- <reset_transform/>
- <scale>96</scale>
- <translate>1120 -2.5 -15</translate>
-
- <billboard tile="0" detail_level="1"/>
-
- <reset_transform/>
- <scale>96</scale>
- <translate>1220 -2.5 -30</translate>
-
- <billboard tile="1" detail_level="1"/>
-</scene>
}
-void Character::draw(Mf::Scalar alpha) {}
+void Character::draw(Mf::Scalar alpha) const {}
Mf::Tilemap& Character::getTilemap()
{
Character(const std::string& name);
~Character();
- void draw(Mf::Scalar alpha);
+ void draw(Mf::Scalar alpha) const;
Mf::Tilemap& getTilemap();
Mf::Animation& getAnimation();
noinst_LTLIBRARIES = libmoof.la
libmoof_la_SOURCES = \
+ Moof/Aabb.cc \
Moof/Aabb.hh \
Moof/Animation.cc \
Moof/Animation.hh \
+ Moof/Camera.cc \
Moof/Camera.hh \
Moof/ConvertUTF.c \
Moof/ConvertUTF.h \
Moof/Drawable.hh \
Moof/Engine.cc \
Moof/Engine.hh \
+ Moof/Entity.hh \
Moof/Event.hh \
+ Moof/Frustum.hh \
Moof/Interpolator.hh \
Moof/Math.hh \
Moof/Mippleton.hh \
+ Moof/Octree.hh \
Moof/OpenGL.cc \
Moof/OpenGL.hh \
+ Moof/Plane.hh \
Moof/Profiler.hh \
Moof/Random.cc \
Moof/Random.hh \
Moof/Tilemap.hh \
Moof/Timer.cc \
Moof/Timer.hh \
+ Moof/Tree.hh \
Moof/Video.cc \
Moof/Video.hh \
Moof/fastevents.c \
EXTRA_DIST = Moof/cml
-YOINK_ENVIRONMENT = YOINK_DATADIR="$(top_srcdir)/data" \
- YOINKRC="$(top_srcdir)/data/yoinkrc"
+YOINK_ENVIRONMENT = YOINK_DATADIR="$(top_srcdir)/data"
run: all
$(YOINK_ENVIRONMENT) ./yoink
--- /dev/null
+
+/*******************************************************************************
+
+ Copyright (c) 2009, Charles McGarvey
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*******************************************************************************/
+
+#include <Moof/Aabb.hh>
+
+
+namespace Mf {
+
+
+void Aabb::draw(Scalar alpha) const
+{
+ Scalar vertices[] = {min[0], min[1], min[2],
+ min[0], max[1], min[2],
+ max[0], max[1], min[2],
+ max[0], min[1], min[2],
+ min[0], max[1], max[2],
+ min[0], min[1], max[2],
+ max[0], min[1], max[2],
+ max[0], max[1], max[2]};
+
+ GLubyte indicis[] = {0, 1, 2, 3,
+ 1, 2, 7, 4,
+ 3, 0, 5, 6,
+ 2, 3, 6, 7,
+ 5, 0, 1, 4,
+ 4, 5, 6, 7};
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(3, GL_SCALAR, 0, vertices);
+
+ glDrawElements(GL_QUADS, sizeof(indicis), GL_UNSIGNED_BYTE, indicis);
+}
+
+
+} // namespace Mf
+
+/** vim: set ts=4 sw=4 tw=80: *************************************************/
+
-/******************************************************************************
+/*******************************************************************************
Copyright (c) 2009, Charles McGarvey
All rights reserved.
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-******************************************************************************/
+*******************************************************************************/
#ifndef _MOOF_AABB_HH_
#define _MOOF_AABB_HH_
+#include <Moof/Drawable.hh>
#include <Moof/Math.hh>
* Axis-aligned Bounding Box
*/
-struct Aabb
+struct Aabb : public Drawable
{
- Aabb() {}
+ Vector3 min;
+ Vector3 max;
- Aabb(const Vector3& minPoint, const Vector3& maxPoint) :
- min(minPoint),
- max(maxPoint) {}
- Aabb (Scalar minX, Scalar minY, Scalar minZ,
- Scalar maxX, Scalar maxY, Scalar maxZ) :
- min(minX, minY, minZ),
- max(maxX, maxY, maxZ) {}
+ Aabb() {}
- Vector3 min;
- Vector3 max;
+ Aabb(const Vector3& a, const Vector3& b)
+ {
+ init(a, b);
+ }
+
+ Aabb(Scalar ax, Scalar ay, Scalar az,
+ Scalar bx, Scalar by, Scalar bz)
+ {
+ Vector3 a(ax, ay, az);
+ Vector3 b(bx, by, bz);
+
+ init(a, b);
+ }
+
+ inline void init(const Vector3& a, const Vector3& b)
+ {
+ if (a[0] < b[0])
+ {
+ min[0] = a[0];
+ max[0] = b[0];
+ }
+ else
+ {
+ min[0] = b[0];
+ max[0] = a[0];
+ }
+ if (a[1] < b[1])
+ {
+ min[1] = a[1];
+ max[1] = b[1];
+ }
+ else
+ {
+ min[1] = b[1];
+ max[1] = a[1];
+ }
+ if (a[2] < b[2])
+ {
+ min[2] = a[2];
+ max[2] = b[2];
+ }
+ else
+ {
+ min[2] = b[2];
+ max[2] = a[2];
+ }
+ }
+
+ inline Vector3 getCenter() const
+ {
+ return Vector3((min[0] + max[0]) / 2.0,
+ (min[1] + max[1]) / 2.0,
+ (min[2] + max[2]) / 2.0);
+ }
+
+ void draw(Scalar alpha) const;
};
--- /dev/null
+
+/*******************************************************************************
+
+ Copyright (c) 2009, Charles McGarvey
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*******************************************************************************/
+
+#include <iostream>
+#include <Moof/Camera.hh>
+
+
+namespace Mf {
+
+
+void Camera::setPosition(const Vector3& point)
+{
+ //position_ = point;
+ Vector3 coeff[2] = {position_, point};
+ pInterp_.init(coeff, 0.1);
+}
+void Camera::setRotation(const Quaternion& rotation)
+{
+ rotation_ = rotation;
+ //srcRotation_ = rotation_;
+ //dstRotation_ = rotation;
+ //tInterp_ = 0.0;
+}
+
+void Camera::update(Scalar t, Scalar dt)
+{
+ pInterp_.update(dt);
+ position_ = pInterp_.getState(0.0);
+
+ //tInterp_ += dt * 10.0;
+ //rotation_ = cml::slerp(srcRotation_, dstRotation_, cml::clamp(tInterp_, 0.0, 1.0));
+ //rotation_.normalize();
+
+ calculateSecondary();
+}
+
+
+void Camera::lookAt(const Vector3& point)
+{
+ quaternion_rotation_aim_at(rotation_, position_, point);
+}
+
+void Camera::adjustFromInput(const Event& event)
+{
+ switch (event.type)
+ {
+ case SDL_KEYDOWN:
+ if (event.key.keysym.sym == SDLK_RIGHT ||
+ event.key.keysym.sym == SDLK_d)
+ {
+ Vector3 vec = position_;
+ vec[0] -= 50.0;
+ setPosition(vec);
+ }
+ else if (event.key.keysym.sym == SDLK_LEFT ||
+ event.key.keysym.sym == SDLK_a)
+ {
+ Vector3 vec = position_;
+ vec[0] += 50.0;
+ setPosition(vec);
+ }
+ else if (event.key.keysym.sym == SDLK_UP ||
+ event.key.keysym.sym == SDLK_w)
+ {
+ Vector3 vec = position_;
+ vec[1] -= 50.0;
+ setPosition(vec);
+ }
+ else if (event.key.keysym.sym == SDLK_DOWN ||
+ event.key.keysym.sym == SDLK_s)
+ {
+ Vector3 vec = position_;
+ vec[1] += 50.0;
+ setPosition(vec);
+ }
+ else if (event.key.keysym.sym == SDLK_PAGEUP)
+ {
+ Vector3 vec = position_;
+ vec[2] += 50.0;
+ setPosition(vec);
+ }
+ else if (event.key.keysym.sym == SDLK_PAGEDOWN)
+ {
+ //position_[2] -= 50.0;
+ Vector3 vec = position_;
+ vec[2] -= 50.0;
+ setPosition(vec);
+ }
+ break;
+
+ case SDL_MOUSEMOTION:
+ {
+ Scalar xrel = cml::rad(Scalar(event.motion.xrel) / 5.0);
+ Scalar yrel = cml::rad(Scalar(event.motion.yrel) / 5.0);
+
+ Quaternion rotation = rotation_;
+
+ quaternion_rotate_about_world_x(rotation, yrel);
+ //rotation_.normalize();
+ quaternion_rotate_about_world_y(rotation, xrel);
+ rotation.normalize();
+
+ setRotation(rotation);
+ break;
+ }
+
+ case SDL_MOUSEBUTTONDOWN:
+ if (event.button.button == SDL_BUTTON_WHEELUP)
+ {
+ Vector3 vec = position_;
+ vec[2] += 50.0;
+ setPosition(vec);
+ }
+ else if (event.button.button == SDL_BUTTON_WHEELDOWN)
+ {
+ Vector3 vec = position_;
+ vec[2] -= 50.0;
+ setPosition(vec);
+ }
+ break;
+ }
+
+ calculateSecondary();
+}
+
+void Camera::calculateSecondary()
+{
+ matrix_rotation_quaternion(transformation_, rotation_);
+
+ Matrix4 translate;
+ matrix_translation(translate, position_);
+
+ //transformation_ = translate * transformation_;
+ transformation_ *= translate;
+}
+
+
+} // namespace Mf
+
+/** vim: set ts=4 sw=4 tw=80: *************************************************/
+
#ifndef _MOOF_CAMERA_HH_
#define _MOOF_CAMERA_HH_
+#include <Moof/Event.hh>
+#include <Moof/Interpolator.hh>
+#include <Moof/Math.hh>
+
namespace Mf {
class Camera
{
+ void calculateSecondary();
+
public:
+ Camera() :
+ position_(0.0, 0.0, 0.0)
+ {
+ quaternion_rotation_world_y(rotation_, 0.0);
+ srcRotation_ = rotation_;
+ dstRotation_ = rotation_;
+ calculateSecondary();
+ }
+
+ void setPosition(const Vector3& point);
+ void setRotation(const Quaternion& rotation);
+
+ void lookAt(const Vector3& point);
+
+ const Matrix4& getTransformation() const
+ {
+ return transformation_;
+ }
+
+ void adjustFromInput(const Event& event);
+
+ void update(Scalar t, Scalar dt);
+
private:
+ Vector3 position_;
+ Quaternion rotation_;
+
+ Matrix4 transformation_;
+
+ Lerpv3 pInterp_;
+
+ Quaternion srcRotation_;
+ Quaternion dstRotation_;
+ Scalar tInterp_;
};
/**
- * Interface for anything that can be culled. This can include more than just
- * frustrum culling.
+ * Interface for anything that can be culled.
*/
class Cullable
{
public:
- virtual bool isVisible(const Camera& cam) = 0;
+ virtual bool isVisible(const Camera& cam) const
+ {
+ return true;
+ }
};
#ifndef _MOOF_DRAWABLE_HH_
#define _MOOF_DRAWABLE_HH_
+#include <Moof/Camera.hh>
#include <Moof/Math.hh>
class Drawable
{
public:
- virtual void draw(Scalar alpha) = 0;
+ virtual void draw(Scalar alpha) const = 0;
};
*******************************************************************************/
-#ifndef _MOOF_PROFILER_HH_
-#define _MOOF_PROFILER_HH_
+#ifndef _MOOF_ENTITY_HH_
+#define _MOOF_ENTITY_HH_
-/**
- * @file Profiler.hh
- * Braindead-simple profiler.
- */
+#include <boost/shared_ptr.hpp>
-#include <ctime>
+#include <Moof/Aabb.hh>
+#include <Moof/Drawable.hh>
+#include <Moof/Cullable.hh>
namespace Mf {
-class Profiler
-{
+
+/**
+ * Interface for game objects that can be drawn to the screen and half a
+ * specified size.
+ */
+
+class Entity : public Drawable, public Cullable
+{
public:
- Profiler(const char* name = "")
- {
- start(name);
- }
- ~Profiler()
+ const Aabb& getAabb() const
{
- stop();
- }
-
- void start(const char* name = "")
- {
- begin = std::clock();
- std::cout << "Profiling " << name << "... ";
+ return aabb_;
}
- void stop()
- {
- if (begin == -1) return;
- double elapsed = double(std::clock() - begin) / double(CLOCKS_PER_SEC);
- std::cout << elapsed << " sec" << std::endl;
- begin = -1;
- }
+protected:
+ Aabb aabb_;
+};
- void cancel()
- {
- begin = -1;
- }
+typedef boost::shared_ptr<Entity> EntityPtr;
-private:
- std::clock_t begin;
-};
} // namespace Mf
-
-#endif // _MOOF_PROFILER_HH_
+#endif // _MOOF_ENTITY_HH_
/** vim: set ts=4 sw=4 tw=80: *************************************************/
--- /dev/null
+
+/*******************************************************************************
+
+ Copyright (c) 2009, Charles McGarvey
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*******************************************************************************/
+
+#ifndef _MOOF_FRUSTUM_HH_
+#define _MOOF_FRUSTUM_HH_
+
+#include <Moof/Plane.hh>
+
+
+namespace Mf {
+
+
+class Frustum
+{
+ Matrix4 projection;
+ //Plane left, right, bottom, top, near, far;
+
+public:
+ Frustum(Scalar l, Scalar r, Scalar b, Scalar t, Scalar n, Scalar f);
+ Frustum(Scalar fovy, Scalar aspect, Scalar near, Scalar far);
+
+ const Matrix4& getMatrix() const;
+};
+
+
+} // namespace Mf
+
+#endif // _MOOF_FRUSTUM_HH_
+
+/** vim: set ts=4 sw=4 tw=80: *************************************************/
+
#ifndef _MOOF_INTERPOLATOR_HH_
#define _MOOF_INTERPOLATOR_HH_
+#include <Moof/Math.hh>
+
namespace Mf {
Interpolator::init(seconds, mode);
calculate(0.0); // set value
- calculate(0.0); // set previous
+ previous_ = value_;
}
void calculate(Scalar alpha)
--- /dev/null
+
+/*******************************************************************************
+
+ Copyright (c) 2009, Charles McGarvey
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*******************************************************************************/
+
+#ifndef _MOOF_OCTREE_HH_
+#define _MOOF_OCTREE_HH_
+
+#include <list>
+
+#include <boost/shared_ptr.hpp>
+
+#include <Moof/Math.hh>
+#include <Moof/Tree.hh>
+
+
+namespace Mf {
+
+
+class Entity;
+
+
+class Octree
+{
+public:
+
+ class Node
+ {
+ Aabb aabb_;
+ Vector3 center_;
+
+ std::list<boost::shared_ptr<Entity> > objects_;
+
+ public:
+
+ Node() :
+ aabb_(-1.0, -1.0, -1.0, 1.0, 1.0, 1.0),
+ center_(0.0, 0.0, 0.0) {}
+
+ Node(const Aabb& aabb) :
+ aabb_(aabb),
+ center_(aabb.getCenter()) {}
+ };
+
+ Octree() :
+ root_(new Tree<Node>()) {}
+
+ Octree(const Aabb& aabb) :
+ root_(new Tree<Node>(Node(aabb))) {}
+
+
+ Tree<Node>::WeakPtr add(EntityPtr object);
+
+private:
+ Tree<Node>::Ptr root_;
+};
+
+
+} // namespace Mf
+
+#endif // _MOOF_OCTREE_HH_
+
+/** vim: set ts=4 sw=4 tw=80: *************************************************/
+
#if USE_DOUBLE_PRECISION
+void (*glGetScalarv)(GLenum, GLscalar*)(glGetDoublev);
+
void (*glLoadMatrix)(const GLscalar*)(glLoadMatrixd);
void (*glMultMatrix)(const GLscalar*)(glMultMatrixd);
+void (*glScale)(GLscalar, GLscalar, GLscalar)(glScaled);
+void (*glRotate)(GLscalar, GLscalar, GLscalar, GLscalar)(glRotated);
+void (*glTranslate)(GLscalar, GLscalar, GLscalar)(glTranslated);
+
void (*glColor3)(GLscalar, GLscalar, GLscalar)(glColor3d);
void (*glColor4)(GLscalar, GLscalar, GLscalar, GLscalar)(glColor4d);
void (*glColor3v)(const GLscalar*)(glColor3dv);
#else
+void (*glGetScalarv(GLenum, GLscalar*)(glGetFloatv);
+
void (*glLoadMatrix)(const GLscalar*)(glLoadMatrixf);
void (*glMultMatrix)(const GLscalar*)(glMultMatrixf);
+void (*glScale)(GLscalar, GLscalar, GLscalar)(glScalef);
+void (*glRotate)(GLscalar, GLscalar, GLscalar, GLscalar)(glRotatef);
+void (*glTranslate)(GLscalar, GLscalar, GLscalar)(glTranslatef);
+
void (*glVertex2)(GLscalar, GLscalar)(glVertex2f);
void (*glVertex3)(GLscalar, GLscalar, GLscalar)(glVertex3f);
void (*glVertex4)(GLscalar, GLscalar, GLscalar, GLscalar)(glVertex4f);
#endif
+extern void (*glGetScalarv)(GLenum, GLscalar*);
+
extern void (*glLoadMatrix)(const GLscalar*);
extern void (*glMultMatrix)(const GLscalar*);
+extern void (*glScale)(GLscalar, GLscalar, GLscalar);
+extern void (*glRotate)(GLscalar, GLscalar, GLscalar, GLscalar);
+extern void (*glTranslate)(GLscalar, GLscalar, GLscalar);
+
extern void (*glColor3)(GLscalar, GLscalar, GLscalar);
extern void (*glColor4)(GLscalar, GLscalar, GLscalar, GLscalar);
extern void (*glColor3v)(const GLscalar*);
--- /dev/null
+
+/*******************************************************************************
+
+ Copyright (c) 2009, Charles McGarvey
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*******************************************************************************/
+
+#ifndef _MOOF_PLANE_HH_
+#define _MOOF_PLANE_HH_
+
+#include <Moof/Math.hh>
+
+
+namespace Mf {
+
+
+class Plane
+{
+ Vector4 components;
+
+public:
+};
+
+
+} // namespace Mf
+
+#endif // _MOOF_PLANE_HH_
+
+/** vim: set ts=4 sw=4 tw=80: *************************************************/
+
#include "Aabb.hh"
#include "Camera.hh"
-#include "Cullable.hh"
#include "Deserializer.hh"
-#include "Drawable.hh"
+#include "Entity.hh"
#include "Math.hh"
#include "Mippleton.hh"
+#include "Octree.hh"
#include "OpenGL.hh"
#include "Scene.hh"
#include "Serializable.hh"
class Scene::SceneImpl : public Mippleton<SceneImpl>
{
- class Scenery : public Drawable, public Cullable
+ class Scenery : public Entity
{
public:
Scenery(const Matrix4& transform, const std::string& textureName) :
}
}
- void draw(Scalar alpha)
+ void draw(Scalar alpha) const
{
glPushMatrix();
//std::cout << "transforming..." << std::endl;
{
(*it).second->get(uScale);
}
+ if ((it = rootObj.find("fog")) != rootObj.end())
+ {
+ (*it).second->get(fog);
+ }
+ if ((it = rootObj.find("blend")) != rootObj.end())
+ {
+ (*it).second->get(blending);
+ }
}
image.getTileCoords(index, texCoords);
}
- void draw(Scalar alpha)
+ void draw(Scalar alpha) const
{
glPushMatrix();
glMultMatrix(transformation.data());
+ if (blending)
+ {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ }
+ /*if (fog) glEnable(GL_FOG);*/
+
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
image.bind();
glEnd();
}
+ glDisable(GL_BLEND);
+ glDisable(GL_FOG);
+
glPopMatrix();
}
if (numbers[0]->getNumber(num))
{
-
+ theBox.min[0] = Scalar(num);
+ }
+ if (numbers[1]->getNumber(num))
+ {
+ theBox.min[1] = Scalar(num);
+ }
+ if (numbers[2]->getNumber(num))
+ {
+ theBox.min[2] = Scalar(num);
+ }
+ if (numbers[3]->getNumber(num))
+ {
+ theBox.max[0] = Scalar(num);
+ }
+ if (numbers[4]->getNumber(num))
+ {
+ theBox.max[1] = Scalar(num);
+ }
+ if (numbers[5]->getNumber(num))
+ {
+ theBox.max[2] = Scalar(num);
}
}
}
loadFromFile();
}
+ ~SceneImpl()
+ {
+ }
+
void loadInstructions(SerializablePtr root)
{
if (instruction == "reset_transform")
{
transform.identity();
- //std::cout << "===================RESET=====================" << std::endl;
}
else if (instruction == "translate")
{
Matrix4 translation;
cml::matrix_translation(translation, vec);
transform = translation * transform;
- //std::cout << "TRANSLATE\t" << vec << std::endl
- //<< transform << std::endl;
}
}
else if (instruction == "scale")
Matrix4 scaling;
cml::matrix_uniform_scale(scaling, Scalar(value));
transform = scaling * transform;
- //std::cout << "SCALE\t\t" << value << std::endl
- //<< transform << std::endl;
}
else if (values.size() == 3)
{
Matrix4 scaling;
cml::matrix_scale(scaling, vec);
transform = scaling * transform;
- //std::cout << "SCALE\t\t" << vec << std::endl
- //<< transform << std::endl;
}
}
}
std::string axis;
size_t axisIndex = 0;
double value = 0.0;
+ Vector3 vec(0.0, 0.0, 0.0);
if (values[0]->get(axis))
{
if (axis == "x")
{
axisIndex = 0;
+ vec[0] = 1.0;
}
else if (axis == "y")
{
axisIndex = 1;
+ vec[1] = 1.0;
}
else if (axis == "z")
{
axisIndex = 2;
+ vec[2] = 1.0;
}
values[1]->getNumber(value);
}
- cml::matrix_rotate_about_local_axis(transform,
+ cml::matrix_rotate_about_world_axis(transform,
axisIndex, Scalar(value * cml::constantsd::rad_per_deg()));
- //std::cout << "ROTATE\t" << axis << " " << value << std::endl
- //<< transform << std::endl;
}
}
}
}
else if (instruction == "tilemap")
{
- //std::cout << "TILEMAP\t" << texture<< std::endl;
- //std::cout << transform << std::endl;
-
it++;
TilePanel* tilePanel = new TilePanel(transform, texture,
*it);
}
else if (instruction == "billboard")
{
- //std::cout << "BILLBOARD\t" << texture << std::endl;
- //std::cout << transform << std::endl;
-
it++;
Billboard* billboard = new Billboard(transform, texture,
*it);
}
}
}
+
+ std::cout << "playfield: " << playfieldBounds.min << " ... " <<
+ playfieldBounds.max << std::endl;
}
//std::cout << "draw object";
(*it)->draw(alpha);
}
+
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+
+ glBindTexture(GL_TEXTURE_2D, 0);
+ glColor4f(0.0f, 1.0f, 0.0f, 1.0f);
+ playfieldBounds.draw(0.0);
+
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
impl_(Scene::SceneImpl::retain(name), &Scene::SceneImpl::release) {}
-void Scene::draw(Scalar alpha)
+void Scene::draw(Scalar alpha) const
{
// pass through
impl_->draw(alpha);
}
+void Scene::refresh()
+{
+ impl_->objects.clear();
+ impl_->loadFromFile();
+}
+
/**
* Specialized search location for scene files. They can be found in the
public:
Scene(const std::string& name);
- void draw(Scalar alpha);
+ void draw(Scalar alpha) const;
+ void refresh();
static std::string getPathToResource(const std::string& name);
* Bind the GL texture for mapping, etc.
*/
-void Texture::bind()
+void Texture::bind() const
{
// pass through
impl_->bind();
* Get the texture object, for the curious.
*/
-GLuint Texture::getObject()
+GLuint Texture::getObject() const
{
// pass through
return impl_->object_;
}
-unsigned Texture::getWidth()
+unsigned Texture::getWidth() const
{
// pass through
return impl_->width_;
}
-unsigned Texture::getHeight()
+unsigned Texture::getHeight() const
{
// pass through
return impl_->height_;
public:
Texture(const std::string& name);
- void bind();
- GLuint getObject();
+ void bind() const;
+ GLuint getObject() const;
- unsigned getWidth();
- unsigned getHeight();
+ unsigned getWidth() const;
+ unsigned getHeight() const;
void setMinFilter(GLuint filter);
void setMagFilter(GLuint filter);
}
-bool Tilemap::getTileCoords(unsigned index, Scalar coords[8])
+bool Tilemap::getTileCoords(unsigned index, Scalar coords[8]) const
{
// make sure the index represents a real tile
if (index >= impl_->nTilesS_ * impl_->nTilesT_) return false;
}
bool Tilemap::getTileCoords(unsigned index, Scalar coords[8],
- Orientation orientation)
+ Orientation orientation) const
{
if (getTileCoords(index, coords))
{
* @return True if index is valid, false otherwise.
*/
- bool getTileCoords(Index index, Scalar coords[8]);
+ bool getTileCoords(Index index, Scalar coords[8]) const;
/**
* @return True if index is valid, false otherwise.
*/
- bool getTileCoords(Index index, Scalar coords[8], Orientation what);
+ bool getTileCoords(Index index, Scalar coords[8], Orientation what) const;
static std::string getPathToResource(const std::string& name);
--- /dev/null
+
+/*******************************************************************************
+
+ Copyright (c) 2009, Charles McGarvey
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*******************************************************************************/
+
+#ifndef _MOOF_TREE_HH_
+#define _MOOF_TREE_HH_
+
+#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
+
+
+namespace Mf {
+
+
+template <typename T>
+class Tree
+{
+public:
+ typedef boost::shared_ptr<Tree> Ptr;
+ typedef boost::weak_ptr<Tree> WeakPtr;
+
+private:
+ WeakPtr parent_;
+ WeakPtr prevSibling_;
+ Ptr next_;
+ WeakPtr lastDescendant_;
+
+public:
+
+ T data;
+
+ Tree() {}
+ Tree(const T& item) :
+ data(item) {}
+
+ inline Ptr next() const
+ {
+ return next_;
+ }
+
+ inline Ptr prev() const
+ {
+ Ptr parent = parent_.lock();
+
+ if (parent)
+ {
+ if (parent->next_.get() == this)
+ {
+ return parent;
+ }
+ else
+ {
+ return prevSibling_.lock()->lastDescendant_.lock();
+ }
+ }
+
+ return Ptr();
+ }
+
+ inline Ptr firstChild() const
+ {
+ if (next_ && next_->parent_.lock().get() == this)
+ {
+ return next_;
+ }
+
+ return Ptr();
+ }
+
+ inline Ptr lastChild() const
+ {
+ Ptr child = firstChild();
+
+ if (child)
+ {
+ child = child->prevSibling_.lock();
+ }
+
+ return child;
+ }
+
+ inline Ptr nextSibling() const
+ {
+ Ptr sibling = lastDescendant_.lock()->next_;
+
+ if (sibling && sibling->parent_.lock() != parent_.lock())
+ {
+ return Ptr();
+ }
+
+ return sibling;
+ }
+
+ inline Ptr prevSibling() const
+ {
+ Ptr parent = parent_.lock();
+
+ if (parent && parent->next_.get() != this)
+ {
+ return prevSibling_.lock();
+ }
+
+ return Ptr();
+ }
+
+
+ class Iterator
+ {
+ Ptr current;
+
+ public:
+
+ };
+
+
+ void insert()
+ {
+ }
+
+ void remove()
+ {
+ }
+
+};
+
+
+} // namespace Mf
+
+#endif // _MOOF_TREE_HH_
+
+/** vim: set ts=4 sw=4 tw=80: *************************************************/
+
std::string files;
char* configFile = getenv("YOINKRC");
+ char* dataDir = getenv("YOINK_DATADIR");
if (configFile)
{
files += ":";
}
+ // add the colon-delimited paths from configure
files += YOINK_CONFIGFILES;
+ if (dataDir)
+ {
+ // if another data directory is set in the environment, look for a
+ // config file there
+ files += ":";
+ files += dataDir;
+ files += "/yoinkrc";
+ }
+
+ // look in the configured data directory last of all
+ files += ":";
+ files += (dataDir ? dataDir : YOINK_DATADIR);
+ files += "/yoinkrc";
+
return files;
}
// first set up the search paths so we can find the icon and other resources
if (dataDir)
{
+ // look first in the data directory specified by the environment
Mf::Resource::addSearchPath(dataDir);
}
+
+ // then look in the configured data directory
Mf::Resource::addSearchPath(YOINK_DATADIR);
return Mf::Resource::getPathToResource("yoink.png");
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
- glEnable(GL_POLYGON_SMOOTH);
+ //glEnable(GL_POLYGON_SMOOTH);
//int texSize;
//glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize);
glClearColor(1.0, 0.0, 0.0, 1.0);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluPerspective(60.0, 1.33333, 1.0, 2500.0);
+
//glLineWidth(10.0f);
}
fadeIn.update(dt);
+ camera.update(t, dt);
+
someChar->getAnimation().update(t, dt);
interp.update(dt);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(60.0, 1.33333, 1.0, 2000.0);
-
glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ //glLoadIdentity();
glBindTexture(GL_TEXTURE_2D, 0);
//glRotatef(drawstate*15.0f, 0.0, 1.0, 0.0);
- glTranslatef(x, y, z);
+ //glTranslatef(x, y, z);
+ glLoadMatrix(camera.getTransformation().data());
// DRAW THE SCENE
testScene->draw(alpha);
{
someChar->getAnimation().startSequence("Punch");
}
- else if (event.key.keysym.sym == SDLK_RIGHT)
- {
- x -= 50.0;
- }
- else if (event.key.keysym.sym == SDLK_LEFT)
- {
- x += 50.0;
- }
- else if (event.key.keysym.sym == SDLK_UP)
- {
- y -= 50.0;
- }
- else if (event.key.keysym.sym == SDLK_DOWN)
+ else if (event.key.keysym.sym == SDLK_r)
{
- y += 50.0;
+ testScene->refresh();
}
- else if (event.key.keysym.sym == SDLK_PAGEUP)
+ else if (event.key.keysym.sym == SDLK_l)
{
- z += 50.0;
- }
- else if (event.key.keysym.sym == SDLK_PAGEDOWN)
- {
- z -= 50.0;
+ getVideo().toggleCursorGrab();
+ getVideo().toggleCursorVisible();
}
+ //else if (event.key.keysym.sym == SDLK_RIGHT)
+ //{
+ //x -= 50.0;
+ //}
+ //else if (event.key.keysym.sym == SDLK_LEFT)
+ //{
+ //x += 50.0;
+ //}
+ //else if (event.key.keysym.sym == SDLK_UP)
+ //{
+ //y -= 50.0;
+ //}
+ //else if (event.key.keysym.sym == SDLK_DOWN)
+ //{
+ //y += 50.0;
+ //}
+ //else if (event.key.keysym.sym == SDLK_PAGEUP)
+ //{
+ //z += 50.0;
+ //}
+ //else if (event.key.keysym.sym == SDLK_PAGEDOWN)
+ //{
+ //z -= 50.0;
+ //}
+
+ case SDL_MOUSEMOTION:
+ case SDL_MOUSEBUTTONDOWN:
+ camera.adjustFromInput(event);
break;
case SDL_QUIT:
case SDL_VIDEORESIZE:
glViewport(0, 0, event.resize.w, event.resize.h);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+
+
+ gluPerspective(60.0, double(event.resize.w / event.resize.h), 1.0, 2500.0);
+
+ glMatrixMode(GL_MODELVIEW);
break;
}
}
+#include <Moof/Tree.hh>
int main(int argc, char* argv[])
{
int status = 0;
+ //Mf::Tree<Mf::Drawable> myTree;
+ //Mf::Tree<Mf::Drawable>::Ptr prev = myTree.previousSibling();
+ //myTree = *prev;
+
try
{
YoinkApp app(argc, argv);
#include <iostream>
#include <string>
+#include <Moof/Camera.hh>
#include <Moof/Dispatcher.hh>
#include <Moof/Engine.hh>
#include <Moof/Interpolator.hh>
Mf::Cerpv2 interp;
Mf::Lerps fadeIn;
+ Mf::Camera camera;
Mf::Scene* testScene;
Mf::Scalar x, y, z;