aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.58k stars 3.94k forks source link

consider renaming geometry.primitive to geometry.type #1457

Closed ngokevin closed 8 years ago

ngokevin commented 8 years ago

Description:

With the registerGeometry API, a variety of geometries can be registered that won't have to be geometric primitives (e.g., text, extrude, svg)

Smaller reasons would consistency with three.js API as Geometry objects have a type and simpler wording.

donmccurdy commented 8 years ago

This sounds more consistent to me, but isn't type reserved?

msimpson commented 8 years ago

@donmccurdy Doesn't seem to be according to MDN.

donmccurdy commented 8 years ago

@msimpson haha oh, right – well not reserved by the language, by otherwise employed by the schema definition: https://aframe.io/docs/core/component.html#Schema

would be a breaking change, but i suppose the schema could use __type instead, leaving type available for use as a property.

msimpson commented 8 years ago

@donmccurdy Oh ... missed that.

ngokevin commented 8 years ago

Or alternatively if we detect an attribute that is not type/default/parse/stringify, then we switch it to multi-property.

ngokevin commented 8 years ago

Actually, type is not reserved. If type's value is a string, then it will be single-prop. If it is an object type: { type: 'string' } then it is multi-prop.

dmarcos commented 8 years ago

I think type is ambiguous and carries a different meaning in a programming context. Primitive is commonly used in many 3D packages: 3D Studio, Maya, Blender

ngokevin commented 8 years ago

In 3D programs, the word primitives is used to create geometric primitives, yes. But three.js geometries don't have to be geometric primitives.

type is what three.js refers to their geometry types. No one is going to confuse geometry component type with programming types. Better the possibility of being ambiguous than being incorrect anyways.

dmarcos commented 8 years ago

type is not descriptive enough in this context. let's move on

ngokevin commented 8 years ago

I made points and counterpoints. If you want to close it, it would be copacetic to address them rather than brushing them off.

dmarcos commented 8 years ago

I think renaming does not bring any benefit. it's changing for the shake of changing and type is a very ambigous word and used in other contexts. primitive is a common concept used in computer graphics https://en.m.wikipedia.org/wiki/Geometric_primitive

ngokevin commented 8 years ago

OK. The main exception I was thinking of was text, SVG, and extrude, but if they're the minority, and we're okay with the slight awkwardness of <a-entity geometry="primitive: text"> or <a-entity geometry="primitive: svg; src: mysvg.svg>, this isn't too big of a deal.

dmarcos commented 8 years ago

text should probably be a separate component.

dmarcos commented 8 years ago

and svg as well

ngokevin commented 8 years ago

You could, but then you don't get free geometry merging, caching, buffering, and automatic memory management provided by the geometry component.