- Mesh upload support

- LLMesh asset decoding and encoding (inc. LLPhysicsConvex, LLSkin, LLSubMesh)
- Query inventory folder by type
- onSelectedObject event
- fetchInventoryItem command
- Fix packing/unpacking of object shape
- Time sync with SimulatorViewerTimeMessage
- Changed several classes to a .from style rather than setting up in the constructor (exception friendly)
- Whole bunch of other improvements
- Object building
This commit is contained in:
Casper Warden
2018-11-15 03:10:14 +00:00
parent 0b4960eb4f
commit 76b080757b
37 changed files with 2864 additions and 415 deletions

View File

@@ -13,31 +13,28 @@ export class TextureEntryFace
static MEDIA_MASK = 0x01;
static TEX_MAP_MASK = 0x06;
textureID: UUID;
rgba: Color4;
repeatU: number;
repeatV: number;
offsetU: number;
offsetV: number;
rotation: number;
glow: number;
materialID: UUID;
bumpiness: Bumpiness = Bumpiness.None;
shininess: Shininess = Shininess.None;
mappingType: MappingType = MappingType.Default;
fullBright = false;
mediaFlags = false;
private _textureID: UUID;
private _rgba: Color4;
private _repeatU: number;
private _repeatV: number;
private _offsetU: number;
private _offsetV: number;
private _rotation: number;
private _glow: number;
private _materialID: UUID;
private _bumpiness: Bumpiness = Bumpiness.None;
private _shininess: Shininess = Shininess.None;
private _mappingType: MappingType = MappingType.Default;
private _fullBright = false;
private _mediaFlags = false;
private materialb: number;
private mediab: number;
private _material: number;
private _media: number;
private hasAttribute: TextureFlags;
private defaultTexture: TextureEntryFace | null;
constructor(def: TextureEntryFace | null)
{
this.rgba = Color4.white;
this.repeatU = 1.0;
this.repeatV = 1.0;
this.defaultTexture = def;
if (this.defaultTexture == null)
{
@@ -49,49 +46,213 @@ export class TextureEntryFace
}
}
get rgba(): Color4
{
if (this._rgba === undefined && this.defaultTexture !== null)
{
return this.defaultTexture.rgba;
}
return this._rgba;
}
set rgba(value: Color4)
{
this._rgba = value;
}
get repeatU(): number
{
if (this._repeatU === undefined && this.defaultTexture !== null)
{
return this.defaultTexture.repeatU;
}
return this._repeatU;
}
set repeatU(value: number)
{
this._repeatU = value;
}
get repeatV(): number
{
if (this._repeatV === undefined && this.defaultTexture !== null)
{
return this.defaultTexture.repeatV;
}
return this._repeatV;
}
set repeatV(value: number)
{
this._repeatV = value;
}
get offsetU(): number
{
if (this._offsetU === undefined && this.defaultTexture !== null)
{
return this.defaultTexture.offsetU;
}
return this._offsetU;
}
set offsetU(value: number)
{
this._offsetU = value;
}
get offsetV(): number
{
if (this._offsetV === undefined && this.defaultTexture !== null)
{
return this.defaultTexture.offsetV;
}
return this._offsetV;
}
set offsetV(value: number)
{
this._offsetV = value;
}
get rotation(): number
{
if (this._rotation === undefined && this.defaultTexture !== null)
{
return this.defaultTexture.rotation;
}
return this._rotation;
}
set rotation(value: number)
{
this._rotation = value;
}
get glow(): number
{
if (this._glow === undefined && this.defaultTexture !== null)
{
return this.defaultTexture.glow
}
return this._glow;
}
set glow(value: number)
{
this._glow = value;
}
get textureID(): UUID
{
if (this._textureID === undefined && this.defaultTexture !== null)
{
return this.defaultTexture.textureID;
}
return this._textureID;
}
set textureID(value: UUID)
{
this._textureID = value;
}
get materialID(): UUID
{
if (this._materialID === undefined && this.defaultTexture !== null)
{
return this.defaultTexture.materialID;
}
return this._materialID;
}
set materialID(value: UUID)
{
this._materialID = value;
}
get material(): number
{
return this.materialb;
if (this._material === undefined && this.defaultTexture !== null)
{
return this.defaultTexture.material;
}
return this._material;
}
set material(material: number)
{
this.materialb = material;
this._material = material;
if ((this.hasAttribute & TextureFlags.Material) !== 0)
{
this.bumpiness = this.materialb & TextureEntryFace.BUMP_MASK;
this.shininess = this.materialb & TextureEntryFace.SHINY_MASK;
this.fullBright = ((this.materialb & TextureEntryFace.FULLBRIGHT_MASK) !== 0);
this._bumpiness = this._material & TextureEntryFace.BUMP_MASK;
this._shininess = this._material & TextureEntryFace.SHINY_MASK;
this._fullBright = ((this._material & TextureEntryFace.FULLBRIGHT_MASK) !== 0);
}
else if (this.defaultTexture !== null)
{
this.bumpiness = this.defaultTexture.bumpiness;
this.shininess = this.defaultTexture.shininess;
this.fullBright = this.defaultTexture.fullBright;
this._bumpiness = this.defaultTexture._bumpiness;
this._shininess = this.defaultTexture._shininess;
this._fullBright = this.defaultTexture._fullBright;
}
}
get media(): number
{
return this.mediab;
if (this._media === undefined && this.defaultTexture !== null)
{
return this.defaultTexture.media;
}
return this._media;
}
set media(media: number)
{
this.mediab = media;
this._media = media;
if ((this.hasAttribute & TextureFlags.Media) !== 0)
{
this.mappingType = media & TextureEntryFace.TEX_MAP_MASK;
this.mediaFlags = ((media & TextureEntryFace.MEDIA_MASK) !== 0);
this._mappingType = media & TextureEntryFace.TEX_MAP_MASK;
this._mediaFlags = ((media & TextureEntryFace.MEDIA_MASK) !== 0);
}
else if (this.defaultTexture !== null)
{
this.mappingType = this.defaultTexture.mappingType;
this.mediaFlags = this.defaultTexture.mediaFlags;
this._mappingType = this.defaultTexture.mappingType;
this._mediaFlags = this.defaultTexture.mediaFlags;
}
else
{
throw new Error('No media attribute and default texture is null');
}
}
get mappingType(): number
{
if (this._mappingType === undefined && this.defaultTexture !== null)
{
return this.defaultTexture.mappingType;
}
return this._mappingType;
}
set mappingType(value: number)
{
this._mappingType = value;
}
get mediaFlags(): boolean
{
if (this._mediaFlags === undefined && this.defaultTexture !== null)
{
return this.defaultTexture.mediaFlags;
}
return this._mediaFlags;
}
set mediaFlags(value: boolean)
{
this._mediaFlags = value;
}
}