Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema updates #241

Closed
wants to merge 78 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
39b9aa1
Fixed url
pjcozzi Feb 19, 2014
12d0ad9
Moved geolocation to extension
pjcozzi Feb 19, 2014
242f593
Update other example
pjcozzi Feb 19, 2014
3cbae3a
Update profile and version
pjcozzi Feb 19, 2014
8a78b6c
Update schema for generator and premultipliedAlpha
pjcozzi Feb 19, 2014
435e38e
Added schema for accessor
pjcozzi Feb 19, 2014
6020b62
Fix default value
pjcozzi Feb 19, 2014
062e1f1
Added schema for animations
pjcozzi Feb 20, 2014
99e9fa2
Remove redundant examples
pjcozzi Feb 20, 2014
7d30ced
Update schema for buffer
pjcozzi Feb 20, 2014
a7e7391
Spec updates for bufferView and camera
pjcozzi Feb 20, 2014
e14f911
Update schema for images
pjcozzi Feb 20, 2014
c8902bd
Added schema for lights
pjcozzi Feb 20, 2014
bb354bc
Streamline validator
pjcozzi Feb 20, 2014
ed9f6f0
Update schema for materials
pjcozzi Feb 20, 2014
0d5f391
Schema for mesh
pjcozzi Feb 21, 2014
bf1c04b
Updated schema for node
pjcozzi Feb 21, 2014
697d77c
Updated schema for program
pjcozzi Feb 21, 2014
ef590f3
Remove old attribute and uniform schema
pjcozzi Feb 21, 2014
b4b9b77
Added schema for sampler
pjcozzi Feb 21, 2014
53556b5
Add schema for scenes
pjcozzi Feb 24, 2014
fe766be
Updated schema for shaders
pjcozzi Feb 24, 2014
6986c57
Start of texture schema
pjcozzi Feb 25, 2014
7ca381d
Texture example
pjcozzi Feb 25, 2014
fd1b6c2
Schema for skins
pjcozzi Feb 25, 2014
fcddd86
Remove old examples
pjcozzi Feb 25, 2014
34ce6f3
Start of schema for technique
pjcozzi Feb 25, 2014
258d7d2
Remove old schema and examples
pjcozzi Feb 25, 2014
d1fd45d
More schema for techniques
pjcozzi Feb 25, 2014
b0c46be
Schema for technique/pass/details
pjcozzi Feb 25, 2014
9cf20dc
Remove 2D transforms
pjcozzi Mar 5, 2014
1ed45de
Parameter semantics updates
pjcozzi Mar 6, 2014
f4b429f
Fix JSON
pjcozzi Mar 6, 2014
61b2855
Change number to integer
pjcozzi Mar 6, 2014
a222f8f
Add text buffer type
pjcozzi Mar 6, 2014
1129b73
Rename extra to extras
pjcozzi Mar 6, 2014
1aa1c76
Add image formats for WebGL 1.0.2 profile
pjcozzi Mar 6, 2014
8565758
Add extensions
pjcozzi Mar 7, 2014
b20d1cf
Changed JOINT_MATRIX to JOINTMATRIX
pjcozzi Mar 7, 2014
6ed6748
Remove count from animations
pjcozzi Mar 7, 2014
461048d
Improve descriptions. Work in progress
pjcozzi Mar 7, 2014
ca69d69
Add name to all top-level glTF properties
pjcozzi Mar 10, 2014
9a2644f
Fix whitespace
pjcozzi Mar 10, 2014
f32999b
More extra schema to a new file
pjcozzi Mar 10, 2014
3b8c148
Renamed jointid to joint
pjcozzi Mar 10, 2014
1a1b848
Rename path to uri
pjcozzi Mar 10, 2014
3c2828a
More details on animation sampler input
pjcozzi Mar 10, 2014
66e4a7f
Merge remote-tracking branch 'origin/master' into schema
pjcozzi Mar 11, 2014
bbc3ad6
Rename source to node
pjcozzi Mar 11, 2014
0e7499e
Update extensions
pjcozzi Mar 11, 2014
106aded
Rename example
pjcozzi Mar 11, 2014
5ca30af
Update accessors
pjcozzi Mar 11, 2014
2b5f332
Fixed a bunch of precision & performance warnings from VS2012-x64.
Mar 11, 2014
04891f0
Removed accidentally submitted build log files.
Mar 11, 2014
da41753
Improved descriptions
pjcozzi Mar 11, 2014
1345304
Merge pull request #251 from tfili/numeric-warnings
fabrobinet Mar 11, 2014
6fc32dd
fix for Clang on Maverick
fabrobinet Mar 12, 2014
d992e20
Start of defaults cleanup
pjcozzi Mar 12, 2014
2190876
Update required properties
pjcozzi Mar 12, 2014
a9f6970
More defaults
pjcozzi Mar 12, 2014
13a967e
Merge remote-tracking branch 'origin/master' into schema
pjcozzi Mar 13, 2014
49a953a
type improvements
pjcozzi Mar 13, 2014
4fd89ee
More improvements to type checking
pjcozzi Mar 13, 2014
9a0c2ea
Minor improvements
pjcozzi Mar 14, 2014
ca10285
Added string length min/max where reasonable
pjcozzi Mar 14, 2014
e48cfdd
Add common type for children of root glTF properties
pjcozzi Mar 14, 2014
54df453
More use of extends
pjcozzi Mar 17, 2014
6521bdd
Misc polish
pjcozzi Mar 17, 2014
8a96a8a
Fix schema
pjcozzi Mar 17, 2014
34ecc1d
Use extends instead of ref so object is completely overwritten
pjcozzi Mar 17, 2014
a96ce69
Added glTFid
pjcozzi Mar 17, 2014
0bf9e5c
Link to spec in schema branch for now
pjcozzi Mar 19, 2014
9426657
Add glTF logo to README.md
pjcozzi Mar 19, 2014
7a0c0db
Merge remote-tracking branch 'origin/master' into schema
pjcozzi Mar 19, 2014
dbe21ce
Links to new schema. Comment out old schema for now.
pjcozzi Mar 19, 2014
f6fdc75
Added version
pjcozzi Mar 19, 2014
95f843d
Move profile and version from root to asset property
pjcozzi May 13, 2014
5775236
Change version from string to number
pjcozzi May 13, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions README.md
@@ -1,6 +1,11 @@
## glTF - the runtime asset format for WebGL, OpenGL ES, and OpenGL
<p align="center">
<img src=“specification/figures/glTF_300.jpg” />
</p>

glTF is the runtime asset format for WebGL, OpenGL ES, and OpenGL.

_glTF is a draft specification, it may change before ratification._

_glTF is a draft Specification - may change before Ratification -_
Everyone is welcomed to contribute to the code and provide feedback about the specification.

#### Common setup
Expand All @@ -10,9 +15,9 @@ git clone --recurse-submodules https://github.com/KhronosGroup/glTF.git

## Specification

_[glTF Specification](https://github.com/KhronosGroup/glTF/blob/master/specification/README.md) is a work-in-progress from the COLLADA Working Group; it is not an official Khronos-ratified specification yet. It is incomplete and subject to change. We've made it available early in the spirit of transparency to receive early community feedback. Please create [issues](https://github.com/KhronosGroup/glTF/issues) with your feedback._
[glTF Specification 0.6](https://github.com/KhronosGroup/glTF/blob/schema/specification/README.md)

_In particular, the definition of materials are in flux, and work on animations and texture and geometry compression are still in the early stages. We are also initially focusing on WebGL. OpenGL ES and OpenGL need additional considerations._
This is a work-in-progress from the COLLADA Working Group; it is not an official Khronos-ratified specification yet. We've made it available early in the spirit of transparency to receive early community feedback. Please create [issues](https://github.com/KhronosGroup/glTF/issues) with your feedback.

## Converter

Expand Down
29 changes: 14 additions & 15 deletions converter/COLLADA2GLTF/COLLADA2GLTFWriter.cpp
Expand Up @@ -154,7 +154,7 @@ namespace GLTF

size_t count = primitive->getVertexAttributesCount();
for (size_t j = 0 ; j < count ; j++) {
Semantic semantic = primitive->getSemanticAtIndex(j);
Semantic semantic = primitive->getSemanticAtIndex((unsigned int)j);
std::string semanticString = GLTFUtils::getStringForSemantic(semantic);

shared_ptr<JSONObject> semanticInfo;
Expand All @@ -165,7 +165,7 @@ namespace GLTF

unsigned int indexOfSet = 0;
if (semantic == GLTF::TEXCOORD) {
indexOfSet = primitive->getIndexOfSetAtIndex(j);
indexOfSet = primitive->getIndexOfSetAtIndex((unsigned int)j);
}

sets->appendValue(shared_ptr<JSONNumber> (new JSONNumber(indexOfSet)));
Expand Down Expand Up @@ -311,7 +311,7 @@ namespace GLTF
}

//generate shaders if needed
shared_ptr <JSONObject> attributeSemantics = serializeAttributeSemanticsForPrimitiveAtIndex(mesh.get(),j);
shared_ptr <JSONObject> attributeSemantics = serializeAttributeSemanticsForPrimitiveAtIndex(mesh.get(), (unsigned int)j);

shared_ptr<JSONObject> techniqueGenerator(new JSONObject());

Expand All @@ -328,7 +328,7 @@ namespace GLTF
//https://github.com/KhronosGroup/glTF/issues/194
//We'll deal with two cases cases of default materials
//With or without NORMALS
shared_ptr <JSONObject> attributeSemantics = serializeAttributeSemanticsForPrimitiveAtIndex(mesh.get(),j);
shared_ptr <JSONObject> attributeSemantics = serializeAttributeSemanticsForPrimitiveAtIndex(mesh.get(), (unsigned int)j);

static shared_ptr<GLTFEffect> defaultEffectNoNormal = createDefaultEffect(this->_asset.get(), attributeSemantics, false);
static shared_ptr<GLTFEffect> defaultEffectWithNormal = createDefaultEffect(this->_asset.get(), attributeSemantics, true);
Expand Down Expand Up @@ -492,7 +492,7 @@ namespace GLTF

const InstanceControllerPointerArray& instanceControllers = node->getInstanceControllers();
shared_ptr <GLTF::JSONArray> meshesArray(new GLTF::JSONArray());
unsigned int count = instanceControllers.getCount();
unsigned int count = (unsigned int)instanceControllers.getCount();
if (count > 0) {
shared_ptr<JSONObject> skins = this->_asset->root()->createObjectIfNeeded("skins");
for (unsigned int i = 0 ; i < count; i++) {
Expand Down Expand Up @@ -838,7 +838,7 @@ namespace GLTF

if (this->_asset->_samplerHashtoSamplerIndex.count(samplerHash) == 0) {
index = this->_asset->_samplerHashtoSamplerIndex.size();
this->_asset->_samplerHashtoSamplerIndex[samplerHash] = index;
this->_asset->_samplerHashtoSamplerIndex[samplerHash] = (unsigned int)index;
addSampler = true;
} else {
index = this->_asset->_samplerHashtoSamplerIndex[samplerHash];
Expand Down Expand Up @@ -1331,12 +1331,12 @@ namespace GLTF

shared_ptr<JSONObject> inverseBindMatrices(new JSONObject());
inverseBindMatrices->setUnsignedInt32(kType, profile->getGLenumForString("FLOAT_MAT4"));
inverseBindMatrices->setUnsignedInt32(kCount, skinControllerData->getJointsCount());
inverseBindMatrices->setUnsignedInt32(kCount, (unsigned int)skinControllerData->getJointsCount());
inverseBindMatrices->setUnsignedInt32(kByteOffset, 0);
glTFSkin->extras()->setValue(kInverseBindMatrices, inverseBindMatrices);

shared_ptr<GLTFOutputStream> animationOutputStream = this->_asset->createOutputStreamIfNeeded(this->_asset->getSharedBufferId());
inverseBindMatrices->setUnsignedInt32(kByteOffset,animationOutputStream->length());
inverseBindMatrices->setUnsignedInt32(kByteOffset, (unsigned int)animationOutputStream->length());
shared_ptr<GLTFBuffer> buffer = glTFSkin->getInverseBindMatrices()->getBuffer();
animationOutputStream->write(buffer);

Expand Down Expand Up @@ -1424,18 +1424,17 @@ namespace GLTF
glTFSkin->setSourceUID(skinController->getSource().toAscii());

unsigned int *remapTableForPositions = mesh->getRemapTableForPositions();
size_t vertexCount = mesh->getMeshAttributesForSemantic(GLTF::POSITION)[0]->getCount();
size_t vertexCount = mesh->getMeshAttribute(GLTF::POSITION, 0)->getCount();
//Now we remap the bone indices and weight attribute in respect of deindexing we have

shared_ptr<GLTFAccessor> weightsAttribute = __CreateAttributeByApplyingRemapTable(glTFSkin->getWeights(), vertexCount, remapTableForPositions, this->_asset->profile());
GLTF::IndexSetToMeshAttributeHashmap& weightsAttributes = mesh->getMeshAttributesForSemantic(GLTF::WEIGHT);
weightsAttributes[0] = weightsAttribute;
mesh->setMeshAttributesForSemantic(GLTF::WEIGHT, weightsAttributes);

mesh->setMeshAttribute(GLTF::WEIGHT, 0, weightsAttribute);

shared_ptr<GLTFAccessor> jointsAttribute = __CreateAttributeByApplyingRemapTable(glTFSkin->getJoints(), vertexCount, remapTableForPositions, this->_asset->profile());
GLTF::IndexSetToMeshAttributeHashmap& jointsAttributes = mesh->getMeshAttributesForSemantic(GLTF::JOINT);
jointsAttributes[0] = jointsAttribute;
mesh->setMeshAttributesForSemantic(GLTF::JOINT, jointsAttributes);

mesh->setMeshAttribute(GLTF::JOINT, 0, jointsAttribute);


GLTF::JSONValueVector primitives = mesh->getPrimitives()->values();
for (size_t i = 0 ; i < primitives.size() ; i++) {
Expand Down
6 changes: 3 additions & 3 deletions converter/COLLADA2GLTF/GLTF/GLTFAccessor.cpp
Expand Up @@ -88,15 +88,15 @@ namespace GLTF
}

void GLTFAccessor::setByteStride(size_t byteStride) {
this->setUnsignedInt32(kByteStride, byteStride);
this->setUnsignedInt32(kByteStride, (unsigned int)byteStride);
}

size_t GLTFAccessor::getByteStride() {
return this->getUnsignedInt32(kByteStride);
}

void GLTFAccessor::setByteOffset(size_t byteOffset) {
this->setUnsignedInt32(kByteOffset, byteOffset);
this->setUnsignedInt32(kByteOffset, (unsigned int)byteOffset);
}

size_t GLTFAccessor::getByteOffset() {
Expand All @@ -108,7 +108,7 @@ namespace GLTF
}

void GLTFAccessor::setCount(size_t count) {
this->setUnsignedInt32(kCount, count);
this->setUnsignedInt32(kCount, (unsigned int)count);
}

const std::string& GLTFAccessor::getID() {
Expand Down
2 changes: 1 addition & 1 deletion converter/COLLADA2GLTF/GLTF/GLTFAccessorCache.h
Expand Up @@ -5,7 +5,7 @@

namespace GLTF
{
class GLTFAccessorCache
class GLTFAccessorCache
{
public:
GLTFAccessorCache(void *pData, size_t length);
Expand Down
2 changes: 1 addition & 1 deletion converter/COLLADA2GLTF/GLTF/GLTFAnimation.cpp
Expand Up @@ -51,7 +51,7 @@ namespace GLTF
}

void GLTFAnimation::setCount(size_t count) {
this->setUnsignedInt32(kCount, count);
this->setUnsignedInt32(kCount, (unsigned int)count);
}

shared_ptr <JSONObject> GLTFAnimation::parameters() {
Expand Down
23 changes: 10 additions & 13 deletions converter/COLLADA2GLTF/GLTF/GLTFAsset.cpp
Expand Up @@ -59,7 +59,7 @@ namespace GLTF
shared_ptr<GLTFAccessor> positionAttribute = mesh->getMeshAttribute(GLTF::POSITION, 0);
size_t vertexCount = positionAttribute->getCount();
unsigned int totalVerticesCount = asset->convertionResults()->getUnsignedInt32("verticesCount");
totalVerticesCount += vertexCount;
totalVerticesCount += (unsigned int)vertexCount;
asset->convertionResults()->setUnsignedInt32("verticesCount", totalVerticesCount);

for (unsigned int j = 0 ; j < allMeshAttributes->size() ; j++) {
Expand All @@ -86,7 +86,7 @@ namespace GLTF
GLTFOutputStream* compressionOutputStream = asset->createOutputStreamIfNeeded(kCompressionOutputStream).get();

shared_ptr <JSONObject> floatAttributeIndexMapping(new JSONObject());
unsigned compressedBufferStart = compressionOutputStream->length();
unsigned compressedBufferStart = (unsigned int)compressionOutputStream->length();
encodeOpen3DGCMesh(mesh, floatAttributeIndexMapping, asset);
typedef std::map<std::string , shared_ptr<GLTF::GLTFBuffer> > IDToBufferDef;
IDToBufferDef IDToBuffer;
Expand All @@ -111,12 +111,12 @@ namespace GLTF
asset->convertionResults()->setUnsignedInt32("trianglesCount", trianglesCount);
size_t indicesLength = sizeof(unsigned short) * indicesCount;
uniqueIndices->setByteOffset(compressedBufferStart);
compressedBufferStart += indicesLength; //we simulate how will be the uncompressed data here, so this is the length in short *on purpose*
compressedBufferStart += (unsigned int)indicesLength; //we simulate how will be the uncompressed data here, so this is the length in short *on purpose*
}
}

shared_ptr<GLTFAccessor> positionAttribute = mesh->getMeshAttribute(GLTF::POSITION, 0);
vertexCount = positionAttribute->getCount();
vertexCount = (unsigned int)positionAttribute->getCount();
unsigned int totalVerticesCount = asset->convertionResults()->getUnsignedInt32("verticesCount");
totalVerticesCount += vertexCount;
asset->convertionResults()->setUnsignedInt32("verticesCount", totalVerticesCount);
Expand All @@ -131,7 +131,7 @@ namespace GLTF
if (!IDToBuffer[bufferView->getBuffer()->getID()].get()) {
meshAttribute->exposeMinMax();
meshAttribute->setByteOffset(compressedBufferStart);
compressedBufferStart += buffer->getByteLength();
compressedBufferStart += (unsigned int)buffer->getByteLength();
IDToBuffer[bufferView->getBuffer()->getID()] = buffer;
}
}
Expand Down Expand Up @@ -533,13 +533,10 @@ namespace GLTF
vector <GLTF::Semantic> allSemantics = mesh->allSemantics();
for (size_t k = 0 ; k < allSemantics.size() ; k++) {
GLTF::Semantic semantic = allSemantics[k];
GLTF::IndexSetToMeshAttributeHashmap::const_iterator meshAttributeIterator;
GLTF::IndexSetToMeshAttributeHashmap& indexSetToMeshAttribute = mesh->getMeshAttributesForSemantic(semantic);
size_t attributesCount = mesh->getMeshAttributesCountForSemantic(semantic);

for (meshAttributeIterator = indexSetToMeshAttribute.begin() ; meshAttributeIterator != indexSetToMeshAttribute.end() ; meshAttributeIterator++) {
//(*it).first; // the key value (of type Key)
//(*it).second; // the mapped value (of type T)
shared_ptr <GLTF::GLTFAccessor> meshAttribute = (*meshAttributeIterator).second;
for (size_t j = 0 ; j < attributesCount ; j++) {
shared_ptr <GLTF::GLTFAccessor> meshAttribute = mesh->getMeshAttribute(semantic, j);

meshAttribute->setBufferView(isCompressed ? compressionBufferView : verticesBufferView);
accessors->setValue(meshAttribute->getID(), meshAttribute);
Expand Down Expand Up @@ -675,8 +672,8 @@ namespace GLTF
if (sharedBuffer->getByteLength() == 0)
remove(rawOutputStream->outputPathCStr());

this->convertionResults()->setUnsignedInt32(kGeometry, this->getGeometryByteLength());
this->convertionResults()->setUnsignedInt32(kAnimation, this->getAnimationByteLength());
this->convertionResults()->setUnsignedInt32(kGeometry, (unsigned int)this->getGeometryByteLength());
this->convertionResults()->setUnsignedInt32(kAnimation, (unsigned int)this->getAnimationByteLength());
this->convertionResults()->setUnsignedInt32(kScene, (int) (verticesLength + indicesLength + animationLength + compressionLength) );

this->log("[geometry] %d bytes\n", (int)this->getGeometryByteLength());
Expand Down
2 changes: 1 addition & 1 deletion converter/COLLADA2GLTF/GLTF/GLTFAsset.h
Expand Up @@ -42,7 +42,7 @@ namespace GLTF

typedef std::map<std::string , shared_ptr<GLTFOutputStream> > NameToOutputStream;

class GLTFAsset
class GLTFAsset
{
public:
GLTFAsset();
Expand Down
10 changes: 5 additions & 5 deletions converter/COLLADA2GLTF/GLTF/GLTFBuffer.cpp
Expand Up @@ -43,21 +43,21 @@ namespace GLTF
_ID(ID),
_data(0),
_ownData(false) {
this->setUnsignedInt32(kByteLength, byteLength);
this->setUnsignedInt32(kByteLength, (unsigned int)byteLength);
}

GLTFBuffer::GLTFBuffer(void *data, size_t byteLength, bool ownData): JSONObject(),
_data((unsigned char*)data),
_ownData(ownData) {
this->setUnsignedInt32(kByteLength, byteLength);
this->setUnsignedInt32(kByteLength, (unsigned int)byteLength);
this->_ID = GLTFUtils::generateIDForType("buffer");
}

GLTFBuffer::GLTFBuffer(std::string ID,void *data, size_t byteLength, bool ownData): JSONObject(),
_ID(ID),
_data((unsigned char*)data),
_ownData(ownData) {
this->setUnsignedInt32(kByteLength, byteLength);
this->setUnsignedInt32(kByteLength, (unsigned int)byteLength);
}

void GLTFBuffer::evaluate(void* context) {
Expand Down Expand Up @@ -112,15 +112,15 @@ namespace GLTF
}

void GLTFBufferView::setByteLength(size_t byteLength) {
this->setUnsignedInt32(kByteLength, byteLength);
this->setUnsignedInt32(kByteLength, (unsigned int)byteLength);
}

size_t GLTFBufferView::getByteLength() {
return this->getUnsignedInt32(kByteLength);
}

void GLTFBufferView::setByteOffset(size_t byteOffset) {
this->setUnsignedInt32(kByteOffset, byteOffset);
this->setUnsignedInt32(kByteOffset, (unsigned int)byteOffset);
}

size_t GLTFBufferView::getByteOffset() {
Expand Down
31 changes: 10 additions & 21 deletions converter/COLLADA2GLTF/GLTF/GLTFMesh.cpp
Expand Up @@ -60,14 +60,11 @@ namespace GLTF
std::map<string, unsigned int> semanticAndSetToIndex;

for (unsigned int i = 0 ; i < allSemantics.size() ; i++) {
IndexSetToMeshAttributeHashmap& indexSetToMeshAttribute = this->getMeshAttributesForSemantic(allSemantics[i]);
IndexSetToMeshAttributeHashmap::const_iterator meshAttributeIterator;
for (meshAttributeIterator = indexSetToMeshAttribute.begin() ; meshAttributeIterator != indexSetToMeshAttribute.end() ; meshAttributeIterator++) {
//(*it).first; // the key value (of type Key)
//(*it).second; // the mapped value (of type T)
shared_ptr <GLTF::GLTFAccessor> selectedMeshAttribute = (*meshAttributeIterator).second;
unsigned int indexSet = (*meshAttributeIterator).first;
GLTF::Semantic semantic = allSemantics[i];
GLTF::Semantic semantic = allSemantics[i];
size_t attributesCount = this->getMeshAttributesCountForSemantic(semantic);
for (size_t j = 0 ; j < attributesCount ; j++) {
shared_ptr <GLTF::GLTFAccessor> selectedMeshAttribute = this->getMeshAttribute(semantic, j);
unsigned int indexSet = j;
std::string semanticIndexSetKey = keyWithSemanticAndSet(semantic, indexSet);
unsigned int size = (unsigned int)meshAttributes->size();
semanticAndSetToIndex[semanticIndexSetKey] = size;
Expand All @@ -84,30 +81,22 @@ namespace GLTF
return true;
}

void GLTFMesh::setMeshAttributesForSemantic(GLTF::Semantic semantic, IndexSetToMeshAttributeHashmap& indexSetToMeshAttributeHashmap) {
this->_semanticToMeshAttributes[semantic] = indexSetToMeshAttributeHashmap;
}

bool GLTFMesh::hasSemantic(Semantic semantic) {
return this->_semanticToMeshAttributes.count(semantic) > 0;
}

IndexSetToMeshAttributeHashmap& GLTFMesh::getMeshAttributesForSemantic(Semantic semantic) {
return this->_semanticToMeshAttributes[semantic];
}

size_t GLTFMesh::getMeshAttributesCountForSemantic(Semantic semantic) {
return this->_semanticToMeshAttributes[semantic].size();
}

shared_ptr<GLTFAccessor> GLTFMesh::getMeshAttribute(Semantic semantic, size_t indexOfSet) {
IndexSetToMeshAttributeHashmap& hasmap = this->_semanticToMeshAttributes[semantic];
return hasmap[indexOfSet];
return hasmap[(unsigned int)indexOfSet];
}

void GLTFMesh::setMeshAttribute(Semantic semantic, size_t indexOfSet, shared_ptr<GLTFAccessor> meshAttribute) {
IndexSetToMeshAttributeHashmap& hasmap = this->_semanticToMeshAttributes[semantic];
hasmap[indexOfSet] = meshAttribute;
hasmap[(unsigned int)indexOfSet] = meshAttribute;
}

vector <GLTF::Semantic> GLTFMesh::allSemantics() {
Expand Down Expand Up @@ -183,16 +172,16 @@ namespace GLTF

size_t count = primitive->getVertexAttributesCount();
for (size_t j = 0 ; j < count ; j++) {
GLTF::Semantic semantic = primitive->getSemanticAtIndex(j);
GLTF::Semantic semantic = primitive->getSemanticAtIndex((unsigned int)j);
std::string semanticAndSet = GLTFUtils::getStringForSemantic(semantic);
unsigned int indexOfSet = 0;
if ((semantic != GLTF::POSITION) && (semantic != GLTF::NORMAL) &&
//FIXME: should not be required for JOINT and WEIGHT
(semantic != GLTF::JOINT) && (semantic != GLTF::WEIGHT)) {
indexOfSet = primitive->getIndexOfSetAtIndex(j);
indexOfSet = primitive->getIndexOfSetAtIndex((unsigned int)j);
semanticAndSet += "_" + GLTFUtils::toString(indexOfSet);
}
attributes->setString(semanticAndSet, this->getMeshAttributesForSemantic(semantic)[indexOfSet]->getID());
attributes->setString(semanticAndSet, this->getMeshAttribute(semantic, indexOfSet)->getID());
}

primitivesArray->appendValue(primitive);
Expand Down