public void LoadImage(int i, int j, int k, TextureMatrix textureMatrix) { if (this.textureMatrix == null) { this.textureMatrix = textureMatrix; } toLoadImages.Add(new Vector3Int(i, j, k)); }
void Start() { Screen.sleepTimeout = SleepTimeout.NeverSleep; imageLoader = GetComponent <ImageLoader>(); rooms = GetComponent <RoomsInformationManager>(); textureMatrix = new TextureMatrix(XMin, XMax, YMin, YMax, ZMin, ZMax, toleranceDistanceCells, jumpDelta); currentPosition = new Position(cameraCenter.position, new Vector3(XMin, YMin, ZMin), jumpDelta); oldPosition = new Position(cameraCenter.position, new Vector3(XMin, YMin, ZMin), jumpDelta); }
IEnumerator LoadLocalTextureWebRequestInMatrix(int i, int j, int k, TextureMatrix textureMatrix) { concurrentCoroutinesNumber++; //string imageName = truncatedPos.x + "%20" + truncatedPos.y + "%20" + truncatedPos.z; string imageName = currentDiscretePosition.x + "%20" + "1.6" + "%20" + currentDiscretePosition.z; imageName = imageName.Replace('.', ','); imageName = imageName + ".jpg"; string urlToUse = ""; if (useWebURL) { urlToUse = webURL + imageName; } else { urlToUse = "file://" + localURL + imageName; } //Debug.Log("URL: " + urlToUse); UnityWebRequest www = UnityWebRequestTexture.GetTexture(webURL + imageName, false); yield return(www.SendWebRequest()); while (!www.isDone) { Debug.Log("is not done yet"); yield return(www); } if (www.isNetworkError) { Debug.Log("Error:" + www.error); Debug.Log(urlToUse + " ERROR"); } else { try { //Debug.Log("ya traje imagen: " + i + ", " + j + ", " + k); concurrentCoroutinesNumber--; Texture2D myTexture = DownloadHandlerTexture.GetContent(www); textureMatrix.Set(i, j, k, myTexture); //www.Dispose(); } catch (InvalidOperationException e) { Debug.Log("image not found - " + urlToUse + " ERROR"); } } }
public MaterialEntry(BinaryReaderX br) { name = br.ReadString(20); tevColor = br.ReadInt32(); tevConstColors = new int[6]; for (int i = 0; i < 6; i++) { tevConstColors[i] = br.ReadInt32(); } int tmp = br.ReadInt32(); texMap_count = (byte)(tmp & 3); texMatrix_count = (byte)(tmp >> 2 & 3); texCoordGen_count = (byte)(tmp >> 4 & 3); tevStage_count = (byte)(tmp >> 6 & 3); alphaCompare = (tmp >> 8 & 1) == 1; blendMode = (tmp >> 9 & 1) == 1; texMaps = new TextureMap[texMap_count]; for (int i = 0; i < texMap_count; i++) { texMaps[i] = new TextureMap(br); } texMats = new TextureMatrix[texMatrix_count]; for (int i = 0; i < texMatrix_count; i++) { texMats[i] = new TextureMatrix(br); } texCGens = new TextureCoordGen[texCoordGen_count]; for (int i = 0; i < texCoordGen_count; i++) { texCGens[i] = new TextureCoordGen(br); } }
protected List <BasicObject> UnpackTextureMatricies() { List <BasicObject> items = new List <BasicObject>(); UInt32 count = ReadUInt32(); for (int i = 0; i < count; i++) { TextureMatrix tx = new TextureMatrix(); items.Add(tx); tx.Name = ReadULongPascalString(); byte state = ReadByte(); tx.UseStatic = (state & (1 << 0)) != 0; tx.UseDynamic = (state & (1 << 1)) != 0; if (tx.UseStatic) { tx.Rotation = ReadFloat(); tx.FixedShift = ReadVector2F(); tx.FixedScale = ReadVector2F(); tx.FixedCenter = ReadVector2F(); } if (tx.UseDynamic) { tx.SpinFreq = ReadFloat(); tx.ShiftFreq = ReadVector2F(); tx.ScaleFreq = ReadVector2F(); tx.Scale = ReadVector2F(); tx.Center = ReadVector2F(); } } return(items); }
protected override bool OnInitialize() { MDL0TextureRef *header = Header; _unk2 = header->_unk2; _unk3 = header->_unk3; _index1 = header->_index1; _index2 = header->_index2; _uWrap = header->_uWrap; _vWrap = header->_vWrap; _minFltr = header->_minFltr; _magFltr = header->_magFltr; _float = header->_lodBias; _unk10 = header->_unk10; _unk11 = header->_unk11 == 1; _unk12 = header->_unk12 == 1; _unk13 = header->_unk13; if (header->_stringOffset != 0) { if (!Material._replaced) { _name = header->ResourceString; } else { _name = Material._name + "_Texture" + Index; } _texture = Model.FindOrCreateTexture(_name); _texture._references.Add(this); } if (header->_secondaryOffset != 0) { string name; if (!Material._replaced) { name = header->SecondaryTexture; } else { name = Material._name + "_Texture" + Index; } _palette = Model.FindOrCreatePalette(name); _palette._references.Add(this); } if (((MDL0MaterialNode)Parent).XFCommands.Length != 0) { TexMtxFlags = new XFTexMtxInfo(((MDL0MaterialNode)Parent).XFCommands[Index * 2].values[0]); DualTexFlags = new XFDualTex(((MDL0MaterialNode)Parent).XFCommands[Index * 2 + 1].values[0]); getValues(); } //if (PaletteNode == null && TextureNode != null) //{ // if (TextureNode.Source == null) // TextureNode.GetSource(); // if (TextureNode.Source is TEX0Node && ((TEX0Node)TextureNode.Source).HasPalette) // { // Model._errors.Add("A palette was not set to texture reference " + Index + " in material " + Parent.Index + " (" + Parent.Name + ")."); // PaletteNode = Model.FindOrCreatePalette(TextureNode.Name); // SignalPropertyChange(); // } //} MDL0MtlTexSettings *TexSettings = ((MDL0MaterialNode)Parent).Header->TexMatrices(Model._version); _texFlags = TexSettings->GetTexFlags(Index); _texMatrix = TexSettings->GetTexMatrices(Index); _flags = (TexFlags)((((MDL0MaterialNode)Parent)._layerFlags >> (4 * Index)) & 0xF); _bindState = new FrameState( new Vector3(_texFlags.TexScale._x, _texFlags.TexScale._y, 1), new Vector3(_texFlags.TexRotation, 0, 0), new Vector3(_texFlags.TexTranslation._x, _texFlags.TexTranslation._y, 0)); return(false); }