Bjr à vous,


Je bloque sur une erreur incompréhensible pour moi:

: Unexpected end of input (at Test001.htm:151:5)

Enervant +++

Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE html>
<!-- Generated 2023-07-28 13:57:24.105 by GHTopoFPC version 3.14159265359  -  Version internationale hors Chine : Utilitaires Bureau 610 désactivés -->
<!-- BoundingBox = (Coin bas gauche: : 403429.920, 3089500.143, 492.017 , Coin haut droit: : 403584.916, 3089670.312, 583.748) -->
<HTML>
  <HEAD>
    <TITLE>Vue 3D</TITLE>
    <META charset="utf-8" />
<!-- External Babylon JS Scripts -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js"></script>
    <script src="https://assets.babylonjs.com/generated/Assets.js"></script>
    <script src="https://cdn.babylonjs.com/recast.js"></script>
    <script src="https://cdn.babylonjs.com/ammo.js"></script>
    <script src="https://cdn.babylonjs.com/havok/HavokPhysics_umd.js"></script>
    <script src="https://cdn.babylonjs.com/cannon.js"></script>
    <script src="https://cdn.babylonjs.com/Oimo.js"></script>
    <script src="https://cdn.babylonjs.com/earcut.min.js"></script>
    <script src="https://cdn.babylonjs.com/babylon.js"></script>
    <script src="https://cdn.babylonjs.com/materialsLibrary/babylonjs.materials.min.js"></script>
    <script src="https://cdn.babylonjs.com/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js"></script>
    <script src="https://cdn.babylonjs.com/postProcessesLibrary/babylonjs.postProcess.min.js"></script>
    <script src="https://cdn.babylonjs.com/loaders/babylonjs.loaders.js"></script>
    <script src="https://cdn.babylonjs.com/serializers/babylonjs.serializers.min.js"></script>
    <script src="https://cdn.babylonjs.com/gui/babylon.gui.min.js"></script>
    <script src="https://cdn.babylonjs.com/inspector/babylon.inspector.bundle.js"></script>
<!-- End -->
    <STYLE>
         html, body{
           overflow: hidden; /* Fuck the Christ */
           width: 100%; 
           height: 100%; 
           margin: 0; 
           padding: 0; 
         }
         #renderCanvas{
           width: 100%; 
           height: 100%; 
           touch-action: none; /* thurlutte */
         }
    </STYLE>
  </HEAD>
  <BODY>
<canvas id="renderCanvas"></canvas>
    <SCRIPT type="text/javascript">
// Variables globales
console.log("DEBUG: MAIN:: Initialisation variables globales");
var MyCanvas = document.getElementById("renderCanvas");
var MyEngine = new BABYLON.Engine(MyCanvas, true, {preserveDrawingBuffer: true, stencil: true});
// ==================================
console.log("DEBUG: MAIN:: 000");
 
/* --------------------------------- */
/* TCenterlines */
/* Polygonales */
function TCenterlines(QR, QG, QB, QA) {
  this.Color = new BABYLON.Color4(QR, QG, QB); // QA
} // End class: TCenterlines
/* ----------------- */
 
/* --------------------------------- */
/* TSceneContainer */
/* Conteneur de scène */
function TSceneContainer(QX1, QY1, QZ1, QX2, QY2, QZ2) {
console.log("DEBUG: TSceneContainer: 001");
  this.CoinBasGauche = new BABYLON.Vector3(QX1, QY1, QZ1); // Coin bas gauche
  this.CoinHautDroit = new BABYLON.Vector3(QX2, QY2, QZ2); // Coin haut droit
  this.Centerlines = new TCenterlines(0, 0, 255, 255); /* Conteneur de la centerline */
  this.DimensionsBox = new BABYLON.Vector3(this.CoinHautDroit.x - this.CoinBasGauche.x, this.CoinHautDroit.y - this.CoinBasGauche.y, this.CoinHautDroit.z - this.CoinBasGauche.z); // Dimensions de la boite englobante
  this.Offset = new BABYLON.Vector3(0.50 * this.DimensionsBox.x, 0.50 * this.DimensionsBox.y, 0.50 * this.DimensionsBox.z); // Offset
  
  /* Fonction retournant un BABYLON.Vector3 */
  this.CalcCoordsFromXYZ = function (QX1, QY1, QZ1) {
      return new BABYLON.Vector3(QX1 - this.CoinBasGauche.x - this.Offset.x,
                    QY1 - this.CoinBasGauche.y - this.Offset.y,
                    QZ1 - this.CoinBasGauche.z - this.Offset.z);
  } // End method: CalcCoordsFromXYZ
 
  
  /* Lignes verticales du cube */
  this.DrawVerticalLinesBoundingBox = function (QScene, QX1, QY1, QColor) {
      var QArrayPoints = [ /*  */
                this.CalcCoordsFromXYZ(QX1, QY1, this.CoinBasGauche.z),
                this.CalcCoordsFromXYZ(QX1, QY1, this.CoinHautDroit.z)
               ]; //QArrayPoints */
                var QPath = new BABYLON.MeshBuilder.CreateLines("BoundingBox", {points: QArrayPoints}, QScene);
                QPath.color = QColor;
                return QPath;
  } // End method: DrawVerticalLinesBoundingBox
 
  
  /* Retourne la longueur de la diagonale du cube */
  this.GetDiagonal = function () {
     return Math.hypot(this.CoinHautDroit.x - this.CoinBasGauche.x,
                       this.CoinHautDroit.y - this.CoinBasGauche.y,
                       this.CoinHautDroit.z - this.CoinBasGauche.z);
  } // End method: GetDiagonal
 
  
  /* Trace la bounding box */
  this.DrawCube = function (QScene, QR, QG, QB, QA) {
      var QArrayPoints = [ /*  */
                this.CalcCoordsFromXYZ(this.CoinBasGauche.x, this.CoinBasGauche.y, this.CoinBasGauche.z),
                this.CalcCoordsFromXYZ(this.CoinHautDroit.x, this.CoinBasGauche.y, this.CoinBasGauche.z),
                this.CalcCoordsFromXYZ(this.CoinHautDroit.x, this.CoinHautDroit.y, this.CoinBasGauche.z),
                this.CalcCoordsFromXYZ(this.CoinBasGauche.x, this.CoinHautDroit.y, this.CoinBasGauche.z),
                this.CalcCoordsFromXYZ(this.CoinBasGauche.x, this.CoinBasGauche.y, this.CoinBasGauche.z),
                this.CalcCoordsFromXYZ(this.CoinBasGauche.x, this.CoinBasGauche.y, this.CoinHautDroit.z),
                this.CalcCoordsFromXYZ(this.CoinHautDroit.x, this.CoinBasGauche.y, this.CoinHautDroit.z),
                this.CalcCoordsFromXYZ(this.CoinHautDroit.x, this.CoinHautDroit.y, this.CoinHautDroit.z),
                this.CalcCoordsFromXYZ(this.CoinBasGauche.x, this.CoinHautDroit.y, this.CoinHautDroit.z),
                this.CalcCoordsFromXYZ(this.CoinBasGauche.x, this.CoinBasGauche.y, this.CoinHautDroit.z),
                this.CalcCoordsFromXYZ(this.CoinBasGauche.x, this.CoinBasGauche.y, this.CoinHautDroit.z)
               ]; //QArrayPoints */
                var QPath = new BABYLON.MeshBuilder.CreateLines("Cube", {points: QArrayPoints}, QScene);
                QPath.color = new BABYLON.Color4(QR, QG, QB, QA);
// Les lignes verticales
                var L1 = this.DrawVerticalLinesBoundingBox(QScene, this.CoinHautDroit.x, this.CoinBasGauche.y, QPath.color);
                var L2 = this.DrawVerticalLinesBoundingBox(QScene, this.CoinHautDroit.x, this.CoinHautDroit.y, QPath.color);
                var L3 = this.DrawVerticalLinesBoundingBox(QScene, this.CoinBasGauche.x, this.CoinHautDroit.y, QPath.color);
  
  
 
} // End class: TSceneContainer
/* ----------------- */
 
/* Construction de la scène */
function createScene() {
  var SceneContainer = new TSceneContainer(403429.920, 3089500.143, 492.017,  403584.916, 3089670.312, 583.748);
console.log("DEBUG:   createScene: 001");
  var QScene = new BABYLON.Scene(MyEngine); /*  <--- WTF: Erreur ici  */
console.log("DEBUG: createScene: 002");
  var QCameraDir = new BABYLON.Vector3(0.000, 0.000, 0.000); // Direction de la caméra
console.log("DEBUG: createScene: 003");
  var QCamera = new BABYLON.ArcRotateCamera("Camera01", 0.000, 0.000, 0.000, QCameraDir, QScene);
  QCamera.setPosition(new BABYLON.Vector3(0.000, 0.000, -SceneContainer.GetDiagonal()));
  console.log("Diagonale = " +  SceneContainer.GetDiagonal());
  QCamera.attachControl(MyCanvas, true); // This attaches the camera to the canvas
  // Les objets ici
  SceneContainer.DrawCube(QScene, 0, 0, 255, 128);
  return QScene;
} // End function: createScene
/* --------------------------------- */
console.log("DEBUG: MAIN: 001");
var MyScene = createScene();
console.log("DEBUG: MAIN: 002");
MyEngine.runRenderLoop(function () {
  if (MyScene) // 
  {
    MyScene.render();
    } // 
}); /* L'accolade ferme la fonction anonyme, la parenthèse ferme l'appel runRenderLoop */
    </SCRIPT>
  <noscript>JavaScript is required</noscript>
  </BODY>
</HTML>