Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
2,373 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,28 @@ | ||
/* | ||
* Copyright 2014 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace FlatBuffers | ||
{ | ||
public static class FlatBufferConstants | ||
{ | ||
public const int FileIdentifierLength = 4; | ||
} | ||
} |
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,48 @@ | ||
/* | ||
* Copyright 2014 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
namespace FlatBuffers | ||
{ | ||
/// <summary> | ||
/// Offset class for typesafe assignments. | ||
/// </summary> | ||
public struct Offset<T> where T : class | ||
{ | ||
public int Value; | ||
public Offset(int value) | ||
{ | ||
Value = value; | ||
} | ||
} | ||
|
||
public struct StringOffset | ||
{ | ||
public int Value; | ||
public StringOffset(int value) | ||
{ | ||
Value = value; | ||
} | ||
} | ||
|
||
public struct VectorOffset | ||
{ | ||
public int Value; | ||
public VectorOffset(int value) | ||
{ | ||
Value = value; | ||
} | ||
} | ||
} |
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,27 @@ | ||
/* | ||
* Copyright 2014 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
namespace FlatBuffers | ||
{ | ||
/// <summary> | ||
/// All structs in the generated code derive from this class, and add their own accessors. | ||
/// </summary> | ||
public abstract class Struct | ||
{ | ||
protected int bb_pos; | ||
protected ByteBuffer bb; | ||
} | ||
} |
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,109 @@ | ||
/* | ||
* Copyright 2014 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
using System; | ||
using System.Text; | ||
|
||
namespace FlatBuffers | ||
{ | ||
/// <summary> | ||
/// All tables in the generated code derive from this class, and add their own accessors. | ||
/// </summary> | ||
public abstract class Table | ||
{ | ||
protected int bb_pos; | ||
protected ByteBuffer bb; | ||
|
||
public ByteBuffer ByteBuffer { get { return bb; } } | ||
|
||
// Look up a field in the vtable, return an offset into the object, or 0 if the field is not | ||
// present. | ||
protected int __offset(int vtableOffset) | ||
{ | ||
int vtable = bb_pos - bb.GetInt(bb_pos); | ||
return vtableOffset < bb.GetShort(vtable) ? (int)bb.GetShort(vtable + vtableOffset) : 0; | ||
} | ||
|
||
// Retrieve the relative offset stored at "offset" | ||
protected int __indirect(int offset) | ||
{ | ||
return offset + bb.GetInt(offset); | ||
} | ||
|
||
// Create a .NET String from UTF-8 data stored inside the flatbuffer. | ||
protected string __string(int offset) | ||
{ | ||
offset += bb.GetInt(offset); | ||
var len = bb.GetInt(offset); | ||
var startPos = offset + sizeof(int); | ||
return Encoding.UTF8.GetString(bb.Data, startPos , len); | ||
} | ||
|
||
// Get the length of a vector whose offset is stored at "offset" in this object. | ||
protected int __vector_len(int offset) | ||
{ | ||
offset += bb_pos; | ||
offset += bb.GetInt(offset); | ||
return bb.GetInt(offset); | ||
} | ||
|
||
// Get the start of data of a vector whose offset is stored at "offset" in this object. | ||
protected int __vector(int offset) | ||
{ | ||
offset += bb_pos; | ||
return offset + bb.GetInt(offset) + sizeof(int); // data starts after the length | ||
} | ||
|
||
// Get the data of a vector whoses offset is stored at "offset" in this object as an | ||
// ArraySegment<byte>. If the vector is not present in the ByteBuffer, | ||
// then a null value will be returned. | ||
protected ArraySegment<byte>? __vector_as_arraysegment(int offset) { | ||
var o = this.__offset(offset); | ||
if (0 == o) | ||
{ | ||
return null; | ||
} | ||
|
||
var pos = this.__vector(o); | ||
var len = this.__vector_len(o); | ||
return new ArraySegment<byte>(this.bb.Data, pos, len); | ||
} | ||
|
||
// Initialize any Table-derived type to point to the union at the given offset. | ||
protected TTable __union<TTable>(TTable t, int offset) where TTable : Table | ||
{ | ||
offset += bb_pos; | ||
t.bb_pos = offset + bb.GetInt(offset); | ||
t.bb = bb; | ||
return t; | ||
} | ||
|
||
protected static bool __has_identifier(ByteBuffer bb, string ident) | ||
{ | ||
if (ident.Length != FlatBufferConstants.FileIdentifierLength) | ||
throw new ArgumentException("FlatBuffers: file identifier must be length " + FlatBufferConstants.FileIdentifierLength, "ident"); | ||
|
||
for (var i = 0; i < FlatBufferConstants.FileIdentifierLength; i++) | ||
{ | ||
if (ident[i] != (char)bb.Get(bb.Position + sizeof(int) + i)) return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
|
||
} | ||
} |
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,38 @@ | ||
// automatically generated, do not modify | ||
|
||
namespace CreatureFlatData | ||
{ | ||
|
||
using FlatBuffers; | ||
|
||
public sealed class anchorPointData : Table { | ||
public static anchorPointData GetRootAsanchorPointData(ByteBuffer _bb) { return GetRootAsanchorPointData(_bb, new anchorPointData()); } | ||
public static anchorPointData GetRootAsanchorPointData(ByteBuffer _bb, anchorPointData obj) { return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } | ||
public anchorPointData __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } | ||
|
||
public float GetPoint(int j) { int o = __offset(4); return o != 0 ? bb.GetFloat(__vector(o) + j * 4) : (float)0; } | ||
public int PointLength { get { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; } } | ||
public string AnimClipName { get { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; } } | ||
|
||
public static Offset<anchorPointData> CreateanchorPointData(FlatBufferBuilder builder, | ||
VectorOffset point = default(VectorOffset), | ||
StringOffset anim_clip_name = default(StringOffset)) { | ||
builder.StartObject(2); | ||
anchorPointData.AddAnimClipName(builder, anim_clip_name); | ||
anchorPointData.AddPoint(builder, point); | ||
return anchorPointData.EndanchorPointData(builder); | ||
} | ||
|
||
public static void StartanchorPointData(FlatBufferBuilder builder) { builder.StartObject(2); } | ||
public static void AddPoint(FlatBufferBuilder builder, VectorOffset pointOffset) { builder.AddOffset(0, pointOffset.Value, 0); } | ||
public static VectorOffset CreatePointVector(FlatBufferBuilder builder, float[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddFloat(data[i]); return builder.EndVector(); } | ||
public static void StartPointVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } | ||
public static void AddAnimClipName(FlatBufferBuilder builder, StringOffset animClipNameOffset) { builder.AddOffset(1, animClipNameOffset.Value, 0); } | ||
public static Offset<anchorPointData> EndanchorPointData(FlatBufferBuilder builder) { | ||
int o = builder.EndObject(); | ||
return new Offset<anchorPointData>(o); | ||
} | ||
}; | ||
|
||
|
||
} |
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,35 @@ | ||
// automatically generated, do not modify | ||
|
||
namespace CreatureFlatData | ||
{ | ||
|
||
using FlatBuffers; | ||
|
||
public sealed class anchorPointsHolder : Table { | ||
public static anchorPointsHolder GetRootAsanchorPointsHolder(ByteBuffer _bb) { return GetRootAsanchorPointsHolder(_bb, new anchorPointsHolder()); } | ||
public static anchorPointsHolder GetRootAsanchorPointsHolder(ByteBuffer _bb, anchorPointsHolder obj) { return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } | ||
public anchorPointsHolder __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } | ||
|
||
public anchorPointData GetAnchorPoints(int j) { return GetAnchorPoints(new anchorPointData(), j); } | ||
public anchorPointData GetAnchorPoints(anchorPointData obj, int j) { int o = __offset(4); return o != 0 ? obj.__init(__indirect(__vector(o) + j * 4), bb) : null; } | ||
public int AnchorPointsLength { get { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; } } | ||
|
||
public static Offset<anchorPointsHolder> CreateanchorPointsHolder(FlatBufferBuilder builder, | ||
VectorOffset anchorPoints = default(VectorOffset)) { | ||
builder.StartObject(1); | ||
anchorPointsHolder.AddAnchorPoints(builder, anchorPoints); | ||
return anchorPointsHolder.EndanchorPointsHolder(builder); | ||
} | ||
|
||
public static void StartanchorPointsHolder(FlatBufferBuilder builder) { builder.StartObject(1); } | ||
public static void AddAnchorPoints(FlatBufferBuilder builder, VectorOffset anchorPointsOffset) { builder.AddOffset(0, anchorPointsOffset.Value, 0); } | ||
public static VectorOffset CreateAnchorPointsVector(FlatBufferBuilder builder, Offset<anchorPointData>[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } | ||
public static void StartAnchorPointsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } | ||
public static Offset<anchorPointsHolder> EndanchorPointsHolder(FlatBufferBuilder builder) { | ||
int o = builder.EndObject(); | ||
return new Offset<anchorPointsHolder>(o); | ||
} | ||
}; | ||
|
||
|
||
} |
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,35 @@ | ||
// automatically generated, do not modify | ||
|
||
namespace CreatureFlatData | ||
{ | ||
|
||
using FlatBuffers; | ||
|
||
public sealed class animation : Table { | ||
public static animation GetRootAsanimation(ByteBuffer _bb) { return GetRootAsanimation(_bb, new animation()); } | ||
public static animation GetRootAsanimation(ByteBuffer _bb, animation obj) { return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } | ||
public animation __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } | ||
|
||
public animationClip GetClips(int j) { return GetClips(new animationClip(), j); } | ||
public animationClip GetClips(animationClip obj, int j) { int o = __offset(4); return o != 0 ? obj.__init(__indirect(__vector(o) + j * 4), bb) : null; } | ||
public int ClipsLength { get { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; } } | ||
|
||
public static Offset<animation> Createanimation(FlatBufferBuilder builder, | ||
VectorOffset clips = default(VectorOffset)) { | ||
builder.StartObject(1); | ||
animation.AddClips(builder, clips); | ||
return animation.Endanimation(builder); | ||
} | ||
|
||
public static void Startanimation(FlatBufferBuilder builder) { builder.StartObject(1); } | ||
public static void AddClips(FlatBufferBuilder builder, VectorOffset clipsOffset) { builder.AddOffset(0, clipsOffset.Value, 0); } | ||
public static VectorOffset CreateClipsVector(FlatBufferBuilder builder, Offset<animationClip>[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); } | ||
public static void StartClipsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } | ||
public static Offset<animation> Endanimation(FlatBufferBuilder builder) { | ||
int o = builder.EndObject(); | ||
return new Offset<animation>(o); | ||
} | ||
}; | ||
|
||
|
||
} |
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,45 @@ | ||
// automatically generated, do not modify | ||
|
||
namespace CreatureFlatData | ||
{ | ||
|
||
using FlatBuffers; | ||
|
||
public sealed class animationBone : Table { | ||
public static animationBone GetRootAsanimationBone(ByteBuffer _bb) { return GetRootAsanimationBone(_bb, new animationBone()); } | ||
public static animationBone GetRootAsanimationBone(ByteBuffer _bb, animationBone obj) { return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } | ||
public animationBone __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } | ||
|
||
public string Name { get { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; } } | ||
public float GetStartPt(int j) { int o = __offset(6); return o != 0 ? bb.GetFloat(__vector(o) + j * 4) : (float)0; } | ||
public int StartPtLength { get { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; } } | ||
public float GetEndPt(int j) { int o = __offset(8); return o != 0 ? bb.GetFloat(__vector(o) + j * 4) : (float)0; } | ||
public int EndPtLength { get { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; } } | ||
|
||
public static Offset<animationBone> CreateanimationBone(FlatBufferBuilder builder, | ||
StringOffset name = default(StringOffset), | ||
VectorOffset start_pt = default(VectorOffset), | ||
VectorOffset end_pt = default(VectorOffset)) { | ||
builder.StartObject(3); | ||
animationBone.AddEndPt(builder, end_pt); | ||
animationBone.AddStartPt(builder, start_pt); | ||
animationBone.AddName(builder, name); | ||
return animationBone.EndanimationBone(builder); | ||
} | ||
|
||
public static void StartanimationBone(FlatBufferBuilder builder) { builder.StartObject(3); } | ||
public static void AddName(FlatBufferBuilder builder, StringOffset nameOffset) { builder.AddOffset(0, nameOffset.Value, 0); } | ||
public static void AddStartPt(FlatBufferBuilder builder, VectorOffset startPtOffset) { builder.AddOffset(1, startPtOffset.Value, 0); } | ||
public static VectorOffset CreateStartPtVector(FlatBufferBuilder builder, float[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddFloat(data[i]); return builder.EndVector(); } | ||
public static void StartStartPtVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } | ||
public static void AddEndPt(FlatBufferBuilder builder, VectorOffset endPtOffset) { builder.AddOffset(2, endPtOffset.Value, 0); } | ||
public static VectorOffset CreateEndPtVector(FlatBufferBuilder builder, float[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddFloat(data[i]); return builder.EndVector(); } | ||
public static void StartEndPtVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); } | ||
public static Offset<animationBone> EndanimationBone(FlatBufferBuilder builder) { | ||
int o = builder.EndObject(); | ||
return new Offset<animationBone>(o); | ||
} | ||
}; | ||
|
||
|
||
} |
Oops, something went wrong.