Converting code from objLoader2 to GLTFloader - three.js

I'm having project which have built into threejs and laravel.
project is just working fine with objLoader2 but large object files causing load timeout issues that's why client requirement is to convert code from objLoader2 to GLTFLoader
I just added reference of GLTFLoader to my project but it is causing parser errors for each loading object and output is blank.
Added GLTFLoader reference like below in laravel:
<script src="{{asset('js/GLTFLoader.js')}}"></script>
Changed code objLoadercode2 like below:
// instantiate a loader
for (var i = 0; i < options.pathLower.length; i++) {
loadersLow[i] = new THREE.GLTFLoader();
}
for (var i = 0; i < options.pathUp.length; i++) {
loadersUp[i] = new THREE.GLTFLoader();
}
it's showing below errors after changing from new THREE.OBJLoader2() to new THREE.GLTFLoader()
can anyone please guide me what I'm missing or is there any versioning conflicts?
any type of help would be appreciated, thanks!

Related

itext XFA: InvalidCastException

Using itext7 and when trying to load XFA form I'm getting:
System.InvalidCastException: 'Unable to cast object of type
'System.Xml.Linq.XText' to type 'System.Xml.Linq.XElement'.'
Source code:
var pdfReader = new PdfReader(package.PdfTemplate);
pdfReader.SetUnethicalReading(true);
using (var document = new PdfDocument(pdfReader, new PdfWriter(writeMS)))
{
var acroForm = PdfAcroForm.GetAcroForm(document, true);
var xfa = acroForm.GetXfaForm();
var dataXml = _dataGenerator.GenerateXfaFormData(package);
xfa.FillXfaForm(dataXml);
xfa.Write(document);
}
The exception is thrown on line
var acroForm = PdfAcroForm.GetAcroForm(document, true);
Sample PDF can be seen here: https://programmcze-my.sharepoint.com/personal/nechanicky_programmcze_onmicrosoft_com/_layouts/15/guestaccess.aspx?docid=0c18710068a124a58a32e77ad53c4cbb9&authkey=AQvVBZLXNirrISLjvT083XY
There indeed was a problem with constructing XfaForm which does not contain <xfa:datasets> entry.
The problem is fixed in iText 7.0.5-SNAPSHOT version. The repository with the sources and the fix can be found here.

Loading a picture using AS3 issues

I am trying to upload a picture when a user clicks on a button using AS3. I have a button and a progress bar on the stage. This is the relevant code:
var myLoader:Loader = new Loader();
myPB.source = myLoader.contentLoaderInfo;
btn_one.addEventListener(MouseEvent.CLICK, btnImage);
function btnImage(event:MouseEvent):void{
myLoader.load(new URLRequest("MyPic.jpeg"));
addCild(myPB);
removeChild(myPB);
btn_one = null;
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishImage);
function finishImage(event:Event):void{
addChild(myLoader);
removeChild(myLoader);
btn_one = null;
When I execute the code this error appears Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found
Any ideas were I am going wrong?
var myLoader:Loader = new Loader();
//myPB.source = myLoader.contentLoaderInfo;
btn_one.addEventListener(MouseEvent.CLICK, btnImage);
function btnImage(event:MouseEvent):void{
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishImage);
myLoader.load(new URLRequest("MyPic.jpeg"));
//addCild(myPB);
//removeChild(myPB);
btn_one = null;
}
function finishImage(event:Event):void{
addChild(myLoader);
//removeChild(myLoader);
btn_one = null;
}
This should work. I don't know what you try to accomplish with adding a Child and removing the same child directly afterwards.
Hope this helps

Cannot apply matrix to loaded model using three.js

I would like to load a model using three.js and then apply a transformation matrix on top of it. This is the code I am using:
var loader = new THREE.OBJMTLLoader();
loader.addEventListener('load', function (event)
{
var object = event.content;
object.matrixAutoUpdate = false;
object.applyMatrix(object_accumulated_matrix);
scene.add(object);
},
{
useWorker: true
});
// should check if ".mtl" file exists but there is no access to the filesystem
loader.load(dir_file_name + ".obj", dir_file_name + ".mtl");
and these are the contents of the object_accumulated_matrix variable:
({elements:{0:1, 1:0, 2:0, 3:0, 4:0, 5:1, 6:0, 7:322, 8:0, 9:0, 10:1, 11:0, 12:0, 13:0, 14:0, 15:1}})
There is a 322 translation value on the Y-axis but I can not seem to get it to work. I have also tried:
object.matrix.copy(object_accumulated_matrix);
but that did not work either.
I would appreciate any help.
Thank you.
Your object_accumulated_matrix is transposed.
You can also try
object.geometry.applyMatrix( object_accumulated_matrix );
which will modify the geometry itself.

How to dynamically load images in a layer using actionscript

I used the below code to load images that are present in my library:
Create_Image_With_Description();
function Create_Image_With_Description():Void {
this.createEmptyMovieClip("imageHolder", 600);
// Put Here Images URoL
imageHolder.loadMovie("Symbol 1");
// Position
imageHolder._x = 0;
imageHolder._y = 0;
// Size
imageHolder._xscale = 210;
imageHolder._yscale = 215;
// Example: my_mc.createTextField(instanceName:String, depth:Number, x:Number,
y:Number,width:Number, height:Number) : Void
this.createTextField("description1Field",1,10,203,120,20);
// Put Here Images description
description1Field.text = "Resident Evil: Afterlife";
}
Here symbol 1 is the image that i've converted into a symbol. When i tried running this i got an error saying "Error opening URL 'file:///E|/Symbol 1'".
I've also tried giving imageHolder.loadMovie("img1.jpg"); But still it didn't worked. Can anyone help me with this
Try replacing these lines:
this.createEmptyMovieClip("imageHolder", 1000);
// Put Here Images URL
this.attachMovie("img1", "img1", {_x:100, _y:100});

ReferenceError: "BarSeriesImpl" is not defined

My report works fine in BIRT- it shows some Bar chart graphic.
But when I import in some system (IBM maximo) I am getting this error instead of displaying the bar chart:
ReferenceError: "BarSeriesImpl" is not defined. at line 8 of chart script:''
I used this script to show me some values on Bar chart.
importPackage( Packages.java.util );
importPackage( Packages.org.eclipse.birt.chart.model.type.impl );
function afterDataSetFilled(series, dataSet, icsc)
{
if( series.getClass() == BarSeriesImpl ){
var inv =
parseInt(icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("IN"));
var outv =
parseInt(icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("OUT"));
var canv =
parseInt(icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("CANCELED"));
var narray1 = new ArrayList( );
narray1.add(inv);
narray1.add(outv);
narray1.add(canv);
dataSet.setValues(narray1);
}else{
var catArray = new ArrayList();
catArray.add("IN");
catArray.add("OUT");
catArray.add("CANCELED");
dataSet.setValues(catArray);
}
}
How to solve this? Does I have to import somehow this class in my system or ..?
Thank you
I know I'm resurrecting an old question but this just caught my eye because it was similar to another post I answered this week. I think you might be missing org.eclipse.birt.chart.model.type.impl.BarSeriesImp in the systems that you are getting this error message. I think if you add the BIRT runtime jars to the lib path then it should resolve that error.

Resources