Jump to content

Why did the Texture Objects Variables change?


Recommended Posts

It looks like with the never version release, texture objects variables have changed.  What was the reasoning for this?  Is there a quick fix I could do, like
BABYLON.Texture._width = BABYLON.Texture.width? or something like that on my older files just to make a quick fix or do I need to track down all the script where I call the old variable names and update it?

Link to comment
Share on other sites

Hi @Pryme8

Not sure what's changed but you can probably do something like this; 

Object.defineProperty(BABYLON.Texture.prototype, 'oldName', {
	get: function() { 
		return this.newName;
	set : function(value) {
		this.newName = value;
	enumerable: true,
	configurable: true

that is what i do in my player controller anyways, so changes applied to player.position is applied to player._model.position

Link to comment
Share on other sites

"var example = new BABYLON.DynamicTexture('texture0', {width:1, height:1}, scene, false, 1);"

example._texture._width is now example._texture.width

same for height and for some other vars I would assume.

I am working off the assumption that the _texture object in the dynamictexture is a BABYLON.Texture object but I may be mistaken.

Link to comment
Share on other sites

Ok this is what changed:

        public createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): InternalTexture {
            var texture = new InternalTexture(this, InternalTexture.DATASOURCE_DYNAMIC)
            texture.baseWidth = width;
            texture.baseHeight = height;

            if (generateMipMaps) {
                width = this.needPOTTextures ? Tools.GetExponentOfTwo(width, this._caps.maxTextureSize) : width;
                height = this.needPOTTextures ? Tools.GetExponentOfTwo(height, this._caps.maxTextureSize) : height;

            texture.width = width;
            texture.height = height;
            texture.isReady = false;
            texture.generateMipMaps = generateMipMaps;
            texture.samplingMode = samplingMode;

            this.updateTextureSamplingMode(samplingMode, texture);


            return texture;

Not a big deal, but figured Id point it out.

I thought it was a texture object, but it looks like its just its own thing.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...