teleportxr 1.0.38 → 1.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/client.js +3 -3
- package/package.json +1 -1
- package/scene/node.js +1 -1
- package/scene/resources.js +14 -11
- package/scene/scene.js +3 -3
package/client/client.js
CHANGED
|
@@ -131,15 +131,15 @@ class Client {
|
|
|
131
131
|
if(this.scene.backgroundTexturePath&&this.scene.backgroundTexturePath!="")
|
|
132
132
|
{
|
|
133
133
|
this.setupCommand.BackgroundMode_backgroundMode=BackgroundMode.TEXTURE;
|
|
134
|
-
this.setupCommand.uid_backgroundTexture=resources.
|
|
134
|
+
this.setupCommand.uid_backgroundTexture=resources.GetOrAddTexture(this.scene.backgroundTexturePath);
|
|
135
135
|
}
|
|
136
136
|
if(this.scene.diffuseCubemapPath&&this.scene.diffuseCubemapPath!="")
|
|
137
137
|
{
|
|
138
|
-
this.clientDynamicLighting.uid_diffuse_cubemap_texture_uid=resources.
|
|
138
|
+
this.clientDynamicLighting.uid_diffuse_cubemap_texture_uid=resources.GetOrAddTexture(this.scene.diffuseCubemapPath);
|
|
139
139
|
}
|
|
140
140
|
if(this.scene.specularCubemapPath&&this.scene.specularCubemapPath!="")
|
|
141
141
|
{
|
|
142
|
-
this.clientDynamicLighting.uid_specular_cubemap_texture_uid=resources.
|
|
142
|
+
this.clientDynamicLighting.uid_specular_cubemap_texture_uid=resources.GetOrAddTexture(this.scene.specularCubemapPath);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
|
package/package.json
CHANGED
package/scene/node.js
CHANGED
|
@@ -247,7 +247,7 @@ class Node {
|
|
|
247
247
|
return Node.sizeof();
|
|
248
248
|
}
|
|
249
249
|
setMeshComponent(mesh_url) {
|
|
250
|
-
resources.
|
|
250
|
+
resources.GetOrAddMesh(mesh_url);
|
|
251
251
|
this.components.forEach((component) => {
|
|
252
252
|
if (component.getType() == NodeDataType.Mesh) {
|
|
253
253
|
component.meshUrl = mesh_url;
|
package/scene/resources.js
CHANGED
|
@@ -150,7 +150,10 @@ function AddTypedResource(typename, path) {
|
|
|
150
150
|
return uid;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
function
|
|
153
|
+
function GetOrAddResourceFromUrl(type, url) {
|
|
154
|
+
if (Resource.pathToUid.has(url)) {
|
|
155
|
+
return Resource.pathToUid.get(url);
|
|
156
|
+
}
|
|
154
157
|
var uid = core.generateUid();
|
|
155
158
|
var res = null;
|
|
156
159
|
switch (type) {
|
|
@@ -159,7 +162,7 @@ function AddResourceFromUrl(type, url) {
|
|
|
159
162
|
throw new Error(
|
|
160
163
|
"Type ",
|
|
161
164
|
type,
|
|
162
|
-
" can't be instantiated with
|
|
165
|
+
" can't be instantiated with GetOrAddResourceFromUrl()."
|
|
163
166
|
);
|
|
164
167
|
break;
|
|
165
168
|
default:
|
|
@@ -186,7 +189,7 @@ function GetOrAddResourceUidFromUrl(type, url){
|
|
|
186
189
|
return uid;
|
|
187
190
|
if(!url)
|
|
188
191
|
return 0;
|
|
189
|
-
return
|
|
192
|
+
return GetOrAddResourceFromUrl(type, url);
|
|
190
193
|
}
|
|
191
194
|
|
|
192
195
|
function GetResourceFromUrl(url) {
|
|
@@ -202,14 +205,14 @@ function GetResourceFromUid(uid) {
|
|
|
202
205
|
return res;
|
|
203
206
|
}
|
|
204
207
|
|
|
205
|
-
//!
|
|
206
|
-
function
|
|
207
|
-
return
|
|
208
|
+
//! Get or add the texture url as a resource.
|
|
209
|
+
function GetOrAddTexture(url) {
|
|
210
|
+
return GetOrAddResourceFromUrl(core.GeometryPayloadType.TexturePointer, url);
|
|
208
211
|
}
|
|
209
212
|
|
|
210
|
-
//!
|
|
211
|
-
function
|
|
212
|
-
return
|
|
213
|
+
//! Get or add the mesh url as a resource.
|
|
214
|
+
function GetOrAddMesh(url) {
|
|
215
|
+
return GetOrAddResourceFromUrl(core.GeometryPayloadType.MeshPointer, url);
|
|
213
216
|
}
|
|
214
217
|
|
|
215
218
|
function AddFontAtlas(path) {
|
|
@@ -233,8 +236,8 @@ module.exports = {
|
|
|
233
236
|
GetResourceUidFromUrl,
|
|
234
237
|
GetOrAddResourceUidFromUrl,
|
|
235
238
|
GetResourceFromUid,
|
|
236
|
-
|
|
237
|
-
|
|
239
|
+
GetOrAddTexture,
|
|
240
|
+
GetOrAddMesh,
|
|
238
241
|
AddFontAtlas,
|
|
239
242
|
AddTextCanvas,
|
|
240
243
|
AddTypedResource,
|
package/scene/scene.js
CHANGED
|
@@ -176,17 +176,17 @@ class Scene {
|
|
|
176
176
|
if(j.environment.background_texture)
|
|
177
177
|
{
|
|
178
178
|
this.backgroundTexturePath=j.environment.background_texture;
|
|
179
|
-
resources.
|
|
179
|
+
resources.GetOrAddTexture(this.backgroundTexturePath);
|
|
180
180
|
}
|
|
181
181
|
if(j.environment.diffuse_cubemap)
|
|
182
182
|
{
|
|
183
183
|
this.diffuseCubemapPath=j.environment.diffuse_cubemap;
|
|
184
|
-
resources.
|
|
184
|
+
resources.GetOrAddTexture(this.diffuseCubemapPath);
|
|
185
185
|
}
|
|
186
186
|
if(j.environment.specular_cubemap)
|
|
187
187
|
{
|
|
188
188
|
this.specularCubemapPath=j.environment.specular_cubemap;
|
|
189
|
-
resources.
|
|
189
|
+
resources.GetOrAddTexture(this.specularCubemapPath);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
if(j.font_atlases)
|