summaryrefslogtreecommitdiffstats
path: root/libs/rs/rsFileA3D.h
diff options
context:
space:
mode:
authorAlex Sakhartchouk <alexst@google.com>2010-05-21 12:53:13 -0700
committerAlex Sakhartchouk <alexst@google.com>2010-05-21 14:00:10 -0700
commitaa7d2884cb563f87294003981e03e37a1abeb961 (patch)
tree85e27332bc586e3eae0ea334e624920de27687cd /libs/rs/rsFileA3D.h
parentdd56b39ec000b3ddd206d242b0fe24b4b955c8ee (diff)
downloadframeworks_base-aa7d2884cb563f87294003981e03e37a1abeb961.zip
frameworks_base-aa7d2884cb563f87294003981e03e37a1abeb961.tar.gz
frameworks_base-aa7d2884cb563f87294003981e03e37a1abeb961.tar.bz2
Removed unnecessary change based on comments.
Now using android utils lib. collada_to_a3d seems to work with android util libs. Integrating old changelist Changing assert to rsAssrt in VertexArray making context compile. Change-Id: I33890defa777f09253bfab630d97782359ec49d7 Added serialization code to rsLib Integrated old changelist Change-Id: Ie4746113f6d1817fbb3264f97fdddde25b779311 Added serialization code to rsLib Change-Id: Ie4746113f6d1817fbb3264f97fdddde25b779311
Diffstat (limited to 'libs/rs/rsFileA3D.h')
-rw-r--r--libs/rs/rsFileA3D.h68
1 files changed, 12 insertions, 56 deletions
diff --git a/libs/rs/rsFileA3D.h b/libs/rs/rsFileA3D.h
index 9ee08ec..e744291 100644
--- a/libs/rs/rsFileA3D.h
+++ b/libs/rs/rsFileA3D.h
@@ -22,6 +22,7 @@
#include "rsMesh.h"
#include <utils/String8.h>
+#include "rsStream.h"
#include <stdio.h>
// ---------------------------------------------------------------------------
@@ -42,76 +43,31 @@ public:
struct A3DIndexEntry {
String8 mID;
- A3DChunkType mType;
+ A3DClassID mType;
uint64_t mOffset;
void * mRsObj;
};
bool load(Context *rsc, FILE *f);
+ size_t getNumLoadedEntries() const;
+ const A3DIndexEntry* getLoadedEntry(size_t index) const;
+ ObjectBase *initializeFromEntry(const A3DIndexEntry *entry);
-protected:
- class IO
- {
- public:
- IO(const uint8_t *, bool use64);
-
- float loadF() {
- mPos = (mPos + 3) & (~3);
- float tmp = reinterpret_cast<const float *>(&mData[mPos])[0];
- mPos += sizeof(float);
- return tmp;
- }
- int32_t loadI32() {
- mPos = (mPos + 3) & (~3);
- int32_t tmp = reinterpret_cast<const int32_t *>(&mData[mPos])[0];
- mPos += sizeof(int32_t);
- return tmp;
- }
- uint32_t loadU32() {
- mPos = (mPos + 3) & (~3);
- uint32_t tmp = reinterpret_cast<const uint32_t *>(&mData[mPos])[0];
- mPos += sizeof(uint32_t);
- return tmp;
- }
- uint16_t loadU16() {
- mPos = (mPos + 1) & (~1);
- uint16_t tmp = reinterpret_cast<const uint16_t *>(&mData[mPos])[0];
- mPos += sizeof(uint16_t);
- return tmp;
- }
- uint8_t loadU8() {
- uint8_t tmp = reinterpret_cast<const uint8_t *>(&mData[mPos])[0];
- mPos += sizeof(uint8_t);
- return tmp;
- }
- uint64_t loadOffset();
- void loadString(String8 *s);
- uint64_t getPos() const {return mPos;}
- const uint8_t * getPtr() const;
- protected:
- const uint8_t * mData;
- uint64_t mPos;
- bool mUse64;
- };
+ void appendToFile(ObjectBase *obj);
+ bool writeFile(const char *filename);
-
- bool process(Context *rsc);
- bool processIndex(Context *rsc, A3DIndexEntry *);
- void processChunk_Mesh(Context *rsc, IO *io, A3DIndexEntry *ie);
- void processChunk_Primitive(Context *rsc, IO *io, A3DIndexEntry *ie);
- void processChunk_Verticies(Context *rsc, IO *io, A3DIndexEntry *ie);
- void processChunk_Element(Context *rsc, IO *io, A3DIndexEntry *ie);
- void processChunk_ElementSource(Context *rsc, IO *io, A3DIndexEntry *ie);
+protected:
const uint8_t * mData;
void * mAlloc;
uint64_t mDataSize;
Context * mRsc;
- Vector<A3DIndexEntry> mIndex;
- Vector<String8> mStrings;
- Vector<uint32_t> mStringIndexValues;
+ OStream *mWriteStream;
+ Vector<A3DIndexEntry*> mWriteIndex;
+ IStream *mReadStream;
+ Vector<A3DIndexEntry*> mIndex;
};