feat: Implement Translations #19
@ -15,7 +15,7 @@ VRML 1.0. Overall, it recognizes and converts
|
|||||||
* All Light nodes
|
* All Light nodes
|
||||||
* Grouping nodes including Transform, Separator, Group, Switch, and WWWAnchor
|
* Grouping nodes including Transform, Separator, Group, Switch, and WWWAnchor
|
||||||
* ShapeHints
|
* ShapeHints
|
||||||
* Rotations
|
* Rotations and Translations
|
||||||
* All shape nodes including Cube, Cone, Cylinder, Sphere, IndexedFaceSet,
|
* All shape nodes including Cube, Cone, Cylinder, Sphere, IndexedFaceSet,
|
||||||
IndexedLineSet, PointSet, Coordinate3, and Normal
|
IndexedLineSet, PointSet, Coordinate3, and Normal
|
||||||
* All material nodes including Material, TextureCoordinate2, and Texture2
|
* All material nodes including Material, TextureCoordinate2, and Texture2
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
name: 'vrml1to97',
|
name: 'vrml1to97',
|
||||||
version: '0.3.0',
|
version: '0.3.1',
|
||||||
description: 'JavaScript converter from VRML 1 to VRML97',
|
description: 'JavaScript converter from VRML 1 to VRML97',
|
||||||
scripts: {
|
scripts: {
|
||||||
test: 'echo "Error: no test specified" && exit 1',
|
test: 'echo "Error: no test specified" && exit 1',
|
||||||
|
@ -205,13 +205,16 @@ function parse(stream: Lexer, tree: DefTree = {}): DefTree
|
|||||||
matches GroupNode
|
matches GroupNode
|
||||||
parent :=
|
parent :=
|
||||||
held.value.endsWith('Separator') ? 'Transform' : 'Group'
|
held.value.endsWith('Separator') ? 'Transform' : 'Group'
|
||||||
{children, ...context} := tree
|
{children, Translation, Rotation, ...context} := tree
|
||||||
subTree := parse stream, context
|
subTree := parse stream, context
|
||||||
if newKids := subTree.children
|
if newKids := subTree.children
|
||||||
newChild .= `${parent} {\n `
|
newChild .= `${parent} {\n `
|
||||||
if 'Rotation' in subTree
|
if 'Rotation' in subTree
|
||||||
newChild += renderList subTree.Rotation
|
newChild += renderList subTree.Rotation
|
||||||
newChild += "\n "
|
newChild += "\n "
|
||||||
|
if 'Translation' in subTree
|
||||||
|
newChild += renderList subTree.Translation
|
||||||
|
newChild += "\n "
|
||||||
newChild += `children [\n ${renderList newKids} ] }\n`
|
newChild += `children [\n ${renderList newKids} ] }\n`
|
||||||
addChild newChild, tree
|
addChild newChild, tree
|
||||||
'ShapeHints'
|
'ShapeHints'
|
||||||
@ -227,6 +230,8 @@ function parse(stream: Lexer, tree: DefTree = {}): DefTree
|
|||||||
tree._definitions[lastDefinition] = [hints]
|
tree._definitions[lastDefinition] = [hints]
|
||||||
'Rotation'
|
'Rotation'
|
||||||
tree.Rotation = toksUntilClose stream
|
tree.Rotation = toksUntilClose stream
|
||||||
|
'Translation'
|
||||||
|
tree.Translation = toksUntilClose stream
|
||||||
'Coordinate3'
|
'Coordinate3'
|
||||||
tree.Coordinate = toksUntilClose stream
|
tree.Coordinate = toksUntilClose stream
|
||||||
'Normal'
|
'Normal'
|
||||||
|
Loading…
Reference in New Issue
Block a user