awesome work so far in newUI scene, created some extra UI(such as welcomepanel) and wiring them up

This commit is contained in:
alexiscatnip
2021-06-07 01:20:14 +08:00
parent 33c4251f82
commit 2226c9c23e
87 changed files with 41244 additions and 7658 deletions
+26
View File
@@ -0,0 +1,26 @@
using Raindrop.Netcom;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Raindrop.Presenters
{
public class LoadingCanvasPresenter : MonoBehaviour
{
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
private RaindropNetcom netcom { get { return instance.Netcom; } }
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2dd0ca2f38210654993a83d66f99f09a
guid: d4624f0ac24806c4594a78f36da30bd9
MonoImporter:
externalObjects: {}
serializedVersion: 2
@@ -0,0 +1,560 @@
#region License and Information
/*****
*
* BMPLoader.cs
*
* This is a simple implementation of a BMP file loader for Unity3D.
* Formats it should support are:
* - 1 bit monochrome indexed
* - 2-8 bit indexed
* - 16 / 24 / 32 bit color (including "BI_BITFIELDS")
* - RLE-4 and RLE-8 support has been added.
*
* Unless the type is "BI_ALPHABITFIELDS" the loader does not interpret alpha
* values by default, however you can set the "ReadPaletteAlpha" setting to
* true to interpret the 4th (usually "00") value as alpha for indexed images.
* You can also set "ForceAlphaReadWhenPossible" to true so it will interpret
* the "left over" bits as alpha if there are any. It will also force to read
* alpha from a palette if it's an indexed image, just like "ReadPaletteAlpha".
*
* It's not tested well to the bone, so there might be some errors somewhere.
* However I tested it with 4 different images created with MS Paint
* (1bit, 4bit, 8bit, 24bit) as those are the only formats supported.
*
* 2017.02.05 - first version
* 2017.03.06 - Added RLE4 / RLE8 support
*
* Copyright (c) 2017 Markus Göbel (Bunny83)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
*****/
#endregion License and Information
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System;
namespace Catnip.Drawing
{
public enum BMPComressionMode : int
{
BI_RGB = 0x00,
BI_RLE8 = 0x01,
BI_RLE4 = 0x02,
BI_BITFIELDS = 0x03,
BI_JPEG = 0x04,
BI_PNG = 0x05,
BI_ALPHABITFIELDS = 0x06,
BI_CMYK = 0x0B,
BI_CMYKRLE8 = 0x0C,
BI_CMYKRLE4 = 0x0D,
}
public struct BMPFileHeader
{
public ushort magic; // "BM"
public uint filesize;
public uint reserved;
public uint offset;
}
public struct BitmapInfoHeader
{
public uint size;
public int width;
public int height;
public ushort nColorPlanes; // always 1
public ushort nBitsPerPixel; // [1,4,8,16,24,32]
public BMPComressionMode compressionMethod;
public uint rawImageSize; // can be "0"
public int xPPM;
public int yPPM;
public uint nPaletteColors;
public uint nImportantColors;
public int absWidth { get { return Mathf.Abs(width); } }
public int absHeight { get { return Mathf.Abs(height); } }
}
public class BMPImage
{
public BMPFileHeader header;
public BitmapInfoHeader info;
public uint rMask = 0x00FF0000;
public uint gMask = 0x0000FF00;
public uint bMask = 0x000000FF;
public uint aMask = 0x00000000;
public List<Color32> palette;
public Color32[] imageData;
public Texture2D ToTexture2D()
{
var tex = new Texture2D(info.absWidth, info.absHeight);
tex.SetPixels32(imageData);
tex.Apply();
return tex;
}
}
public class BMPLoader
{
const ushort MAGIC = 0x4D42; // "BM" little endian
public bool ReadPaletteAlpha = false;
public bool ForceAlphaReadWhenPossible = false;
public BMPImage LoadBMP(string aFileName)
{
using (var file = File.OpenRead(aFileName))
return LoadBMP(file);
}
public BMPImage LoadBMP(byte[] aData)
{
using (var stream = new MemoryStream(aData))
return LoadBMP(stream);
}
public BMPImage LoadBMP(Stream aData)
{
using (var reader = new BinaryReader(aData))
return LoadBMP(reader);
}
public BMPImage LoadBMP(BinaryReader aReader)
{
BMPImage bmp = new BMPImage();
if (!ReadFileHeader(aReader, ref bmp.header))
{
Debug.LogError("Not a BMP file");
return null;
}
if (!ReadInfoHeader(aReader, ref bmp.info))
{
Debug.LogError("Unsupported header format");
return null;
}
if (bmp.info.compressionMethod != BMPComressionMode.BI_RGB
&& bmp.info.compressionMethod != BMPComressionMode.BI_BITFIELDS
&& bmp.info.compressionMethod != BMPComressionMode.BI_ALPHABITFIELDS
&& bmp.info.compressionMethod != BMPComressionMode.BI_RLE4
&& bmp.info.compressionMethod != BMPComressionMode.BI_RLE8
)
{
Debug.LogError("Unsupported image format: " + bmp.info.compressionMethod);
return null;
}
long offset = 14 + bmp.info.size;
aReader.BaseStream.Seek(offset, SeekOrigin.Begin);
if (bmp.info.nBitsPerPixel < 24)
{
bmp.rMask = 0x00007C00;
bmp.gMask = 0x000003E0;
bmp.bMask = 0x0000001F;
}
if (bmp.info.compressionMethod == BMPComressionMode.BI_BITFIELDS || bmp.info.compressionMethod == BMPComressionMode.BI_ALPHABITFIELDS)
{
bmp.rMask = aReader.ReadUInt32();
bmp.gMask = aReader.ReadUInt32();
bmp.bMask = aReader.ReadUInt32();
}
if (ForceAlphaReadWhenPossible)
bmp.aMask = GetMask(bmp.info.nBitsPerPixel) ^ (bmp.rMask | bmp.gMask | bmp.bMask);
if (bmp.info.compressionMethod == BMPComressionMode.BI_ALPHABITFIELDS)
bmp.aMask = aReader.ReadUInt32();
if (bmp.info.nPaletteColors > 0 || bmp.info.nBitsPerPixel <= 8)
bmp.palette = ReadPalette(aReader, bmp, ReadPaletteAlpha || ForceAlphaReadWhenPossible);
aReader.BaseStream.Seek(bmp.header.offset, SeekOrigin.Begin);
bool uncompressed = bmp.info.compressionMethod == BMPComressionMode.BI_RGB ||
bmp.info.compressionMethod == BMPComressionMode.BI_BITFIELDS ||
bmp.info.compressionMethod == BMPComressionMode.BI_ALPHABITFIELDS;
if (bmp.info.nBitsPerPixel == 32 && uncompressed)
Read32BitImage(aReader, bmp);
else if (bmp.info.nBitsPerPixel == 24 && uncompressed)
Read24BitImage(aReader, bmp);
else if (bmp.info.nBitsPerPixel == 16 && uncompressed)
Read16BitImage(aReader, bmp);
else if (bmp.info.compressionMethod == BMPComressionMode.BI_RLE4 && bmp.info.nBitsPerPixel == 4 && bmp.palette != null)
ReadIndexedImageRLE4(aReader, bmp);
else if (bmp.info.compressionMethod == BMPComressionMode.BI_RLE8 && bmp.info.nBitsPerPixel == 8 && bmp.palette != null)
ReadIndexedImageRLE8(aReader, bmp);
else if (uncompressed && bmp.info.nBitsPerPixel <= 8 && bmp.palette != null)
ReadIndexedImage(aReader, bmp);
else
{
Debug.LogError("Unsupported file format: " + bmp.info.compressionMethod + " BPP: " + bmp.info.nBitsPerPixel);
return null;
}
return bmp;
}
private static void Read32BitImage(BinaryReader aReader, BMPImage bmp)
{
int w = Mathf.Abs(bmp.info.width);
int h = Mathf.Abs(bmp.info.height);
Color32[] data = bmp.imageData = new Color32[w * h];
if (aReader.BaseStream.Position + w * h * 4 > aReader.BaseStream.Length)
{
Debug.LogError("Unexpected end of file.");
return;
}
int shiftR = GetShiftCount(bmp.rMask);
int shiftG = GetShiftCount(bmp.gMask);
int shiftB = GetShiftCount(bmp.bMask);
int shiftA = GetShiftCount(bmp.aMask);
byte a = 255;
for (int i = 0; i < data.Length; i++)
{
uint v = aReader.ReadUInt32();
byte r = (byte)((v & bmp.rMask) >> shiftR);
byte g = (byte)((v & bmp.gMask) >> shiftG);
byte b = (byte)((v & bmp.bMask) >> shiftB);
if (bmp.bMask != 0)
a = (byte)((v & bmp.aMask) >> shiftA);
data[i] = new Color32(r, g, b, a);
}
}
private static void Read24BitImage(BinaryReader aReader, BMPImage bmp)
{
int w = Mathf.Abs(bmp.info.width);
int h = Mathf.Abs(bmp.info.height);
int rowLength = ((24 * w + 31) / 32) * 4;
int count = rowLength * h;
int pad = rowLength - w * 3;
Color32[] data = bmp.imageData = new Color32[w * h];
if (aReader.BaseStream.Position + count > aReader.BaseStream.Length)
{
Debug.LogError("Unexpected end of file. (Have " + (aReader.BaseStream.Position + count) + " bytes, expected " + aReader.BaseStream.Length + " bytes)");
return;
}
int shiftR = GetShiftCount(bmp.rMask);
int shiftG = GetShiftCount(bmp.gMask);
int shiftB = GetShiftCount(bmp.bMask);
for (int y = 0; y < h; y++)
{
for (int x = 0; x < w; x++)
{
uint v = aReader.ReadByte() | ((uint)aReader.ReadByte() << 8) | ((uint)aReader.ReadByte() << 16);
byte r = (byte)((v & bmp.rMask) >> shiftR);
byte g = (byte)((v & bmp.gMask) >> shiftG);
byte b = (byte)((v & bmp.bMask) >> shiftB);
data[x + y * w] = new Color32(r, g, b, 255);
}
for (int i = 0; i < pad; i++)
aReader.ReadByte();
}
}
private static void Read16BitImage(BinaryReader aReader, BMPImage bmp)
{
int w = Mathf.Abs(bmp.info.width);
int h = Mathf.Abs(bmp.info.height);
int rowLength = ((16 * w + 31) / 32) * 4;
int count = rowLength * h;
int pad = rowLength - w * 2;
Color32[] data = bmp.imageData = new Color32[w * h];
if (aReader.BaseStream.Position + count > aReader.BaseStream.Length)
{
Debug.LogError("Unexpected end of file. (Have " + (aReader.BaseStream.Position + count) + " bytes, expected " + aReader.BaseStream.Length + " bytes)");
return;
}
int shiftR = GetShiftCount(bmp.rMask);
int shiftG = GetShiftCount(bmp.gMask);
int shiftB = GetShiftCount(bmp.bMask);
int shiftA = GetShiftCount(bmp.aMask);
byte a = 255;
for (int y = 0; y < h; y++)
{
for (int x = 0; x < w; x++)
{
uint v = aReader.ReadByte() | ((uint)aReader.ReadByte() << 8);
byte r = (byte)((v & bmp.rMask) >> shiftR);
byte g = (byte)((v & bmp.gMask) >> shiftG);
byte b = (byte)((v & bmp.bMask) >> shiftB);
if (bmp.aMask != 0)
a = (byte)((v & bmp.aMask) >> shiftA);
data[x + y * w] = new Color32(r, g, b, a);
}
for (int i = 0; i < pad; i++)
aReader.ReadByte();
}
}
private static void ReadIndexedImage(BinaryReader aReader, BMPImage bmp)
{
int w = Mathf.Abs(bmp.info.width);
int h = Mathf.Abs(bmp.info.height);
int bitCount = bmp.info.nBitsPerPixel;
int rowLength = ((bitCount * w + 31) / 32) * 4;
int count = rowLength * h;
int pad = rowLength - (w * bitCount + 7) / 8;
Color32[] data = bmp.imageData = new Color32[w * h];
if (aReader.BaseStream.Position + count > aReader.BaseStream.Length)
{
Debug.LogError("Unexpected end of file. (Have " + (aReader.BaseStream.Position + count) + " bytes, expected " + aReader.BaseStream.Length + " bytes)");
return;
}
BitStreamReader bitReader = new BitStreamReader(aReader);
for (int y = 0; y < h; y++)
{
for (int x = 0; x < w; x++)
{
int v = (int)bitReader.ReadBits(bitCount);
if (v >= bmp.palette.Count)
{
Debug.LogError("Indexed bitmap has indices greater than it's color palette");
return;
}
data[x + y * w] = bmp.palette[v];
}
bitReader.Flush();
for (int i = 0; i < pad; i++)
aReader.ReadByte();
}
}
private static void ReadIndexedImageRLE4(BinaryReader aReader, BMPImage bmp)
{
int w = Mathf.Abs(bmp.info.width);
int h = Mathf.Abs(bmp.info.height);
Color32[] data = bmp.imageData = new Color32[w * h];
int x = 0;
int y = 0;
int yOffset = 0;
while (aReader.BaseStream.Position < aReader.BaseStream.Length - 1)
{
int count = (int)aReader.ReadByte();
byte d = aReader.ReadByte();
if (count > 0)
{
for (int i = (count / 2); i > 0; i--)
{
data[x++ + yOffset] = bmp.palette[(d >> 4) & 0x0F];
data[x++ + yOffset] = bmp.palette[d & 0x0F];
}
if ((count & 0x01) > 0)
{
data[x++ + yOffset] = bmp.palette[(d >> 4) & 0x0F];
}
}
else
{
if (d == 0)
{
x = 0;
y += 1;
yOffset = y * w;
}
else if (d == 1)
{
break;
}
else if (d == 2)
{
x += aReader.ReadByte();
y += aReader.ReadByte();
yOffset = y * w;
}
else
{
for (int i = (d / 2); i > 0; i--)
{
byte d2 = aReader.ReadByte();
data[x++ + yOffset] = bmp.palette[(d2 >> 4) & 0x0F];
data[x++ + yOffset] = bmp.palette[d2 & 0x0F];
}
if ((d & 0x01) > 0)
{
data[x++ + yOffset] = bmp.palette[(aReader.ReadByte() >> 4) & 0x0F];
}
if ((((d - 1) / 2) & 1) == 0)
{
aReader.ReadByte(); // padding (word alignment)
}
}
}
}
}
private static void ReadIndexedImageRLE8(BinaryReader aReader, BMPImage bmp)
{
int w = Mathf.Abs(bmp.info.width);
int h = Mathf.Abs(bmp.info.height);
Color32[] data = bmp.imageData = new Color32[w * h];
int x = 0;
int y = 0;
int yOffset = 0;
while (aReader.BaseStream.Position < aReader.BaseStream.Length - 1)
{
int count = (int)aReader.ReadByte();
byte d = aReader.ReadByte();
if (count > 0)
{
for (int i = count; i > 0; i--)
{
data[x++ + yOffset] = bmp.palette[d];
}
}
else
{
if (d == 0)
{
x = 0;
y += 1;
yOffset = y * w;
}
else if (d == 1)
{
break;
}
else if (d == 2)
{
x += aReader.ReadByte();
y += aReader.ReadByte();
yOffset = y * w;
}
else
{
for (int i = d; i > 0; i--)
{
data[x++ + yOffset] = bmp.palette[aReader.ReadByte()];
}
if ((d & 0x01) > 0)
{
aReader.ReadByte(); // padding (word alignment)
}
}
}
}
}
private static int GetShiftCount(uint mask)
{
for (int i = 0; i < 32; i++)
{
if ((mask & 0x01) > 0)
return i;
mask >>= 1;
}
return -1;
}
private static uint GetMask(int bitCount)
{
uint mask = 0;
for (int i = 0; i < bitCount; i++)
{
mask <<= 1;
mask |= 0x01;
}
return mask;
}
private static bool ReadFileHeader(BinaryReader aReader, ref BMPFileHeader aFileHeader)
{
aFileHeader.magic = aReader.ReadUInt16();
if (aFileHeader.magic != MAGIC)
return false;
aFileHeader.filesize = aReader.ReadUInt32();
aFileHeader.reserved = aReader.ReadUInt32();
aFileHeader.offset = aReader.ReadUInt32();
return true;
}
private static bool ReadInfoHeader(BinaryReader aReader, ref BitmapInfoHeader aHeader)
{
aHeader.size = aReader.ReadUInt32();
if (aHeader.size < 40)
return false;
aHeader.width = aReader.ReadInt32();
aHeader.height = aReader.ReadInt32();
aHeader.nColorPlanes = aReader.ReadUInt16();
aHeader.nBitsPerPixel = aReader.ReadUInt16();
aHeader.compressionMethod = (BMPComressionMode)aReader.ReadInt32();
aHeader.rawImageSize = aReader.ReadUInt32();
aHeader.xPPM = aReader.ReadInt32();
aHeader.yPPM = aReader.ReadInt32();
aHeader.nPaletteColors = aReader.ReadUInt32();
aHeader.nImportantColors = aReader.ReadUInt32();
int pad = (int)aHeader.size - 40;
if (pad > 0)
aReader.ReadBytes(pad);
return true;
}
public static List<Color32> ReadPalette(BinaryReader aReader, BMPImage aBmp, bool aReadAlpha)
{
uint count = aBmp.info.nPaletteColors;
if (count == 0u)
count = 1u << aBmp.info.nBitsPerPixel;
var palette = new List<Color32>((int)count);
for (int i = 0; i < count; i++)
{
byte b = aReader.ReadByte();
byte g = aReader.ReadByte();
byte r = aReader.ReadByte();
byte a = aReader.ReadByte();
if (!aReadAlpha)
a = 255;
palette.Add(new Color32(r, g, b, a));
}
return palette;
}
}
public class BitStreamReader
{
BinaryReader m_Reader;
byte m_Data = 0;
int m_Bits = 0;
public BitStreamReader(BinaryReader aReader)
{
m_Reader = aReader;
}
public BitStreamReader(Stream aStream) : this(new BinaryReader(aStream)) { }
public byte ReadBit()
{
if (m_Bits <= 0)
{
m_Data = m_Reader.ReadByte();
m_Bits = 8;
}
return (byte)((m_Data >> --m_Bits) & 1);
}
public ulong ReadBits(int aCount)
{
ulong val = 0UL;
if (aCount <= 0 || aCount > 32)
throw new System.ArgumentOutOfRangeException("aCount", "aCount must be between 1 and 32 inclusive");
for (int i = aCount - 1; i >= 0; i--)
val |= ((ulong)ReadBit() << i);
return val;
}
public void Flush()
{
m_Data = 0;
m_Bits = 0;
}
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a25319b36bd93b140be7c650bc57094a
guid: 34ab85155eb4dee4bb2020fd10405b6a
MonoImporter:
externalObjects: {}
serializedVersion: 2
@@ -1,37 +1,73 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Catnip.Drawing;
using Catnip.Drawing.Imaging;
using SixLabors.ImageSharp;
using UnityEngine;
//fake image class that actually just calls unity image internally.
namespace Catnip.Drawing
{
public sealed class Bitmap : Catnip.Drawing.Image
//use this as the template for call to texture.GetRawTextureData<T>()
//https://forum.unity.com/threads/2019-2-dots-image-processing-performance.729314/
[StructLayout(LayoutKind.Explicit)]
public struct Pixel
{
[FieldOffset(0)]
public int rgba;
[FieldOffset(0)]
public byte r;
[FieldOffset(1)]
public byte g;
[FieldOffset(2)]
public byte b;
[FieldOffset(3)]
public byte a;
}
public sealed class Bitmap //: Catnip.Drawing.Image
{
private Texture2D tex;
private TextureFormat texformat;
//Initializes a new instance of the Bitmap class with the specified size and format.
public Bitmap(int width, int height, PixelFormat format32bppArgb)
{
Width = width;
Height = height;
if (format32bppArgb == PixelFormat.Format32bppArgb)
{
texformat = TextureFormat.ARGB32;
}
}
public Bitmap(int width, int height)
{
Width = width;
Height = height;
}
public override int Width { get; internal set; }
public override int Height { get; internal set; }
public /*override*/ int Width { get; internal set; }
public /*override*/ int Height { get; internal set; }
public Catnip.Drawing.Imaging.PixelFormat PixelFormat { get; internal set; }
public BitmapData LockBits(Rectangle rectangle, object readOnly, PixelFormat format32bppArgb)
{
throw new NotImplementedException();
}
@@ -48,7 +84,34 @@ namespace Catnip.Drawing
public void RotateFlip(object rotate270FlipNone)
{
//rotate the texture.
//tex.GetRawTextureData<Pixel>()
throw new NotImplementedException();
}
public void fillColor(Catnip.Drawing.Color color)
{
var fillColor = color;
var fillColorArray = tex.GetPixels();
for (var i = 0; i < fillColorArray.Length; ++i)
{
fillColorArray[i] = fillColor;
}
tex.SetPixels(fillColorArray);
//applies the setPixel changes.
tex.Apply();
}
public static Bitmap FromFile(string fname)
{
var fileData = File.ReadAllBytes(fname);
var bmp = new Bitmap(5,5);
bmp.tex.LoadImage(fileData);
return bmp;
}
}
}
@@ -1,21 +1,71 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using UnityEngine;
//namespace Catnip.Drawing
//{
// public struct Color
// {
// public static Color Transparent { get => (Catnip.Drawing.Color) UnityEngine.Color.clear; }
using System;
/**
* Raindrop Metaverse Client
* Copyright(c) 2009-2014, Raindrop Development Team
* Copyright(c) 2016-2020, Sjofn, LLC
* All rights reserved.
*
* Raindrop is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program.If not, see<https://www.gnu.org/licenses/>.
*/
namespace Catnip.Drawing
{
public struct Color
{
//UnityEngine.Color color;
// public static explicit operator Catnip.Drawing.Color(byte b) => new UnityEngine.Color(b);
// public static explicit operator UnityEngine.Color() => new Catnip.Drawing.Color(byte b) ;
//
// Summary:
// Red component of the color.
public float r;
//
// Summary:
// Green component of the color.
public float g;
//
// Summary:
// Blue component of the color.
public float b;
//
// Summary:
// Alpha component of the color (0 is transparent, 1 is opaque).
public float a;
// }
//}
public static Color FromArgb(int a, int r, int g, int b)
{
var cl = new Color
{
a = a,
r = r,
g = g,
b = b
};
return cl;
//throw new NotImplementedException();
}
//convert catnip.color -> ue.color
public static implicit operator UnityEngine.Color(Color v)
{
return new UnityEngine.Color(v.r,v.g,v.b,v.a);
//throw new NotImplementedException();
}
}
}
@@ -1,23 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SixLabors.ImageSharp;
//using System;
//using System.Collections.Generic;
//using System.IO;
//using System.Linq;
//using System.Runtime.Serialization;
//using System.Text;
//using System.Threading.Tasks;
//using SixLabors.ImageSharp;
//using UnityEngine;
//fake image class that actually just calls unity image internally.
namespace Catnip.Drawing
{
public abstract class Image
{
////fake image class that actually just calls unity image internally. //modified 5/6/2021
//namespace Catnip.Drawing
//{
// public abstract class Image : MarshalByRefObject, IDisposable, ICloneable, ISerializable
// {
public abstract int Width { get; internal set; }
public abstract int Height { get; internal set; }
// private Texture2D tex;
// public abstract int Width { get; internal set; }
// public abstract int Height { get; internal set; }
internal static Bitmap FromFile(string fname)
{
throw new NotImplementedException();
}
}
}
// public static Image FromFile(string fname)
// {
// return FromFile(filename, false);
// }
// public static Image FromFile(string filename, bool useEmbeddedColorManagement)
// {
// if (!File.Exists(filename))
// throw new FileNotFoundException(filename);
// var fileData = File.ReadAllBytes(filename);
// //var tex = new Texture2D(2, 2);
// //tex.LoadImage(fileData);
// var image = SixLabors.ImageSharp.Image.Load(filename);
// return image;
// }
// public object Clone()
// {
// throw new NotImplementedException();
// }
// public void Dispose()
// {
// throw new NotImplementedException();
// }
// public void GetObjectData(SerializationInfo info, StreamingContext context)
// {
// throw new NotImplementedException();
// }
// }
//}
@@ -15,6 +15,12 @@ namespace Catnip.Drawing.Imaging
public int Width { get; internal set; }
public int Height { get; internal set; }
public PixelFormat PixelFormat { get; internal set; }
public BitmapData()
{
}
}
//https://docs.microsoft.com/en-us/dotnet/api/system.drawing.imaging.pixelformat?view=net-5.0
@@ -0,0 +1,76 @@
namespace Catnip.Drawing
{
//
// Summary:
// Specifies how much an image is rotated and the axis used to flip the image.
public enum RotateFlipType
{
//
// Summary:
// Specifies no clockwise rotation and no flipping.
RotateNoneFlipNone = 0,
//
// Summary:
// Specifies a 180-degree clockwise rotation followed by a horizontal and vertical
// flip.
Rotate180FlipXY = 0,
//
// Summary:
// Specifies a 90-degree clockwise rotation without flipping.
Rotate90FlipNone = 1,
//
// Summary:
// Specifies a 270-degree clockwise rotation followed by a horizontal and vertical
// flip.
Rotate270FlipXY = 1,
//
// Summary:
// Specifies a 180-degree clockwise rotation without flipping.
Rotate180FlipNone = 2,
//
// Summary:
// Specifies no clockwise rotation followed by a horizontal and vertical flip.
RotateNoneFlipXY = 2,
//
// Summary:
// Specifies a 270-degree clockwise rotation without flipping.
Rotate270FlipNone = 3,
//
// Summary:
// Specifies a 90-degree clockwise rotation followed by a horizontal and vertical
// flip.
Rotate90FlipXY = 3,
//
// Summary:
// Specifies no clockwise rotation followed by a horizontal flip.
RotateNoneFlipX = 4,
//
// Summary:
// Specifies a 180-degree clockwise rotation followed by a vertical flip.
Rotate180FlipY = 4,
//
// Summary:
// Specifies a 90-degree clockwise rotation followed by a horizontal flip.
Rotate90FlipX = 5,
//
// Summary:
// Specifies a 270-degree clockwise rotation followed by a vertical flip.
Rotate270FlipY = 5,
//
// Summary:
// Specifies a 180-degree clockwise rotation followed by a horizontal flip.
Rotate180FlipX = 6,
//
// Summary:
// Specifies no clockwise rotation followed by a vertical flip.
RotateNoneFlipY = 6,
//
// Summary:
// Specifies a 270-degree clockwise rotation followed by a horizontal flip.
Rotate270FlipX = 7,
//
// Summary:
// Specifies a 90-degree clockwise rotation followed by a vertical flip.
Rotate90FlipY = 7
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6b08134eeb7f1bb4eb50737682810134
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -29,6 +29,7 @@ using System;
//using System.Drawing.Imaging;
using Catnip.Drawing;
using Catnip.Drawing.Imaging;
using UnityEngine;
namespace OpenMetaverse.Imaging
{
@@ -386,7 +387,7 @@ namespace OpenMetaverse.Imaging
/// origin, suitable for feeding directly into OpenGL
/// </summary>
/// <returns>A byte array containing raw texture data</returns>
public Bitmap ExportBitmap()
public Texture2D ExportTex2D()
{
byte[] raw = new byte[Width * Height * 4];
@@ -427,19 +428,40 @@ namespace OpenMetaverse.Imaging
}
}
Bitmap b = new Bitmap(
Width,
Height,
PixelFormat.Format32bppArgb);
Texture2D b = new Texture2D(Width, Height);
b.hideFlags = HideFlags.HideAndDontSave; //this helps us delete this texture later?
BitmapData bd = b.LockBits(new Rectangle(0, 0, b.Width, b.Height),
ImageLockMode.WriteOnly,
PixelFormat.Format32bppArgb);
var mip0Data = b.GetPixelData<Color32>(1);
System.Runtime.InteropServices.Marshal.Copy(raw, 0, bd.Scan0, Width * Height * 4);
if (mip0Data.Length != Width * Height)
{
Debug.LogError("mip0 data size (of texture) not match the data size of array!");
}
b.UnlockBits(bd);
for (int i = 0; i < mip0Data.Length; i++)
{
var blue = raw[i * 4 + 0];
var green = raw[i * 4 + 1];
var red = raw[i * 4 + 2];
var alpha = raw[i * 4 + 3];
mip0Data[i] = new Color32(red, green, blue, alpha);
}
//Bitmap b = new Bitmap(
// Width,
// Height,
// PixelFormat.Format32bppArgb);
//BitmapData bd = b.LockBits(new Rectangle(0, 0, b.Width, b.Height),
// ImageLockMode.WriteOnly,
// PixelFormat.Format32bppArgb);
//System.Runtime.InteropServices.Marshal.Copy(raw, 0, bd.Scan0, Width * Height * 4);
//b.UnlockBits(bd);
b.Apply(false);
return b;
}
@@ -31,6 +31,7 @@ using System.Runtime.InteropServices;
//using Rectangle = System.Drawing.Rectangle;
using Catnip.Drawing;
using Catnip.Drawing.Imaging;
using UnityEngine;
namespace OpenMetaverse.Imaging
{
@@ -248,7 +249,7 @@ namespace OpenMetaverse.Imaging
/// <param name="managedImage">ManagedImage object to decode to</param>
/// <param name="image">Image object to decode to</param>
/// <returns>True if the decode succeeds, otherwise false</returns>
public static bool DecodeToImage(byte[] encoded, out ManagedImage managedImage, out Image image)
public static bool DecodeToImage(byte[] encoded, out ManagedImage managedImage, out Texture2D image)
{
managedImage = null;
image = null;
@@ -257,7 +258,7 @@ namespace OpenMetaverse.Imaging
{
try
{
image = managedImage.ExportBitmap();
image = managedImage.ExportTex2D();
return true;
}
catch (Exception ex)
@@ -29,6 +29,7 @@ using System;
//using System.Drawing.Imaging;
using Catnip.Drawing;
using Catnip.Drawing.Imaging;
using UnityEngine;
namespace OpenMetaverse.Imaging
{
@@ -133,7 +133,7 @@ namespace OpenMetaverse.ImportExport
bitmap = LoadTGAClass.LoadTGA(fname);
break;
default:
bitmap = (Bitmap)Image.FromFile(fname);
bitmap = (Bitmap)Bitmap.FromFile(fname);
break;
}
+455 -452
View File
@@ -1,516 +1,519 @@
///**
// * Radegast Metaverse Client
// * Copyright(c) 2009-2014, Radegast Development Team
// * Copyright(c) 2016-2020, Sjofn, LLC
// * All rights reserved.
// *
// * Radegast is free software: you can redistribute it and/or modify
// * it under the terms of the GNU Lesser General Public License as published
// * by the Free Software Foundation, either version 3 of the License, or
// * (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
// * GNU General Public License for more details.
// *
// * You should have received a copy of the GNU Lesser General Public License
// * along with this program.If not, see<https://www.gnu.org/licenses/>.
// */
/**
* Radegast Metaverse Client
* Copyright(c) 2009-2014, Radegast Development Team
* Copyright(c) 2016-2020, Sjofn, LLC
* All rights reserved.
*
* Radegast is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program.If not, see<https://www.gnu.org/licenses/>.
*/
//using System;
//using System.Collections;
////using System.Drawing;
//using System.Text;
//using System.IO;
//using Raindrop.Netcom;
//using OpenMetaverse;
//using OpenMetaverse.StructuredData;
//using Newtonsoft.Json;
////using System.Web.Script.Serialization;
//using System.Collections.Generic;
//using UnityEngine;
//using Color = SixLabors.ImageSharp.Color;
using System;
using System.Collections;
//using System.Drawing;
using System.Text;
using System.IO;
using Raindrop.Netcom;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using Newtonsoft.Json;
//using System.Web.Script.Serialization;
using System.Collections.Generic;
using UnityEngine;
using Color = SixLabors.ImageSharp.Color;
//namespace Raindrop
//{
// public class IMTextManager
// {
// public bool DingOnAllIncoming = false;
namespace Raindrop
{
//this class offers the GUI to have the ability to handle messages, via composition.
public class IMTextManager
{
public bool DingOnAllIncoming = false;
// RaindropInstance instance;
// RaindropNetcom netcom => instance.Netcom;
// IMTextManagerType Type;
// string sessionName;
// bool AutoResponseSent = false;
// ArrayList textBuffer;
RaindropInstance instance;
RaindropNetcom netcom => instance.Netcom;
IMTextManagerType Type;
string sessionName;
bool AutoResponseSent = false;
ArrayList textBuffer;
// public static Dictionary<string, Settings.FontSetting> fontSettings = new Dictionary<string, Settings.FontSetting>();
public static Dictionary<string, Settings.FontSetting> fontSettings = new Dictionary<string, Settings.FontSetting>();
// public IMTextManager(RaindropInstance instance, ITextPrinter textPrinter, IMTextManagerType type, UUID sessionID, string sessionName)
// {
// SessionID = sessionID;
// this.sessionName = sessionName;
// TextPrinter = textPrinter;
// textBuffer = new ArrayList();
// Type = type;
public IMTextManager(RaindropInstance instance, ITextPrinter textPrinter, IMTextManagerType type, UUID sessionID, string sessionName)
{
SessionID = sessionID;
this.sessionName = sessionName;
TextPrinter = textPrinter;
textBuffer = new ArrayList();
Type = type;
// this.instance = instance;
// PrintLastLog();
// AddNetcomEvents();
// InitializeConfig();
this.instance = instance;
PrintLastLog();
AddNetcomEvents();
InitializeConfig();
// }
}
// private void InitializeConfig()
// {
// Settings s = instance.GlobalSettings;
// //var serializer = new JavaScriptSerializer();
// //var serializer = new JsonSerializer();
private void InitializeConfig()
{
Settings s = instance.GlobalSettings;
//var serializer = new JavaScriptSerializer();
//var serializer = new JsonSerializer();
// if (s["im_timestamps"].Type == OSDType.Unknown)
// {
// s["im_timestamps"] = OSD.FromBoolean(true);
// }
// if (s["chat_fonts"].Type == OSDType.Unknown)
// {
// try
// {
// s["chat_fonts"] = JsonConvert.SerializeObject(Settings.DefaultFontSettings);
// }
// catch (Exception ex)
// {
// Debug.LogError("Failed to save default font settings: " + ex.Message);
// //System.Windows.Forms.MessageBox.Show("Failed to save default font settings: " + ex.Message);
// }
// }
if (s["im_timestamps"].Type == OSDType.Unknown)
{
s["im_timestamps"] = OSD.FromBoolean(true);
}
//if (s["chat_fonts"].Type == OSDType.Unknown)
//{
// try
// {
// s["chat_fonts"] = JsonConvert.SerializeObject(Settings.DefaultFontSettings);
// }
// catch (Exception ex)
// {
// Debug.LogError("Failed to save default font settings: " + ex.Message);
// //System.Windows.Forms.MessageBox.Show("Failed to save default font settings: " + ex.Message);
// }
//}
// try
// {
// fontSettings = JsonConvert.DeserializeObject<Dictionary<string, Settings.FontSetting>>(s["chat_fonts"]);
// }
// catch (Exception ex)
// {
// Debug.LogError("Failed to read chat font settings: " + ex.Message);
try
{
fontSettings = JsonConvert.DeserializeObject<Dictionary<string, Settings.FontSetting>>(s["chat_fonts"]);
}
catch (Exception ex)
{
Debug.LogError("Failed to read chat font settings: " + ex.Message);
// //System.Windows.Forms.MessageBox.Show("Failed to read chat font settings: " + ex.Message);
// }
//System.Windows.Forms.MessageBox.Show("Failed to read chat font settings: " + ex.Message);
}
// ShowTimestamps = s["im_timestamps"].AsBoolean();
ShowTimestamps = s["im_timestamps"].AsBoolean();
// s.OnSettingChanged += new Settings.SettingChangedCallback(s_OnSettingChanged);
// }
s.OnSettingChanged += new Settings.SettingChangedCallback(s_OnSettingChanged);
}
// void s_OnSettingChanged(object sender, SettingsEventArgs e)
// {
// if (e.Key == "im_timestamps" && e.Value != null)
// {
// ShowTimestamps = e.Value.AsBoolean();
// ReprintAllText();
// }
// else if(e.Key == "chat_fonts")
// {
// try
// {
// //var serializer = new JavaScriptSerializer();
// fontSettings = JsonConvert.DeserializeObject<Dictionary<string, Settings.FontSetting>>(e.Value);
// }
// catch (Exception ex)
// {
// Debug.LogError("Failed to read new font settings: " + ex.Message);
// //System.Windows.Forms.MessageBox.Show("Failed to read new font settings: " + ex.Message);
// }
// ReprintAllText();
// }
// }
void s_OnSettingChanged(object sender, SettingsEventArgs e)
{
if (e.Key == "im_timestamps" && e.Value != null)
{
ShowTimestamps = e.Value.AsBoolean();
ReprintAllText();
}
else if (e.Key == "chat_fonts")
{
try
{
//var serializer = new JavaScriptSerializer();
fontSettings = JsonConvert.DeserializeObject<Dictionary<string, Settings.FontSetting>>(e.Value);
}
catch (Exception ex)
{
Debug.LogError("Failed to read new font settings: " + ex.Message);
//System.Windows.Forms.MessageBox.Show("Failed to read new font settings: " + ex.Message);
}
ReprintAllText();
}
}
// private void AddNetcomEvents()
// {
// netcom.InstantMessageReceived += new EventHandler<InstantMessageEventArgs>(netcom_InstantMessageReceived);
// netcom.InstantMessageSent += new EventHandler<InstantMessageSentEventArgs>(netcom_InstantMessageSent);
// }
private void AddNetcomEvents()
{
netcom.InstantMessageReceived += new EventHandler<InstantMessageEventArgs>(netcom_InstantMessageReceived);
netcom.InstantMessageSent += new EventHandler<InstantMessageSentEventArgs>(netcom_InstantMessageSent);
}
// private void RemoveNetcomEvents()
// {
// netcom.InstantMessageReceived -= netcom_InstantMessageReceived;
// netcom.InstantMessageSent -= netcom_InstantMessageSent;
// }
private void RemoveNetcomEvents()
{
netcom.InstantMessageReceived -= netcom_InstantMessageReceived;
netcom.InstantMessageSent -= netcom_InstantMessageSent;
}
// private void netcom_InstantMessageSent(object sender, InstantMessageSentEventArgs e)
// {
// if (e.SessionID != SessionID) return;
private void netcom_InstantMessageSent(object sender, InstantMessageSentEventArgs e)
{
if (e.SessionID != SessionID) return;
// textBuffer.Add(e);
// ProcessIM(e, true);
// }
textBuffer.Add(e);
ProcessIM(e, true);
}
// private void netcom_InstantMessageReceived(object sender, InstantMessageEventArgs e)
// {
// if (e.IM.IMSessionID != SessionID) return;
// if (e.IM.Dialog == InstantMessageDialog.StartTyping ||
// e.IM.Dialog == InstantMessageDialog.StopTyping)
// return;
private void netcom_InstantMessageReceived(object sender, InstantMessageEventArgs e)
{
if (e.IM.IMSessionID != SessionID) return;
if (e.IM.Dialog == InstantMessageDialog.StartTyping ||
e.IM.Dialog == InstantMessageDialog.StopTyping)
return;
// if (instance.Client.Self.MuteList.Find(me => me.Type == MuteType.Resident && me.ID == e.IM.FromAgentID) != null)
// {
// return;
// }
if (instance.Client.Self.MuteList.Find(me => me.Type == MuteType.Resident && me.ID == e.IM.FromAgentID) != null)
{
return;
}
// textBuffer.Add(e);
// ProcessIM(e, true);
// }
textBuffer.Add(e);
ProcessIM(e, true);
}
// public void ProcessIM(object e, bool isNewMessage)
// {
// if (e is InstantMessageEventArgs)
// ProcessIncomingIM((InstantMessageEventArgs)e, isNewMessage);
// else if (e is InstantMessageSentEventArgs)
// ProcessOutgoingIM((InstantMessageSentEventArgs)e, isNewMessage);
// }
public void ProcessIM(object e, bool isNewMessage)
{
if (e is InstantMessageEventArgs)
ProcessIncomingIM((InstantMessageEventArgs)e, isNewMessage);
else if (e is InstantMessageSentEventArgs)
ProcessOutgoingIM((InstantMessageSentEventArgs)e, isNewMessage);
}
// private void ProcessOutgoingIM(InstantMessageSentEventArgs e, bool isNewMessage)
// {
// PrintIM(e.Timestamp, netcom.LoginOptions.FullName, instance.Client.Self.AgentID, e.Message, isNewMessage);
// }
private void ProcessOutgoingIM(InstantMessageSentEventArgs e, bool isNewMessage)
{
PrintIM(e.Timestamp, netcom.LoginOptions.FullName, instance.Client.Self.AgentID, e.Message, isNewMessage);
}
// private void ProcessIncomingIM(InstantMessageEventArgs e, bool isNewMessage)
// {
// string msg = e.IM.Message;
private void ProcessIncomingIM(InstantMessageEventArgs e, bool isNewMessage)
{
string msg = e.IM.Message;
// //if (instance.RLV.RestictionActive("recvim", e.IM.FromAgentID.ToString()))
// //{
// // msg = "*** IM blocked by your viewer";
//if (instance.RLV.RestictionActive("recvim", e.IM.FromAgentID.ToString()))
//{
// msg = "*** IM blocked by your viewer";
// // if (Type == IMTextManagerType.Agent)
// // {
// // instance.Client.Self.InstantMessage(instance.Client.Self.Name,
// // e.IM.FromAgentID,
// // "*** The Resident you messaged is prevented from reading your instant messages at the moment, please try again later.",
// // e.IM.IMSessionID,
// // InstantMessageDialog.BusyAutoResponse,
// // InstantMessageOnline.Offline,
// // instance.Client.Self.RelativePosition,
// // instance.Client.Network.CurrentSim.ID,
// // null);
// // }
// //}
// if (Type == IMTextManagerType.Agent)
// {
// instance.Client.Self.InstantMessage(instance.Client.Self.Name,
// e.IM.FromAgentID,
// "*** The Resident you messaged is prevented from reading your instant messages at the moment, please try again later.",
// e.IM.IMSessionID,
// InstantMessageDialog.BusyAutoResponse,
// InstantMessageOnline.Offline,
// instance.Client.Self.RelativePosition,
// instance.Client.Network.CurrentSim.ID,
// null);
// }
//}
// if (DingOnAllIncoming)
// {
// //instance.MediaManager.PlayUISound(UISounds.IM);
// }
// PrintIM(DateTime.Now, instance.Names.Get(e.IM.FromAgentID, e.IM.FromAgentName), e.IM.FromAgentID, msg, isNewMessage);
if (DingOnAllIncoming)
{
//instance.MediaManager.PlayUISound(UISounds.IM);
}
PrintIM(DateTime.Now, instance.Names.Get(e.IM.FromAgentID, e.IM.FromAgentName), e.IM.FromAgentID, msg, isNewMessage);
// //if (!AutoResponseSent && Type == IMTextManagerType.Agent && e.IM.FromAgentID != UUID.Zero && e.IM.FromAgentName != "Second Life")
// //{
// // bool autoRespond = false;
// // AutoResponseType art = (AutoResponseType)instance.GlobalSettings["auto_response_type"].AsInteger();
//if (!AutoResponseSent && Type == IMTextManagerType.Agent && e.IM.FromAgentID != UUID.Zero && e.IM.FromAgentName != "Second Life")
//{
// bool autoRespond = false;
// AutoResponseType art = (AutoResponseType)instance.GlobalSettings["auto_response_type"].AsInteger();
// // switch (art)
// // {
// // case AutoResponseType.WhenBusy: autoRespond = instance.State.IsBusy; break;
// // case AutoResponseType.WhenFromNonFriend: autoRespond = !instance.Client.Friends.FriendList.ContainsKey(e.IM.FromAgentID); break;
// // case AutoResponseType.Always: autoRespond = true; break;
// // }
// switch (art)
// {
// case AutoResponseType.WhenBusy: autoRespond = instance.State.IsBusy; break;
// case AutoResponseType.WhenFromNonFriend: autoRespond = !instance.Client.Friends.FriendList.ContainsKey(e.IM.FromAgentID); break;
// case AutoResponseType.Always: autoRespond = true; break;
// }
// // if (autoRespond)
// // {
// // AutoResponseSent = true;
// // instance.Client.Self.InstantMessage(instance.Client.Self.Name,
// // e.IM.FromAgentID,
// // instance.GlobalSettings["auto_response_text"].AsString(),
// // e.IM.IMSessionID,
// // InstantMessageDialog.BusyAutoResponse,
// // InstantMessageOnline.Online,
// // instance.Client.Self.RelativePosition,
// // instance.Client.Network.CurrentSim.ID,
// // null);
// if (autoRespond)
// {
// AutoResponseSent = true;
// instance.Client.Self.InstantMessage(instance.Client.Self.Name,
// e.IM.FromAgentID,
// instance.GlobalSettings["auto_response_text"].AsString(),
// e.IM.IMSessionID,
// InstantMessageDialog.BusyAutoResponse,
// InstantMessageOnline.Online,
// instance.Client.Self.RelativePosition,
// instance.Client.Network.CurrentSim.ID,
// null);
// // PrintIM(DateTime.Now, instance.Client.Self.Name, instance.Client.Self.AgentID, instance.GlobalSettings["auto_response_text"].AsString(), isNewMessage);
// // }
// //}
// }
// PrintIM(DateTime.Now, instance.Client.Self.Name, instance.Client.Self.AgentID, instance.GlobalSettings["auto_response_text"].AsString(), isNewMessage);
// }
//}
}
// public void DisplayNotification(string message)
// {
// if (instance.MainForm.InvokeRequired)
// {
// instance.MainForm.Invoke(new System.Windows.Forms.MethodInvoker(() => DisplayNotification(message)));
// return;
// }
public void DisplayNotification(string message)
{
//if (instance.MainForm.InvokeRequired)
//{
// instance.MainForm.Invoke(new System.Windows.Forms.MethodInvoker(() => DisplayNotification(message)));
// return;
//}
// if (ShowTimestamps)
// {
// if(fontSettings.ContainsKey("Timestamp"))
// {
// var fontSetting = fontSettings["Timestamp"];
// TextPrinter.ForeColor = fontSetting.ForeColor;
// TextPrinter.BackColor = fontSetting.BackColor;
// TextPrinter.Font = fontSetting.Font;
// TextPrinter.PrintText(DateTime.Now.ToString("[HH:mm] "));
// }
// else
// {
// TextPrinter.ForeColor = SystemColors.GrayText;
// TextPrinter.BackColor = Color.Transparent;
// TextPrinter.Font = Settings.FontSetting.DefaultFont;
// TextPrinter.PrintText(DateTime.Now.ToString("[HH:mm] "));
// }
// }
//todo
// if(fontSettings.ContainsKey("Notification"))
// {
// var fontSetting = fontSettings["Notification"];
// TextPrinter.ForeColor = fontSetting.ForeColor;
// TextPrinter.BackColor = fontSetting.BackColor;
// TextPrinter.Font = fontSetting.Font;
// }
// else
// {
// TextPrinter.ForeColor = Color.DarkCyan;
// TextPrinter.BackColor = Color.Transparent;
// TextPrinter.Font = Settings.FontSetting.DefaultFont;
// }
//if (ShowTimestamps)
//{
// if (fontSettings.ContainsKey("Timestamp"))
// {
// var fontSetting = fontSettings["Timestamp"];
// TextPrinter.ForeColor = fontSetting.ForeColor;
// TextPrinter.BackColor = fontSetting.BackColor;
// TextPrinter.Font = fontSetting.Font;
// TextPrinter.PrintText(DateTime.Now.ToString("[HH:mm] "));
// }
// else
// {
// TextPrinter.ForeColor = SystemColors.GrayText;
// TextPrinter.BackColor = Color.Transparent;
// TextPrinter.Font = Settings.FontSetting.DefaultFont;
// TextPrinter.PrintText(DateTime.Now.ToString("[HH:mm] "));
// }
//}
// instance.LogClientMessage(sessionName + ".txt", message);
// TextPrinter.PrintTextLine(message);
// }
//if (fontSettings.ContainsKey("Notification"))
//{
// var fontSetting = fontSettings["Notification"];
// TextPrinter.ForeColor = fontSetting.ForeColor;
// TextPrinter.BackColor = fontSetting.BackColor;
// TextPrinter.Font = fontSetting.Font;
//}
//else
//{
// TextPrinter.ForeColor = Color.DarkCyan;
// TextPrinter.BackColor = Color.Transparent;
// TextPrinter.Font = Settings.FontSetting.DefaultFont;
//}
// private void PrintIM(DateTime timestamp, string fromName, UUID fromID, string message, bool isNewMessage)
// {
// if (ShowTimestamps)
// {
// if(fontSettings.ContainsKey("Timestamp"))
// {
// var fontSetting = fontSettings["Timestamp"];
// TextPrinter.ForeColor = fontSetting.ForeColor;
// TextPrinter.BackColor = fontSetting.BackColor;
// TextPrinter.Font = fontSetting.Font;
// TextPrinter.PrintText(DateTime.Now.ToString("[HH:mm] "));
// }
// else
// {
// TextPrinter.ForeColor = SystemColors.GrayText;
// TextPrinter.BackColor = Color.Transparent;
// TextPrinter.Font = Settings.FontSetting.DefaultFont;
// TextPrinter.PrintText(DateTime.Now.ToString("[HH:mm] "));
// }
// }
instance.LogClientMessage(sessionName + ".txt", message);
TextPrinter.PrintTextLine(message);
}
// if(fontSettings.ContainsKey("Name"))
// {
// var fontSetting = fontSettings["Name"];
// TextPrinter.ForeColor = fontSetting.ForeColor;
// TextPrinter.BackColor = fontSetting.BackColor;
// TextPrinter.Font = fontSetting.Font;
// }
// else
// {
// TextPrinter.ForeColor = SystemColors.WindowText;
// TextPrinter.BackColor = Color.Transparent;
// TextPrinter.Font = Settings.FontSetting.DefaultFont;
// }
private void PrintIM(DateTime timestamp, string fromName, UUID fromID, string message, bool isNewMessage)
{
if (ShowTimestamps)
{
if (fontSettings.ContainsKey("Timestamp"))
{
var fontSetting = fontSettings["Timestamp"];
//TextPrinter.ForeColor = fontSetting.ForeColor;
//TextPrinter.BackColor = fontSetting.BackColor;
//TextPrinter.Font = fontSetting.Font;
TextPrinter.PrintText(DateTime.Now.ToString("[HH:mm] "));
}
else
{
//TextPrinter.ForeColor = SystemColors.GrayText;
//TextPrinter.BackColor = Color.Transparent;
//TextPrinter.Font = Settings.FontSetting.DefaultFont;
TextPrinter.PrintText(DateTime.Now.ToString("[HH:mm] "));
}
}
// if (instance.GlobalSettings["av_name_link"])
// {
// TextPrinter.InsertLink(fromName, $"secondlife:///app/agent/{fromID}/about");
// }
// else
// {
// TextPrinter.PrintText(fromName);
// }
if (fontSettings.ContainsKey("Name"))
{
var fontSetting = fontSettings["Name"];
//TextPrinter.ForeColor = fontSetting.ForeColor;
//TextPrinter.BackColor = fontSetting.BackColor;
//TextPrinter.Font = fontSetting.Font;
}
else
{
//TextPrinter.ForeColor = SystemColors.WindowText;
//TextPrinter.BackColor = Color.Transparent;
//TextPrinter.Font = Settings.FontSetting.DefaultFont;
}
// StringBuilder sb = new StringBuilder();
if (instance.GlobalSettings["av_name_link"])
{
TextPrinter.InsertLink(fromName, $"secondlife:///app/agent/{fromID}/about");
}
else
{
TextPrinter.PrintText(fromName);
}
// if (message.StartsWith("/me "))
// {
// if(fontSettings.ContainsKey("Emote"))
// {
// var fontSetting = fontSettings["Emote"];
// TextPrinter.ForeColor = fontSetting.ForeColor;
// TextPrinter.BackColor = fontSetting.BackColor;
// TextPrinter.Font = fontSetting.Font;
// }
// else
// {
// TextPrinter.ForeColor = SystemColors.WindowText;
// TextPrinter.BackColor = Color.Transparent;
// TextPrinter.Font = Settings.FontSetting.DefaultFont;
// }
StringBuilder sb = new StringBuilder();
// sb.Append(message.Substring(3));
// }
// else
// {
// if(fromID == instance.Client.Self.AgentID)
// {
// if(fontSettings.ContainsKey("OutgoingIM"))
// {
// var fontSetting = fontSettings["OutgoingIM"];
// TextPrinter.ForeColor = fontSetting.ForeColor;
// TextPrinter.BackColor = fontSetting.BackColor;
// TextPrinter.Font = fontSetting.Font;
// }
// else
// {
// TextPrinter.ForeColor = SystemColors.WindowText;
// TextPrinter.BackColor = Color.Transparent;
// TextPrinter.Font = Settings.FontSetting.DefaultFont;
// }
// }
// else
// {
// if(fontSettings.ContainsKey("IncomingIM"))
// {
// var fontSetting = fontSettings["IncomingIM"];
// TextPrinter.ForeColor = fontSetting.ForeColor;
// TextPrinter.BackColor = fontSetting.BackColor;
// TextPrinter.Font = fontSetting.Font;
// }
// else
// {
// TextPrinter.ForeColor = SystemColors.WindowText;
// TextPrinter.BackColor = Color.Transparent;
// TextPrinter.Font = Settings.FontSetting.DefaultFont;
// }
// }
if (message.StartsWith("/me "))
{
if (fontSettings.ContainsKey("Emote"))
{
var fontSetting = fontSettings["Emote"];
//TextPrinter.ForeColor = fontSetting.ForeColor;
//TextPrinter.BackColor = fontSetting.BackColor;
//TextPrinter.Font = fontSetting.Font;
}
else
{
//TextPrinter.ForeColor = SystemColors.WindowText;
//TextPrinter.BackColor = Color.Transparent;
//TextPrinter.Font = Settings.FontSetting.DefaultFont;
}
// sb.Append(": ");
// sb.Append(message);
// }
sb.Append(message.Substring(3));
}
else
{
if (fromID == instance.Client.Self.AgentID)
{
if (fontSettings.ContainsKey("OutgoingIM"))
{
var fontSetting = fontSettings["OutgoingIM"];
//TextPrinter.ForeColor = fontSetting.ForeColor;
//TextPrinter.BackColor = fontSetting.BackColor;
//TextPrinter.Font = fontSetting.Font;
}
else
{
//TextPrinter.ForeColor = SystemColors.WindowText;
//TextPrinter.BackColor = Color.Transparent;
//TextPrinter.Font = Settings.FontSetting.DefaultFont;
}
}
else
{
if (fontSettings.ContainsKey("IncomingIM"))
{
var fontSetting = fontSettings["IncomingIM"];
//TextPrinter.ForeColor = fontSetting.ForeColor;
//TextPrinter.BackColor = fontSetting.BackColor;
//TextPrinter.Font = fontSetting.Font;
}
else
{
//TextPrinter.ForeColor = SystemColors.WindowText;
//TextPrinter.BackColor = Color.Transparent;
//TextPrinter.Font = Settings.FontSetting.DefaultFont;
}
}
// if(isNewMessage)
// {
// instance.LogClientMessage(sessionName + ".txt", fromName + sb);
// }
sb.Append(": ");
sb.Append(message);
}
// TextPrinter.PrintTextLine(sb.ToString());
// }
if (isNewMessage)
{
instance.LogClientMessage(sessionName + ".txt", fromName + sb);
}
// public static string ReadEndTokens(string path, Int64 numberOfTokens, Encoding encoding, string tokenSeparator)
// {
TextPrinter.PrintTextLine(sb.ToString());
}
// int sizeOfChar = encoding.GetByteCount("\n");
// byte[] buffer = encoding.GetBytes(tokenSeparator);
public static string ReadEndTokens(string path, Int64 numberOfTokens, Encoding encoding, string tokenSeparator)
{
int sizeOfChar = encoding.GetByteCount("\n");
byte[] buffer = encoding.GetBytes(tokenSeparator);
// using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
// {
// Int64 tokenCount = 0;
// Int64 endPosition = fs.Length / sizeOfChar;
using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
{
Int64 tokenCount = 0;
Int64 endPosition = fs.Length / sizeOfChar;
// for (Int64 position = sizeOfChar; position < endPosition; position += sizeOfChar)
// {
// fs.Seek(-position, SeekOrigin.End);
// fs.Read(buffer, 0, buffer.Length);
for (Int64 position = sizeOfChar; position < endPosition; position += sizeOfChar)
{
fs.Seek(-position, SeekOrigin.End);
fs.Read(buffer, 0, buffer.Length);
// if (encoding.GetString(buffer) == tokenSeparator)
// {
// tokenCount++;
// if (tokenCount == numberOfTokens)
// {
// byte[] returnBuffer = new byte[fs.Length - fs.Position];
// fs.Read(returnBuffer, 0, returnBuffer.Length);
// return encoding.GetString(returnBuffer);
// }
// }
// }
if (encoding.GetString(buffer) == tokenSeparator)
{
tokenCount++;
if (tokenCount == numberOfTokens)
{
byte[] returnBuffer = new byte[fs.Length - fs.Position];
fs.Read(returnBuffer, 0, returnBuffer.Length);
return encoding.GetString(returnBuffer);
}
}
}
// // handle case where number of tokens in file is less than numberOfTokens
// fs.Seek(0, SeekOrigin.Begin);
// buffer = new byte[fs.Length];
// fs.Read(buffer, 0, buffer.Length);
// return encoding.GetString(buffer);
// }
// }
// handle case where number of tokens in file is less than numberOfTokens
fs.Seek(0, SeekOrigin.Begin);
buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
return encoding.GetString(buffer);
}
}
// private void PrintLastLog()
// {
// string last = string.Empty;
// try
// {
// last = ReadEndTokens(instance.ChatFileName(sessionName + ".txt"), 20, Encoding.UTF8, Environment.NewLine);
// }
// catch { }
private void PrintLastLog()
{
string last = string.Empty;
try
{
last = ReadEndTokens(instance.ChatFileName(sessionName + ".txt"), 20, Encoding.UTF8, Environment.NewLine);
}
catch { }
// if (string.IsNullOrEmpty(last))
// {
// return;
// }
if (string.IsNullOrEmpty(last))
{
return;
}
// string[] lines = last.Split(Environment.NewLine.ToCharArray());
// foreach (var line in lines)
// {
// string msg = line.Trim();
// if (!string.IsNullOrEmpty(msg))
// {
// if(fontSettings.ContainsKey("History"))
// {
// var fontSetting = fontSettings["History"];
// TextPrinter.ForeColor = fontSetting.ForeColor;
// TextPrinter.BackColor = fontSetting.BackColor;
// TextPrinter.Font = fontSetting.Font;
// }
// else
// {
// TextPrinter.ForeColor = SystemColors.GrayText;
// TextPrinter.BackColor = Color.Transparent;
// TextPrinter.Font = Settings.FontSetting.DefaultFont;
// }
// TextPrinter.PrintTextLine(msg);
// }
// }
string[] lines = last.Split(Environment.NewLine.ToCharArray());
foreach (var line in lines)
{
string msg = line.Trim();
if (!string.IsNullOrEmpty(msg))
{
if (fontSettings.ContainsKey("History"))
{
var fontSetting = fontSettings["History"];
//TextPrinter.ForeColor = fontSetting.ForeColor;
//TextPrinter.BackColor = fontSetting.BackColor;
//TextPrinter.Font = fontSetting.Font;
}
else
{
//TextPrinter.ForeColor = SystemColors.GrayText;
//TextPrinter.BackColor = Color.Transparent;
//TextPrinter.Font = Settings.FontSetting.DefaultFont;
}
TextPrinter.PrintTextLine(msg);
}
}
// if(fontSettings.ContainsKey("History"))
// {
// var fontSetting = fontSettings["History"];
// TextPrinter.ForeColor = fontSetting.ForeColor;
// TextPrinter.BackColor = fontSetting.BackColor;
// TextPrinter.Font = fontSetting.Font;
// }
// else
// {
// TextPrinter.ForeColor = SystemColors.GrayText;
// TextPrinter.BackColor = Color.Transparent;
// TextPrinter.Font = Settings.FontSetting.DefaultFont;
// }
// TextPrinter.PrintTextLine("====");
// }
if (fontSettings.ContainsKey("History"))
{
var fontSetting = fontSettings["History"];
//TextPrinter.ForeColor = fontSetting.ForeColor;
//TextPrinter.BackColor = fontSetting.BackColor;
//TextPrinter.Font = fontSetting.Font;
}
else
{
//TextPrinter.ForeColor = SystemColors.GrayText;
//TextPrinter.BackColor = Color.Transparent;
//TextPrinter.Font = Settings.FontSetting.DefaultFont;
}
TextPrinter.PrintTextLine("====");
}
// public void ReprintAllText()
// {
// TextPrinter.ClearText();
// PrintLastLog();
// foreach (object obj in textBuffer)
// ProcessIM(obj, false);
// }
public void ReprintAllText()
{
TextPrinter.ClearText();
PrintLastLog();
foreach (object obj in textBuffer)
ProcessIM(obj, false);
}
// public void ClearInternalBuffer()
// {
// textBuffer.Clear();
// }
public void ClearInternalBuffer()
{
textBuffer.Clear();
}
// public void CleanUp()
// {
// RemoveNetcomEvents();
public void CleanUp()
{
RemoveNetcomEvents();
// textBuffer.Clear();
// textBuffer = null;
textBuffer.Clear();
textBuffer = null;
// TextPrinter = null;
// }
TextPrinter = null;
}
// public ITextPrinter TextPrinter { get; set; }
public ITextPrinter TextPrinter { get; set; } //a reference to a generic text printer (whose job is to print into a tectbox nicely.)
// public bool ShowTimestamps { get; set; }
public bool ShowTimestamps { get; set; }
// public UUID SessionID { get; set; }
// }
public UUID SessionID { get; set; }
}
// public enum IMTextManagerType
// {
// Agent,
// Group,
// Conference
// }
//}
public enum IMTextManagerType
{
Agent,
Group,
Conference
}
}
+172
View File
@@ -0,0 +1,172 @@
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using Raindrop;
using Raindrop.Netcom;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Raindrop
{
class LoginUtils
{
// this function saves content of loginoptions to globalsettings file.
public static void SaveConfig(LoginOptions loginoptions, Raindrop.Settings globalSettings)
{
Raindrop.Settings s = globalSettings;
SavedLogin sl = new SavedLogin();
string username = loginoptions.FirstName + " " + loginoptions.LastName;
string Password = loginoptions.Password;
//if (cbxUsername.SelectedIndex > 0 && cbxUsername.SelectedItem is SavedLogin)
//{
// username = ((SavedLogin)cbxUsername.SelectedItem).Username;
//}
if (loginoptions.GridLoginUri != string.Empty) // custom login uri
{
sl.GridID = "custom_login_uri";
sl.CustomURI = loginoptions.GridLoginUri;
}
else
{
sl.GridID = loginoptions.Grid.ID; //GridID;//netcom.LoginOptions.Grid.ID; //(GridDropdownGO.SelectedItem as Grid).ID;
sl.CustomURI = string.Empty;
}
string savedLoginsKey = string.Format("{0}%{1}", username, sl.GridID);
if (!(s["saved_logins"] is OSDMap))
{
s["saved_logins"] = new OSDMap();
}
if (loginoptions.IsSaveCredentials)
{
sl.Username = s["username"] = username;
if (LoginOptions.IsPasswordMD5(Password))
{
sl.Password = Password;
s["password"] = Password;
}
else
{
sl.Password = Utils.MD5(Password);
s["password"] = Utils.MD5(Password);
}
//if (cbxLocation.SelectedIndex == -1)
//{
// sl.CustomStartLocation = cbxLocation.Text;
//}
//else
//{
// sl.CustomStartLocation = string.Empty;
//}
//sl.StartLocationType = cbxLocation.SelectedIndex;
((OSDMap)s["saved_logins"])[savedLoginsKey] = sl.ToOSD(); //settings_map["saved_logins"] -> savedloginsmap; savedloginsmap[savedLoginsKey] -> set: sl.ToOSD(); where savedLoginsKey is username+gridID
}
else if (((OSDMap)s["saved_logins"]).ContainsKey(savedLoginsKey))
{
((OSDMap)s["saved_logins"]).Remove(savedLoginsKey);
}
//s["login_location_type"] = OSD.FromInteger(cbxLocation.SelectedIndex);
//s["login_location"] = OSD.FromString(cbxLocation.Text);
//s["login_grid"] = OSD.FromInteger(gridmgr.); //note: this was removed as this was literally a magic number (int) that corresponds to the position of the dropbox selection.
s["login_uri"] = OSD.FromString(loginoptions.GridLoginUri);
s["remember_login"] = OSD.FromBoolean (loginoptions.IsSaveCredentials);
}
public class SavedLogin
{
public string Username;
public string Password;
public string GridID;
public string CustomURI;
public int StartLocationType;
public string CustomStartLocation;
public OSDMap ToOSD()
{
OSDMap ret = new OSDMap(4);
ret["username"] = Username;
ret["password"] = Password;
ret["grid"] = GridID;
ret["custom_url"] = CustomURI;
ret["location_type"] = StartLocationType;
ret["custom_location"] = CustomStartLocation;
return ret;
}
public static SavedLogin FromOSD(OSD data)
{
if (!(data is OSDMap)) return null;
OSDMap map = (OSDMap)data;
SavedLogin ret = new SavedLogin();
ret.Username = map["username"];
ret.Password = map["password"];
ret.GridID = map["grid"];
ret.CustomURI = map["custom_url"];
if (map.ContainsKey("location_type"))
{
ret.StartLocationType = map["location_type"];
}
else
{
ret.StartLocationType = 1;
}
ret.CustomStartLocation = map["custom_location"];
return ret;
}
public override string ToString()
{
RaindropInstance instance = RaindropInstance.GlobalInstance;
string gridName;
if (GridID == "custom_login_uri")
{
gridName = "Custom Login URI";
}
else if (instance.GridManger.KeyExists(GridID))
{
gridName = instance.GridManger[GridID].Name;
}
else
{
gridName = GridID;
}
return string.Format("{0} -- {1}", Username, gridName);
}
}
//clear the content of disk-cached user and pass. (UI side)
private void ClearConfig(Settings s)
{
//Settings s = settings;
s["username"] = string.Empty;
s["password"] = string.Empty;
}
public static bool getRememberFromSettings (Settings settings)
{
Settings s = settings;
return (bool) s["remember_login"];
}
public static void setRememberToSettings(Settings settings, bool isRemember)
{
Settings s = settings;
settings["remember_login"] = isRemember;
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c01d5deb6b6476e43b05eba1dd972bd9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+55
View File
@@ -44,6 +44,9 @@ namespace Raindrop
private bool turningRight = false;
private bool movingForward = false;
private bool movingBackward = false;
private bool movingLeftward = false;
private bool movingRightward = false;
//private bool modified = false;
public bool TurningLeft
{
@@ -53,6 +56,7 @@ namespace Raindrop
}
set
{
//modified = true;
turningLeft = value;
if (value)
{
@@ -76,6 +80,7 @@ namespace Raindrop
}
set
{
//modified = true;
turningRight = value;
if (value)
{
@@ -99,6 +104,7 @@ namespace Raindrop
}
set
{
//modified = true;
movingForward = value;
if (value)
{
@@ -121,6 +127,7 @@ namespace Raindrop
}
set
{
//modified = true;
movingBackward = value;
if (value)
{
@@ -135,6 +142,54 @@ namespace Raindrop
}
}
}
public bool MovingLeftward
{
get
{
return movingLeftward;
}
set
{
//modified = true;
movingLeftward = value;
if (value)
{
client.Self.Movement.LeftPos = true;
client.Self.Movement.SendUpdate(true);
}
else
{
client.Self.Movement.LeftPos = false;
client.Self.Movement.SendUpdate(true);
}
}
}
public bool MovingRight
{
get
{
return movingRightward;
}
set
{
//modified = true;
movingRightward = value;
if (value)
{
client.Self.Movement.LeftNeg = true;
client.Self.Movement.SendUpdate(true);
}
else
{
client.Self.Movement.LeftNeg= false;
client.Self.Movement.SendUpdate(true);
}
}
}
public RaindropMovement(RaindropInstance instance)
{
+10 -4
View File
@@ -45,8 +45,9 @@ namespace Raindrop.Netcom
private string startLocationCustom = string.Empty;
private Grid grid;
private string gridCustomLoginUri = string.Empty;
private string gridLoginUri = string.Empty;
private LastExecStatus lastExecEvent = LastExecStatus.Normal;
private bool isSaveCredentials;
public LoginOptions()
@@ -118,10 +119,10 @@ namespace Raindrop.Netcom
set { grid = value; }
}
public string GridCustomLoginUri
public string GridLoginUri
{
get { return gridCustomLoginUri; }
set { gridCustomLoginUri = value; }
get { return gridLoginUri; }
set { gridLoginUri = value; }
}
public LastExecStatus LastExecEvent
@@ -129,5 +130,10 @@ namespace Raindrop.Netcom
get { return lastExecEvent; }
set { lastExecEvent = value; }
}
public bool IsSaveCredentials {
get => isSaveCredentials;
set => isSaveCredentials = value;
}
}
}
+4 -1
View File
@@ -67,7 +67,7 @@ namespace Raindrop
//private frmMain mainForm; //frmMain is a class that inherits RadegastForm. It seems to be the code-behind of the overall UI, that includes the view and buttons.
private mainUIManager mainCanvas;
private RaindropUnitySceneRenderer mainWorldRenderer;
//private RaindropUnitySceneRenderer mainWorldRenderer;
// Singleton, there can be only one instance
private static RaindropInstance globalInstance = null;
@@ -107,6 +107,7 @@ namespace Raindrop
/// <summary>
/// Grid client's user dir for settings and logs
/// ala the path combined with the account's full name
/// </summary>
public string ClientDir
{
@@ -612,6 +613,7 @@ namespace Raindrop
return fileName;
}
//obtains the relevant filepath/name.
public string ChatFileName(string session)
{
string fileName = session;
@@ -624,6 +626,7 @@ namespace Raindrop
return Path.Combine(ClientDir, fileName);
}
//this method will log all messages to the relevant file.
public void LogClientMessage(string sessioName, string message)
{
if (globalSettings["disable_chat_im_log"]) return;
+5 -1
View File
@@ -5,7 +5,11 @@
"GUID:b6ef318018e211441b43da945a1caf13",
"GUID:560b04d1a97f54a4e82edc0cbbb69285",
"GUID:6055be8ebefd69e48b49212b09b47b2f",
"GUID:9dcc7c0610df60a49a59da5f5f76ac0b"
"GUID:9dcc7c0610df60a49a59da5f5f76ac0b",
"GUID:d8b63aba1907145bea998dd612889d6b",
"GUID:2665a8d13d1b3f18800f46e256720795",
"GUID:82c7e6eac44d7e048b22ad98800dcfc7",
"GUID:247a163e3cc6efb42bd22b9023b87ff3"
],
"includePlatforms": [],
"excludePlatforms": [],
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 58c9a8d4e41202344b977b2dcfcdcb27
guid: aeafe6f7f5372694b8ae10ad5b8c13d1
folderAsset: yes
DefaultImporter:
externalObjects: {}
+84
View File
@@ -0,0 +1,84 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Water Material
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 3
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 0.2688679, g: 0.8321994, b: 1, a: 0.30588236}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.24973297, g: 0.80092263, b: 0.8679245, a: 0.5529412}
m_BuildTextureStacks: []
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1e01adcfbed955e4885c1149aadbd674
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
+102
View File
@@ -0,0 +1,102 @@
fileFormatVersion: 2
guid: 97cea9270fd066b4490b0c198f20745e
ModelImporter:
serializedVersion: 20200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:
+129
View File
@@ -0,0 +1,129 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Jobs;
using Unity.Collections;
using Unity.Burst;
using Unity.Jobs;
using Unity.Mathematics;
public class WaveGenerator : MonoBehaviour
{
[Header("Wave Parameters")]
public float waveScale;
public float waveOffsetSpeed;
public float waveHeight;
[Header("References and Prefabs")]
public MeshFilter waterMeshFilter;
private Mesh waterMesh;
NativeArray<Vector3> waterVertices;
NativeArray<Vector3> waterNormals;
JobHandle meshModificationJobHandle; // 1
UpdateMeshJob meshModificationJob; // 2
[BurstCompile]
private struct UpdateMeshJob : IJobParallelFor
{
// 1
public NativeArray<Vector3> vertices;
// 2
[ReadOnly]
public NativeArray<Vector3> normals;
// 3
public float offsetSpeed;
public float scale;
public float height;
// 4
public float time;
private float Noise(float x, float y)
{
float2 pos = math.float2(x, y);
return noise.snoise(pos);
}
public void Execute(int i)
{
// 1
if (normals[i].z > 0f)
{
// 2
var vertex = vertices[i];
// 3
float noiseValue =
Noise(vertex.x * scale + offsetSpeed * time, vertex.y * scale +
offsetSpeed * time);
// 4
vertices[i] =
new Vector3(vertex.x, vertex.y, noiseValue * height + 0.3f);
}
}
}
private void Start()
{
waterMesh = waterMeshFilter.mesh;
waterMesh.MarkDynamic(); // 1
waterVertices =
new NativeArray<Vector3>(waterMesh.vertices, Allocator.Persistent); // 2
waterNormals =
new NativeArray<Vector3>(waterMesh.normals, Allocator.Persistent);
}
private void OnDestroy()
{
waterVertices.Dispose();
waterNormals.Dispose();
}
private void Update()
{
// 1
meshModificationJob = new UpdateMeshJob()
{
vertices = waterVertices,
normals = waterNormals,
offsetSpeed = waveOffsetSpeed,
time = Time.time,
scale = waveScale,
height = waveHeight
};
// 2
meshModificationJobHandle =
meshModificationJob.Schedule(waterVertices.Length, 64);
}
private void LateUpdate()
{
// 1
meshModificationJobHandle.Complete();
// 2
waterMesh.SetVertices(meshModificationJob.vertices);
// 3
waterMesh.RecalculateNormals();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c28691974fb6987488fd885619c2eb39
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,177 +1,177 @@
//
// Radegast Metaverse Client
// Copyright (c) 2009-2014, Radegast Development Team
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the application "Radegast", nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// $Id$
//
using OpenMetaverse;
using System.Collections.Generic;
using UnityEngine;
using Raindrop.Rendering;
using Raindrop.Render;
using System.Threading;
using OpenMetaverse.Rendering;
////
//// Radegast Metaverse Client
//// Copyright (c) 2009-2014, Radegast Development Team
//// All rights reserved.
////
//// Redistribution and use in source and binary forms, with or without
//// modification, are permitted provided that the following conditions are met:
////
//// * Redistributions of source code must retain the above copyright notice,
//// this list of conditions and the following disclaimer.
//// * Redistributions in binary form must reproduce the above copyright
//// notice, this list of conditions and the following disclaimer in the
//// documentation and/or other materials provided with the distribution.
//// * Neither the name of the application "Radegast", nor the names of its
//// contributors may be used to endorse or promote products derived from
//// this software without specific prior written permission.
////
//// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
//// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
//// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
//// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
//// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
//// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
//// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
//// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
//// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
////
//// $Id$
////
//using OpenMetaverse;
//using System.Collections.Generic;
//using UnityEngine;
//using Raindrop.Rendering;
//using Raindrop.Render;
//using System.Threading;
//using OpenMetaverse.Rendering;
namespace Raindrop
{
//I render stuff into the unity scene!
public class RaindropUnitySceneRenderer: MonoBehaviour
{
RaindropInstance Instance;
GridClient Client => Instance.Client;
Simulator sim => Instance.Client.Network.CurrentSim;
//namespace Raindrop
//{
// //I render stuff into the unity scene!
// public class RaindropUnitySceneRenderer: MonoBehaviour
// {
// RaindropInstance Instance;
// GridClient Client => Instance.Client;
// Simulator sim => Instance.Client.Network.CurrentSim;
public bool Modified = true;
float[,] heightTable = new float[256, 256];
Face terrainFace;
uint[] terrainIndices;
ColorVertex[] terrainVertices;
// public bool Modified = true;
// float[,] heightTable = new float[256, 256];
// Face terrainFace;
// uint[] terrainIndices;
// ColorVertex[] terrainVertices;
bool terrainInProgress = false;
bool terrainTextureNeedsUpdate = false;
float terrainTimeSinceUpdate = Rendering.RenderSettings.MinimumTimeBetweenTerrainUpdated + 1f; // Update terrain om first run
// bool terrainInProgress = false;
// bool terrainTextureNeedsUpdate = false;
// float terrainTimeSinceUpdate = Rendering.RenderSettings.MinimumTimeBetweenTerrainUpdated + 1f; // Update terrain om first run
bool fetchingTerrainTexture = false;
// bool fetchingTerrainTexture = false;
Texture2D terrainImage = null;
MeshmerizerR meshrenderer;
// Texture2D terrainImage = null;
// MeshmerizerR meshrenderer;
private GameObject land;
private GameObject Avatar;
private List<GameObject> SimAvatarList;
// private GameObject land;
// private GameObject Avatar;
// private List<GameObject> SimAvatarList;
public RaindropUnitySceneRenderer()
{
//terrainImage = new Texture2D(1024,1024);
//terrainImage.hideFlags = HideFlags.HideAndDontSave;
// public RaindropUnitySceneRenderer()
// {
// //terrainImage = new Texture2D(1024,1024);
// //terrainImage.hideFlags = HideFlags.HideAndDontSave;
terrainImage = TempImageManager.CreateTexture2D(1024, 1024);
// terrainImage = TempImageManager.CreateTexture2D(1024, 1024);
}
// }
public void ResetTerrain()
{
ResetTerrain(true);
}
// public void ResetTerrain()
// {
// ResetTerrain(true);
// }
public void ResetTerrain(bool removeImage)
{
if (terrainImage != null)
{
TempImageManager.Destroy(terrainImage);
//RenderedTextureManager.dispose();
//terrainImage.Dispose();
terrainImage = null;
}
// public void ResetTerrain(bool removeImage)
// {
// if (terrainImage != null)
// {
// TempImageManager.Destroy(terrainImage);
// //RenderedTextureManager.dispose();
// //terrainImage.Dispose();
// terrainImage = null;
// }
fetchingTerrainTexture = false;
Modified = true;
}
// fetchingTerrainTexture = false;
// Modified = true;
// }
private void UpdateTerrain()
{
if (sim == null || sim.Terrain == null) return;
// private void UpdateTerrain()
// {
// if (sim == null || sim.Terrain == null) return;
ThreadPool.QueueUserWorkItem(sync =>
{
int step = 1;
// ThreadPool.QueueUserWorkItem(sync =>
// {
// int step = 1;
for (int x = 0; x < 256; x += step)
{
for (int y = 0; y < 256; y += step)
{
float z = 0;
int patchNr = ((int)x / 16) * 16 + (int)y / 16;
if (sim.Terrain[patchNr] != null
&& sim.Terrain[patchNr].Data != null)
{
float[] data = sim.Terrain[patchNr].Data;
z = data[(int)x % 16 * 16 + (int)y % 16];
}
heightTable[x, y] = z;
}
}
// for (int x = 0; x < 256; x += step)
// {
// for (int y = 0; y < 256; y += step)
// {
// float z = 0;
// int patchNr = ((int)x / 16) * 16 + (int)y / 16;
// if (sim.Terrain[patchNr] != null
// && sim.Terrain[patchNr].Data != null)
// {
// float[] data = sim.Terrain[patchNr].Data;
// z = data[(int)x % 16 * 16 + (int)y % 16];
// }
// heightTable[x, y] = z;
// }
// }
terrainFace = meshrenderer.TerrainMesh(heightTable, 0f, 255f, 0f, 255f);
terrainVertices = new ColorVertex[terrainFace.Vertices.Count];
for (int i = 0; i < terrainFace.Vertices.Count; i++)
{
byte[] part = Utils.IntToBytes(i);
terrainVertices[i] = new ColorVertex()
{
Vertex = terrainFace.Vertices[i],
Color = new Color4b()
{
R = part[0],
G = part[1],
B = part[2],
A = 253 // terrain picking
}
};
}
terrainIndices = new uint[terrainFace.Indices.Count];
for (int i = 0; i < terrainIndices.Length; i++)
{
terrainIndices[i] = terrainFace.Indices[i];
}
terrainInProgress = false;
Modified = false;
terrainTextureNeedsUpdate = true;
terrainTimeSinceUpdate = 0f;
});
}
// terrainFace = meshrenderer.TerrainMesh(heightTable, 0f, 255f, 0f, 255f);
// terrainVertices = new ColorVertex[terrainFace.Vertices.Count];
// for (int i = 0; i < terrainFace.Vertices.Count; i++)
// {
// byte[] part = Utils.IntToBytes(i);
// terrainVertices[i] = new ColorVertex()
// {
// Vertex = terrainFace.Vertices[i],
// Color = new Color4b()
// {
// R = part[0],
// G = part[1],
// B = part[2],
// A = 253 // terrain picking
// }
// };
// }
// terrainIndices = new uint[terrainFace.Indices.Count];
// for (int i = 0; i < terrainIndices.Length; i++)
// {
// terrainIndices[i] = terrainFace.Indices[i];
// }
// terrainInProgress = false;
// Modified = false;
// terrainTextureNeedsUpdate = true;
// terrainTimeSinceUpdate = 0f;
// });
// }
void UpdateTerrainTexture()
{
if (!fetchingTerrainTexture)
{
fetchingTerrainTexture = true;
ThreadPool.QueueUserWorkItem(sync =>
{
Simulator sim = Client.Network.CurrentSim;
terrainImage = TerrainSplat.Splat(Instance, heightTable,
new UUID[] { sim.TerrainDetail0, sim.TerrainDetail1, sim.TerrainDetail2, sim.TerrainDetail3 },
new float[] { sim.TerrainStartHeight00, sim.TerrainStartHeight01, sim.TerrainStartHeight10, sim.TerrainStartHeight11 },
new float[] { sim.TerrainHeightRange00, sim.TerrainHeightRange01, sim.TerrainHeightRange10, sim.TerrainHeightRange11 });
// void UpdateTerrainTexture()
// {
// if (!fetchingTerrainTexture)
// {
// fetchingTerrainTexture = true;
// ThreadPool.QueueUserWorkItem(sync =>
// {
// Simulator sim = Client.Network.CurrentSim;
// terrainImage = TerrainSplat.Splat(Instance, heightTable,
// new UUID[] { sim.TerrainDetail0, sim.TerrainDetail1, sim.TerrainDetail2, sim.TerrainDetail3 },
// new float[] { sim.TerrainStartHeight00, sim.TerrainStartHeight01, sim.TerrainStartHeight10, sim.TerrainStartHeight11 },
// new float[] { sim.TerrainHeightRange00, sim.TerrainHeightRange01, sim.TerrainHeightRange10, sim.TerrainHeightRange11 });
fetchingTerrainTexture = false;
terrainTextureNeedsUpdate = false;
});
}
}
// fetchingTerrainTexture = false;
// terrainTextureNeedsUpdate = false;
// });
// }
// }
}
}
// }
//}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+272 -272
View File
@@ -32,311 +32,311 @@ using OpenMetaverse.Rendering;
namespace Raindrop.Rendering
{
[StructLayout(LayoutKind.Sequential)]
public struct Color4b
{
public byte R;
public byte G;
public byte B;
public byte A;
}
//[StructLayout(LayoutKind.Sequential)]
//public struct Color4b
//{
// public byte R;
// public byte G;
// public byte B;
// public byte A;
//}
[StructLayout(LayoutKind.Explicit)]
public struct ColorVertex
{
[FieldOffset(0)]
public Vertex Vertex;
[FieldOffset(32)]
public Color4b Color;
public static int Size = 36;
}
//[StructLayout(LayoutKind.Explicit)]
//public struct ColorVertex
//{
// [FieldOffset(0)]
// public Vertex Vertex;
// [FieldOffset(32)]
// public Color4b Color;
// public static int Size = 36;
//}
public class TextureInfo
{
public Image Texture;
public int TexturePointer;
public bool HasAlpha;
public bool FullAlpha;
public bool IsMask;
public bool IsInvisible;
public UUID TextureID;
public bool FetchFailed;
}
//public class TextureInfo
//{
// public Image Texture;
// public int TexturePointer;
// public bool HasAlpha;
// public bool FullAlpha;
// public bool IsMask;
// public bool IsInvisible;
// public UUID TextureID;
// public bool FetchFailed;
//}
public class TextureLoadItem
{
public FaceData Data;
public Primitive Prim;
public Primitive.TextureEntryFace TeFace;
public byte[] TextureData = null;
public byte[] TGAData = null;
public bool LoadAssetFromCache = false;
public ImageType ImageType = ImageType.Normal;
public string BakeName = string.Empty;
public UUID AvatarID = UUID.Zero;
}
//public class TextureLoadItem
//{
// public FaceData Data;
// public Primitive Prim;
// public Primitive.TextureEntryFace TeFace;
// public byte[] TextureData = null;
// public byte[] TGAData = null;
// public bool LoadAssetFromCache = false;
// public ImageType ImageType = ImageType.Normal;
// public string BakeName = string.Empty;
// public UUID AvatarID = UUID.Zero;
//}
public enum RenderPass
{
Picking,
Simple,
Alpha,
Invisible
}
//public enum RenderPass
//{
// Picking,
// Simple,
// Alpha,
// Invisible
//}
public enum SceneObjectType
{
None,
Primitive,
Avatar,
}
//public enum SceneObjectType
//{
// None,
// Primitive,
// Avatar,
//}
/// <summary>
/// Base class for all scene objects
/// </summary>
public abstract class SceneObject : IComparable, IDisposable
{
#region Public fields
/// <summary>Interpolated local position of the object</summary>
public Vector3 InterpolatedPosition;
/// <summary>Interpolated local rotation of the object</summary>
public Quaternion InterpolatedRotation;
/// <summary>Rendered position of the object in the region</summary>
public Vector3 RenderPosition;
/// <summary>Rendered rotationm of the object in the region</summary>
public Quaternion RenderRotation;
/// <summary>Per frame calculated square of the distance from camera</summary>
public float DistanceSquared;
/// <summary>Bounding volume of the object</summary>
public BoundingVolume BoundingVolume;
/// <summary>Was the sim position and distance from camera calculated during this frame</summary>
public bool PositionCalculated;
/// <summary>Scene object type</summary>
public SceneObjectType Type = SceneObjectType.None;
/// <summary>Libomv primitive</summary>
public virtual Primitive BasePrim { get; set; }
/// <summary>Were initial initialization tasks done</summary>
public bool Initialized;
/// <summary>Is this object disposed</summary>
public bool IsDisposed = false;
public int AlphaQueryID = -1;
public int SimpleQueryID = -1;
public bool HasAlphaFaces;
public bool HasSimpleFaces;
public bool HasInvisibleFaces;
///// <summary>
///// Base class for all scene objects
///// </summary>
//public abstract class SceneObject : IComparable, IDisposable
//{
// #region Public fields
// /// <summary>Interpolated local position of the object</summary>
// public Vector3 InterpolatedPosition;
// /// <summary>Interpolated local rotation of the object</summary>
// public Quaternion InterpolatedRotation;
// /// <summary>Rendered position of the object in the region</summary>
// public Vector3 RenderPosition;
// /// <summary>Rendered rotationm of the object in the region</summary>
// public Quaternion RenderRotation;
// /// <summary>Per frame calculated square of the distance from camera</summary>
// public float DistanceSquared;
// /// <summary>Bounding volume of the object</summary>
// public BoundingVolume BoundingVolume;
// /// <summary>Was the sim position and distance from camera calculated during this frame</summary>
// public bool PositionCalculated;
// /// <summary>Scene object type</summary>
// public SceneObjectType Type = SceneObjectType.None;
// /// <summary>Libomv primitive</summary>
// public virtual Primitive BasePrim { get; set; }
// /// <summary>Were initial initialization tasks done</summary>
// public bool Initialized;
// /// <summary>Is this object disposed</summary>
// public bool IsDisposed = false;
// public int AlphaQueryID = -1;
// public int SimpleQueryID = -1;
// public bool HasAlphaFaces;
// public bool HasSimpleFaces;
// public bool HasInvisibleFaces;
#endregion Public fields
// #endregion Public fields
uint previousParent = uint.MaxValue;
// uint previousParent = uint.MaxValue;
/// <summary>
/// Cleanup resources used
/// </summary>
public virtual void Dispose()
{
IsDisposed = true;
}
// /// <summary>
// /// Cleanup resources used
// /// </summary>
// public virtual void Dispose()
// {
// IsDisposed = true;
// }
/// <summary>
/// Task performed the fist time object is set for rendering
/// </summary>
public virtual void Initialize()
{
RenderPosition = InterpolatedPosition = BasePrim.Position;
RenderRotation = InterpolatedRotation = BasePrim.Rotation;
Initialized = true;
}
// /// <summary>
// /// Task performed the fist time object is set for rendering
// /// </summary>
// public virtual void Initialize()
// {
// RenderPosition = InterpolatedPosition = BasePrim.Position;
// RenderRotation = InterpolatedRotation = BasePrim.Rotation;
// Initialized = true;
// }
/// <summary>
/// Perform per frame tasks
/// </summary>
/// <param name="time">Time since the last call (last frame time in seconds)</param>
public virtual void Step(float time)
{
if (BasePrim == null) return;
// /// <summary>
// /// Perform per frame tasks
// /// </summary>
// /// <param name="time">Time since the last call (last frame time in seconds)</param>
// public virtual void Step(float time)
// {
// if (BasePrim == null) return;
// Don't interpolate when parent changes (sit/stand link/unlink)
if (previousParent != BasePrim.ParentID)
{
previousParent = BasePrim.ParentID;
InterpolatedPosition = BasePrim.Position;
InterpolatedRotation = BasePrim.Rotation;
return;
}
// // Don't interpolate when parent changes (sit/stand link/unlink)
// if (previousParent != BasePrim.ParentID)
// {
// previousParent = BasePrim.ParentID;
// InterpolatedPosition = BasePrim.Position;
// InterpolatedRotation = BasePrim.Rotation;
// return;
// }
// Linear velocity and acceleration
if (BasePrim.Velocity != Vector3.Zero)
{
BasePrim.Position = InterpolatedPosition = BasePrim.Position + BasePrim.Velocity * time
* 0.98f * RaindropInstance.GlobalInstance.Client.Network.CurrentSim.Stats.Dilation;
BasePrim.Velocity += BasePrim.Acceleration * time;
}
else if (InterpolatedPosition != BasePrim.Position)
{
InterpolatedPosition = RHelp.Smoothed1stOrder(InterpolatedPosition, BasePrim.Position, time);
}
// // Linear velocity and acceleration
// if (BasePrim.Velocity != Vector3.Zero)
// {
// BasePrim.Position = InterpolatedPosition = BasePrim.Position + BasePrim.Velocity * time
// * 0.98f * RaindropInstance.GlobalInstance.Client.Network.CurrentSim.Stats.Dilation;
// BasePrim.Velocity += BasePrim.Acceleration * time;
// }
// else if (InterpolatedPosition != BasePrim.Position)
// {
// InterpolatedPosition = RHelp.Smoothed1stOrder(InterpolatedPosition, BasePrim.Position, time);
// }
// Angular velocity (target omega)
if (BasePrim.AngularVelocity != Vector3.Zero)
{
Vector3 angVel = BasePrim.AngularVelocity;
float angle = time * angVel.Length();
Quaternion dQ = Quaternion.CreateFromAxisAngle(angVel, angle);
InterpolatedRotation = dQ * InterpolatedRotation;
}
else if (InterpolatedRotation != BasePrim.Rotation && !(this is RenderAvatar))
{
InterpolatedRotation = Quaternion.Slerp(InterpolatedRotation, BasePrim.Rotation, time * 10f);
if (1f - Math.Abs(Quaternion.Dot(InterpolatedRotation, BasePrim.Rotation)) < 0.0001)
InterpolatedRotation = BasePrim.Rotation;
}
else
{
InterpolatedRotation = BasePrim.Rotation;
}
}
// // Angular velocity (target omega)
// if (BasePrim.AngularVelocity != Vector3.Zero)
// {
// Vector3 angVel = BasePrim.AngularVelocity;
// float angle = time * angVel.Length();
// Quaternion dQ = Quaternion.CreateFromAxisAngle(angVel, angle);
// InterpolatedRotation = dQ * InterpolatedRotation;
// }
// else if (InterpolatedRotation != BasePrim.Rotation && !(this is RenderAvatar))
// {
// InterpolatedRotation = Quaternion.Slerp(InterpolatedRotation, BasePrim.Rotation, time * 10f);
// if (1f - Math.Abs(Quaternion.Dot(InterpolatedRotation, BasePrim.Rotation)) < 0.0001)
// InterpolatedRotation = BasePrim.Rotation;
// }
// else
// {
// InterpolatedRotation = BasePrim.Rotation;
// }
// }
/// <summary>
/// Render scene object
/// </summary>
/// <param name="pass">Which pass are we currently in</param>
/// <param name="pickingID">ID used to identify which object was picked</param>
/// <param name="scene">Main scene renderer</param>
/// <param name="time">Time it took to render the last frame</param>
public virtual void Render(RenderPass pass, int pickingID, SceneWindow scene, float time)
{
}
// /// <summary>
// /// Render scene object
// /// </summary>
// /// <param name="pass">Which pass are we currently in</param>
// /// <param name="pickingID">ID used to identify which object was picked</param>
// /// <param name="scene">Main scene renderer</param>
// /// <param name="time">Time it took to render the last frame</param>
// public virtual void Render(RenderPass pass, int pickingID, SceneWindow scene, float time)
// {
// }
/// <summary>
/// Implementation of the IComparable interface
/// used for sorting by distance
/// </summary>
/// <param name="other">Object we are comparing to</param>
/// <returns>Result of the comparison</returns>
public virtual int CompareTo(object other)
{
SceneObject o = (SceneObject)other;
if (DistanceSquared < o.DistanceSquared)
return -1;
if (DistanceSquared > o.DistanceSquared)
return 1;
return 0;
}
// /// <summary>
// /// Implementation of the IComparable interface
// /// used for sorting by distance
// /// </summary>
// /// <param name="other">Object we are comparing to</param>
// /// <returns>Result of the comparison</returns>
// public virtual int CompareTo(object other)
// {
// SceneObject o = (SceneObject)other;
// if (DistanceSquared < o.DistanceSquared)
// return -1;
// if (DistanceSquared > o.DistanceSquared)
// return 1;
// return 0;
// }
#region Occlusion queries
public void StartQuery(RenderPass pass)
{
if (!RenderSettings.OcclusionCullingEnabled) return;
// #region Occlusion queries
// public void StartQuery(RenderPass pass)
// {
// if (!RenderSettings.OcclusionCullingEnabled) return;
if (pass == RenderPass.Simple)
{
StartSimpleQuery();
}
else if (pass == RenderPass.Alpha)
{
StartAlphaQuery();
}
}
// if (pass == RenderPass.Simple)
// {
// StartSimpleQuery();
// }
// else if (pass == RenderPass.Alpha)
// {
// StartAlphaQuery();
// }
// }
public void EndQuery(RenderPass pass)
{
if (!RenderSettings.OcclusionCullingEnabled) return;
// public void EndQuery(RenderPass pass)
// {
// if (!RenderSettings.OcclusionCullingEnabled) return;
if (pass == RenderPass.Simple)
{
EndSimpleQuery();
}
else if (pass == RenderPass.Alpha)
{
EndAlphaQuery();
}
}
// if (pass == RenderPass.Simple)
// {
// EndSimpleQuery();
// }
// else if (pass == RenderPass.Alpha)
// {
// EndAlphaQuery();
// }
// }
//public void StartAlphaQuery()
//{
// if (!RenderSettings.OcclusionCullingEnabled) return;
// //public void StartAlphaQuery()
// //{
// // if (!RenderSettings.OcclusionCullingEnabled) return;
// if (AlphaQueryID == -1)
// {
// Compat.GenQueries(out AlphaQueryID);
// }
// if (AlphaQueryID > 0)
// {
// Compat.BeginQuery(QueryTarget.SamplesPassed, AlphaQueryID);
// }
//}
// // if (AlphaQueryID == -1)
// // {
// // Compat.GenQueries(out AlphaQueryID);
// // }
// // if (AlphaQueryID > 0)
// // {
// // Compat.BeginQuery(QueryTarget.SamplesPassed, AlphaQueryID);
// // }
// //}
//public void EndAlphaQuery()
//{
// if (!RenderSettings.OcclusionCullingEnabled) return;
// //public void EndAlphaQuery()
// //{
// // if (!RenderSettings.OcclusionCullingEnabled) return;
// if (AlphaQueryID > 0)
// {
// Compat.EndQuery(QueryTarget.SamplesPassed);
// }
//}
// // if (AlphaQueryID > 0)
// // {
// // Compat.EndQuery(QueryTarget.SamplesPassed);
// // }
// //}
//public void StartSimpleQuery()
//{
// if (!RenderSettings.OcclusionCullingEnabled) return;
// //public void StartSimpleQuery()
// //{
// // if (!RenderSettings.OcclusionCullingEnabled) return;
// if (SimpleQueryID == -1)
// {
// Compat.GenQueries(out SimpleQueryID);
// }
// if (SimpleQueryID > 0)
// {
// Compat.BeginQuery(QueryTarget.SamplesPassed, SimpleQueryID);
// }
//}
// // if (SimpleQueryID == -1)
// // {
// // Compat.GenQueries(out SimpleQueryID);
// // }
// // if (SimpleQueryID > 0)
// // {
// // Compat.BeginQuery(QueryTarget.SamplesPassed, SimpleQueryID);
// // }
// //}
//public void EndSimpleQuery()
//{
// if (!RenderSettings.OcclusionCullingEnabled) return;
// //public void EndSimpleQuery()
// //{
// // if (!RenderSettings.OcclusionCullingEnabled) return;
// if (SimpleQueryID > 0)
// {
// Compat.EndQuery(QueryTarget.SamplesPassed);
// }
//}
// // if (SimpleQueryID > 0)
// // {
// // Compat.EndQuery(QueryTarget.SamplesPassed);
// // }
// //}
//public bool Occluded()
//{
// if (!RenderSettings.OcclusionCullingEnabled) return false;
// //public bool Occluded()
// //{
// // if (!RenderSettings.OcclusionCullingEnabled) return false;
// if (HasInvisibleFaces) return false;
// // if (HasInvisibleFaces) return false;
// if ((SimpleQueryID == -1 && AlphaQueryID == -1))
// {
// return false;
// }
// // if ((SimpleQueryID == -1 && AlphaQueryID == -1))
// // {
// // return false;
// // }
// if ((!HasAlphaFaces && !HasSimpleFaces)) return true;
// // if ((!HasAlphaFaces && !HasSimpleFaces)) return true;
// int samples = 1;
// if (HasSimpleFaces && SimpleQueryID > 0)
// {
// Compat.GetQueryObject(SimpleQueryID, GetQueryObjectParam.QueryResult, out samples);
// }
// if (HasSimpleFaces && samples > 0)
// {
// return false;
// }
// // int samples = 1;
// // if (HasSimpleFaces && SimpleQueryID > 0)
// // {
// // Compat.GetQueryObject(SimpleQueryID, GetQueryObjectParam.QueryResult, out samples);
// // }
// // if (HasSimpleFaces && samples > 0)
// // {
// // return false;
// // }
// samples = 1;
// if (HasAlphaFaces && AlphaQueryID > 0)
// {
// Compat.GetQueryObject(AlphaQueryID, GetQueryObjectParam.QueryResult, out samples);
// }
// if (HasAlphaFaces && samples > 0)
// {
// return false;
// }
// // samples = 1;
// // if (HasAlphaFaces && AlphaQueryID > 0)
// // {
// // Compat.GetQueryObject(AlphaQueryID, GetQueryObjectParam.QueryResult, out samples);
// // }
// // if (HasAlphaFaces && samples > 0)
// // {
// // return false;
// // }
// return true;
//}
#endregion Occlusion queries
}
// // return true;
// //}
// #endregion Occlusion queries
//}
public static class RHelp
{
@@ -388,7 +388,7 @@ namespace Raindrop.Rendering
return new UnityEngine.Vector3(v.X, v.Z, v.Y);
}
public static UnityEngine.Vector4 TKVector3(Vector4 v)
public static UnityEngine.Vector4 TKVector4(Vector4 v)
{
return new UnityEngine.Vector4(v.X, v.Y, v.Z, v.W);
}
@@ -890,7 +890,7 @@ namespace Raindrop.Rendering
#region Vertex Normal
// HACK: Sometimes normals are getting set to <NaN,NaN,NaN>
if (!Single.IsNaN(vertex.Normal.X) &&
if (!Single.IsNaN(vertex.Normal.X) &&
!Single.IsNaN(vertex.Normal.Y) &&
!Single.IsNaN(vertex.Normal.Z))
{
+232 -143
View File
@@ -18,18 +18,64 @@
* along with this program.If not, see<https://www.gnu.org/licenses/>.
*/
//To do the terrain splatting you build an array the size of the heightmap with values [0-3] that map to the four terrain textures. Floating point is used so you can blend between the textures when creating the final output. The array is a combination of the actual height (scaled down to 0-3) and some perlin noise. Heres clean room documentation of the noise generation:
//vec = global_position * 0.20319f;
//low_freq = perlin_noise2(vec.X * 0.222222, vec.Y * 0.222222) * 6.5;
//high_freq = perlin_turbulence2(vec.X, vec.Y, 2) * 2.25;
//noise = (low_freq + high_freq) * 2;
//To build the final values in the array the start height and height range need to be used by bilinearly interpolating between the four corners of each with the current x/y position in the array. It all comes together like:
//value = (height + noise - interpolated_start_height) * 4 / interpolated_height_range;
//That 's all there is to it basically. The rest is an exercise in texture compositing and interpolation.
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
//using System.Drawing;
//using System.Drawing.Imaging;
using Catnip.Drawing;
using Catnip.Drawing.Imaging;
//using Catnip.Drawing;
//using Catnip.Drawing.Imaging;
using System.Threading;
using OpenMetaverse;
using OpenMetaverse.Imaging;
using Unity.Collections;
using UnityEngine;
using Color = Catnip.Drawing.Color;
using Debug = System.Diagnostics.Debug;
using Vector3 = OpenMetaverse.Vector3;
namespace Raindrop.Rendering
{
[StructLayout(LayoutKind.Explicit)]
public struct Pixel
{
#region Data
[FieldOffset(0)]
public int rgba;
[FieldOffset(0)]
public byte r;
[FieldOffset(1)]
public byte g;
[FieldOffset(2)]
public byte b;
[FieldOffset(3)]
public byte a;
#endregion
}
public static class TerrainSplat
{
#region Constants
@@ -48,7 +94,7 @@ namespace Raindrop.Rendering
ROCK_DETAIL
};
private static readonly Catnip.Drawing.Color[] DEFAULT_TERRAIN_COLOR = new Color[]
private static readonly Color[] DEFAULT_TERRAIN_COLOR = new Color[]
{
Color.FromArgb(255, 164, 136, 117),
Color.FromArgb(255, 65, 87, 47),
@@ -72,14 +118,14 @@ namespace Raindrop.Rendering
/// <returns>A composited 256x256 RGB texture ready for rendering</returns>
/// <remarks>Based on the algorithm described at http://opensimulator.org/wiki/Terrain_Splatting
/// </remarks>
public static Bitmap Splat(RaindropInstance instance, float[,] heightmap, UUID[] textureIDs, float[] startHeights, float[] heightRanges)
public static Texture2D Splat(RaindropInstance instance, float[,] heightmap, UUID[] textureIDs, float[] startHeights, float[] heightRanges)
{
Debug.Assert(textureIDs.Length == 4);
Debug.Assert(startHeights.Length == 4);
Debug.Assert(heightRanges.Length == 4);
int outputSize = 2048;
Bitmap[] detailTexture = new Bitmap[4];
Texture2D[] detailTexture = new Texture2D[4];
// Swap empty terrain textureIDs with default IDs
for (int i = 0; i < textureIDs.Length; i++)
@@ -107,16 +153,19 @@ namespace Raindrop.Rendering
if (detailTexture[i] == null)
{
// Create a solid color texture for this layer
detailTexture[i] = new Bitmap(outputSize, outputSize, PixelFormat.Format24bppRgb);
using (Graphics gfx = Graphics.FromImage(detailTexture[i]))
{
using (SolidBrush brush = new SolidBrush(DEFAULT_TERRAIN_COLOR[i]))
gfx.FillRectangle(brush, 0, 0, outputSize, outputSize);
}
detailTexture[i] = new Texture2D(outputSize, outputSize);
fillcolor(detailTexture[i], DEFAULT_TERRAIN_COLOR[i]);
//detailTexture[i].fillColor(DEFAULT_TERRAIN_COLOR[i]);
//using (Graphics gfx = Graphics.FromImage(detailTexture[i]))
//{
// using (SolidBrush brush = new SolidBrush(DEFAULT_TERRAIN_COLOR[i]))
// gfx.FillRectangle(brush, 0, 0, outputSize, outputSize);
//}
}
else if (detailTexture[i].Width != outputSize || detailTexture[i].Height != outputSize)
else if (detailTexture[i].width != outputSize || detailTexture[i].height != outputSize)
{
detailTexture[i] = ResizeBitmap(detailTexture[i], 256, 256);
detailTexture[i] = ResizeTexture2D(detailTexture[i], 256, 256);
}
}
@@ -178,195 +227,235 @@ namespace Raindrop.Rendering
#endregion Layer Map
#region Texture Compositing
Bitmap output = new Bitmap(outputSize, outputSize, PixelFormat.Format24bppRgb);
BitmapData outputData = output.LockBits(new Rectangle(0, 0, outputSize, outputSize), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);
//Texture2D output = new Texture2D(outputSize, outputSize, PixelFormat.Format24bppRgb);
Texture2D output = new Texture2D(outputSize, outputSize);
//Texture2DData outputData = output.LockBits(new Rectangle(0, 0, outputSize, outputSize), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);
NativeArray<Pixel> outputData = output.GetRawTextureData<Pixel>();
Pixel outputDataScan0 = outputData[0];
unsafe
{
// Get handles to all of the texture data arrays
BitmapData[] datas = new BitmapData[]
//Texture2DData[] datas = new Texture2DData[]
NativeArray<Pixel>[] datas = new NativeArray<Pixel>[]
{
detailTexture[0].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[0].PixelFormat),
detailTexture[1].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[1].PixelFormat),
detailTexture[2].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[2].PixelFormat),
detailTexture[3].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[3].PixelFormat)
detailTexture[0].GetRawTextureData<Pixel>(),
detailTexture[1].GetRawTextureData<Pixel>(),
detailTexture[2].GetRawTextureData<Pixel>(),
detailTexture[3].GetRawTextureData<Pixel>(),
//detailTexture[0].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[0].PixelFormat),
// detailTexture[1].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[1].PixelFormat),
// detailTexture[2].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[2].PixelFormat),
// detailTexture[3].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[3].PixelFormat)
};
int[] comps = new int[]
{
(datas[0].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3,
(datas[1].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3,
(datas[2].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3,
(datas[3].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3
4,
4,
4,
4 //lmao wtf
//(datas[0].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3,
//(datas[1].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3,
//(datas[2].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3,
//(datas[3].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3
};
int[] strides = new int[]
{
datas[0].Stride,
datas[1].Stride,
datas[2].Stride,
datas[3].Stride
};
//int[] strides = new int[] //stride, aka scan-width (in bytes)
//{
// datas[0].Stride,
// datas[1].Stride,
// datas[2].Stride,
// datas[3].Stride
//};
IntPtr[] scans = new IntPtr[]
{
datas[0].Scan0,
datas[1].Scan0,
datas[2].Scan0,
datas[3].Scan0
};
//IntPtr[] scans = new IntPtr[] //memoryAddr of the BMPs
//{
// datas[0].Scan0,
// datas[1].Scan0,
// datas[2].Scan0,
// datas[3].Scan0
//};
int ratio = outputSize / RegionSize;
//TODO terrain texture interpolating
for (int y = 0; y < outputSize; y++)
{
for (int x = 0; x < outputSize; x++)
{
float layer = layermap[(y / ratio) * RegionSize + x / ratio];
float layerx = layermap[(y / ratio) * RegionSize + Math.Min(outputSize - 1, (x + 1)) / ratio];
float layerxx = layermap[(y / ratio) * RegionSize + Math.Max(0, (x - 1)) / ratio];
float layery = layermap[Math.Min(outputSize - 1, (y + 1)) / ratio * RegionSize + x / ratio];
float layeryy = layermap[(Math.Max(0, (y - 1)) / ratio) * RegionSize + x / ratio];
float layer = layermap[(y / ratio) * RegionSize + x / ratio]; //grabs layermap value at x,y on the 2dgrid
float layerx = layermap[(y / ratio) * RegionSize + Math.Min(outputSize - 1, (x + 1)) / ratio]; //at x+1,y
float layerxx = layermap[(y / ratio) * RegionSize + Math.Max(0, (x - 1)) / ratio]; //at x-1,y
float layery = layermap[Math.Min(outputSize - 1, (y + 1)) / ratio * RegionSize + x / ratio]; //at x,y+1
float layeryy = layermap[(Math.Max(0, (y - 1)) / ratio) * RegionSize + x / ratio]; //at x,y-1
// Select two textures
int l0 = (int)Math.Floor(layer);
int l1 = Math.Min(l0 + 1, 3);
int l0 = (int)Math.Floor(layer); //lowest texture-layer for the current point in layermap
int l1 = Math.Min(l0 + 1, 3); //next-lowest texture-layer for the current point in layermap
byte* ptrA = (byte*)scans[l0] + (y % 256) * strides[l0] + (x % 256) * comps[l0];
byte* ptrB = (byte*)scans[l1] + (y % 256) * strides[l1] + (x % 256) * comps[l1];
byte* ptrO = (byte*)outputData.Scan0 + y * outputData.Stride + x * 3;
//todo: placeholder here.
outputData[(y / ratio) * RegionSize + x / ratio] = datas[l0][(y / ratio) * RegionSize + x / ratio];
float aB = *(ptrA + 0);
float aG = *(ptrA + 1);
float aR = *(ptrA + 2);
// Pixel* ptrA = (Pixel*)scans[l0] + (y % 256) * strides[l0] + (x % 256) * comps[l0];
// Pixel* ptrB = (Pixel*)scans[l1] + (y % 256) * strides[l1] + (x % 256) * comps[l1];
// Pixel* ptrO = (Pixel*)outputData.Scan0 + y * outputData.Stride + x * 3;
int lX = (int)Math.Floor(layerx);
byte* ptrX = (byte*)scans[lX] + (y % 256) * strides[lX] + (x % 256) * comps[lX];
int lXX = (int)Math.Floor(layerxx);
byte* ptrXX = (byte*)scans[lXX] + (y % 256) * strides[lXX] + (x % 256) * comps[lXX];
int lY = (int)Math.Floor(layery);
byte* ptrY = (byte*)scans[lY] + (y % 256) * strides[lY] + (x % 256) * comps[lY];
int lYY = (int)Math.Floor(layeryy);
byte* ptrYY = (byte*)scans[lYY] + (y % 256) * strides[lYY] + (x % 256) * comps[lYY];
// byte aB = *byte (ptrA + 0);
// float aG = *(ptrA + 1);
// float aR = *(ptrA + 2);
float bB = *(ptrB + 0);
float bG = *(ptrB + 1);
float bR = *(ptrB + 2);
// int lX = (int)Math.Floor(layerx);
// byte* ptrX = (byte*)scans[lX] + (y % 256) * strides[lX] + (x % 256) * comps[lX];
// int lXX = (int)Math.Floor(layerxx);
// byte* ptrXX = (byte*)scans[lXX] + (y % 256) * strides[lXX] + (x % 256) * comps[lXX];
// int lY = (int)Math.Floor(layery);
// byte* ptrY = (byte*)scans[lY] + (y % 256) * strides[lY] + (x % 256) * comps[lY];
// int lYY = (int)Math.Floor(layeryy);
// byte* ptrYY = (byte*)scans[lYY] + (y % 256) * strides[lYY] + (x % 256) * comps[lYY];
float layerDiff = layer - l0;
float xlayerDiff = layerx - layer;
float xxlayerDiff = layerxx - layer;
float ylayerDiff = layery - layer;
float yylayerDiff = layeryy - layer;
// Interpolate between the two selected textures
*(ptrO + 0) = (byte)Math.Floor(aB + layerDiff * (bB - aB) +
xlayerDiff * (*ptrX - aB) +
xxlayerDiff * (*(ptrXX) - aB) +
ylayerDiff * (*ptrY - aB) +
yylayerDiff * (*(ptrYY) - aB));
*(ptrO + 1) = (byte)Math.Floor(aG + layerDiff * (bG - aG) +
xlayerDiff * (*(ptrX + 1) - aG) +
xxlayerDiff * (*(ptrXX + 1) - aG) +
ylayerDiff * (*(ptrY + 1) - aG) +
yylayerDiff * (*(ptrYY + 1) - aG));
*(ptrO + 2) = (byte)Math.Floor(aR + layerDiff * (bR - aR) +
xlayerDiff * (*(ptrX + 2) - aR) +
xxlayerDiff * (*(ptrXX + 2) - aR) +
ylayerDiff * (*(ptrY + 2) - aR) +
yylayerDiff * (*(ptrYY + 2) - aR));
// float bB = *(ptrB + 0);
// float bG = *(ptrB + 1);
// float bR = *(ptrB + 2);
// float layerDiff = layer - l0;
// float xlayerDiff = layerx - layer;
// float xxlayerDiff = layerxx - layer;
// float ylayerDiff = layery - layer;
// float yylayerDiff = layeryy - layer;
// // Interpolate between the two selected textures
// *(ptrO + 0) = (byte)Math.Floor(aB + layerDiff * (bB - aB) +
// xlayerDiff * (*ptrX - aB) +
// xxlayerDiff * (*(ptrXX) - aB) +
// ylayerDiff * (*ptrY - aB) +
// yylayerDiff * (*(ptrYY) - aB));
// *(ptrO + 1) = (byte)Math.Floor(aG + layerDiff * (bG - aG) +
// xlayerDiff * (*(ptrX + 1) - aG) +
// xxlayerDiff * (*(ptrXX + 1) - aG) +
// ylayerDiff * (*(ptrY + 1) - aG) +
// yylayerDiff * (*(ptrYY + 1) - aG));
// *(ptrO + 2) = (byte)Math.Floor(aR + layerDiff * (bR - aR) +
// xlayerDiff * (*(ptrX + 2) - aR) +
// xxlayerDiff * (*(ptrXX + 2) - aR) +
// ylayerDiff * (*(ptrY + 2) - aR) +
// yylayerDiff * (*(ptrYY + 2) - aR));
}
}
for (int i = 0; i < 4; i++)
for (int i = 0; i < 4; i++)
{
detailTexture[i].UnlockBits(datas[i]);
detailTexture[i].Dispose();
//seems like we dont need to dispose mem
//https://docs.unity3d.com/ScriptReference/Texture2D.GetRawTextureData.html
//detailTexture[i].UnlockBits(datas[i]);
//detailTexture[i].Dispose();
}
}
layermap = null;
output.UnlockBits(outputData);
//output.UnlockBits(outputData);
output.RotateFlip(RotateFlipType.Rotate270FlipNone);
//output.RotateFlip(RotateFlipType.Rotate270FlipNone); //why rotate?
#endregion Texture Compositing
//output = outputData;
output.LoadRawTextureData(outputData);
return output;
}
private static TextureDownloadCallback TextureDownloadCallback(Bitmap[] detailTexture, int i, AutoResetEvent textureDone)
private static void fillcolor(Texture2D tex2, Color color)
{
//var fillColor : Color = Color(1, 0.0, 0.0);
var fillColorArray = tex2.GetPixels();
for (var i = 0; i < fillColorArray.Length; ++i)
{
fillColorArray[i] = color;
}
tex2.SetPixels(fillColorArray);
tex2.Apply();
}
private static TextureDownloadCallback TextureDownloadCallback(Texture2D[] detailTexture, int i, AutoResetEvent textureDone)
{
return (state, assetTexture) =>
{
if (state == TextureRequestState.Finished && assetTexture?.AssetData != null)
{
Image img;
Texture2D img;
ManagedImage mi;
OpenJPEG.DecodeToImage(assetTexture.AssetData, out mi, out img);
detailTexture[i] = (Bitmap)img;
detailTexture[i] = (Texture2D)img;
}
textureDone.Set();
};
}
public static Bitmap ResizeBitmap(Bitmap b, int nWidth, int nHeight)
public static Texture2D ResizeTexture2D(Texture2D b, int nWidth, int nHeight)
{
Bitmap result = new Bitmap(nWidth, nHeight);
using (Graphics g = Graphics.FromImage((Image)result))
{
g.DrawImage(b, 0, 0, nWidth, nHeight);
}
b.Dispose();
return result;
//Texture2D newTex = new Texture2D(nWidth, nHeight);
//Texture2D result = new Texture2D(nWidth, nHeight);
//using (Graphics g = Graphics.FromImage((Image)result))
//{
// g.DrawImage(b, 0, 0, nWidth, nHeight);
//}
//b.Dispose();
b.Resize(nWidth,nHeight);
//UnityEngine.Object.Destroy(b);
return b;
}
public static Bitmap TileBitmap(Bitmap b, int tiles)
{
Bitmap result = new Bitmap(b.Width * tiles, b.Width * tiles);
using (Graphics g = Graphics.FromImage((Image)result))
{
for (int x = 0; x < tiles; x++)
{
for (int y = 0; y < tiles; y++)
{
g.DrawImage(b, x * 256, y * 256, x * 256 + 256, y * 256 + 256);
}
}
}
b.Dispose();
return result;
}
//public static Texture2D TileTexture2D(Texture2D b, int tiles)
//{
// Texture2D result = new Texture2D(b.Width * tiles, b.Width * tiles);
// using (Graphics g = Graphics.FromImage((Image)result))
// {
// for (int x = 0; x < tiles; x++)
// {
// for (int y = 0; y < tiles; y++)
// {
// g.DrawImage(b, x * 256, y * 256, x * 256 + 256, y * 256 + 256);
// }
// }
// }
// b.Dispose();
// return result;
//}
public static Bitmap SplatSimple(float[,] heightmap)
{
const float BASE_HSV_H = 93f / 360f;
const float BASE_HSV_S = 44f / 100f;
const float BASE_HSV_V = 34f / 100f;
//public static Texture2D SplatSimple(float[,] heightmap)
//{
// const float BASE_HSV_H = 93f / 360f;
// const float BASE_HSV_S = 44f / 100f;
// const float BASE_HSV_V = 34f / 100f;
Bitmap img = new Bitmap(256, 256);
BitmapData bitmapData = img.LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);
// Texture2D img = new Texture2D(256, 256);
// Texture2DData texture2DData = img.LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);
unsafe
{
for (int y = 255; y >= 0; y--)
{
for (int x = 0; x < 256; x++)
{
float normHeight = heightmap[x, y] / 255f;
normHeight = Utils.Clamp(normHeight, BASE_HSV_V, 1.0f);
// unsafe
// {
// for (int y = 255; y >= 0; y--)
// {
// for (int x = 0; x < 256; x++)
// {
// float normHeight = heightmap[x, y] / 255f;
// normHeight = Utils.Clamp(normHeight, BASE_HSV_V, 1.0f);
Color4 color = Color4.FromHSV(BASE_HSV_H, BASE_HSV_S, normHeight);
// Color4 color = Color4.FromHSV(BASE_HSV_H, BASE_HSV_S, normHeight);
byte* ptr = (byte*)bitmapData.Scan0 + y * bitmapData.Stride + x * 3;
*(ptr + 0) = (byte)(color.B * 255f);
*(ptr + 1) = (byte)(color.G * 255f);
*(ptr + 2) = (byte)(color.R * 255f);
}
}
}
// byte* ptr = (byte*)texture2DData.Scan0 + y * texture2DData.Stride + x * 3;
// *(ptr + 0) = (byte)(color.B * 255f);
// *(ptr + 1) = (byte)(color.G * 255f);
// *(ptr + 2) = (byte)(color.R * 255f);
// }
// }
// }
img.UnlockBits(bitmapData);
return img;
}
// img.UnlockBits(Texture2DData);
// return img;
//}
}
}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 60a0e112a84a9d4449b0ee43583400b6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,837 @@
////
//// Radegast Metaverse Client
//// Copyright (c) 2009-2014, Radegast Development Team
//// All rights reserved.
////
//// Redistribution and use in source and binary forms, with or without
//// modification, are permitted provided that the following conditions are met:
////
//// * Redistributions of source code must retain the above copyright notice,
//// this list of conditions and the following disclaimer.
//// * Redistributions in binary form must reproduce the above copyright
//// notice, this list of conditions and the following disclaimer in the
//// documentation and/or other materials provided with the distribution.
//// * Neither the name of the application "Radegast", nor the names of its
//// contributors may be used to endorse or promote products derived from
//// this software without specific prior written permission.
////
//// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
//// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
//// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
//// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
//// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
//// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
//// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
//// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
//// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
////
//// $Id$
////
//using System;
//using System.Collections.Generic;
//using System.IO;
//using System.Reflection;
//using System.Threading;
////using Radegast.Commands;
//using Raindrop.Netcom;
////using Radegast.Media;
//using OpenMetaverse;
//using UnityEngine;
//using Logger = OpenMetaverse.Logger;
//namespace Raindrop.Stub
//{
// //this class is so you can develop UI in peace LOL. ie 'fake backend'
// public class RaindropInstanceStub
// {
// private GridClientStub client;
// private RaindropNetcomStub netcom;
// //private Renderer renderer;
// private StateManager state;
// private mainUIManager mainCanvas;
// //private RaindropUnitySceneRenderer mainWorldRenderer;
// // Singleton, there can be only one instance
// private static RaindropInstanceStub globalInstance = null;
// public static RaindropInstanceStub GlobalInstance
// {
// get
// {
// if (globalInstance == null)
// {
// globalInstance = new RaindropInstanceStub(new GridClient());
// }
// return globalInstance;
// }
// }
// /// <summary>
// /// Manages retrieving avatar names
// /// </summary>
// public NameManager Names { get { return names; } }
// private NameManager names;
// /// <summary>
// /// When was Radegast started (UTC)
// /// </summary>
// public readonly DateTime StartupTimeUTC;
// /// <summary>
// /// Time zone of the current world (currently hard coded to US Pacific time)
// /// </summary>
// public TimeZoneInfo WordTimeZone;
// private string userDir;
// /// <summary>
// /// System (not grid!) user's dir
// /// </summary>
// public string UserDir { get { return userDir; } }
// /// <summary>
// /// Grid client's user dir for settings and logs
// /// ala the path combined with the account's full name
// /// </summary>
// public string ClientDir
// {
// get
// {
// if (client != null && client.Self != null && !string.IsNullOrEmpty(client.Self.Name))
// {
// return Path.Combine(userDir, client.Self.Name);
// }
// else
// {
// return Environment.CurrentDirectory;
// }
// }
// }
// public string InventoryCacheFileName { get { return Path.Combine(ClientDir, "inventory.cache"); } }
// private string globalLogFile;
// public string GlobalLogFile { get { return globalLogFile; } }
// private bool monoRuntime;
// public bool MonoRuntime { get { return monoRuntime; } }
// private Dictionary<UUID, Group> groups = new Dictionary<UUID, Group>();
// public Dictionary<UUID, Group> Groups { get { return groups; } }
// private Settings globalSettings;
// /// <summary>
// /// Global settings for the entire application
// /// </summary>
// public Settings GlobalSettings { get { return globalSettings; } }
// private Settings clientSettings;
// /// <summary>
// /// Per client settings
// /// </summary>
// public Settings ClientSettings { get { return clientSettings; } }
// public const string INCOMPLETE_NAME = "Loading...";
// public readonly bool advancedDebugging = false;
// //private PluginManager pluginManager;
// ///// <summary> Handles loading plugins and scripts</summary>
// //public PluginManager PluginManager { get { return pluginManager; } }
// //private MediaManager mediaManager;
// ///// <summary>
// ///// Radegast media manager for playing streams and in world sounds
// ///// </summary>
// //public MediaManager MediaManager { get { return mediaManager; } }
// //private CommandsManager commandsManager;
// ///// <summary>
// ///// Radegast command manager for executing textual console commands
// ///// </summary>
// //public CommandsManager CommandsManager { get { return commandsManager; } }
// /// <summary>
// /// Radegast ContextAction manager for context sensitive actions
// /// </summary>
// //public ContextActionsManager ContextActionManager { get; private set; }
// private RaindropMovement movement;
// /// <summary>
// /// Allows key emulation for moving avatar around
// /// </summary>
// public RaindropMovement Movement { get { return movement; } }
// //private InventoryClipboard inventoryClipboard;
// ///// <summary>
// ///// The last item that was cut or copied in the inventory, used for pasting
// ///// in a different place on the inventory, or other places like profile
// ///// that allow sending copied inventory items
// ///// </summary>
// //public InventoryClipboard InventoryClipboard
// //{
// // get { return inventoryClipboard; }
// // set
// // {
// // inventoryClipboard = value;
// // OnInventoryClipboardUpdated(EventArgs.Empty);
// // }
// //}
// //private RLVManager rlv;
// ///// <summary>
// ///// Manager for RLV functionality
// ///// </summary>
// //public RLVManager RLV { get { return rlv; } }
// private GridManager gridManager;
// /// <summary>Manages default params for different grids</summary>
// public GridManager GridManger { get { return gridManager; } }
// /// <summary>
// /// Current Outfit Folder (appearnce) manager
// /// </summary>
// public CurrentOutfitFolder COF;
// /// <summary>
// /// Did we report crash to the grid login service
// /// </summary>
// public bool ReportedCrash = false;
// private string CrashMarkerFileName
// {
// get
// {
// return Path.Combine(UserDir, "crash_marker");
// }
// }
// #region Events
// #region ClientChanged event
// /// <summary>The event subscribers, null of no subscribers</summary>
// private EventHandler<ClientChangedEventArgs> m_ClientChanged;
// ///<summary>Raises the ClientChanged Event</summary>
// /// <param name="e">A ClientChangedEventArgs object containing
// /// the old and the new client</param>
// protected virtual void OnClientChanged(ClientChangedEventArgs e)
// {
// EventHandler<ClientChangedEventArgs> handler = m_ClientChanged;
// if (handler != null)
// handler(this, e);
// }
// /// <summary>Thread sync lock object</summary>
// private readonly object m_ClientChangedLock = new object();
// /// <summary>Raised when the GridClient object in the main Radegast instance is changed</summary>
// public event EventHandler<ClientChangedEventArgs> ClientChanged
// {
// add { lock (m_ClientChangedLock) { m_ClientChanged += value; } }
// remove { lock (m_ClientChangedLock) { m_ClientChanged -= value; } }
// }
// #endregion ClientChanged event
// #region InventoryClipboardUpdated event
// /// <summary>The event subscribers, null of no subscribers</summary>
// private EventHandler<EventArgs> m_InventoryClipboardUpdated;
// ///<summary>Raises the InventoryClipboardUpdated Event</summary>
// /// <param name="e">A EventArgs object containing
// /// the old and the new client</param>
// protected virtual void OnInventoryClipboardUpdated(EventArgs e)
// {
// EventHandler<EventArgs> handler = m_InventoryClipboardUpdated;
// if (handler != null)
// handler(this, e);
// }
// /// <summary>Thread sync lock object</summary>
// private readonly object m_InventoryClipboardUpdatedLock = new object();
// /// <summary>Raised when the GridClient object in the main Radegast instance is changed</summary>
// public event EventHandler<EventArgs> InventoryClipboardUpdated
// {
// add { lock (m_InventoryClipboardUpdatedLock) { m_InventoryClipboardUpdated += value; } }
// remove { lock (m_InventoryClipboardUpdatedLock) { m_InventoryClipboardUpdated -= value; } }
// }
// #endregion InventoryClipboardUpdated event
// #endregion Events
// public RaindropInstanceStub(GridClient client0)
// {
// // incase something else calls GlobalInstance while we are loading
// globalInstance = this;
// client = client0;
// // Initialize current time zone, and mark when we started
// GetWorldTimeZone();
// StartupTimeUTC = DateTime.UtcNow;
// // Are we running mono?
// monoRuntime = Type.GetType("Mono.Runtime") != null;
// //Keyboard = new Keyboard();
// //Application.AddMessageFilter(Keyboard);
// netcom = new RaindropNetcom(this);
// state = new StateManager(this);
// //mediaManager = new MediaManager(this);
// //commandsManager = new CommandsManager(this);
// //ContextActionManager = new ContextActionsManager(this);
// //RegisterContextActions();
// movement = new RaindropMovement(this);
// InitializeLoggingAndConfig();
// InitializeClient(client);
// //rlv = new RLVManager(this);
// gridManager = new GridManager();
// Debug.Log(streaming_assets_dir);
// gridManager.LoadGrids(streaming_assets_dir);
// names = new NameManager(this);
// COF = new CurrentOutfitFolder(this);
// mainCanvas = new mainUIManager(this);
// //mainCanvas.InitializeControls();
// //mainCanvas.Load += new EventHandler(mainForm_Load);
// //pluginManager = new PluginManager(this);
// //pluginManager.ScanAndLoadPlugins();
// }
// private void InitializeClient(GridClient client)
// {
// client.Settings.MULTIPLE_SIMS = false;
// client.Settings.USE_INTERPOLATION_TIMER = false;
// client.Settings.ALWAYS_REQUEST_OBJECTS = true;
// client.Settings.ALWAYS_DECODE_OBJECTS = true;
// client.Settings.OBJECT_TRACKING = true;
// client.Settings.ENABLE_SIMSTATS = true;
// client.Settings.FETCH_MISSING_INVENTORY = true;
// client.Settings.SEND_AGENT_THROTTLE = true;
// client.Settings.SEND_AGENT_UPDATES = true;
// client.Settings.STORE_LAND_PATCHES = true;
// client.Settings.USE_ASSET_CACHE = true;
// client.Settings.ASSET_CACHE_DIR = Path.Combine(userDir, "cache");
// client.Assets.Cache.AutoPruneEnabled = false;
// client.Assets.Cache.ComputeAssetCacheFilename = ComputeCacheName;
// client.Throttle.Total = 5000000f;
// client.Settings.THROTTLE_OUTGOING_PACKETS = false;
// client.Settings.LOGIN_TIMEOUT = 120 * 1000;
// client.Settings.SIMULATOR_TIMEOUT = 180 * 1000;
// client.Settings.MAX_CONCURRENT_TEXTURE_DOWNLOADS = 20;
// client.Self.Movement.AutoResetControls = false;
// client.Self.Movement.UpdateInterval = 250;
// RegisterClientEvents(client);
// SetClientTag();
// }
// public string ComputeCacheName(string cacheDir, UUID assetID)
// {
// string fileName = assetID.ToString();
// string dir = cacheDir
// + Path.DirectorySeparatorChar + fileName.Substring(0, 1)
// + Path.DirectorySeparatorChar + fileName.Substring(1, 1);
// try
// {
// if (!Directory.Exists(dir))
// {
// Directory.CreateDirectory(dir);
// }
// }
// catch
// {
// return Path.Combine(cacheDir, fileName);
// }
// return Path.Combine(dir, fileName);
// }
// private void RegisterClientEvents(GridClient client)
// {
// //log
// OpenMetaverse.Logger.OnLogMessage += Logger_OnLogMessage;
// client.Groups.CurrentGroups += new EventHandler<CurrentGroupsEventArgs>(Groups_CurrentGroups);
// client.Groups.GroupLeaveReply += new EventHandler<GroupOperationEventArgs>(Groups_GroupsChanged);
// client.Groups.GroupDropped += new EventHandler<GroupDroppedEventArgs>(Groups_GroupsChanged);
// client.Groups.GroupJoinedReply += new EventHandler<GroupOperationEventArgs>(Groups_GroupsChanged);
// if (netcom != null)
// netcom.ClientConnected += new EventHandler<EventArgs>(netcom_ClientConnected);
// client.Network.LoginProgress += new EventHandler<LoginProgressEventArgs>(Network_LoginProgress);
// }
// private void UnregisterClientEvents(GridClient client)
// {
// client.Groups.CurrentGroups -= new EventHandler<CurrentGroupsEventArgs>(Groups_CurrentGroups);
// client.Groups.GroupLeaveReply -= new EventHandler<GroupOperationEventArgs>(Groups_GroupsChanged);
// client.Groups.GroupDropped -= new EventHandler<GroupDroppedEventArgs>(Groups_GroupsChanged);
// client.Groups.GroupJoinedReply -= new EventHandler<GroupOperationEventArgs>(Groups_GroupsChanged);
// if (netcom != null)
// netcom.ClientConnected -= new EventHandler<EventArgs>(netcom_ClientConnected);
// client.Network.LoginProgress -= new EventHandler<LoginProgressEventArgs>(Network_LoginProgress);
// }
// public void SetClientTag()
// {
// if (GlobalSettings["send_rad_client_tag"])
// {
// client.Settings.CLIENT_IDENTIFICATION_TAG = new UUID("b748af88-58e2-995b-cf26-9486dea8e830");
// }
// else
// {
// client.Settings.CLIENT_IDENTIFICATION_TAG = UUID.Zero;
// }
// }
// private void GetWorldTimeZone()
// {
// try
// {
// foreach (TimeZoneInfo tz in TimeZoneInfo.GetSystemTimeZones())
// {
// if (tz.Id == "Pacific Standard Time" || tz.Id == "America/Los_Angeles")
// {
// WordTimeZone = tz;
// break;
// }
// }
// }
// catch (Exception) { }
// }
// public DateTime GetWorldTime()
// {
// DateTime now;
// try
// {
// if (WordTimeZone != null)
// now = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, WordTimeZone);
// else
// now = DateTime.UtcNow.AddHours(-7);
// }
// catch (Exception)
// {
// now = DateTime.UtcNow.AddHours(-7);
// }
// return now;
// }
// public void Reconnect()
// {
// //TabConsole.DisplayNotificationInChat("Attempting to reconnect...", ChatBufferTextStyle.StatusDarkBlue);
// Logger.Log("Attempting to reconnect", Helpers.LogLevel.Info, client);
// GridClient oldClient = client;
// client = new GridClient();
// UnregisterClientEvents(oldClient);
// InitializeClient(client);
// OnClientChanged(new ClientChangedEventArgs(oldClient, client));
// netcom.Login();
// }
// public void CleanUp()
// {
// MarkEndExecution();
// if (COF != null)
// {
// COF.Dispose();
// COF = null;
// }
// if (names != null)
// {
// names.Dispose();
// names = null;
// }
// if (gridManager != null)
// {
// gridManager.Dispose();
// gridManager = null;
// }
// //if (rlv != null)
// //{
// // rlv.Dispose();
// // rlv = null;
// //}
// if (client != null)
// {
// UnregisterClientEvents(client);
// }
// //if (pluginManager != null)
// //{
// // pluginManager.Dispose();
// // pluginManager = null;
// //}
// if (movement != null)
// {
// movement.Dispose();
// movement = null;
// }
// //if (commandsManager != null)
// //{
// // commandsManager.Dispose();
// // commandsManager = null;
// //}
// //if (ContextActionManager != null)
// //{
// // ContextActionManager.Dispose();
// // ContextActionManager = null;
// //}
// //if (mediaManager != null)
// //{
// // mediaManager.Dispose();
// // mediaManager = null;
// //}
// if (state != null)
// {
// state.Dispose();
// state = null;
// }
// if (netcom != null)
// {
// netcom.Dispose();
// netcom = null;
// }
// //if (mainCanvas != null)
// //{
// // mainCanvas.Load -= new EventHandler(mainForm_Load);
// //}
// Logger.Log("RaindropInstanceStub finished cleaning up.", Helpers.LogLevel.Debug);
// }
// void mainForm_Load(object sender, EventArgs e)
// {
// //pluginManager.StartPlugins();
// }
// void netcom_ClientConnected(object sender, EventArgs e)
// {
// client.Self.RequestMuteList();
// }
// void Network_LoginProgress(object sender, LoginProgressEventArgs e)
// {
// if (e.Status == LoginStatus.ConnectingToSim)
// {
// try
// {
// if (!Directory.Exists(ClientDir))
// {
// Directory.CreateDirectory(ClientDir);
// }
// clientSettings = new Settings(Path.Combine(ClientDir, "client_settings.xml"));
// }
// catch (Exception ex)
// {
// Logger.Log("Failed to create client directory", Helpers.LogLevel.Warning, ex);
// }
// }
// }
// /// <summary>
// /// Fetches avatar name
// /// </summary>
// /// <param name="key">Avatar UUID</param>
// /// <param name="blocking">Should we wait until the name is retrieved</param>
// /// <returns>Avatar name</returns>
// [Obsolete("Use Instance.Names.Get() instead")]
// public string getAvatarName(UUID key, bool blocking)
// {
// return Names.Get(key, blocking);
// }
// /// <summary>
// /// Fetches avatar name from cache, if not in cache will request name from the server
// /// </summary>
// /// <param name="key">Avatar UUID</param>
// /// <returns>Avatar name</returns>
// [Obsolete("Use Instance.Names.Get() instead")]
// public string getAvatarName(UUID key)
// {
// return Names.Get(key);
// }
// void Groups_GroupsChanged(object sender, EventArgs e)
// {
// client.Groups.RequestCurrentGroups();
// }
// public static string SafeFileName(string fileName)
// {
// foreach (char lDisallowed in Path.GetInvalidFileNameChars())
// {
// fileName = fileName.Replace(lDisallowed.ToString(), "_");
// }
// return fileName;
// }
// //obtains the relevant filepath/name.
// public string ChatFileName(string session)
// {
// string fileName = session;
// foreach (char lDisallowed in System.IO.Path.GetInvalidFileNameChars())
// {
// fileName = fileName.Replace(lDisallowed.ToString(), "_");
// }
// return Path.Combine(ClientDir, fileName);
// }
// //this method will log all messages to the relevant file.
// public void LogClientMessage(string sessioName, string message)
// {
// if (globalSettings["disable_chat_im_log"]) return;
// lock (this)
// {
// try
// {
// File.AppendAllText(ChatFileName(sessioName),
// DateTime.Now.ToString("yyyy-MM-dd [HH:mm:ss] ") + message + Environment.NewLine);
// }
// catch (Exception) { }
// }
// }
// void Groups_CurrentGroups(object sender, CurrentGroupsEventArgs e)
// {
// this.groups = e.Groups;
// }
// private void InitializeLoggingAndConfig()
// {
// try
// {
// userDir = Path.Combine(app_data_dir, PROGRAMNAME);
// if (!Directory.Exists(userDir))
// {
// Directory.CreateDirectory(userDir);
// }
// }
// catch (Exception)
// {
// Logger.DebugLog("unable to create userDir: " + userDir);
// userDir = System.Environment.CurrentDirectory;
// };
// globalLogFile = Path.Combine(userDir, PROGRAMNAME + ".log");
// globalSettings = new Settings(Path.Combine(userDir, "settings.xml"));
// //frmSettings.InitSettigs(globalSettings, monoRuntime);
// }
// public GridClient Client
// {
// get { return client; }
// }
// public RaindropNetcom Netcom
// {
// get { return netcom; }
// }
// public StateManager State
// {
// get { return state; }
// }
// public mainUIManager MainCanvas
// {
// get { return mainCanvas; }
// }
// public OpenMetaverse.Vector3 cameraLoc { get; internal set; }
// //public TabsConsole TabConsole
// //{
// // get { return mainForm.TabConsole; }
// //}
// public void HandleThreadException(object sender, ThreadExceptionEventArgs e)
// {
// Logger.Log("Unhandled thread exception: "
// + e.Exception.Message + Environment.NewLine
// + e.Exception.StackTrace + Environment.NewLine,
// Helpers.LogLevel.Error,
// client);
// }
// #region Crash reporting
// FileStream MarkerLock = null;
// private string PROGRAMNAME = "RaindropTest_02";
// public bool AnotherInstanceRunning()
// {
// // We have successfuly obtained lock
// if (MarkerLock != null && MarkerLock.CanWrite)
// {
// Logger.Log("No other instances detected, marker file already locked", Helpers.LogLevel.Debug);
// return false || MonoRuntime;
// }
// try
// {
// MarkerLock = new FileStream(CrashMarkerFileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
// Logger.Log(string.Format("Successfully created and locked marker file {0}", CrashMarkerFileName), Helpers.LogLevel.Debug);
// return false || MonoRuntime;
// }
// catch
// {
// MarkerLock = null;
// Logger.Log(string.Format("Another instance detected, marker fils {0} locked", CrashMarkerFileName), Helpers.LogLevel.Debug);
// return true;
// }
// }
// public LastExecStatus GetLastExecStatus()
// {
// // Crash marker file found and is not locked by us
// if (File.Exists(CrashMarkerFileName) && MarkerLock == null)
// {
// Logger.Log(string.Format("Found crash marker file {0}", CrashMarkerFileName), Helpers.LogLevel.Debug);
// return LastExecStatus.OtherCrash;
// }
// else
// {
// Logger.Log(string.Format("No crash marker file {0} found", CrashMarkerFileName), Helpers.LogLevel.Debug);
// return LastExecStatus.Normal;
// }
// }
// public void MarkStartExecution()
// {
// Logger.Log(string.Format("Marking start of execution run, creating file: {0}", CrashMarkerFileName), Helpers.LogLevel.Debug);
// try
// {
// File.Create(CrashMarkerFileName).Dispose();
// }
// catch { }
// }
// public void MarkEndExecution()
// {
// Logger.Log(string.Format("Marking end of execution run, deleting file: {0}", CrashMarkerFileName), Helpers.LogLevel.Debug);
// try
// {
// if (MarkerLock != null)
// {
// MarkerLock.Close();
// MarkerLock.Dispose();
// MarkerLock = null;
// }
// File.Delete(CrashMarkerFileName);
// }
// catch { }
// }
// internal void setAppDataDir(string app_data_Path)
// {
// throw new NotImplementedException();
// }
// #endregion Crash reporting
// #region Context Actions
// //void RegisterContextActions()
// //{
// // ContextActionManager.RegisterContextAction(typeof(Primitive), "Save as DAE...", ExportDAEHander);
// // ContextActionManager.RegisterContextAction(typeof(Primitive), "Copy UUID to clipboard", CopyObjectUUIDHandler);
// //}
// //void DeregisterContextActions()
// //{
// // ContextActionManager.DeregisterContextAction(typeof(Primitive), "Save as DAE...");
// // ContextActionManager.DeregisterContextAction(typeof(Primitive), "Copy UUID to clipboard");
// //}
// //void ExportDAEHander(object sender, EventArgs e)
// //{
// // MainForm.DisplayColladaConsole((Primitive)sender);
// //}
// //void CopyObjectUUIDHandler(object sender, EventArgs e)
// //{
// // if (mainForm.InvokeRequired)
// // {
// // if (mainForm.IsHandleCreated || !MonoRuntime)
// // {
// // mainForm.Invoke(new MethodInvoker(() => CopyObjectUUIDHandler(sender, e)));
// // }
// // return;
// // }
// // Clipboard.SetText(((Primitive)sender).ID.ToString());
// //}
// #endregion Context Actions
// private void Logger_OnLogMessage(object message, Helpers.LogLevel level)
// {
// if (level == Helpers.LogLevel.Debug)
// {
// Debug.Log(message);
// }
// else if (level == Helpers.LogLevel.Error)
// {
// Debug.LogError(message);
// }
// else if (level == Helpers.LogLevel.Info)
// {
// Debug.Log(message);
// }
// else if (level == Helpers.LogLevel.Warning)
// {
// Debug.LogWarning(message);
// }
// else
// {
// Debug.LogError(message);
// }
// }
// }
// #region Event classes
// public class ClientChangedEventArgs : EventArgs
// {
// private GridClient m_OldClient;
// private GridClient m_Client;
// public GridClient OldClient { get { return m_OldClient; } }
// public GridClient Client { get { return m_Client; } }
// public ClientChangedEventArgs(GridClient OldClient, GridClient Client)
// {
// m_OldClient = OldClient;
// m_Client = Client;
// }
// }
// #endregion Event classes
//}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2a7c1fcc6548d3240bb531a3db7e888d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -25,7 +25,7 @@ public class CanvasManager : Singleton<CanvasManager>
}
public void reinitToLoginScreen()
public void resetToLoginScreen()
{
canvasControllerList.ForEach(x => x.gameObject.SetActive(false));
pushCanvas(CanvasType.Login);
@@ -1,7 +1,11 @@
public enum CanvasType
{
Welcome,
Login,
Game,
Chat,
Map
Map,
EULA,
Settings,
}
+48
View File
@@ -0,0 +1,48 @@
using Raindrop;
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
//a monobehavior that makes a toggle toggle the eula acceptance in globalSettings
public class EulaModalPresenter : MonoBehaviour
{
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
//public string nameOfEulaToggleGO;
private Toggle EulaToggle;
public GameObject EulaToggleGO;
private void Start()
{
//var _ = gameObject.transform.Find(nameOfEulaToggleGO);
// <EulaToggle>();
EulaToggle = EulaToggleGO.GetComponent<Toggle>();
bool is_accepted_in_settings = instance.GlobalSettings["Accept_RaindropEula"];
if (is_accepted_in_settings)
{
EulaToggle.isOn = true;
return;
}
if (EulaToggle != null)
{
EulaToggle.onValueChanged.AsObservable().Subscribe(_ => onToggleChanged(_)); //when clicked, runs this method.
}
}
private void onToggleChanged(bool isEulaAccepted)
{
//if (isEulaAccepted)
//{
instance.GlobalSettings["Accept_RaindropEula"] = isEulaAccepted;
//}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e395c2ef7bf934f40879e238aabf3fd6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+18
View File
@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LoadingCanvasDriver : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d8043248760e6e64184fb57b23d22350
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+1
View File
@@ -51,6 +51,7 @@ public class ModalManager : Singleton<ModalManager>
}
private bool isOnMainThread()
{
return mainThread.Equals(System.Threading.Thread.CurrentThread);
+3 -2
View File
@@ -17,6 +17,7 @@ namespace Raindrop
//mainUImanager has dependencies:
// CanvasManager - stores and manages the pops, push of views onto the ui stack.
// ModalManager - pops and shows modals.
// LoadingCanvasPresenter - this particular modal/screen is tricky; it appears only when the scene is loading.
private RaindropInstance instance;
private RaindropNetcom netcom { get { return instance.Netcom; } }
@@ -43,7 +44,7 @@ namespace Raindrop
private void initialiseUI()
{
canvasManager.pushCanvas(CanvasType.Login);
canvasManager.pushCanvas(CanvasType.Welcome);
modalManager.showSimpleModalBoxWithActionBtn("Disclaimer", "This software is a work in progress. There is no guarantee about its stability. ", "Accept");
}
@@ -131,7 +132,7 @@ namespace Raindrop
if (e.Reason == NetworkManager.DisconnectType.ClientInitiated) return;
netcom_ClientLoggedOut(sender, EventArgs.Empty);
canvasManager.reinitToLoginScreen();
canvasManager.resetToLoginScreen();
//if (instance.GlobalSettings["auto_reconnect"].AsBoolean())
//{
@@ -0,0 +1,81 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Lean;
using Raindrop;
using OpenMetaverse;
using Raindrop.Netcom;
using Lean.Gui;
//make the joystick position drive the user's movement (u,d,l,r) :)
public class joystickToMovementBackend : MonoBehaviour
{
public LeanJoystick variableJoystick;
public GameObject theJoystickInScene;
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
private RaindropNetcom netcom { get { return instance.Netcom; } }
private GridClient client { get { return instance.Client; } }
bool Active => instance.Client.Network.Connected;
void Awake()
{
if (theJoystickInScene.GetComponent<LeanJoystick>() == null)
{
Debug.LogError("the joystick object is not found!");
}
variableJoystick = theJoystickInScene.GetComponent<LeanJoystick>();
}
// Update is called once per frame
void Update()
{
if (! Active)
{
return;
}
float vert = variableJoystick.ScaledValue.y;
float horz = variableJoystick.ScaledValue.x;
float thresh = 0.7f;
if (vert > thresh)
{
instance.Movement.MovingBackward = false;
instance.Movement.MovingForward = true;
}
else if (vert < -thresh)
{
instance.Movement.MovingBackward = true;
instance.Movement.MovingForward = false;
}
else
{
instance.Movement.MovingBackward = false;
instance.Movement.MovingForward = false;
}
if (horz > thresh)
{
instance.Movement.TurningLeft = false;
instance.Movement.TurningRight = true;
}
else if (horz < -thresh)
{
instance.Movement.TurningLeft = true;
instance.Movement.TurningRight = false;
}
else
{
instance.Movement.TurningLeft = false;
instance.Movement.TurningRight = false;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ca2b2f6974c6e104ba51b93674432915
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+25 -2
View File
@@ -34,8 +34,10 @@ namespace Raindrop.Presenters
private int chatPointer;
private List<ChatLogPresenter> listOfChatLogs;
private ChatLogPresenter selectedChatLog;
public readonly Dictionary<UUID, ulong> agentSimHandle = new Dictionary<UUID, ulong>();
private static readonly string LOCALCHATTITLE = "Local Chat";
public ChatTextManager ChatManager { get; private set; }
bool Active => instance.Client.Network.Connected;
@@ -57,6 +59,7 @@ namespace Raindrop.Presenters
private List<string> chatTitles= new List<string>
{
LOCALCHATTITLE
};
private string msgtext;
@@ -69,14 +72,22 @@ namespace Raindrop.Presenters
void Start()
{
var chatGO = ChatBox.gameObject.GetComponent<ITextLikeGameObject>();
CloseButton.onClick.AsObservable().Subscribe(_ => OnCloseBtnClick()); //when clicked, runs this method.
SendButton.onClick.AsObservable().Subscribe(_ => OnSendBtnClick()); //change username property.
ChatInputField.onValueChanged.AsObservable().Subscribe(_ => OnInputChanged(_)); //change username property.
ChatManager = new ChatTextManager(instance, new RichTextBoxPrinter(ChatBox.gameObject));
var chatGO = (IPrintableMonobehavior) ChatBox.gameObject.GetComponent<ITextLikeGameObject>();
ChatManager = new ChatTextManager(instance, new TextBoxPrinter(chatGO));
RegisterClientEvents(client);
}
private void OnDestroy()
{
UnregisterClientEvents(client);
}
private void OnInputChanged(string _)
@@ -87,6 +98,9 @@ namespace Raindrop.Presenters
private void OnSendBtnClick()
{
if (selectedChatLog == null)
return;
ProcessChatInput(msgtext,ChatType.Normal);
return;
}
@@ -111,7 +125,16 @@ namespace Raindrop.Presenters
client.Network.SimDisconnected -= new EventHandler<SimDisconnectedEventArgs>(Network_SimDisconnected);
}
//adds a tab for this particular IM session
public void AddIMTab(UUID target, UUID session, string targetName)
{
//IMTabWindow imTab = new IMTabWindow(instance, target, session, targetName);
//GroupButtons.Add(new IMTextManager(instance,??,IMTextManagerType.Agent,));
//imTab.SelectIMInput();
//return imTab;
}
void Self_TeleportProgress(object sender, TeleportEventArgs e)
{
@@ -0,0 +1,15 @@
using UnityEngine;
namespace Raindrop.Presenters
{
//this is a dropdown menu with a plus button on the side that lets you enter new info to the dropdownmenu
public class DropdownMenuWithEntry:MonoBehaviour
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 508e7c3fabc6cb14d8e8dab7832d40b2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+5 -42
View File
@@ -41,7 +41,6 @@ namespace Raindrop.Presenters
public TMP_Text locationText;
public MinimapModule minimap;
public VariableJoystick variableJoystick;
public UnityEngine.Vector2 jsDir;
@@ -63,8 +62,7 @@ namespace Raindrop.Presenters
initialiseFields();
ChatButton.onClick.AsObservable().Subscribe(_ => OnChatBtnClick()); //when clicked, runs this method.
MapButton.onClick.AsObservable().Subscribe(_ => OnChatBtnClick()); //when clicked, runs this method.
MapButton.onClick.AsObservable().Subscribe(_ => OnMapBtnClick()); //when clicked, runs this method.
@@ -73,46 +71,11 @@ namespace Raindrop.Presenters
private void Update()
{
float vert = variableJoystick.Vertical;
float horz = variableJoystick.Horizontal;
float thresh = 0.7f;
if (vert > thresh)
if (Active == false)
{
instance.Movement.MovingForward = true;
instance.Movement.MovingBackward = false;
}
else if (vert < -thresh)
{
instance.Movement.MovingBackward = true;
instance.Movement.MovingForward = false;
}
else
{
instance.Movement.MovingBackward = false;
instance.Movement.MovingForward= false;
}
if (horz > thresh)
{
instance.Movement.TurningRight= true;
instance.Movement.TurningLeft = false;
}
else if (horz < -thresh)
{
instance.Movement.TurningLeft = true;
instance.Movement.TurningRight = false;
}
else
{
instance.Movement.TurningLeft = false;
instance.Movement.TurningRight= false;
//prepare to go back to login screen?
//do nothing for now.
return;
}
@@ -0,0 +1,76 @@
using Raindrop.Netcom;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Raindrop.Presenters
{
//attach this directly to the dropdown on your login screen :)
[RequireComponent(typeof(Dropdown))]
public class GenericDropdown : MonoBehaviour
{
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
private RaindropNetcom netcom { get { return instance.Netcom; } }
void Start()
{
this.clear();
this.set(instance.GridManger.Grids);
this.Add("Custom");
dd = this.gameObject.GetComponent<Dropdown>();
dd.onValueChanged.AddListener(delegate {
DropdownValueChanged(dd);
});
}
private void DropdownValueChanged(Dropdown dd)
{
SelectedIndex = dd.value;
SelectedItem = instance.GridManger.Grids[SelectedIndex];
netcom.LoginOptions.Grid = instance.GridManger.Grids[SelectedIndex];
}
private List<string> gridDropdownOptions = new List<string> //type is grid
{
};
public Dropdown dd;
public int SelectedIndex;
public Grid SelectedItem;
public void clear ()
{
gridDropdownOptions.Clear();
dd.ClearOptions();
}
public void set<T>(List<T> grids)
{
foreach(var _ in grids)
{
gridDropdownOptions.Add(_.ToString());
}
dd.AddOptions(gridDropdownOptions);
}
internal void Add(string v)
{
gridDropdownOptions.Add(v);
dd.AddOptions(gridDropdownOptions);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cdd5f19c76fa0a14ca4f523cedcc7778
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -14,5 +14,9 @@ namespace Raindrop
string Content { get; set; }
Color ForeColor { get; set; }
Color BackColor { get; set; }
string Text { get; set; }
void AppendText(string v);
void Clear();
}
}
-3
View File
@@ -33,8 +33,5 @@ namespace Raindrop
void ClearText();
string Content { get; set; }
Color ForeColor { get; set; }
Color BackColor { get; set; }
Font Font { get; set; }
}
}
+73 -177
View File
@@ -11,15 +11,24 @@ using Settings = Raindrop.Settings;
using UnityEngine.UI;
using UniRx;
using TMPro;
using static Raindrop.LoginUtils;
//view(unitytext) -- presenter(this) -- controller(this?) -- model (raindropinstance singleton)
namespace Raindrop.Presenters
{
//the main logic(presenter) for the login=panel.
//it saves and loads (on init) the last known user.
//it handles loggin in, inaddition to showing login messages
//We are to revert to this UI whenever the user is disconnected. (on disconnect)
//custom URL is not supported.
//grid selection is supported.
//not support custom input into dropboxes yet.
public class LoginPresenter : MonoBehaviour
{
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
private RaindropNetcom netcom { get { return instance.Netcom; } }
@@ -27,12 +36,17 @@ namespace Raindrop.Presenters
public Button LoginButton;
public TMP_InputField usernameField;
public TMP_InputField passwordField;
public Dropdown gridDropdown;
//public Dropdown gridDropdown;
public Toggle TOSCheckbox;
public Toggle RememberCheckbox;
public ModalManager ModalMgr;
public Modal loginStatusModal;
//extragrid seclections
public GameObject GridDropdownGO; //required.
public GenericDropdown genericDropdown;
//public TMP_InputField customURL;
//public Toggle customURLCheckbox;
#endregion
#region internal representations
@@ -41,7 +55,7 @@ namespace Raindrop.Presenters
private string password;
private readonly string INIT_USERNAME = "username";
private readonly string INIT_PASSWORD = "password";
private Settings s;
public string Username
{
@@ -55,9 +69,9 @@ namespace Raindrop.Presenters
public ReactiveProperty<string> Login_msg { get; private set; }
private List<string> gridDropdownOptions = new List<string> //type is grid
{
};
//private List<string> gridDropdownOptions = new List<string> //type is grid
//{
//};
private int gridSelectedItem;
@@ -67,8 +81,11 @@ namespace Raindrop.Presenters
private bool btnLoginEnabled;
private bool cbTOStrue = true;
private bool cbCustomURL = false;
private bool cbRememberBool;
private string[] options;
private DropdownMenuWithEntry usernameDropdownMenuWithEntry;
private GameObject UserDropdownMenu;
#endregion
@@ -77,7 +94,9 @@ namespace Raindrop.Presenters
// Use this for initialization
void Start()
{
initialiseFields();
//GridDropdownGO = this.gameObject.GetComponent<GenericDropdown>().gameObject;
genericDropdown = GridDropdownGO.GetComponent<GenericDropdown>();
//GridDropdownView.DropdownSelectionChanged += GenericDropdown_DropdownSelectionChanged;
LoginButton.onClick.AsObservable().Subscribe(_ => OnLoginBtnClick()); //when clicked, runs this method.
usernameField.onValueChanged.AsObservable().Subscribe(_ => Username = _); //change username property.
@@ -86,12 +105,21 @@ namespace Raindrop.Presenters
RememberCheckbox.OnValueChangedAsObservable().Subscribe(_ => cbRememberBool = _); //when toggle checkbox, set boolean to the same value as the toggle-state
TOSCheckbox.OnValueChangedAsObservable().Subscribe(_ => cbTOStrue = _); //when toggle checkbox, set boolean to the same value as the toggle-state
gridDropdown.OnValueChangedAsObservable().Subscribe(_ => gridSelectedItem = _);
//gridDropdown.OnValueChangedAsObservable().Subscribe(_ => gridSelectedItem = _);
//customURLCheckbox.onValueChanged.AsObservable().Subscribe(_ => cbCustomURL = _); //change username property.
//DropdownMenuWithEntry = UserDropdownMenu.GetComponent<DropdownMenuWithEntry>();
AddNetcomEvents();
}
private void GenericDropdown_DropdownSelectionChanged()
{
throw new NotImplementedException();
}
private void AddNetcomEvents()
{
@@ -116,21 +144,25 @@ namespace Raindrop.Presenters
{
case LoginStatus.ConnectingToLogin:
Login_msg.GetType().GetProperty("Value").SetValue(Login_msg, "Connecting to login server...");
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Logging in process...", Login_msg.Value, "cancel");
//lblLoginStatus.ForeColor = Color.Black;
break;
case LoginStatus.ConnectingToSim:
Login_msg.Value = ("Connecting to region...");
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Logging in process...", Login_msg.Value, "cancel");
//lblLoginStatus.ForeColor = Color.Black;
break;
case LoginStatus.Redirecting:
Login_msg.Value = "Redirecting...";
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Logging in process...", Login_msg.Value, "cancel");
//lblLoginStatus.ForeColor = Color.Black;
break;
case LoginStatus.ReadingResponse:
Login_msg.Value = "Reading response...";
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Logging in process...", Login_msg.Value, "cancel");
//lblLoginStatus.ForeColor = Color.Black;
break;
@@ -140,23 +172,27 @@ namespace Raindrop.Presenters
//proLogin.Visible = false;
//btnLogin.Text = "Logout";
btnLoginEnabled = true;
btnLoginEnabled = false;
instance.Client.Groups.RequestCurrentGroups();
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Logging in process...","Logged in !", "yay!");
break;
case LoginStatus.Failed:
case LoginStatus.Failed:
//lblLoginStatus.ForeColor = Color.Red;
if (e.FailReason == "tos")
{
Login_msg.Value = "Must agree to Terms of Service before logging in";
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Logging in failed",Login_msg.Value, "ok");
//pnlTos.Visible = true;
//txtTOS.Text = e.Message.Replace("\n", "\r\n");
btnLoginEnabled = false;
btnLoginEnabled = true;
}
else
{
Login_msg.Value = e.Message;
btnLoginEnabled = true;
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Logging in failed", Login_msg.Value, "ok");
btnLoginEnabled = false;
}
//proLogin.Visible = false;
@@ -168,6 +204,7 @@ namespace Raindrop.Presenters
public void netcom_ClientLoggedOut(object sender, EventArgs e)
{
Login_msg.Value = "logged out.";
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Login status", Login_msg.Value, "ok");
//pnlLoginPrompt.Visible = true;
//pnlLoggingIn.Visible = false;
@@ -180,6 +217,7 @@ namespace Raindrop.Presenters
btnLoginEnabled = false;
Login_msg.Value = "Logging out...";
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Login status", Login_msg.Value, "ok");
//lblLoginStatus.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
//proLogin.Visible = true;
@@ -188,6 +226,7 @@ namespace Raindrop.Presenters
public void netcom_ClientLoggingIn(object sender, OverrideEventArgs e)
{
Login_msg.Value = "Logging in...";
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Login status", Login_msg.Value, "ok");
//lblLoginStatus.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
//proLogin.Visible = true;
@@ -196,19 +235,7 @@ namespace Raindrop.Presenters
btnLoginEnabled = false;
}
private void cb_LoginFailed()
{
string message = "meow";
showModal("Login failed.", message);
}
private void showModal(string v, string message)
{
instance.MainCanvas.modalManager.showModal("v", message);
}
private void initialiseFields()
@@ -232,17 +259,17 @@ namespace Raindrop.Presenters
// Initilize grid dropdown
int gridIx = -1;
//GridDropdownGO.clear();
//GridDropdownGO.set(instance.GridManger.Grids);
//gridDropdown.ClearOptions();
//for (int i = 0; i < instance.GridManger.Count; i++)
//{
// //gridList.Add(instance.GridManger[i]);
// gridDropdownOptions.Add(instance.GridManger[i].ToString());
// //Debug.Log(instance.GridManger[i].ToString());
//}
//GridDropdownGO.Add("Custom");
gridDropdown.ClearOptions();
for (int i = 0; i < instance.GridManger.Count; i++)
{
//gridList.Add(instance.GridManger[i]);
gridDropdownOptions.Add(instance.GridManger[i].ToString());
//Debug.Log(instance.GridManger[i].ToString());
}
gridDropdownOptions.Add("Custom");
gridDropdown.AddOptions(gridDropdownOptions);
//if (gridIx != -1)
//{
@@ -251,13 +278,9 @@ namespace Raindrop.Presenters
Settings s = instance.GlobalSettings;
RememberCheckbox.isOn = s["remember_login"];
// Setup login name
string savedUsername;
savedUsername = s["username"];
RememberCheckbox.isOn = LoginUtils.getRememberFromSettings(s);
string savedUsername = s["username"];
usernameField.text = (savedUsername);
try
@@ -270,6 +293,7 @@ namespace Raindrop.Presenters
SavedLogin sl = SavedLogin.FromOSD(savedLogins[loginKey]);
Debug.Log("username cache: " + sl.ToString());
//cbxUsername.Items.Add(sl);
//usernameDropdownMenuWithEntry.Items.Add(sl);
}
}
}
@@ -302,6 +326,7 @@ namespace Raindrop.Presenters
// cbxLocation.Text = s["login_location"].AsString();
// }
//}
//}
//else
//{
// switch (MainProgram.s_CommandLineOpts.Location)
@@ -440,7 +465,7 @@ namespace Raindrop.Presenters
//}
//else
//{
netcom.LoginOptions.Grid = instance.GridManger.Grids[gridSelectedItem];
//netcom.LoginOptions.Grid = instance.GridManger.Grids[gridSelectedItem];
//}
if (netcom.LoginOptions.Grid.Platform != "SecondLife")
@@ -455,78 +480,10 @@ namespace Raindrop.Presenters
instance.Client.Settings.HTTP_INVENTORY = true;
}
var temp = netcom.LoginOptions;
netcom.Login();
SaveConfig();
}
private void SaveConfig()
{
Settings s = instance.GlobalSettings;
SavedLogin sl = new SavedLogin();
string username = Username;
//if (cbxUsername.SelectedIndex > 0 && cbxUsername.SelectedItem is SavedLogin)
//{
// username = ((SavedLogin)cbxUsername.SelectedItem).Username;
//}
//if (cbxGrid.SelectedIndex == cbxGrid.Items.Count - 1) // custom login uri
//{
// sl.GridID = "custom_login_uri";
// sl.CustomURI = txtCustomLoginUri.Text;
//}
//else
//{
// sl.GridID = (cbxGrid.SelectedItem as Grid).ID;
// sl.CustomURI = string.Empty;
//}
string savedLoginsKey = string.Format("{0}%{1}", username, sl.GridID);
if (!(s["saved_logins"] is OSDMap))
{
s["saved_logins"] = new OSDMap();
}
if (cbRememberBool)
{
sl.Username = s["username"] = username;
if (LoginOptions.IsPasswordMD5(Password))
{
sl.Password = Password;
s["password"] = Password;
}
else
{
sl.Password = Utils.MD5(Password);
s["password"] = Utils.MD5(Password);
}
//if (cbxLocation.SelectedIndex == -1)
//{
// sl.CustomStartLocation = cbxLocation.Text;
//}
//else
//{
// sl.CustomStartLocation = string.Empty;
//}
//sl.StartLocationType = cbxLocation.SelectedIndex;
((OSDMap)s["saved_logins"])[savedLoginsKey] = sl.ToOSD();
}
else if (((OSDMap)s["saved_logins"]).ContainsKey(savedLoginsKey))
{
((OSDMap)s["saved_logins"]).Remove(savedLoginsKey);
}
//s["login_location_type"] = OSD.FromInteger(cbxLocation.SelectedIndex);
//s["login_location"] = OSD.FromString(cbxLocation.Text);
//s["login_grid"] = OSD.FromInteger(cbxGrid.SelectedIndex);
//s["login_uri"] = OSD.FromString(txtCustomLoginUri.Text);
//s["remember_login"] = cbRemember.Checked;
LoginUtils.SaveConfig(netcom.LoginOptions, instance.GlobalSettings);
}
@@ -539,68 +496,7 @@ namespace Raindrop.Presenters
public class SavedLogin
{
public string Username;
public string Password;
public string GridID;
public string CustomURI;
public int StartLocationType;
public string CustomStartLocation;
public OSDMap ToOSD()
{
OSDMap ret = new OSDMap(4);
ret["username"] = Username;
ret["password"] = Password;
ret["grid"] = GridID;
ret["custom_url"] = CustomURI;
ret["location_type"] = StartLocationType;
ret["custom_location"] = CustomStartLocation;
return ret;
}
public static SavedLogin FromOSD(OSD data)
{
if (!(data is OSDMap)) return null;
OSDMap map = (OSDMap)data;
SavedLogin ret = new SavedLogin();
ret.Username = map["username"];
ret.Password = map["password"];
ret.GridID = map["grid"];
ret.CustomURI = map["custom_url"];
if (map.ContainsKey("location_type"))
{
ret.StartLocationType = map["location_type"];
}
else
{
ret.StartLocationType = 1;
}
ret.CustomStartLocation = map["custom_location"];
return ret;
}
public override string ToString()
{
RaindropInstance instance = RaindropInstance.GlobalInstance;
string gridName;
if (GridID == "custom_login_uri")
{
gridName = "Custom Login URI";
}
else if (instance.GridManger.KeyExists(GridID))
{
gridName = instance.GridManger[GridID].Name;
}
else
{
gridName = GridID;
}
return string.Format("{0} -- {1}", Username, gridName);
}
}
}
}
+23 -13
View File
@@ -17,20 +17,18 @@ namespace Raindrop.Presenters
public class MinimapModule:MonoBehaviour
{
[SerializeField]
private Image Image;
private Texture2D my_img;
private Image Image; //the unity ui component
private Texture2D map_tex; //the unity engine texture.
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
private RaindropNetcom netcom { get { return instance.Netcom; } }
private GridClient client { get { return instance.Client; } }
private bool isWorking = false;
private UnityEngine.Vector3 referenceToCameraPosition;
//private UnityEngine.Vector3 referenceToCameraPosition;
private UnityEngine.Vector3 referenceToAvatarPosition;
private UnityEngine.Vector3 referenceToSimPositionGlobal;
//private UnityEngine.Vector3 referenceToSimPositionGlobal;
public Button MiniMapButton;
private readonly int DEFAULT_RES = 500;
MinimapModule()
{
@@ -42,6 +40,13 @@ namespace Raindrop.Presenters
}
private void Update()
{
//set the camera to follow the avi.
}
private void OnMinimapClick()
{
@@ -52,23 +57,25 @@ namespace Raindrop.Presenters
private void Network_OnCurrentSimChanged(object sender, SimChangedEventArgs e)
{
isWorking = true;
if (client.Network.Connected) return;
GridRegion region;
if (client.Grid.GetGridRegion(client.Network.CurrentSim.Name, GridLayerType.Objects, out region))
{
SetMapLayer(my_img);
Texture2D _new_MapLayer = null; // LOL! its unity texture btw.
var _MapImageID = region.MapImageID;
UUID _MapImageID = region.MapImageID;
ManagedImage nullImage;
client.Assets.RequestImage(_MapImageID, ImageType.Baked,
delegate (TextureRequestState state, AssetTexture asset)
{
if (state == TextureRequestState.Finished)
OpenJPEG.DecodeToImage(asset.AssetData, out nullImage, out _MapLayer);
{
OpenJPEG.DecodeToImage(asset.AssetData, out nullImage, out _new_MapLayer); //this call interally calls to another function 'DecodeToImage(byte[] encoded, out ManagedImage managedImage)'
SetMapLayer(_new_MapLayer );
}
else
Debug.LogWarning("minimap failed to DL texture.");
});
@@ -76,12 +83,15 @@ namespace Raindrop.Presenters
}
private void SetMapLayer(Texture2D my_img)
private void SetMapLayer(Texture2D new_texture )
{
my_img = new Texture2D(DEFAULT_RES, DEFAULT_RES);
Destroy(map_tex); //delete the tex2d that is no longer (?) used.
map_tex = new_texture;
//throw new NotImplementedException();
}
}
}
@@ -1,5 +1,6 @@
using SixLabors.ImageSharp;
using System;
/**
* Radegast Metaverse Client
@@ -24,6 +25,18 @@ namespace Raindrop
{
public class PrintableTextUI : UnityEngine.MonoBehaviour, IPrintableMonobehavior
{
public string Text => throw new NotImplementedException();
string IPrintableMonobehavior.Content { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
Color IPrintableMonobehavior.ForeColor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
Color IPrintableMonobehavior.BackColor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
string IPrintableMonobehavior.Text { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public void AppendText(string v)
{
throw new NotImplementedException();
}
public void Clear()
{
throw new NotImplementedException();
@@ -33,5 +46,35 @@ namespace Raindrop
{
throw new NotImplementedException();
}
void IPrintableMonobehavior.ClearText()
{
throw new NotImplementedException();
}
void IPrintableMonobehavior.InsertLink(string text)
{
throw new NotImplementedException();
}
void IPrintableMonobehavior.InsertLink(string text, string hyperlink)
{
throw new NotImplementedException();
}
void IPrintableMonobehavior.PrintText(string text)
{
throw new NotImplementedException();
}
void IPrintableMonobehavior.PrintTextLine(string text)
{
throw new NotImplementedException();
}
void IPrintableMonobehavior.PrintTextLine(string text, Color color)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,63 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
//A very generic tab button. shoud use observer pattern to notify the 'parent' that the tab was cliked.
namespace Raindrop.Presenters
{
[RequireComponent(typeof(Image))]
public class TabButtonPresenter : MonoBehaviour, IPointerEnterHandler, IPointerClickHandler, IPointerExitHandler
{
public TabGroup tabGroup; //the 'parent' to notify when clicked..
public UnityEvent onTabSelected;
public UnityEvent onTabDeselected;
//[HideInInspector]
public Image background;
void Start()
{
background = GetComponent<Image>();
if (tabGroup != null)
tabGroup.Subscribe(this);
}
public void OnPointerClick(PointerEventData eventData)
{
tabGroup.OnTabSelected(this);
}
public void OnPointerEnter(PointerEventData eventData)
{
tabGroup.OnTabEnter(this);
}
public void OnPointerExit(PointerEventData eventData)
{
tabGroup.OnTabExit(this);
}
public void Select()
{
if (onTabSelected != null)
{
onTabSelected.Invoke();
}
}
public void Deselect()
{
if (onTabDeselected != null)
{
onTabSelected.Invoke();
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 55ebefe361c04fe499c1041fa9cfb9f2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+106
View File
@@ -0,0 +1,106 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Raindrop.Presenters
{
public class TabGroup : MonoBehaviour
{
// These must be 1 to 1, same order in hierarchy
[HideInInspector]
public List<TabButtonPresenter> tabButtons = new List<TabButtonPresenter>();
public List<GameObject> tabPages = new List<GameObject>();
//In case I need to sort the lists by GetSiblingIndex
//objListOrder.Sort((x, y) => x.OrderDate.CompareTo(y.OrderDate));
public Color tabIdleColor;
public Color tabHoverColor;
public Color tabSelectedColor;
private TabButtonPresenter selectedTab;
public void Start()
{
// Select first tab
foreach (TabButtonPresenter tabButton in tabButtons)
{
if (tabButton.transform.GetSiblingIndex() == 0)
OnTabSelected(tabButton);
}
}
public void Subscribe(TabButtonPresenter tabButton)
{
tabButtons.Add(tabButton);
// Sort by order in hierarchy
tabButtons.Sort((x, y) => x.transform.GetSiblingIndex().CompareTo(y.transform.GetSiblingIndex()));
}
public void OnTabEnter(TabButtonPresenter tabButton)
{
ResetTabs();
if ((selectedTab == null) || (tabButton != selectedTab))
tabButton.background.color = tabHoverColor;
}
public void OnTabExit(TabButtonPresenter tabButton)
{
ResetTabs();
}
public void OnTabSelected(TabButtonPresenter tabButton)
{
if (selectedTab != null)
{
selectedTab.Deselect();
}
selectedTab = tabButton;
selectedTab.Select();
ResetTabs();
tabButton.background.color = tabSelectedColor;
int index = tabButton.transform.GetSiblingIndex();
for (int i = 0; i < tabPages.Count; i++)
{
if (i == index)
{
tabPages[i].SetActive(true);
}
else
{
tabPages[i].SetActive(false);
}
}
}
public void ResetTabs()
{
foreach (TabButtonPresenter tabButton in tabButtons)
{
if ((selectedTab != null) && (tabButton == selectedTab))
continue;
tabButton.background.color = tabIdleColor;
}
}
public void NextTab()
{
int currentIndex = selectedTab.transform.GetSiblingIndex();
int nextIndex = currentIndex < tabButtons.Count - 1 ? currentIndex + 1 : tabButtons.Count - 1;
OnTabSelected(tabButtons[nextIndex]);
}
public void PreviousTab()
{
int currentIndex = selectedTab.transform.GetSiblingIndex();
int previousIndex = currentIndex > 0 ? currentIndex - 1 : 0;
OnTabSelected(tabButtons[previousIndex]);
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6d140dcfde9bfdd479a2f3f39b52f5e2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+6 -27
View File
@@ -24,14 +24,14 @@ using UnityEngine;
namespace Raindrop
{
public class RichTextBoxPrinter : ITextLikeGameObject
public class TextBoxPrinter : ITextPrinter
{
private IPrintableMonobehavior rtb;
private static readonly string urlRegexString = @"(https?://[^ \r\n]+)|(\[secondlife://[^ \]\r\n]* ?(?:[^\]\r\n]*)])|(secondlife://[^ \r\n]*)";
Regex urlRegex;
private SlUriParser uriParser;
public RichTextBoxPrinter(IPrintableMonobehavior textBox)
public TextBoxPrinter(IPrintableMonobehavior textBox)
{
rtb = textBox;
@@ -73,9 +73,9 @@ namespace Raindrop
for (linePartIndex = 0; linePartIndex < lineParts.Length - 1; linePartIndex += 2)
{
rtb.AppendText(lineParts[linePartIndex]);
Color c = ForeColor;
//Color c = ForeColor;
rtb.InsertLink(uriParser.GetLinkName(lineParts[linePartIndex + 1]), lineParts[linePartIndex + 1]);
ForeColor = c;
//ForeColor = c;
}
if (linePartIndex != lineParts.Length)
{
@@ -113,11 +113,8 @@ namespace Raindrop
// rtb.Invoke(new MethodInvoker(() => PrintTextLine(text, color)));
// return;
//}
Color c = ForeColor;
ForeColor = color;
PrintTextLine(text);
ForeColor = c;
PrintTextLine(text);
}
public void ClearText()
@@ -131,24 +128,6 @@ namespace Raindrop
set => rtb.Text = value;
}
public Color ForeColor
{
get => rtb.SelectionColor;
set => rtb.SelectionColor = value;
}
public Color BackColor
{
get => rtb.SelectionBackColor;
set => rtb.SelectionBackColor = value;
}
public Font Font
{
get => rtb.SelectionFont;
set => rtb.SelectionFont = value;
}
#endregion
}
}
+1 -1
View File
@@ -22,7 +22,7 @@ public class MainEntryPoint : MonoBehaviour
private void Awake()
{
MainRaindropInstance = RaindropInstance.GlobalInstance;
MainRaindropInstance = RaindropInstance.GlobalInstance;
}
}
+42
View File
@@ -0,0 +1,42 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using UnityEngine;
//using Raindrop;
////this contains functions that help UnityUI directly call the internal functions. just like a facade.
//public class RaindropFacade : MonoBehaviour
//{
// //public GameObject EULApanel;
// //public CanvasManager CanvasManagerRef;
// //this static-new is like a globally accessible instance without a singleton! :)
// public RaindropInstance MainRaindropInstance;
// //this one manages the viewmodels and the stacking of UI modals.
// //public MonoViewModel RaindropVM;
// public void UIShowEULAPanel()
// {
// MainRaindropInstance.MainCanvas.canvasManager.pushCanvas(CanvasType.EULA);
// }
// public void UIPushPanel(CanvasType ct)
// {
// MainRaindropInstance.MainCanvas.canvasManager.pushCanvas(ct);
// }
// public void UIPopTopPanel()
// {
// MainRaindropInstance.MainCanvas.canvasManager.popCanvas();
// }
// public string app_data_Path { get; private set; }
// private void Awake()
// {
// MainRaindropInstance = RaindropInstance.GlobalInstance;
// }
//}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b66cc37da73a39d428d4312da2f22e75
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4a1b7411272091e42a21f18134312226
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,39 @@
using Raindrop.Netcom;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using Raindrop.Rendering;
namespace Raindrop.Unity3D
{
//sets the attached gameobject to the location of the user in the sim.
class AgentLocationUpdater : MonoBehaviour
{
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
private RaindropNetcom netcom { get { return instance.Netcom; } }
bool Active => instance.Client.Network.Connected;
private void Awake()
{
}
private void Update()
{
if (! Active)
{
return;
}
transform.position = (UnityEngine.Vector3)RHelp.TKVector3(instance.Client.Self.SimPosition); //convert OMV v3 to unity v3, so that we can move the object to the desired location lol.
//transform.rotation = (UnityEngine.Vector3)RHelp.TKVector4(instance.Client.Self.SimRotation);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5e54be4f9b460e64cbe1a7a1a8f900f9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,93 @@
using Raindrop.Netcom;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using Raindrop.Rendering;
using OpenMetaverse;
using System.Threading;
namespace Raindrop.Unity3D
{
//sets the mesh of the gameobject to match the sim's shape.
class TerrainMeshUpdater : MonoBehaviour
{
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
private RaindropNetcom netcom { get { return instance.Netcom; } }
bool Active => instance.Client.Network.Connected;
public bool Modified = true;
float[,] heightTable = new float[256, 256];
bool fetchingTerrainTexture = false;
Texture2D terrainImage = null;
MeshRenderer meshRenderer;
bool terrainTextureNeedsUpdate = false;
private OpenMetaverse.Simulator knownCurrentSim;
private void Awake()
{
MeshRenderer meshRenderer = gameObject.AddComponent<MeshRenderer>();
meshRenderer.sharedMaterial = new UnityEngine.Material(Shader.Find("Standard")); //hopefully this not use reflection.
}
private void Update()
{
if (! Active)
{
return;
}
if (instance.Client.Network.CurrentSim != knownCurrentSim)
{
knownCurrentSim = instance.Client.Network.CurrentSim;
resetMesh();
}
if (terrainTextureNeedsUpdate)
{
UpdateTerrainTexture();
}
}
private void resetMesh()
{
if (terrainImage != null)
{
Destroy(terrainImage);
terrainImage = null;
}
fetchingTerrainTexture = false;
Modified = true;
}
void UpdateTerrainTexture()
{
if (!fetchingTerrainTexture)
{
fetchingTerrainTexture = true;
ThreadPool.QueueUserWorkItem(sync =>
{
Simulator sim = instance.Client.Network.CurrentSim;
terrainImage = TerrainSplat.Splat(instance, heightTable,
new UUID[] { sim.TerrainDetail0, sim.TerrainDetail1, sim.TerrainDetail2, sim.TerrainDetail3 },
new float[] { sim.TerrainStartHeight00, sim.TerrainStartHeight01, sim.TerrainStartHeight10, sim.TerrainStartHeight11 },
new float[] { sim.TerrainHeightRange00, sim.TerrainHeightRange01, sim.TerrainHeightRange10, sim.TerrainHeightRange11 });
fetchingTerrainTexture = false;
terrainTextureNeedsUpdate = false;
});
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 273bea64f85319b47951a7be20af4cc6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 32ec4e5084bec564cbf86ed4ecce62c1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
-17
View File
@@ -1,17 +0,0 @@
// The Model. All property notify when their values change
using UniRx;
public class Enemy
{
public ReactiveProperty<long> CurrentHp { get; private set; }
public IReadOnlyReactiveProperty<bool> IsDead { get; private set; }
public Enemy(int initialHp)
{
// Declarative Property
CurrentHp = new ReactiveProperty<long>((long)initialHp);
IsDead = CurrentHp.Select(x => x <= 0).ToReactiveProperty();
}
}
-32
View File
@@ -1,32 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
// Presenter for scene(canvas) root.
public class ReactivePresenter : MonoBehaviour
{
// Presenter is aware of its View (binded in the inspector)
public Button MyButton;
public Toggle MyToggle;
public Text MyText;
// State-Change-Events from Model by ReactiveProperty
Enemy enemy = new Enemy(1000);
void Start()
{
// Rx supplies user events from Views and Models in a reactive manner
MyButton.OnClickAsObservable().Subscribe(_ => enemy.CurrentHp.Value -= 99); // subscribe to the onclick() event abd fire this callback method when the event is raised
MyToggle.OnValueChangedAsObservable().SubscribeToInteractable(MyButton); //subscribed to the onvaluechanged() event of this toggle. set interactable of 'Mybutton' to same as the value in the event.
// Models notify Presenters via Rx, and Presenters update their views
enemy.CurrentHp.SubscribeToText(MyText); //subscribe to the current hp paramter in model. when it change, update mytext paramteter to match.
enemy.IsDead.Where(isDead => isDead == true) //subscribe to the isdead parameter in model. if isDead is true in the event, run the lambda callback method 'interactable of my button to false.'
.Subscribe(_ =>
{
MyToggle.interactable = MyButton.interactable = false;
});
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

+120
View File
@@ -0,0 +1,120 @@
fileFormatVersion: 2
guid: b16b592b8b2486b4ba0010dbd9b2cf47
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

+120
View File
@@ -0,0 +1,120 @@
fileFormatVersion: 2
guid: 20aba566ba3a6da4aa6738e21a786cad
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
-32
View File
@@ -1,32 +0,0 @@
using System;
/**
* Raindrop Metaverse Client
* Copyright(c) 2009-2014, Raindrop Development Team
* Copyright(c) 2016-2020, Sjofn, LLC
* All rights reserved.
*
* Raindrop is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program.If not, see<https://www.gnu.org/licenses/>.
*/
namespace Catnip.Drawing
{
internal class Color
{
internal static Color FromArgb(int v1, int v2, int v3, int v4)
{
throw new NotImplementedException();
}
}
}
+51 -48
View File
@@ -1,55 +1,58 @@
{
"dependencies" : {
"com.gameframe.gui" : "https://github.com/coryleach/UnityGUI.git#2.0.0",
"com.unity.2d.sprite" : "1.0.0",
"com.unity.collab-proxy" : "1.3.9",
"com.unity.ide.rider" : "2.0.7",
"com.unity.ide.visualstudio" : "2.0.7",
"com.unity.ide.vscode" : "1.2.3",
"com.unity.test-framework" : "1.1.24",
"com.unity.textmeshpro" : "3.0.4",
"com.unity.timeline" : "1.4.7",
"com.unity.ugui" : "1.0.0",
"com.unity.modules.ai" : "1.0.0",
"com.unity.modules.androidjni" : "1.0.0",
"com.unity.modules.animation" : "1.0.0",
"com.unity.modules.assetbundle" : "1.0.0",
"com.unity.modules.audio" : "1.0.0",
"com.unity.modules.cloth" : "1.0.0",
"com.unity.modules.director" : "1.0.0",
"com.unity.modules.imageconversion" : "1.0.0",
"com.unity.modules.imgui" : "1.0.0",
"com.unity.modules.jsonserialize" : "1.0.0",
"com.unity.modules.particlesystem" : "1.0.0",
"com.unity.modules.physics" : "1.0.0",
"com.unity.modules.physics2d" : "1.0.0",
"com.unity.modules.screencapture" : "1.0.0",
"com.unity.modules.terrain" : "1.0.0",
"com.unity.modules.terrainphysics" : "1.0.0",
"com.unity.modules.tilemap" : "1.0.0",
"com.unity.modules.ui" : "1.0.0",
"com.unity.modules.uielements" : "1.0.0",
"com.unity.modules.umbra" : "1.0.0",
"com.unity.modules.unityanalytics" : "1.0.0",
"com.unity.modules.unitywebrequest" : "1.0.0",
"com.unity.modules.unitywebrequestassetbundle" : "1.0.0",
"com.unity.modules.unitywebrequestaudio" : "1.0.0",
"com.unity.modules.unitywebrequesttexture" : "1.0.0",
"com.unity.modules.unitywebrequestwww" : "1.0.0",
"com.unity.modules.vehicles" : "1.0.0",
"com.unity.modules.video" : "1.0.0",
"com.unity.modules.vr" : "1.0.0",
"com.unity.modules.wind" : "1.0.0",
"com.unity.modules.xr" : "1.0.0",
"jillejr.newtonsoft.json-for-unity" : "13.0.102"
"dependencies": {
"com.gameframe.gui": "https://github.com/coryleach/UnityGUI.git#2.0.0",
"com.unity.2d.sprite": "1.0.0",
"com.unity.burst": "1.5.4",
"com.unity.collab-proxy": "1.3.9",
"com.unity.collections": "0.17.0-preview.18",
"com.unity.ide.rider": "2.0.7",
"com.unity.ide.visualstudio": "2.0.7",
"com.unity.ide.vscode": "1.2.3",
"com.unity.jobs": "0.8.0-preview.23",
"com.unity.test-framework": "1.1.24",
"com.unity.textmeshpro": "3.0.4",
"com.unity.timeline": "1.4.7",
"com.unity.ugui": "1.0.0",
"jillejr.newtonsoft.json-for-unity": "https://github.com/jilleJr/Newtonsoft.Json-for-Unity.git#upm",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.cloth": "1.0.0",
"com.unity.modules.director": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.physics2d": "1.0.0",
"com.unity.modules.screencapture": "1.0.0",
"com.unity.modules.terrain": "1.0.0",
"com.unity.modules.terrainphysics": "1.0.0",
"com.unity.modules.tilemap": "1.0.0",
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.uielements": "1.0.0",
"com.unity.modules.umbra": "1.0.0",
"com.unity.modules.unityanalytics": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
"com.unity.modules.unitywebrequestaudio": "1.0.0",
"com.unity.modules.unitywebrequesttexture": "1.0.0",
"com.unity.modules.unitywebrequestwww": "1.0.0",
"com.unity.modules.vehicles": "1.0.0",
"com.unity.modules.video": "1.0.0",
"com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
},
"scopedRegistries" : [
"scopedRegistries": [
{
"name" : "jilleJr",
"url" : "https://npm.cloudsmith.io/jillejr/newtonsoft-json-for-unity",
"scopes" : [
"name": "jilleJr",
"url": "https://npm.cloudsmith.io/jillejr/newtonsoft-json-for-unity",
"scopes": [
"jillejr.newtonsoft.json-for-unity"
]
}
]
}
}
+38 -3
View File
@@ -15,6 +15,15 @@
"source": "builtin",
"dependencies": {}
},
"com.unity.burst": {
"version": "1.5.4",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.mathematics": "1.2.1"
},
"url": "https://packages.unity.com"
},
"com.unity.collab-proxy": {
"version": "1.3.9",
"depth": 0,
@@ -22,6 +31,15 @@
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.collections": {
"version": "0.17.0-preview.18",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.burst": "1.5.3"
},
"url": "https://packages.unity.com"
},
"com.unity.ext.nunit": {
"version": "1.0.6",
"depth": 1,
@@ -54,6 +72,23 @@
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.jobs": {
"version": "0.8.0-preview.23",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.collections": "0.15.0-preview.21",
"com.unity.mathematics": "1.2.1"
},
"url": "https://packages.unity.com"
},
"com.unity.mathematics": {
"version": "1.2.1",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.test-framework": {
"version": "1.1.24",
"depth": 0,
@@ -96,11 +131,11 @@
}
},
"jillejr.newtonsoft.json-for-unity": {
"version": "13.0.102",
"version": "https://github.com/jilleJr/Newtonsoft.Json-for-Unity.git#upm",
"depth": 0,
"source": "registry",
"source": "git",
"dependencies": {},
"url": "https://npm.cloudsmith.io/jillejr/newtonsoft-json-for-unity"
"hash": "f2c6cb09817832dccd0600f291053d8d55298ee9"
},
"com.unity.modules.ai": {
"version": "1.0.0",
+1 -1
View File
@@ -9,6 +9,6 @@ EditorBuildSettings:
path: Assets/Scenes/SampleScene.unity
guid: 9fc0d4010bbf28b4594072e72b8655ab
- enabled: 1
path: Assets/Scenes/UIMocks.unity
path: Assets/Scenes/newUI.unity
guid: a72b6cd7ea683e5459da82491579217e
m_configObjects: {}
+3 -3
View File
@@ -12,11 +12,11 @@ MonoBehaviour:
m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_EnablePreviewPackages: 0
m_EnablePackageDependencies: 0
m_EnablePreviewPackages: 1
m_EnablePackageDependencies: 1
m_AdvancedSettingsExpanded: 1
m_ScopedRegistriesSettingsExpanded: 1
oneTimeWarningShown: 0
oneTimeWarningShown: 1
m_Registries:
- m_Id: main
m_Name: