# HG changeset patch # User koryspansel # Date 1317680081 25200 # Node ID 6d4437a24aeba28ff7d65a4c2fbd14758406e047 # Parent 1fe27776627ebe9e903af75cb4bf0ea9c3ebe68a Added camera position to level definition diff -r 1fe27776627e -r 6d4437a24aeb Assets/Maps/map00.def --- a/Assets/Maps/map00.def Mon Oct 03 15:05:09 2011 -0700 +++ b/Assets/Maps/map00.def Mon Oct 03 15:14:41 2011 -0700 @@ -5,6 +5,9 @@ 7,7 3,1 0 +10 +0.46 +0.57 (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) diff -r 1fe27776627e -r 6d4437a24aeb Assets/Maps/map01.def --- a/Assets/Maps/map01.def Mon Oct 03 15:05:09 2011 -0700 +++ b/Assets/Maps/map01.def Mon Oct 03 15:14:41 2011 -0700 @@ -5,6 +5,9 @@ 7,7 3,1 0 +10 +0.46 +0.57 (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) diff -r 1fe27776627e -r 6d4437a24aeb Assets/Maps/map02.def --- a/Assets/Maps/map02.def Mon Oct 03 15:05:09 2011 -0700 +++ b/Assets/Maps/map02.def Mon Oct 03 15:14:41 2011 -0700 @@ -5,6 +5,9 @@ 7,7 3,1 0 +10 +0.46 +0.57 (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) diff -r 1fe27776627e -r 6d4437a24aeb Assets/Maps/map03.def --- a/Assets/Maps/map03.def Mon Oct 03 15:05:09 2011 -0700 +++ b/Assets/Maps/map03.def Mon Oct 03 15:14:41 2011 -0700 @@ -5,6 +5,9 @@ 7,7 3,1 0 +10 +0.46 +0.57 (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) diff -r 1fe27776627e -r 6d4437a24aeb Assets/Maps/map04.def --- a/Assets/Maps/map04.def Mon Oct 03 15:05:09 2011 -0700 +++ b/Assets/Maps/map04.def Mon Oct 03 15:14:41 2011 -0700 @@ -5,6 +5,9 @@ 7,7 0,0 0 +10 +0.46 +0.57 (1,1)(1,1)(1,1)(1,1)(1,1)(1,1)(1,1) (1,1)(1,0)(1,0)(1,0)(1,0)(1,0)(1,1) diff -r 1fe27776627e -r 6d4437a24aeb Assets/Maps/map05.def --- a/Assets/Maps/map05.def Mon Oct 03 15:05:09 2011 -0700 +++ b/Assets/Maps/map05.def Mon Oct 03 15:14:41 2011 -0700 @@ -5,6 +5,9 @@ 7,7 3,1 1 +10 +0.46 +0.57 (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) (1,0)(1,0)(1,0)(1,0)(2,0)(1,0)(1,0) diff -r 1fe27776627e -r 6d4437a24aeb Assets/Maps/map06.def --- a/Assets/Maps/map06.def Mon Oct 03 15:05:09 2011 -0700 +++ b/Assets/Maps/map06.def Mon Oct 03 15:14:41 2011 -0700 @@ -5,6 +5,9 @@ 7,7 3,1 0 +10 +0.46 +0.57 (1,0)(1,0)(1,0)(1,0)(1,0)(1,0)(1,0) (1,0)(1,0)(4,1)(1,0)(2,0)(1,0)(1,0) diff -r 1fe27776627e -r 6d4437a24aeb Data/Maps/map00.map Binary file Data/Maps/map00.map has changed diff -r 1fe27776627e -r 6d4437a24aeb Data/Maps/map01.map Binary file Data/Maps/map01.map has changed diff -r 1fe27776627e -r 6d4437a24aeb Data/Maps/map02.map Binary file Data/Maps/map02.map has changed diff -r 1fe27776627e -r 6d4437a24aeb Data/Maps/map03.map Binary file Data/Maps/map03.map has changed diff -r 1fe27776627e -r 6d4437a24aeb Data/Maps/map04.map Binary file Data/Maps/map04.map has changed diff -r 1fe27776627e -r 6d4437a24aeb Data/Maps/map05.map Binary file Data/Maps/map05.map has changed diff -r 1fe27776627e -r 6d4437a24aeb Data/Maps/map06.map Binary file Data/Maps/map06.map has changed diff -r 1fe27776627e -r 6d4437a24aeb LightClone/Source/Loader.cpp --- a/LightClone/Source/Loader.cpp Mon Oct 03 15:05:09 2011 -0700 +++ b/LightClone/Source/Loader.cpp Mon Oct 03 15:14:41 2011 -0700 @@ -17,6 +17,9 @@ kPosition.X = 0; kPosition.Y = 0; kDirection = Direction_North; + fCameraDistance = 10.0f; + fCameraYaw = 0.46f; + fCameraPitch = 0.57f; } /* @@ -71,6 +74,15 @@ if(kBuffer.Read(&kDirection) != Error_Success) return Error_Fail; + if(kBuffer.Read(&fCameraDistance) != Error_Success) + return Error_Fail; + + if(kBuffer.Read(&fCameraYaw) != Error_Success) + return Error_Fail; + + if(kBuffer.Read(&fCameraPitch) != Error_Success) + return Error_Fail; + if(kSize.X == 0 || kSize.Y == 0) return Error_Fail; @@ -133,3 +145,27 @@ { return kDirection; } + +/* + * GetCameraDistance + */ +float Loader::GetCameraDistance() const +{ + return fCameraDistance; +} + +/* + * GetCameraYaw + */ +float Loader::GetCameraYaw() const +{ + return fCameraYaw; +} + +/* + * GetCameraPitch + */ +float Loader::GetCameraPitch() const +{ + return fCameraPitch; +} diff -r 1fe27776627e -r 6d4437a24aeb LightClone/Source/Loader.h --- a/LightClone/Source/Loader.h Mon Oct 03 15:05:09 2011 -0700 +++ b/LightClone/Source/Loader.h Mon Oct 03 15:14:41 2011 -0700 @@ -37,6 +37,21 @@ */ Direction kDirection; + /* + * fCameraDistance + */ + float fCameraDistance; + + /* + * fCameraYaw + */ + float fCameraYaw; + + /* + * fCameraPitch + */ + float fCameraPitch; + public: /* @@ -78,6 +93,21 @@ * GetInitialDirection */ const Direction& GetInitialDirection() const; + + /* + * GetCameraDistance + */ + float GetCameraDistance() const; + + /* + * GetCameraYaw + */ + float GetCameraYaw() const; + + /* + * GetCameraPitch + */ + float GetCameraPitch() const; }; #endif //__LOADER_H__ diff -r 1fe27776627e -r 6d4437a24aeb LightClone/Source/World.cpp --- a/LightClone/Source/World.cpp Mon Oct 03 15:05:09 2011 -0700 +++ b/LightClone/Source/World.cpp Mon Oct 03 15:14:41 2011 -0700 @@ -133,6 +133,8 @@ kBot.Setup(&kEnvironment); kBot.SetPosition(kLoader.GetInitialPosition()); kBot.SetDirection(kLoader.GetInitialDirection()); + + //kCameraController.SetDistance( } } diff -r 1fe27776627e -r 6d4437a24aeb LightTools/build.py --- a/LightTools/build.py Mon Oct 03 15:05:09 2011 -0700 +++ b/LightTools/build.py Mon Oct 03 15:14:41 2011 -0700 @@ -14,10 +14,13 @@ class MapDefinition: Parse = functools.partial(string.split, sep=',') - def __init__(self, size, position, direction, grid): + def __init__(self, size, position, direction, distance, yaw, pitch, grid): self.Size = self._ParseVector(size) self.Position = self._ParseVector(position) self.Direction = self._ParseVector(direction) + self.Distance = self._ParseVectorF(distance) + self.Yaw = self._ParseVectorF(yaw) + self.Pitch = self._ParseVectorF(pitch) self.Grid = self._ParseList(grid) def Write(self, filename): @@ -25,6 +28,9 @@ handle.write(struct.pack('i' * len(self.Size), *self.Size)) # 8 handle.write(struct.pack('i' * len(self.Position), *self.Position)) # 8 handle.write(struct.pack('i' * len(self.Direction), *self.Direction)) # 4 + handle.write(struct.pack('f' * len(self.Distance), *self.Distance)) # 4 + handle.write(struct.pack('f' * len(self.Yaw), *self.Yaw)) # 4 + handle.write(struct.pack('f' * len(self.Pitch), *self.Pitch)) # 4 for tower in self.Grid: handle.write(struct.pack('i' * len(tower), *tower)) # 8 * Size.X * Size.Y @@ -32,6 +38,9 @@ def _ParseVector(self, line): return map(int, self.Parse(line)) + def _ParseVectorF(self, line): + return map(float, self.Parse(line)) + def _ParseList(self, lines): return [map(int, item.groups()) for item in _pattern.finditer(''.join(lines))] @@ -49,9 +58,12 @@ size = definition[0] position = definition[1] direction = definition[2] - grid = definition[3:] + distance = definition[3] + yaw = definition[4] + pitch = definition[5] + grid = definition[6:] - return MapDefinition(size, position, direction, grid) + return MapDefinition(size, position, direction, distance, yaw, pitch, grid) def Compile(input_map, output_map): if os.path.isfile(input_map): @@ -84,15 +96,3 @@ continue Compile(os.path.join(path_assets, filename), os.path.join(path_build, os.path.splitext(filename)[0] + '.map')) - #definition = ReadDefinition(os.path.join(path_assets, filename)) - #if not definition: - # continue - - #output = os.path.join(path_build, os.path.splitext(filename)[0] + '.map') - #folder = os.path.dirname(output) - - #if not os.path.isdir(folder): - # os.makedirs(folder) - - #print 'Building %s from %s' % (os.path.basename(output), os.path.basename(filename)) - #definition.Write(output)