glTF icon indicating copy to clipboard operation
glTF copied to clipboard

Set index for SEMANTIC

Open fabrobinet opened this issue 13 years ago • 7 comments

Currently we have a couple of { semantic, set }.

Patrick suggested we could use a parsing convention like "semantic.set" so that we get a single property. Some implementation experiments and/or community feedback welcomed before changing this.

fabrobinet avatar Mar 14 '13 17:03 fabrobinet

A bit more details from our discussion:

The COLLADA solution is to introduce a new property, set, to uniquely identify an attribute. Although this keeps the semantic property clean and well defined, it also requires the client-side implementation to carry around two properties to link attributes from primitive to program. It seems more concise and convenient to have unique semantics, e.g,

"TEXCOORD.0" "TEXCOORD.1", "TEXCOORD.2"

We can define the semantic string format as "SemanticName[.OptionalUniqueIndex]."

and

We can look at it like this: there is pain either because

  1. We have to manage two properties: semantic and set
  2. We have to parse semantic

For rendering uses cases, (2) is less frequent than (1) so I prefer (2). My renderer doesn't need (2). Also, (2) requires less overall code. (1) is just a one-liner if needed.

pjcozzi avatar Mar 14 '13 19:03 pjcozzi

I asked for advice from web developers. using "." character in JSON is not good practice, same for "-" , only "_" seems safe. It is technically possible to handle "." but it might appear not right for a JSON SPEC.

fabrobinet avatar Mar 15 '13 00:03 fabrobinet

what about "/" or "," , not good?

"_" is ok by me. Are we already using that anywhere in our reserved identifiers?

Tony

On Thu, Mar 14, 2013 at 5:59 PM, Fabrice Robinet [email protected]:

I asked for advice from web developers. using "." character in JSON is not good practice, same for "-" , only "_" seems safe. It is technically possible to handle "." but it might appear not right for a JSON SPEC.

— Reply to this email directly or view it on GitHubhttps://github.com/KhronosGroup/glTF/issues/1#issuecomment-14938621 .

Tony Parisi [email protected] CTO at Large 415.902.8002 Skype auradeluxe Follow me on Twitter! http://twitter.com/auradeluxe Read my blog at http://www.tonyparisi.com/

Read my book! WebGL, Up and Running http://shop.oreilly.com/product/0636920024729.do http://www.amazon.com/dp/144932357X

tparisi avatar Mar 15 '13 02:03 tparisi

I'm OK with "_", but why is "." a bad idea? It is inside a string literal; we should be able to do whatever we want.

pjcozzi avatar Mar 15 '13 12:03 pjcozzi

Yes, but is usually not recommended because they need to access a property like this obj['prop'] and can't do obj.prop in that case, which is what people tend to like more.

To be honest I would really prefer "." I just don't want to upset JS purists here :).

fabrobinet avatar Mar 15 '13 16:03 fabrobinet

Gotcha. This is a non-issue for "semantic" : "name.index"; however, I see that it is an issue for "name.index" : { whatever }.

I'm OK with "_".

pjcozzi avatar Mar 15 '13 17:03 pjcozzi

That is pushed. Closing.

fabrobinet avatar Mar 15 '13 23:03 fabrobinet