-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VOXELFORMAT: added spritestack source files
see issue #569 - just the empty files for now
- Loading branch information
Showing
5 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/modules/voxelformat/private/spritestack/SpriteStackFormat.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* @file | ||
*/ | ||
|
||
#include "SpriteStackFormat.h" | ||
#include "core/Log.h" | ||
#include "core/ScopedPtr.h" | ||
#include "io/ZipArchive.h" | ||
#include "scenegraph/SceneGraphNode.h" | ||
#include <glm/common.hpp> | ||
|
||
namespace voxelformat { | ||
|
||
bool SpriteStackFormat::loadGroupsPalette(const core::String &filename, const io::ArchivePtr &archive, | ||
scenegraph::SceneGraph &sceneGraph, palette::Palette &palette, | ||
const LoadContext &ctx) { | ||
core::ScopedPtr<io::SeekableReadStream> stream(archive->readStream(filename)); | ||
if (!stream) { | ||
Log::error("Could not load file %s", filename.c_str()); | ||
return false; | ||
} | ||
const io::ArchivePtr &zipArchive = io::openZipArchive(stream); | ||
if (!zipArchive) { | ||
Log::error("Failed to open zip archive"); | ||
return false; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
} // namespace voxelformat |
36 changes: 36 additions & 0 deletions
36
src/modules/voxelformat/private/spritestack/SpriteStackFormat.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* @file | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "io/Archive.h" | ||
#include "io/Stream.h" | ||
#include "voxelformat/Format.h" | ||
|
||
namespace voxelformat { | ||
|
||
/** | ||
* @brief SpriteStack (*.zip) | ||
* | ||
* @ingroup Formats | ||
*/ | ||
class SpriteStackFormat : public PaletteFormat { | ||
private: | ||
bool loadGroupsPalette(const core::String &filename, const io::ArchivePtr &archive, | ||
scenegraph::SceneGraph &sceneGraph, palette::Palette &palette, | ||
const LoadContext &ctx) override; | ||
|
||
public: | ||
bool saveGroups(const scenegraph::SceneGraph &sceneGraph, const core::String &filename, | ||
const io::ArchivePtr &archive, const SaveContext &ctx) override { | ||
return false; | ||
} | ||
|
||
static const io::FormatDescription &format() { | ||
static io::FormatDescription f{"SpriteStack", {"zip"}, {}, 0u}; | ||
return f; | ||
} | ||
}; | ||
|
||
} // namespace voxelformat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* @file | ||
*/ | ||
|
||
#include "AbstractFormatTest.h" | ||
|
||
namespace voxelformat { | ||
|
||
class SpriteStackFormatTest : public AbstractFormatTest {}; | ||
|
||
TEST_F(SpriteStackFormatTest, testLoad) { | ||
testLoad("spritestack.zip", 1); | ||
} | ||
|
||
} // namespace voxelformat |