| 1 |
#X3D V3.2 utf8 |
| 2 |
PROFILE Interchange |
| 3 |
|
| 4 |
# ---------------------------------------------------------------------------- |
| 5 |
# Testcase based on https://github.com/castle-engine/castle-model-viewer/issues/40 . |
| 6 |
# |
| 7 |
# - IndexedFaceSet |
| 8 |
# |
| 9 |
# - With non-trivial creaseAngle (vectors cannot be assumed perfectly flat or perfectly smooth) |
| 10 |
# |
| 11 |
# - Renderer should calculate as many normals as coordIndex (so 5 in this example, |
| 12 |
# the last one is actually useless -- normals for index -1 are generally useless, |
| 13 |
# but make it easier to address). |
| 14 |
# |
| 15 |
# This means *not* as many normals as Coordinate node |
| 16 |
# (it would be pointless, and also would not account for geometries where the same vertex |
| 17 |
# from Coordinate is addressed many times in coordIndex, and should have different |
| 18 |
# normal on each face). |
| 19 |
# |
| 20 |
# In CGE code terms, it means "niPerVertexNonIndexed", where "N := Normals.L[IndexNum]". |
| 21 |
# |
| 22 |
# - For renderer, this is a bit special case. |
| 23 |
# The IndexNum (used normally to access coordIndex) should be used to access Normals array. |
| 24 |
# This does not correspond to any "normal" X3D state, |
| 25 |
# when you provide "Normal" node explicitly in "normal" field, and |
| 26 |
# |
| 27 |
# - leave normalIndex empty. |
| 28 |
# |
| 29 |
# Then "niPerVertexCoordIndexed", "N := Normals.L[CoordIndex.Items.L[IndexNum]]". |
| 30 |
# |
| 31 |
# - set normalIndex. |
| 32 |
# |
| 33 |
# Then "niPerVertexNormalIndexed", "N := Normals.L[NormalIndex.ItemsSafe[IndexNum]]". |
| 34 |
# ---------------------------------------------------------------------------- |
| 35 |
|
| 36 |
# Generated by castle-model-viewer. |
| 37 |
# Use castle-model-viewer "Clipboard -> Print Current Camera..." to generate X3D code like below. |
| 38 |
# Camera settings "encoded" in the X3D declaration below : |
| 39 |
# position 4.21 -2.39 -1.26 |
| 40 |
# direction -0.84 0.48 0.25 |
| 41 |
# up -0.05 -0.53 0.85 |
| 42 |
# gravityUp 0.00 1.00 0.00 |
| 43 |
Viewpoint { |
| 44 |
position 4.2071061134338379 -2.3897814750671387 -1.2603694200515747 |
| 45 |
orientation 0.84581035375595093 0.23715686798095703 0.47787156701087952 2.2429020404815674 |
| 46 |
} |
| 47 |
|
| 48 |
Shape { |
| 49 |
appearance Appearance { |
| 50 |
material Material { |
| 51 |
} |
| 52 |
} |
| 53 |
geometry IndexedFaceSet { |
| 54 |
coord Coordinate { |
| 55 |
point [ |
| 56 |
-1 -1 -1, |
| 57 |
1 -1 -1, |
| 58 |
-1 1 -1, |
| 59 |
1 1 -1, |
| 60 |
-1 -1 1, |
| 61 |
1 -1 1, |
| 62 |
-1 1 1, |
| 63 |
1 1 1, |
| 64 |
] |
| 65 |
} |
| 66 |
coordIndex [ |
| 67 |
3, 7, 5, 1, -1, |
| 68 |
] |
| 69 |
creaseAngle 0.5 |
| 70 |
} |
| 71 |
} |