Template
*
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db652713c229a9f4eb22bdeaebf66ee0
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b44823674f0f024e96dfcbb6c2ba395
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eab96370ae1f9ee4e8bf7adb3bff193e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Reflection;
|
||||
//using System;
|
||||
|
||||
[CustomPropertyDrawer (typeof (InspectorButton))]
|
||||
public class InspectorButtonDrawer : PropertyDrawer {
|
||||
|
||||
|
||||
|
||||
|
||||
public override void OnGUI (Rect pos, SerializedProperty prop, GUIContent label) {
|
||||
SerializedObject O = prop.GetType ().GetField ("m_SerializedObject", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(prop) as SerializedObject;
|
||||
Object[] TargetObjects = O.targetObjects;
|
||||
|
||||
|
||||
string MethodName = prop.name;
|
||||
char[] charsToTrim = {'_'};
|
||||
MethodName = MethodName.Trim(charsToTrim);
|
||||
MethodInfo TargetMethod = TargetObjects[0].GetType ().GetMethod (MethodName);
|
||||
if (TargetMethod == null) {
|
||||
GUI.color = Color.red;
|
||||
GUI.Label(pos,"Method "+MethodName+" not found.");
|
||||
GUI.color = Color.white;
|
||||
return;
|
||||
}
|
||||
|
||||
if (GUI.Button (pos, MethodName)) {
|
||||
foreach (Object o in TargetObjects)
|
||||
TargetMethod.Invoke(o,new object[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
[System.Serializable]
|
||||
public struct InspectorButton { }
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fbdbaf4ec4741148a8dcd3202435ddf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,385 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
public class LevelLoader : MonoBehaviour
|
||||
{
|
||||
public string LevelName = "COLD1";
|
||||
|
||||
private string _resoucresDir = @"C:\Users\l-pro\OneDrive\Рабочий стол\HogsOfWar\Processed";
|
||||
|
||||
private string PmgPath { get { return Path.Combine(_resoucresDir, LevelName + ".PMG"); } }
|
||||
|
||||
private string PtgPath { get { return Path.Combine(_resoucresDir, LevelName + ".PTG"); } }
|
||||
|
||||
private string PogPath { get { return Path.Combine(_resoucresDir, LevelName + ".POG"); } }
|
||||
|
||||
|
||||
public static uint TimPixelToRgba32(ushort timPixel) {
|
||||
uint r = (uint)(timPixel & 0x1f);
|
||||
uint g = (uint)(((timPixel) >> 5) & 0x1f);
|
||||
uint b = (uint)(((timPixel) >> 10) & 0x1f);
|
||||
|
||||
r <<= 3;
|
||||
g <<= 3;
|
||||
b <<= 3;
|
||||
|
||||
bool black = (timPixel & 0x7fff) == 0;
|
||||
bool stpOn = (timPixel & 0x8000) != 0;
|
||||
|
||||
uint alpha = ((black && stpOn) || (!black && !stpOn)) ? (byte)0xff : (byte)0x00;
|
||||
return r | (g << 8) | (b << 16) | (alpha << 24);
|
||||
}
|
||||
|
||||
public Material Mat;
|
||||
|
||||
private static ImageRGBA32 TimToImage(TimFile tim) {
|
||||
uint[] data = new uint[tim.ImageHeight * tim.ImageWidth];
|
||||
|
||||
var format = tim.header.Format;
|
||||
|
||||
if (format == TimFile.Format.Bpp4Bit) {
|
||||
|
||||
for (int i = 0; i < tim.image.data.Length; i++) {
|
||||
var ip = tim.image.data[i];
|
||||
var i0 = (ip >> 0) & 0x0f;
|
||||
var i1 = (ip >> 4) & 0x0f;
|
||||
var i2 = (ip >> 8) & 0x0f;
|
||||
var i3 = (ip >> 12) & 0x0f;
|
||||
|
||||
|
||||
data[i * 4 + 0] = TimPixelToRgba32(tim.lut.data[i0]);
|
||||
data[i * 4 + 1] = TimPixelToRgba32(tim.lut.data[i1]);
|
||||
data[i * 4 + 2] = TimPixelToRgba32(tim.lut.data[i2]);
|
||||
data[i * 4 + 3] = TimPixelToRgba32(tim.lut.data[i3]);
|
||||
}
|
||||
|
||||
}
|
||||
ImageRGBA32 img = new ImageRGBA32((uint)tim.ImageWidth, (uint)tim.ImageHeight, data);
|
||||
return img;
|
||||
}
|
||||
|
||||
public InspectorButton Rebuild_;
|
||||
|
||||
class ImageRGBA32 {
|
||||
public uint Width;
|
||||
public uint Height;
|
||||
public uint[] Data;
|
||||
|
||||
public ImageRGBA32(uint width, uint height) {
|
||||
Width = width;
|
||||
Height = height;
|
||||
Data = new uint[Width * Height];
|
||||
}
|
||||
|
||||
public ImageRGBA32(uint width, uint height, uint[] data) {
|
||||
Width = width;
|
||||
Height = height;
|
||||
Data = data;
|
||||
}
|
||||
|
||||
public void Fill(uint color) {
|
||||
for(int i = 0; i < Data.Length; ++i) {
|
||||
Data[i] = color;
|
||||
}
|
||||
}
|
||||
|
||||
public void Blit(ImageRGBA32 image, uint x, uint y) {
|
||||
for(uint iy = 0; iy < image.Height; ++iy) {
|
||||
uint ry = iy + y;
|
||||
if(ry >= Height) {
|
||||
break;
|
||||
}
|
||||
for (uint ix = 0; ix < image.Width; ++ix) {
|
||||
uint rx = ix + x;
|
||||
if (rx >= Width) {
|
||||
break;
|
||||
}
|
||||
|
||||
var color = image.Data[iy * image.Width + ix];
|
||||
Data[ry * Width + rx] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Texture2D ToTexture2D() {
|
||||
Texture2D tex = new Texture2D((int)Width, (int)Height, TextureFormat.RGBA32, false);
|
||||
|
||||
var handle = GCHandle.Alloc(Data, GCHandleType.Pinned);
|
||||
tex.LoadRawTextureData(handle.AddrOfPinnedObject(), Data.Length * 4);
|
||||
handle.Free();
|
||||
tex.Apply();
|
||||
|
||||
return tex;
|
||||
}
|
||||
|
||||
|
||||
public ImageRGBA32 FlipX() {
|
||||
ImageRGBA32 result = new ImageRGBA32(Width, Height);
|
||||
|
||||
for (int y = 0; y < Height; ++y) {
|
||||
for (int x = 0; x < Width; ++x) {
|
||||
|
||||
var vy = y;
|
||||
var vx = Width - x - 1;
|
||||
|
||||
result.Data[vy * result.Width + vx] = Data[y * Width + x];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public ImageRGBA32 Rotate90() {
|
||||
ImageRGBA32 result = new ImageRGBA32(Height, Width);
|
||||
|
||||
for(int y = 0; y < Height; ++y) {
|
||||
for (int x = 0; x < Width; ++x) {
|
||||
|
||||
var vy = x;
|
||||
var vx = Height - y - 1;
|
||||
|
||||
result.Data[vy * result.Width + vx] = Data[y * Width + x];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public Texture2D Atlas;
|
||||
|
||||
public bool ApplyTransform = false;
|
||||
|
||||
public void BuildMapTexture(PmgFile pmg, PtgFile ptg) {
|
||||
|
||||
var textures = ptg.Textures.Select(v => TimToImage(v)).ToArray();
|
||||
|
||||
var sideBlocks = (int)Math.Sqrt(pmg.Blocks.Length);
|
||||
Debug.Log("Side blocks: " + sideBlocks);
|
||||
|
||||
|
||||
uint atlasSize = (uint)(sideBlocks * 4 * ptg.Textures[0].ImageWidth);
|
||||
uint textureBlockSize = textures[0].Width;
|
||||
|
||||
ImageRGBA32 atlas = new ImageRGBA32(atlasSize, atlasSize);
|
||||
atlas.Fill(0xffffffff);
|
||||
|
||||
Debug.Log("Atlas size: " + atlasSize);
|
||||
|
||||
for (int y = 0; y < sideBlocks; ++y) {
|
||||
for (int x = 0; x < sideBlocks; ++x) {
|
||||
int blockId = y * sideBlocks + x;
|
||||
|
||||
var block = pmg.Blocks[blockId];
|
||||
|
||||
for (int tileY = 0; tileY < 4; ++tileY) {
|
||||
for (int tileX = 0; tileX < 4; ++tileX) {
|
||||
|
||||
int tileId = tileY * 4 + tileX;
|
||||
|
||||
var tile = block.tiles[tileId];
|
||||
|
||||
var texId = tile.TextureIndex;
|
||||
|
||||
/* if(tile.RotationFlip != PmgFile.PmgBlock.Tile.Transform.None) {
|
||||
Debug.Log("Transform = " + tile.RotationFlip.ToString());
|
||||
}*/
|
||||
|
||||
var tex = textures[texId];
|
||||
|
||||
if (ApplyTransform) {
|
||||
|
||||
if ((tile.RotationFlip & PmgFile.PmgBlock.Tile.Transform.FlipX) == PmgFile.PmgBlock.Tile.Transform.FlipX) {
|
||||
tex = tex.FlipX();
|
||||
}
|
||||
|
||||
if ((tile.RotationFlip & PmgFile.PmgBlock.Tile.Transform.Rotate90) == PmgFile.PmgBlock.Tile.Transform.Rotate90) {
|
||||
tex = tex.Rotate90();
|
||||
}
|
||||
|
||||
if ((tile.RotationFlip & PmgFile.PmgBlock.Tile.Transform.Rotate180) == PmgFile.PmgBlock.Tile.Transform.Rotate180) {
|
||||
tex = tex.Rotate90();
|
||||
tex = tex.Rotate90();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var ty = y * 4 + tileY;
|
||||
var tx = x * 4 + tileX;
|
||||
atlas.Blit(tex, (uint)(tx * textureBlockSize), (uint)(ty * textureBlockSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Atlas = atlas.ToTexture2D();
|
||||
Atlas.filterMode = FilterMode.Point;
|
||||
|
||||
if (Mat != null) {
|
||||
Mat.mainTexture = Atlas;
|
||||
}
|
||||
}
|
||||
|
||||
public PogFile.ObjectRecord[] Objects;
|
||||
|
||||
private float unitScale = 1.0f / 512.0f;
|
||||
|
||||
|
||||
private void PlaceObjects() {
|
||||
var pogBytes = File.ReadAllBytes(PogPath);
|
||||
Objects = PogFile.Parse(pogBytes).Objects;
|
||||
|
||||
|
||||
var parent = transform.GetChild(0);
|
||||
|
||||
var oldChildsCount = parent.childCount;
|
||||
|
||||
List<Transform> children = new List<Transform>();
|
||||
|
||||
for(int i = 0; i < oldChildsCount; ++i) {
|
||||
children.Add(parent.GetChild(i));
|
||||
}
|
||||
|
||||
|
||||
foreach(var child in children) {
|
||||
UnityEngine.Object.DestroyImmediate(child.gameObject);
|
||||
}
|
||||
|
||||
foreach (var obj in Objects) {
|
||||
var transform = new Vector3(-obj.XOffset, obj.YOffset, -obj.ZOffset) * unitScale;
|
||||
|
||||
GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
|
||||
cube.transform.parent = parent;
|
||||
cube.transform.position = transform;
|
||||
cube.transform.localScale = Vector3.one;
|
||||
cube.transform.localRotation = Quaternion.identity;
|
||||
cube.name = obj.Name;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Rebuild() {
|
||||
PlaceObjects();
|
||||
|
||||
var pmgBytes = File.ReadAllBytes(PmgPath);
|
||||
var ptgBytes = File.ReadAllBytes(PtgPath);
|
||||
|
||||
var pmg = PmgFile.Parse(pmgBytes);
|
||||
var ptg = PtgFile.Parse(ptgBytes);
|
||||
|
||||
|
||||
var pmgBlocks = pmg.Blocks;
|
||||
|
||||
List<Vector3> result = new List<Vector3>();
|
||||
|
||||
List<int> indices = new List<int>();
|
||||
|
||||
Debug.Log("pmgBlocks count: " + pmgBlocks.Length);
|
||||
|
||||
TriangleMeshConstructor mc = new TriangleMeshConstructor();
|
||||
var uvs = mc.UvChannel(0);
|
||||
|
||||
int blockSideCount = (int)Math.Sqrt(pmgBlocks.Length);
|
||||
|
||||
int blockx = 0;
|
||||
int blocky = 0;
|
||||
|
||||
List<Color> colors = new List<Color>();
|
||||
|
||||
short zoffset = -32001;
|
||||
|
||||
|
||||
var cornerX = -8 * 4 * 512;
|
||||
var cornerY = 8 * 4 * 512;
|
||||
|
||||
var cornerDX = cornerX - pmgBlocks[0].xOffset;
|
||||
var cornerDY = cornerY - pmgBlocks[0].zOffset;
|
||||
|
||||
foreach (var block in pmgBlocks) {
|
||||
float x = block.xOffset + cornerDX;
|
||||
float z = block.zOffset+ cornerDY;
|
||||
|
||||
if(zoffset != block.zOffset) {
|
||||
zoffset = block.zOffset;
|
||||
Debug.Log("zoffset: " + zoffset);
|
||||
|
||||
}
|
||||
|
||||
var vertices = block.vertices;
|
||||
|
||||
int indexOffset = result.Count;
|
||||
|
||||
for (int i = 0; i < vertices.Length; ++i) {
|
||||
var v = vertices[i];
|
||||
|
||||
int vx = (i % 5) * 512;
|
||||
int vy = (i / 5) * 512;
|
||||
|
||||
int vXId = blockx * 4 + (i % 5);
|
||||
int vYId = blocky * 4 + (i / 5);
|
||||
|
||||
uvs.Add(new Vector2(vXId / (float)(blockSideCount * 4), vYId / (float)(blockSideCount * 4)));
|
||||
|
||||
result.Add(new Vector3(-(x + vx), v.height, (-z + vy)) * unitScale);
|
||||
|
||||
float l = v.lighting / 255.0f;
|
||||
|
||||
colors.Add(new Color(l, l, l, 1.0f));
|
||||
}
|
||||
|
||||
for (int yVertex = 0; yVertex < 4; yVertex++) {
|
||||
for (int xVertex = 0; xVertex < 4; xVertex++) {
|
||||
|
||||
int i0 = (yVertex + 0) * 5 + (xVertex + 0);
|
||||
int i2 = (yVertex + 1) * 5 + (xVertex + 0);
|
||||
int i1 = (yVertex + 0) * 5 + (xVertex + 1);
|
||||
|
||||
int i3 = (yVertex + 0) * 5 + (xVertex + 1);
|
||||
int i5 = (yVertex + 1) * 5 + (xVertex + 0);
|
||||
int i4 = (yVertex + 1) * 5 + (xVertex + 1);
|
||||
|
||||
indices.Add(i0 + indexOffset);
|
||||
indices.Add(i1 + indexOffset);
|
||||
indices.Add(i2 + indexOffset);
|
||||
|
||||
indices.Add(i3 + indexOffset);
|
||||
indices.Add(i4 + indexOffset);
|
||||
indices.Add(i5 + indexOffset);
|
||||
}
|
||||
}
|
||||
|
||||
blockx++;
|
||||
if(blockx == blockSideCount) {
|
||||
blockx = 0;
|
||||
blocky++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
mc.Vertices = result;
|
||||
mc.Indices = indices.ToArray();
|
||||
mc.Colors = colors;
|
||||
// mc.AssingColors(Color.white);
|
||||
mc.BreakVertices();
|
||||
|
||||
mc.RecalculateFlatNormals();
|
||||
|
||||
var pm = GetComponent<ProceduralMesh>();
|
||||
pm.Rebuild(mc);
|
||||
|
||||
BuildMapTexture(pmg, ptg);
|
||||
|
||||
GetComponent<MeshRenderer>().sharedMaterial.mainTexture = Atlas;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 633b283922cbc694fbe8e51e90430a0b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,77 @@
|
||||
%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: New Material 1
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
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}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa4a620216138984aa040fbcfd5cbc66
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,85 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public class PmgFile {
|
||||
|
||||
[Serializable]
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public class PmgBlock {
|
||||
[Serializable]
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct Vertex {
|
||||
public short height; // height sample
|
||||
public short lighting; // <= 255
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct Tile {
|
||||
|
||||
[Flags]
|
||||
public enum Transform : byte {
|
||||
FlipX = 1,
|
||||
Rotate90 = 2,
|
||||
Rotate180 = 4
|
||||
}
|
||||
|
||||
public enum Slip : byte {
|
||||
Full = 0,
|
||||
Bottom = 1,
|
||||
Left = 2,
|
||||
Top = 3,
|
||||
Right = 4,
|
||||
BottomRight = 5,
|
||||
BottomLeft = 6,
|
||||
TopLeft = 7,
|
||||
TopRight = 8
|
||||
}
|
||||
|
||||
public short Field0; // always 0 -> obsolete xOffset?
|
||||
public short Field1; // always 0 -> obsolete yOffset?
|
||||
public short Field2; // always 0 -> obsolete zOffset?
|
||||
|
||||
public char Type;
|
||||
public Slip slip;
|
||||
public short Field3;
|
||||
public Transform RotationFlip;
|
||||
public int TextureIndex;
|
||||
public char Field4;
|
||||
}
|
||||
|
||||
public short xOffset; // -16384 ~ 16384
|
||||
public short yOffset; // unreliable?
|
||||
public short zOffset; // -16384 ~ 16384
|
||||
public short Field0;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 25)]
|
||||
public Vertex[] vertices;
|
||||
|
||||
public int Field1;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public Tile[] tiles;
|
||||
}
|
||||
|
||||
public PmgBlock[] Blocks;
|
||||
|
||||
public static PmgFile Parse(byte[] data) {
|
||||
PmgFile result = new PmgFile();
|
||||
var blockSize = Marshal.SizeOf(typeof(PmgBlock));
|
||||
int blockCount = data.Length / blockSize;
|
||||
|
||||
var handle = GCHandle.Alloc(data, GCHandleType.Pinned);
|
||||
var ptr = handle.AddrOfPinnedObject();
|
||||
|
||||
List<PmgBlock> blocks = new List<PmgBlock>();
|
||||
for (int Block = 0; Block < blockCount; Block++) {
|
||||
blocks.Add(Marshal.PtrToStructure<PmgBlock>(ptr));
|
||||
ptr += blockSize;
|
||||
}
|
||||
handle.Free();
|
||||
result.Blocks = blocks.ToArray();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1270eb9f822e7dc41aa582824ba23d09
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PmgMesh : MonoBehaviour
|
||||
{
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c21c6db49345dc741bdafe1cbf4218fe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
public class PogFile
|
||||
{
|
||||
[Serializable]
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct ObjectRecord {
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
|
||||
public string Name;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public byte[] SomeData;
|
||||
|
||||
public short XOffset;
|
||||
public short YOffset;
|
||||
public short ZOffset;
|
||||
|
||||
public short ID;
|
||||
public short XRotation; // 4096 = 360°
|
||||
public short YRotation; // 4096 = 360°
|
||||
public short ZRotation; // 4096 = 360°
|
||||
public short TypeID; // Model type id (instancing)
|
||||
|
||||
public short BoundingBoxWidth;
|
||||
public short BoundingBoxHeight;
|
||||
public short BoundingBoxLength;
|
||||
|
||||
public short BoundingBoxType;
|
||||
|
||||
public short Short0;
|
||||
public byte Byte0;
|
||||
|
||||
public byte Team;
|
||||
|
||||
public short ScriptType;
|
||||
|
||||
public byte ScriptGroup;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)]
|
||||
public byte[] ScriptParamters;
|
||||
public short ScriptXOffset;
|
||||
public short ScriptYOffset;
|
||||
public short ScriptZOffset;
|
||||
|
||||
public short Flag;
|
||||
|
||||
public short Short1;
|
||||
public short Short2;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private ObjectRecord[] _objects;
|
||||
|
||||
public ObjectRecord[] Objects {
|
||||
get { return _objects; }
|
||||
}
|
||||
|
||||
public static PogFile Parse(byte[] data) {
|
||||
PogFile result = new PogFile();
|
||||
|
||||
MemoryStream src = new MemoryStream(data);
|
||||
|
||||
BinaryReader r = new BinaryReader(src);
|
||||
var count = r.ReadUInt16();
|
||||
|
||||
var itemSize = Marshal.SizeOf<ObjectRecord>();
|
||||
|
||||
|
||||
List<ObjectRecord> records = new List<ObjectRecord>();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
var itemData = r.ReadBytes(itemSize);
|
||||
|
||||
var handle = GCHandle.Alloc(itemData, GCHandleType.Pinned);
|
||||
records.Add( Marshal.PtrToStructure<ObjectRecord>(handle.AddrOfPinnedObject()));
|
||||
|
||||
|
||||
}
|
||||
result._objects = records.ToArray();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2a0498aa7d4ac3488e46b47a9ed49b6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 66dc951a7eb347f43bae6565765c1d5e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1bbb36f00b3c97149b3ac8cc4a00e78e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,117 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class LineChar {
|
||||
public float Width;
|
||||
public List<Vector2> Vertices = new List<Vector2>();
|
||||
};
|
||||
|
||||
public static class LineFont
|
||||
{
|
||||
public static readonly List<LineChar> Chars;
|
||||
|
||||
static LineFont()
|
||||
{
|
||||
Chars = new List<LineChar>(
|
||||
new LineChar[]
|
||||
{
|
||||
/* */ new LineChar{Width = 16, Vertices = new List<Vector2>(new Vector2[]{})},
|
||||
/*!*/ new LineChar{Width = 10, Vertices = new List<Vector2>(new Vector2[]{new Vector2(5,21),new Vector2(5,7),new Vector2(5,2),new Vector2(4,1),new Vector2(4,1),new Vector2(5,0),new Vector2(5,0),new Vector2(6,1),new Vector2(6,1),new Vector2(5,2)})},
|
||||
/*"*/ new LineChar{Width = 16, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,14),new Vector2(12,21),new Vector2(12,14)})},
|
||||
/*#*/ new LineChar{Width = 21, Vertices = new List<Vector2>(new Vector2[]{new Vector2(11,25),new Vector2(4,-7),new Vector2(17,25),new Vector2(10,-7),new Vector2(4,12),new Vector2(18,12),new Vector2(3,6),new Vector2(17,6)})},
|
||||
/*$*/ new LineChar{Width = 20, Vertices = new List<Vector2>(new Vector2[]{new Vector2(8,25),new Vector2(8,-4),new Vector2(12,25),new Vector2(12,-4),new Vector2(17,18),new Vector2(15,20),new Vector2(15,20),new Vector2(12,21),new Vector2(12,21),new Vector2(8,21),new Vector2(8,21),new Vector2(5,20),new Vector2(5,20),new Vector2(3,18),new Vector2(3,18),new Vector2(3,16),new Vector2(3,16),new Vector2(4,14),new Vector2(4,14),new Vector2(5,13),new Vector2(5,13),new Vector2(7,12),new Vector2(7,12),new Vector2(13,10),new Vector2(13,10),new Vector2(15,9),new Vector2(15,9),new Vector2(16,8),new Vector2(16,8),new Vector2(17,6),new Vector2(17,6),new Vector2(17,3),new Vector2(17,3),new Vector2(15,1),new Vector2(15,1),new Vector2(12,0),new Vector2(12,0),new Vector2(8,0),new Vector2(8,0),new Vector2(5,1),new Vector2(5,1),new Vector2(3,3)})},
|
||||
/*%*/ new LineChar{Width = 24, Vertices = new List<Vector2>(new Vector2[]{new Vector2(21,21),new Vector2(3,0),new Vector2(8,21),new Vector2(10,19),new Vector2(10,19),new Vector2(10,17),new Vector2(10,17),new Vector2(9,15),new Vector2(9,15),new Vector2(7,14),new Vector2(7,14),new Vector2(5,14),new Vector2(5,14),new Vector2(3,16),new Vector2(3,16),new Vector2(3,18),new Vector2(3,18),new Vector2(4,20),new Vector2(4,20),new Vector2(6,21),new Vector2(6,21),new Vector2(8,21),new Vector2(8,21),new Vector2(10,20),new Vector2(10,20),new Vector2(13,19),new Vector2(13,19),new Vector2(16,19),new Vector2(16,19),new Vector2(19,20),new Vector2(19,20),new Vector2(21,21),new Vector2(17,7),new Vector2(15,6),new Vector2(15,6),new Vector2(14,4),new Vector2(14,4),new Vector2(14,2),new Vector2(14,2),new Vector2(16,0),new Vector2(16,0),new Vector2(18,0),new Vector2(18,0),new Vector2(20,1),new Vector2(20,1),new Vector2(21,3),new Vector2(21,3),new Vector2(21,5),new Vector2(21,5),new Vector2(19,7),new Vector2(19,7),new Vector2(17,7)})},
|
||||
/*&*/ new LineChar{Width = 26, Vertices = new List<Vector2>(new Vector2[]{new Vector2(23,12),new Vector2(23,13),new Vector2(23,13),new Vector2(22,14),new Vector2(22,14),new Vector2(21,14),new Vector2(21,14),new Vector2(20,13),new Vector2(20,13),new Vector2(19,11),new Vector2(19,11),new Vector2(17,6),new Vector2(17,6),new Vector2(15,3),new Vector2(15,3),new Vector2(13,1),new Vector2(13,1),new Vector2(11,0),new Vector2(11,0),new Vector2(7,0),new Vector2(7,0),new Vector2(5,1),new Vector2(5,1),new Vector2(4,2),new Vector2(4,2),new Vector2(3,4),new Vector2(3,4),new Vector2(3,6),new Vector2(3,6),new Vector2(4,8),new Vector2(4,8),new Vector2(5,9),new Vector2(5,9),new Vector2(12,13),new Vector2(12,13),new Vector2(13,14),new Vector2(13,14),new Vector2(14,16),new Vector2(14,16),new Vector2(14,18),new Vector2(14,18),new Vector2(13,20),new Vector2(13,20),new Vector2(11,21),new Vector2(11,21),new Vector2(9,20),new Vector2(9,20),new Vector2(8,18),new Vector2(8,18),new Vector2(8,16),new Vector2(8,16),new Vector2(9,13),new Vector2(9,13),new Vector2(11,10),new Vector2(11,10),new Vector2(16,3),new Vector2(16,3),new Vector2(18,1),new Vector2(18,1),new Vector2(20,0),new Vector2(20,0),new Vector2(22,0),new Vector2(22,0),new Vector2(23,1),new Vector2(23,1),new Vector2(23,2)})},
|
||||
/*'*/ new LineChar{Width = 10, Vertices = new List<Vector2>(new Vector2[]{new Vector2(5,19),new Vector2(4,20),new Vector2(4,20),new Vector2(5,21),new Vector2(5,21),new Vector2(6,20),new Vector2(6,20),new Vector2(6,18),new Vector2(6,18),new Vector2(5,16),new Vector2(5,16),new Vector2(4,15)})},
|
||||
/*(*/ new LineChar{Width = 14, Vertices = new List<Vector2>(new Vector2[]{new Vector2(11,25),new Vector2(9,23),new Vector2(9,23),new Vector2(7,20),new Vector2(7,20),new Vector2(5,16),new Vector2(5,16),new Vector2(4,11),new Vector2(4,11),new Vector2(4,7),new Vector2(4,7),new Vector2(5,2),new Vector2(5,2),new Vector2(7,-2),new Vector2(7,-2),new Vector2(9,-5),new Vector2(9,-5),new Vector2(11,-7)})},
|
||||
/*)*/ new LineChar{Width = 14, Vertices = new List<Vector2>(new Vector2[]{new Vector2(3,25),new Vector2(5,23),new Vector2(5,23),new Vector2(7,20),new Vector2(7,20),new Vector2(9,16),new Vector2(9,16),new Vector2(10,11),new Vector2(10,11),new Vector2(10,7),new Vector2(10,7),new Vector2(9,2),new Vector2(9,2),new Vector2(7,-2),new Vector2(7,-2),new Vector2(5,-5),new Vector2(5,-5),new Vector2(3,-7)})},
|
||||
/***/ new LineChar{Width = 16, Vertices = new List<Vector2>(new Vector2[]{new Vector2(8,21),new Vector2(8,9),new Vector2(3,18),new Vector2(13,12),new Vector2(13,18),new Vector2(3,12)})},
|
||||
/*+*/ new LineChar{Width = 26, Vertices = new List<Vector2>(new Vector2[]{new Vector2(13,18),new Vector2(13,0),new Vector2(4,9),new Vector2(22,9)})},
|
||||
/*,*/ new LineChar{Width = 10, Vertices = new List<Vector2>(new Vector2[]{new Vector2(6,1),new Vector2(5,0),new Vector2(5,0),new Vector2(4,1),new Vector2(4,1),new Vector2(5,2),new Vector2(5,2),new Vector2(6,1),new Vector2(6,1),new Vector2(6,-1),new Vector2(6,-1),new Vector2(5,-3),new Vector2(5,-3),new Vector2(4,-4)})},
|
||||
/*-*/ new LineChar{Width = 26, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,9),new Vector2(22,9)})},
|
||||
/*.*/ new LineChar{Width = 10, Vertices = new List<Vector2>(new Vector2[]{new Vector2(5,2),new Vector2(4,1),new Vector2(4,1),new Vector2(5,0),new Vector2(5,0),new Vector2(6,1),new Vector2(6,1),new Vector2(5,2)})},
|
||||
/*/*/ new LineChar{Width = 22, Vertices = new List<Vector2>(new Vector2[]{new Vector2(20,25),new Vector2(2,-7)})},
|
||||
/*0*/ new LineChar{Width = 20, Vertices = new List<Vector2>(new Vector2[]{new Vector2(9,21),new Vector2(6,20),new Vector2(6,20),new Vector2(4,17),new Vector2(4,17),new Vector2(3,12),new Vector2(3,12),new Vector2(3,9),new Vector2(3,9),new Vector2(4,4),new Vector2(4,4),new Vector2(6,1),new Vector2(6,1),new Vector2(9,0),new Vector2(9,0),new Vector2(11,0),new Vector2(11,0),new Vector2(14,1),new Vector2(14,1),new Vector2(16,4),new Vector2(16,4),new Vector2(17,9),new Vector2(17,9),new Vector2(17,12),new Vector2(17,12),new Vector2(16,17),new Vector2(16,17),new Vector2(14,20),new Vector2(14,20),new Vector2(11,21),new Vector2(11,21),new Vector2(9,21)})},
|
||||
/*1*/ new LineChar{Width = 20, Vertices = new List<Vector2>(new Vector2[]{new Vector2(6,17),new Vector2(8,18),new Vector2(8,18),new Vector2(11,21),new Vector2(11,21),new Vector2(11,0)})},
|
||||
/*2*/ new LineChar{Width = 20, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,16),new Vector2(4,17),new Vector2(4,17),new Vector2(5,19),new Vector2(5,19),new Vector2(6,20),new Vector2(6,20),new Vector2(8,21),new Vector2(8,21),new Vector2(12,21),new Vector2(12,21),new Vector2(14,20),new Vector2(14,20),new Vector2(15,19),new Vector2(15,19),new Vector2(16,17),new Vector2(16,17),new Vector2(16,15),new Vector2(16,15),new Vector2(15,13),new Vector2(15,13),new Vector2(13,10),new Vector2(13,10),new Vector2(3,0),new Vector2(3,0),new Vector2(17,0)})},
|
||||
/*3*/ new LineChar{Width = 20, Vertices = new List<Vector2>(new Vector2[]{new Vector2(5,21),new Vector2(16,21),new Vector2(16,21),new Vector2(10,13),new Vector2(10,13),new Vector2(13,13),new Vector2(13,13),new Vector2(15,12),new Vector2(15,12),new Vector2(16,11),new Vector2(16,11),new Vector2(17,8),new Vector2(17,8),new Vector2(17,6),new Vector2(17,6),new Vector2(16,3),new Vector2(16,3),new Vector2(14,1),new Vector2(14,1),new Vector2(11,0),new Vector2(11,0),new Vector2(8,0),new Vector2(8,0),new Vector2(5,1),new Vector2(5,1),new Vector2(4,2),new Vector2(4,2),new Vector2(3,4)})},
|
||||
/*4*/ new LineChar{Width = 20, Vertices = new List<Vector2>(new Vector2[]{new Vector2(13,21),new Vector2(3,7),new Vector2(3,7),new Vector2(18,7),new Vector2(13,21),new Vector2(13,0)})},
|
||||
/*5*/ new LineChar{Width = 20, Vertices = new List<Vector2>(new Vector2[]{new Vector2(15,21),new Vector2(5,21),new Vector2(5,21),new Vector2(4,12),new Vector2(4,12),new Vector2(5,13),new Vector2(5,13),new Vector2(8,14),new Vector2(8,14),new Vector2(11,14),new Vector2(11,14),new Vector2(14,13),new Vector2(14,13),new Vector2(16,11),new Vector2(16,11),new Vector2(17,8),new Vector2(17,8),new Vector2(17,6),new Vector2(17,6),new Vector2(16,3),new Vector2(16,3),new Vector2(14,1),new Vector2(14,1),new Vector2(11,0),new Vector2(11,0),new Vector2(8,0),new Vector2(8,0),new Vector2(5,1),new Vector2(5,1),new Vector2(4,2),new Vector2(4,2),new Vector2(3,4)})},
|
||||
/*6*/ new LineChar{Width = 20, Vertices = new List<Vector2>(new Vector2[]{new Vector2(16,18),new Vector2(15,20),new Vector2(15,20),new Vector2(12,21),new Vector2(12,21),new Vector2(10,21),new Vector2(10,21),new Vector2(7,20),new Vector2(7,20),new Vector2(5,17),new Vector2(5,17),new Vector2(4,12),new Vector2(4,12),new Vector2(4,7),new Vector2(4,7),new Vector2(5,3),new Vector2(5,3),new Vector2(7,1),new Vector2(7,1),new Vector2(10,0),new Vector2(10,0),new Vector2(11,0),new Vector2(11,0),new Vector2(14,1),new Vector2(14,1),new Vector2(16,3),new Vector2(16,3),new Vector2(17,6),new Vector2(17,6),new Vector2(17,7),new Vector2(17,7),new Vector2(16,10),new Vector2(16,10),new Vector2(14,12),new Vector2(14,12),new Vector2(11,13),new Vector2(11,13),new Vector2(10,13),new Vector2(10,13),new Vector2(7,12),new Vector2(7,12),new Vector2(5,10),new Vector2(5,10),new Vector2(4,7)})},
|
||||
/*7*/ new LineChar{Width = 20, Vertices = new List<Vector2>(new Vector2[]{new Vector2(17,21),new Vector2(7,0),new Vector2(3,21),new Vector2(17,21)})},
|
||||
/*8*/ new LineChar{Width = 20, Vertices = new List<Vector2>(new Vector2[]{new Vector2(8,21),new Vector2(5,20),new Vector2(5,20),new Vector2(4,18),new Vector2(4,18),new Vector2(4,16),new Vector2(4,16),new Vector2(5,14),new Vector2(5,14),new Vector2(7,13),new Vector2(7,13),new Vector2(11,12),new Vector2(11,12),new Vector2(14,11),new Vector2(14,11),new Vector2(16,9),new Vector2(16,9),new Vector2(17,7),new Vector2(17,7),new Vector2(17,4),new Vector2(17,4),new Vector2(16,2),new Vector2(16,2),new Vector2(15,1),new Vector2(15,1),new Vector2(12,0),new Vector2(12,0),new Vector2(8,0),new Vector2(8,0),new Vector2(5,1),new Vector2(5,1),new Vector2(4,2),new Vector2(4,2),new Vector2(3,4),new Vector2(3,4),new Vector2(3,7),new Vector2(3,7),new Vector2(4,9),new Vector2(4,9),new Vector2(6,11),new Vector2(6,11),new Vector2(9,12),new Vector2(9,12),new Vector2(13,13),new Vector2(13,13),new Vector2(15,14),new Vector2(15,14),new Vector2(16,16),new Vector2(16,16),new Vector2(16,18),new Vector2(16,18),new Vector2(15,20),new Vector2(15,20),new Vector2(12,21),new Vector2(12,21),new Vector2(8,21)})},
|
||||
/*9*/ new LineChar{Width = 20, Vertices = new List<Vector2>(new Vector2[]{new Vector2(16,14),new Vector2(15,11),new Vector2(15,11),new Vector2(13,9),new Vector2(13,9),new Vector2(10,8),new Vector2(10,8),new Vector2(9,8),new Vector2(9,8),new Vector2(6,9),new Vector2(6,9),new Vector2(4,11),new Vector2(4,11),new Vector2(3,14),new Vector2(3,14),new Vector2(3,15),new Vector2(3,15),new Vector2(4,18),new Vector2(4,18),new Vector2(6,20),new Vector2(6,20),new Vector2(9,21),new Vector2(9,21),new Vector2(10,21),new Vector2(10,21),new Vector2(13,20),new Vector2(13,20),new Vector2(15,18),new Vector2(15,18),new Vector2(16,14),new Vector2(16,14),new Vector2(16,9),new Vector2(16,9),new Vector2(15,4),new Vector2(15,4),new Vector2(13,1),new Vector2(13,1),new Vector2(10,0),new Vector2(10,0),new Vector2(8,0),new Vector2(8,0),new Vector2(5,1),new Vector2(5,1),new Vector2(4,3)})},
|
||||
/*:*/ new LineChar{Width = 10, Vertices = new List<Vector2>(new Vector2[]{new Vector2(5,14),new Vector2(4,13),new Vector2(4,13),new Vector2(5,12),new Vector2(5,12),new Vector2(6,13),new Vector2(6,13),new Vector2(5,14),new Vector2(5,2),new Vector2(4,1),new Vector2(4,1),new Vector2(5,0),new Vector2(5,0),new Vector2(6,1),new Vector2(6,1),new Vector2(5,2)})},
|
||||
/*;*/ new LineChar{Width = 10, Vertices = new List<Vector2>(new Vector2[]{new Vector2(5,14),new Vector2(4,13),new Vector2(4,13),new Vector2(5,12),new Vector2(5,12),new Vector2(6,13),new Vector2(6,13),new Vector2(5,14),new Vector2(6,1),new Vector2(5,0),new Vector2(5,0),new Vector2(4,1),new Vector2(4,1),new Vector2(5,2),new Vector2(5,2),new Vector2(6,1),new Vector2(6,1),new Vector2(6,-1),new Vector2(6,-1),new Vector2(5,-3),new Vector2(5,-3),new Vector2(4,-4)})},
|
||||
/*<*/ new LineChar{Width = 24, Vertices = new List<Vector2>(new Vector2[]{new Vector2(20,18),new Vector2(4,9),new Vector2(4,9),new Vector2(20,0)})},
|
||||
/*=*/ new LineChar{Width = 26, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,12),new Vector2(22,12),new Vector2(4,6),new Vector2(22,6)})},
|
||||
/*>*/ new LineChar{Width = 24, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,18),new Vector2(20,9),new Vector2(20,9),new Vector2(4,0)})},
|
||||
/*?*/ new LineChar{Width = 18, Vertices = new List<Vector2>(new Vector2[]{new Vector2(3,16),new Vector2(3,17),new Vector2(3,17),new Vector2(4,19),new Vector2(4,19),new Vector2(5,20),new Vector2(5,20),new Vector2(7,21),new Vector2(7,21),new Vector2(11,21),new Vector2(11,21),new Vector2(13,20),new Vector2(13,20),new Vector2(14,19),new Vector2(14,19),new Vector2(15,17),new Vector2(15,17),new Vector2(15,15),new Vector2(15,15),new Vector2(14,13),new Vector2(14,13),new Vector2(13,12),new Vector2(13,12),new Vector2(9,10),new Vector2(9,10),new Vector2(9,7),new Vector2(9,2),new Vector2(8,1),new Vector2(8,1),new Vector2(9,0),new Vector2(9,0),new Vector2(10,1),new Vector2(10,1),new Vector2(9,2)})},
|
||||
/*@*/ new LineChar{Width = 27, Vertices = new List<Vector2>(new Vector2[]{new Vector2(18,13),new Vector2(17,15),new Vector2(17,15),new Vector2(15,16),new Vector2(15,16),new Vector2(12,16),new Vector2(12,16),new Vector2(10,15),new Vector2(10,15),new Vector2(9,14),new Vector2(9,14),new Vector2(8,11),new Vector2(8,11),new Vector2(8,8),new Vector2(8,8),new Vector2(9,6),new Vector2(9,6),new Vector2(11,5),new Vector2(11,5),new Vector2(14,5),new Vector2(14,5),new Vector2(16,6),new Vector2(16,6),new Vector2(17,8),new Vector2(12,16),new Vector2(10,14),new Vector2(10,14),new Vector2(9,11),new Vector2(9,11),new Vector2(9,8),new Vector2(9,8),new Vector2(10,6),new Vector2(10,6),new Vector2(11,5),new Vector2(18,16),new Vector2(17,8),new Vector2(17,8),new Vector2(17,6),new Vector2(17,6),new Vector2(19,5),new Vector2(19,5),new Vector2(21,5),new Vector2(21,5),new Vector2(23,7),new Vector2(23,7),new Vector2(24,10),new Vector2(24,10),new Vector2(24,12),new Vector2(24,12),new Vector2(23,15),new Vector2(23,15),new Vector2(22,17),new Vector2(22,17),new Vector2(20,19),new Vector2(20,19),new Vector2(18,20),new Vector2(18,20),new Vector2(15,21),new Vector2(15,21),new Vector2(12,21),new Vector2(12,21),new Vector2(9,20),new Vector2(9,20),new Vector2(7,19),new Vector2(7,19),new Vector2(5,17),new Vector2(5,17),new Vector2(4,15),new Vector2(4,15),new Vector2(3,12),new Vector2(3,12),new Vector2(3,9),new Vector2(3,9),new Vector2(4,6),new Vector2(4,6),new Vector2(5,4),new Vector2(5,4),new Vector2(7,2),new Vector2(7,2),new Vector2(9,1),new Vector2(9,1),new Vector2(12,0),new Vector2(12,0),new Vector2(15,0),new Vector2(15,0),new Vector2(18,1),new Vector2(18,1),new Vector2(20,2),new Vector2(20,2),new Vector2(21,3),new Vector2(19,16),new Vector2(18,8),new Vector2(18,8),new Vector2(18,6),new Vector2(18,6),new Vector2(19,5)})},
|
||||
/*A*/ new LineChar{Width = 18, Vertices = new List<Vector2>(new Vector2[]{new Vector2(9,21),new Vector2(1,0),new Vector2(9,21),new Vector2(17,0),new Vector2(4,7),new Vector2(14,7)})},
|
||||
/*B*/ new LineChar{Width = 21, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0),new Vector2(4,21),new Vector2(13,21),new Vector2(13,21),new Vector2(16,20),new Vector2(16,20),new Vector2(17,19),new Vector2(17,19),new Vector2(18,17),new Vector2(18,17),new Vector2(18,15),new Vector2(18,15),new Vector2(17,13),new Vector2(17,13),new Vector2(16,12),new Vector2(16,12),new Vector2(13,11),new Vector2(4,11),new Vector2(13,11),new Vector2(13,11),new Vector2(16,10),new Vector2(16,10),new Vector2(17,9),new Vector2(17,9),new Vector2(18,7),new Vector2(18,7),new Vector2(18,4),new Vector2(18,4),new Vector2(17,2),new Vector2(17,2),new Vector2(16,1),new Vector2(16,1),new Vector2(13,0),new Vector2(13,0),new Vector2(4,0)})},
|
||||
/*C*/ new LineChar{Width = 21, Vertices = new List<Vector2>(new Vector2[]{new Vector2(18,16),new Vector2(17,18),new Vector2(17,18),new Vector2(15,20),new Vector2(15,20),new Vector2(13,21),new Vector2(13,21),new Vector2(9,21),new Vector2(9,21),new Vector2(7,20),new Vector2(7,20),new Vector2(5,18),new Vector2(5,18),new Vector2(4,16),new Vector2(4,16),new Vector2(3,13),new Vector2(3,13),new Vector2(3,8),new Vector2(3,8),new Vector2(4,5),new Vector2(4,5),new Vector2(5,3),new Vector2(5,3),new Vector2(7,1),new Vector2(7,1),new Vector2(9,0),new Vector2(9,0),new Vector2(13,0),new Vector2(13,0),new Vector2(15,1),new Vector2(15,1),new Vector2(17,3),new Vector2(17,3),new Vector2(18,5)})},
|
||||
/*D*/ new LineChar{Width = 21, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0),new Vector2(4,21),new Vector2(11,21),new Vector2(11,21),new Vector2(14,20),new Vector2(14,20),new Vector2(16,18),new Vector2(16,18),new Vector2(17,16),new Vector2(17,16),new Vector2(18,13),new Vector2(18,13),new Vector2(18,8),new Vector2(18,8),new Vector2(17,5),new Vector2(17,5),new Vector2(16,3),new Vector2(16,3),new Vector2(14,1),new Vector2(14,1),new Vector2(11,0),new Vector2(11,0),new Vector2(4,0)})},
|
||||
/*E*/ new LineChar{Width = 19, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0),new Vector2(4,21),new Vector2(17,21),new Vector2(4,11),new Vector2(12,11),new Vector2(4,0),new Vector2(17,0)})},
|
||||
/*F*/ new LineChar{Width = 18, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0),new Vector2(4,21),new Vector2(17,21),new Vector2(4,11),new Vector2(12,11)})},
|
||||
/*G*/ new LineChar{Width = 21, Vertices = new List<Vector2>(new Vector2[]{new Vector2(18,16),new Vector2(17,18),new Vector2(17,18),new Vector2(15,20),new Vector2(15,20),new Vector2(13,21),new Vector2(13,21),new Vector2(9,21),new Vector2(9,21),new Vector2(7,20),new Vector2(7,20),new Vector2(5,18),new Vector2(5,18),new Vector2(4,16),new Vector2(4,16),new Vector2(3,13),new Vector2(3,13),new Vector2(3,8),new Vector2(3,8),new Vector2(4,5),new Vector2(4,5),new Vector2(5,3),new Vector2(5,3),new Vector2(7,1),new Vector2(7,1),new Vector2(9,0),new Vector2(9,0),new Vector2(13,0),new Vector2(13,0),new Vector2(15,1),new Vector2(15,1),new Vector2(17,3),new Vector2(17,3),new Vector2(18,5),new Vector2(18,5),new Vector2(18,8),new Vector2(13,8),new Vector2(18,8)})},
|
||||
/*H*/ new LineChar{Width = 22, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0),new Vector2(18,21),new Vector2(18,0),new Vector2(4,11),new Vector2(18,11)})},
|
||||
/*I*/ new LineChar{Width = 8, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0)})},
|
||||
/*J*/ new LineChar{Width = 16, Vertices = new List<Vector2>(new Vector2[]{new Vector2(12,21),new Vector2(12,5),new Vector2(12,5),new Vector2(11,2),new Vector2(11,2),new Vector2(10,1),new Vector2(10,1),new Vector2(8,0),new Vector2(8,0),new Vector2(6,0),new Vector2(6,0),new Vector2(4,1),new Vector2(4,1),new Vector2(3,2),new Vector2(3,2),new Vector2(2,5),new Vector2(2,5),new Vector2(2,7)})},
|
||||
/*K*/ new LineChar{Width = 21, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0),new Vector2(18,21),new Vector2(4,7),new Vector2(9,12),new Vector2(18,0)})},
|
||||
/*L*/ new LineChar{Width = 17, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0),new Vector2(4,0),new Vector2(16,0)})},
|
||||
/*M*/ new LineChar{Width = 24, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0),new Vector2(4,21),new Vector2(12,0),new Vector2(20,21),new Vector2(12,0),new Vector2(20,21),new Vector2(20,0)})},
|
||||
/*N*/ new LineChar{Width = 22, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0),new Vector2(4,21),new Vector2(18,0),new Vector2(18,21),new Vector2(18,0)})},
|
||||
/*O*/ new LineChar{Width = 22, Vertices = new List<Vector2>(new Vector2[]{new Vector2(9,21),new Vector2(7,20),new Vector2(7,20),new Vector2(5,18),new Vector2(5,18),new Vector2(4,16),new Vector2(4,16),new Vector2(3,13),new Vector2(3,13),new Vector2(3,8),new Vector2(3,8),new Vector2(4,5),new Vector2(4,5),new Vector2(5,3),new Vector2(5,3),new Vector2(7,1),new Vector2(7,1),new Vector2(9,0),new Vector2(9,0),new Vector2(13,0),new Vector2(13,0),new Vector2(15,1),new Vector2(15,1),new Vector2(17,3),new Vector2(17,3),new Vector2(18,5),new Vector2(18,5),new Vector2(19,8),new Vector2(19,8),new Vector2(19,13),new Vector2(19,13),new Vector2(18,16),new Vector2(18,16),new Vector2(17,18),new Vector2(17,18),new Vector2(15,20),new Vector2(15,20),new Vector2(13,21),new Vector2(13,21),new Vector2(9,21)})},
|
||||
/*P*/ new LineChar{Width = 21, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0),new Vector2(4,21),new Vector2(13,21),new Vector2(13,21),new Vector2(16,20),new Vector2(16,20),new Vector2(17,19),new Vector2(17,19),new Vector2(18,17),new Vector2(18,17),new Vector2(18,14),new Vector2(18,14),new Vector2(17,12),new Vector2(17,12),new Vector2(16,11),new Vector2(16,11),new Vector2(13,10),new Vector2(13,10),new Vector2(4,10)})},
|
||||
/*Q*/ new LineChar{Width = 22, Vertices = new List<Vector2>(new Vector2[]{new Vector2(9,21),new Vector2(7,20),new Vector2(7,20),new Vector2(5,18),new Vector2(5,18),new Vector2(4,16),new Vector2(4,16),new Vector2(3,13),new Vector2(3,13),new Vector2(3,8),new Vector2(3,8),new Vector2(4,5),new Vector2(4,5),new Vector2(5,3),new Vector2(5,3),new Vector2(7,1),new Vector2(7,1),new Vector2(9,0),new Vector2(9,0),new Vector2(13,0),new Vector2(13,0),new Vector2(15,1),new Vector2(15,1),new Vector2(17,3),new Vector2(17,3),new Vector2(18,5),new Vector2(18,5),new Vector2(19,8),new Vector2(19,8),new Vector2(19,13),new Vector2(19,13),new Vector2(18,16),new Vector2(18,16),new Vector2(17,18),new Vector2(17,18),new Vector2(15,20),new Vector2(15,20),new Vector2(13,21),new Vector2(13,21),new Vector2(9,21),new Vector2(12,4),new Vector2(18,-2)})},
|
||||
/*R*/ new LineChar{Width = 21, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0),new Vector2(4,21),new Vector2(13,21),new Vector2(13,21),new Vector2(16,20),new Vector2(16,20),new Vector2(17,19),new Vector2(17,19),new Vector2(18,17),new Vector2(18,17),new Vector2(18,15),new Vector2(18,15),new Vector2(17,13),new Vector2(17,13),new Vector2(16,12),new Vector2(16,12),new Vector2(13,11),new Vector2(13,11),new Vector2(4,11),new Vector2(11,11),new Vector2(18,0)})},
|
||||
/*S*/ new LineChar{Width = 20, Vertices = new List<Vector2>(new Vector2[]{new Vector2(17,18),new Vector2(15,20),new Vector2(15,20),new Vector2(12,21),new Vector2(12,21),new Vector2(8,21),new Vector2(8,21),new Vector2(5,20),new Vector2(5,20),new Vector2(3,18),new Vector2(3,18),new Vector2(3,16),new Vector2(3,16),new Vector2(4,14),new Vector2(4,14),new Vector2(5,13),new Vector2(5,13),new Vector2(7,12),new Vector2(7,12),new Vector2(13,10),new Vector2(13,10),new Vector2(15,9),new Vector2(15,9),new Vector2(16,8),new Vector2(16,8),new Vector2(17,6),new Vector2(17,6),new Vector2(17,3),new Vector2(17,3),new Vector2(15,1),new Vector2(15,1),new Vector2(12,0),new Vector2(12,0),new Vector2(8,0),new Vector2(8,0),new Vector2(5,1),new Vector2(5,1),new Vector2(3,3)})},
|
||||
/*T*/ new LineChar{Width = 16, Vertices = new List<Vector2>(new Vector2[]{new Vector2(8,21),new Vector2(8,0),new Vector2(1,21),new Vector2(15,21)})},
|
||||
/*U*/ new LineChar{Width = 22, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,6),new Vector2(4,6),new Vector2(5,3),new Vector2(5,3),new Vector2(7,1),new Vector2(7,1),new Vector2(10,0),new Vector2(10,0),new Vector2(12,0),new Vector2(12,0),new Vector2(15,1),new Vector2(15,1),new Vector2(17,3),new Vector2(17,3),new Vector2(18,6),new Vector2(18,6),new Vector2(18,21)})},
|
||||
/*V*/ new LineChar{Width = 18, Vertices = new List<Vector2>(new Vector2[]{new Vector2(1,21),new Vector2(9,0),new Vector2(17,21),new Vector2(9,0)})},
|
||||
/*W*/ new LineChar{Width = 24, Vertices = new List<Vector2>(new Vector2[]{new Vector2(2,21),new Vector2(7,0),new Vector2(12,21),new Vector2(7,0),new Vector2(12,21),new Vector2(17,0),new Vector2(22,21),new Vector2(17,0)})},
|
||||
/*X*/ new LineChar{Width = 20, Vertices = new List<Vector2>(new Vector2[]{new Vector2(3,21),new Vector2(17,0),new Vector2(17,21),new Vector2(3,0)})},
|
||||
/*Y*/ new LineChar{Width = 18, Vertices = new List<Vector2>(new Vector2[]{new Vector2(1,21),new Vector2(9,11),new Vector2(9,11),new Vector2(9,0),new Vector2(17,21),new Vector2(9,11)})},
|
||||
/*Z*/ new LineChar{Width = 20, Vertices = new List<Vector2>(new Vector2[]{new Vector2(17,21),new Vector2(3,0),new Vector2(3,21),new Vector2(17,21),new Vector2(3,0),new Vector2(17,0)})},
|
||||
/*[*/ new LineChar{Width = 14, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,25),new Vector2(4,-7),new Vector2(4,25),new Vector2(11,25),new Vector2(4,-7),new Vector2(11,-7)})},
|
||||
/*\*/ new LineChar{Width = 14, Vertices = new List<Vector2>(new Vector2[]{new Vector2(0,21),new Vector2(14,-3)})},
|
||||
/*]*/ new LineChar{Width = 14, Vertices = new List<Vector2>(new Vector2[]{new Vector2(9,25),new Vector2(9,-7),new Vector2(3,25),new Vector2(10,25),new Vector2(3,-7),new Vector2(10,-7)})},
|
||||
/*^*/ new LineChar{Width = 16, Vertices = new List<Vector2>(new Vector2[]{new Vector2(6,15),new Vector2(8,18),new Vector2(8,18),new Vector2(10,15),new Vector2(3,12),new Vector2(8,17),new Vector2(8,17),new Vector2(13,12),new Vector2(8,17),new Vector2(8,0)})},
|
||||
/*_*/ new LineChar{Width = 16, Vertices = new List<Vector2>(new Vector2[]{new Vector2(0,-2),new Vector2(16,-2)})},
|
||||
/*`*/ new LineChar{Width = 10, Vertices = new List<Vector2>(new Vector2[]{new Vector2(6,21),new Vector2(5,20),new Vector2(5,20),new Vector2(4,18),new Vector2(4,18),new Vector2(4,16),new Vector2(4,16),new Vector2(5,15),new Vector2(5,15),new Vector2(6,16),new Vector2(6,16),new Vector2(5,17)})},
|
||||
/*a*/ new LineChar{Width = 19, Vertices = new List<Vector2>(new Vector2[]{new Vector2(15,14),new Vector2(15,0),new Vector2(15,11),new Vector2(13,13),new Vector2(13,13),new Vector2(11,14),new Vector2(11,14),new Vector2(8,14),new Vector2(8,14),new Vector2(6,13),new Vector2(6,13),new Vector2(4,11),new Vector2(4,11),new Vector2(3,8),new Vector2(3,8),new Vector2(3,6),new Vector2(3,6),new Vector2(4,3),new Vector2(4,3),new Vector2(6,1),new Vector2(6,1),new Vector2(8,0),new Vector2(8,0),new Vector2(11,0),new Vector2(11,0),new Vector2(13,1),new Vector2(13,1),new Vector2(15,3)})},
|
||||
/*b*/ new LineChar{Width = 19, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0),new Vector2(4,11),new Vector2(6,13),new Vector2(6,13),new Vector2(8,14),new Vector2(8,14),new Vector2(11,14),new Vector2(11,14),new Vector2(13,13),new Vector2(13,13),new Vector2(15,11),new Vector2(15,11),new Vector2(16,8),new Vector2(16,8),new Vector2(16,6),new Vector2(16,6),new Vector2(15,3),new Vector2(15,3),new Vector2(13,1),new Vector2(13,1),new Vector2(11,0),new Vector2(11,0),new Vector2(8,0),new Vector2(8,0),new Vector2(6,1),new Vector2(6,1),new Vector2(4,3)})},
|
||||
/*c*/ new LineChar{Width = 18, Vertices = new List<Vector2>(new Vector2[]{new Vector2(15,11),new Vector2(13,13),new Vector2(13,13),new Vector2(11,14),new Vector2(11,14),new Vector2(8,14),new Vector2(8,14),new Vector2(6,13),new Vector2(6,13),new Vector2(4,11),new Vector2(4,11),new Vector2(3,8),new Vector2(3,8),new Vector2(3,6),new Vector2(3,6),new Vector2(4,3),new Vector2(4,3),new Vector2(6,1),new Vector2(6,1),new Vector2(8,0),new Vector2(8,0),new Vector2(11,0),new Vector2(11,0),new Vector2(13,1),new Vector2(13,1),new Vector2(15,3)})},
|
||||
/*d*/ new LineChar{Width = 19, Vertices = new List<Vector2>(new Vector2[]{new Vector2(15,21),new Vector2(15,0),new Vector2(15,11),new Vector2(13,13),new Vector2(13,13),new Vector2(11,14),new Vector2(11,14),new Vector2(8,14),new Vector2(8,14),new Vector2(6,13),new Vector2(6,13),new Vector2(4,11),new Vector2(4,11),new Vector2(3,8),new Vector2(3,8),new Vector2(3,6),new Vector2(3,6),new Vector2(4,3),new Vector2(4,3),new Vector2(6,1),new Vector2(6,1),new Vector2(8,0),new Vector2(8,0),new Vector2(11,0),new Vector2(11,0),new Vector2(13,1),new Vector2(13,1),new Vector2(15,3)})},
|
||||
/*e*/ new LineChar{Width = 18, Vertices = new List<Vector2>(new Vector2[]{new Vector2(3,8),new Vector2(15,8),new Vector2(15,8),new Vector2(15,10),new Vector2(15,10),new Vector2(14,12),new Vector2(14,12),new Vector2(13,13),new Vector2(13,13),new Vector2(11,14),new Vector2(11,14),new Vector2(8,14),new Vector2(8,14),new Vector2(6,13),new Vector2(6,13),new Vector2(4,11),new Vector2(4,11),new Vector2(3,8),new Vector2(3,8),new Vector2(3,6),new Vector2(3,6),new Vector2(4,3),new Vector2(4,3),new Vector2(6,1),new Vector2(6,1),new Vector2(8,0),new Vector2(8,0),new Vector2(11,0),new Vector2(11,0),new Vector2(13,1),new Vector2(13,1),new Vector2(15,3)})},
|
||||
/*f*/ new LineChar{Width = 12, Vertices = new List<Vector2>(new Vector2[]{new Vector2(10,21),new Vector2(8,21),new Vector2(8,21),new Vector2(6,20),new Vector2(6,20),new Vector2(5,17),new Vector2(5,17),new Vector2(5,0),new Vector2(2,14),new Vector2(9,14)})},
|
||||
/*g*/ new LineChar{Width = 19, Vertices = new List<Vector2>(new Vector2[]{new Vector2(15,14),new Vector2(15,-2),new Vector2(15,-2),new Vector2(14,-5),new Vector2(14,-5),new Vector2(13,-6),new Vector2(13,-6),new Vector2(11,-7),new Vector2(11,-7),new Vector2(8,-7),new Vector2(8,-7),new Vector2(6,-6),new Vector2(15,11),new Vector2(13,13),new Vector2(13,13),new Vector2(11,14),new Vector2(11,14),new Vector2(8,14),new Vector2(8,14),new Vector2(6,13),new Vector2(6,13),new Vector2(4,11),new Vector2(4,11),new Vector2(3,8),new Vector2(3,8),new Vector2(3,6),new Vector2(3,6),new Vector2(4,3),new Vector2(4,3),new Vector2(6,1),new Vector2(6,1),new Vector2(8,0),new Vector2(8,0),new Vector2(11,0),new Vector2(11,0),new Vector2(13,1),new Vector2(13,1),new Vector2(15,3)})},
|
||||
/*h*/ new LineChar{Width = 19, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0),new Vector2(4,10),new Vector2(7,13),new Vector2(7,13),new Vector2(9,14),new Vector2(9,14),new Vector2(12,14),new Vector2(12,14),new Vector2(14,13),new Vector2(14,13),new Vector2(15,10),new Vector2(15,10),new Vector2(15,0)})},
|
||||
/*i*/ new LineChar{Width = 8, Vertices = new List<Vector2>(new Vector2[]{new Vector2(3,21),new Vector2(4,20),new Vector2(4,20),new Vector2(5,21),new Vector2(5,21),new Vector2(4,22),new Vector2(4,22),new Vector2(3,21),new Vector2(4,14),new Vector2(4,0)})},
|
||||
/*j*/ new LineChar{Width = 10, Vertices = new List<Vector2>(new Vector2[]{new Vector2(5,21),new Vector2(6,20),new Vector2(6,20),new Vector2(7,21),new Vector2(7,21),new Vector2(6,22),new Vector2(6,22),new Vector2(5,21),new Vector2(6,14),new Vector2(6,-3),new Vector2(6,-3),new Vector2(5,-6),new Vector2(5,-6),new Vector2(3,-7),new Vector2(3,-7),new Vector2(1,-7)})},
|
||||
/*k*/ new LineChar{Width = 17, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0),new Vector2(14,14),new Vector2(4,4),new Vector2(8,8),new Vector2(15,0)})},
|
||||
/*l*/ new LineChar{Width = 8, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,21),new Vector2(4,0)})},
|
||||
/*m*/ new LineChar{Width = 30, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,14),new Vector2(4,0),new Vector2(4,10),new Vector2(7,13),new Vector2(7,13),new Vector2(9,14),new Vector2(9,14),new Vector2(12,14),new Vector2(12,14),new Vector2(14,13),new Vector2(14,13),new Vector2(15,10),new Vector2(15,10),new Vector2(15,0),new Vector2(15,10),new Vector2(18,13),new Vector2(18,13),new Vector2(20,14),new Vector2(20,14),new Vector2(23,14),new Vector2(23,14),new Vector2(25,13),new Vector2(25,13),new Vector2(26,10),new Vector2(26,10),new Vector2(26,0)})},
|
||||
/*n*/ new LineChar{Width = 19, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,14),new Vector2(4,0),new Vector2(4,10),new Vector2(7,13),new Vector2(7,13),new Vector2(9,14),new Vector2(9,14),new Vector2(12,14),new Vector2(12,14),new Vector2(14,13),new Vector2(14,13),new Vector2(15,10),new Vector2(15,10),new Vector2(15,0)})},
|
||||
/*o*/ new LineChar{Width = 19, Vertices = new List<Vector2>(new Vector2[]{new Vector2(8,14),new Vector2(6,13),new Vector2(6,13),new Vector2(4,11),new Vector2(4,11),new Vector2(3,8),new Vector2(3,8),new Vector2(3,6),new Vector2(3,6),new Vector2(4,3),new Vector2(4,3),new Vector2(6,1),new Vector2(6,1),new Vector2(8,0),new Vector2(8,0),new Vector2(11,0),new Vector2(11,0),new Vector2(13,1),new Vector2(13,1),new Vector2(15,3),new Vector2(15,3),new Vector2(16,6),new Vector2(16,6),new Vector2(16,8),new Vector2(16,8),new Vector2(15,11),new Vector2(15,11),new Vector2(13,13),new Vector2(13,13),new Vector2(11,14),new Vector2(11,14),new Vector2(8,14)})},
|
||||
/*p*/ new LineChar{Width = 19, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,14),new Vector2(4,-7),new Vector2(4,11),new Vector2(6,13),new Vector2(6,13),new Vector2(8,14),new Vector2(8,14),new Vector2(11,14),new Vector2(11,14),new Vector2(13,13),new Vector2(13,13),new Vector2(15,11),new Vector2(15,11),new Vector2(16,8),new Vector2(16,8),new Vector2(16,6),new Vector2(16,6),new Vector2(15,3),new Vector2(15,3),new Vector2(13,1),new Vector2(13,1),new Vector2(11,0),new Vector2(11,0),new Vector2(8,0),new Vector2(8,0),new Vector2(6,1),new Vector2(6,1),new Vector2(4,3)})},
|
||||
/*q*/ new LineChar{Width = 19, Vertices = new List<Vector2>(new Vector2[]{new Vector2(15,14),new Vector2(15,-7),new Vector2(15,11),new Vector2(13,13),new Vector2(13,13),new Vector2(11,14),new Vector2(11,14),new Vector2(8,14),new Vector2(8,14),new Vector2(6,13),new Vector2(6,13),new Vector2(4,11),new Vector2(4,11),new Vector2(3,8),new Vector2(3,8),new Vector2(3,6),new Vector2(3,6),new Vector2(4,3),new Vector2(4,3),new Vector2(6,1),new Vector2(6,1),new Vector2(8,0),new Vector2(8,0),new Vector2(11,0),new Vector2(11,0),new Vector2(13,1),new Vector2(13,1),new Vector2(15,3)})},
|
||||
/*r*/ new LineChar{Width = 13, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,14),new Vector2(4,0),new Vector2(4,8),new Vector2(5,11),new Vector2(5,11),new Vector2(7,13),new Vector2(7,13),new Vector2(9,14),new Vector2(9,14),new Vector2(12,14)})},
|
||||
/*s*/ new LineChar{Width = 17, Vertices = new List<Vector2>(new Vector2[]{new Vector2(14,11),new Vector2(13,13),new Vector2(13,13),new Vector2(10,14),new Vector2(10,14),new Vector2(7,14),new Vector2(7,14),new Vector2(4,13),new Vector2(4,13),new Vector2(3,11),new Vector2(3,11),new Vector2(4,9),new Vector2(4,9),new Vector2(6,8),new Vector2(6,8),new Vector2(11,7),new Vector2(11,7),new Vector2(13,6),new Vector2(13,6),new Vector2(14,4),new Vector2(14,4),new Vector2(14,3),new Vector2(14,3),new Vector2(13,1),new Vector2(13,1),new Vector2(10,0),new Vector2(10,0),new Vector2(7,0),new Vector2(7,0),new Vector2(4,1),new Vector2(4,1),new Vector2(3,3)})},
|
||||
/*t*/ new LineChar{Width = 12, Vertices = new List<Vector2>(new Vector2[]{new Vector2(5,21),new Vector2(5,4),new Vector2(5,4),new Vector2(6,1),new Vector2(6,1),new Vector2(8,0),new Vector2(8,0),new Vector2(10,0),new Vector2(2,14),new Vector2(9,14)})},
|
||||
/*u*/ new LineChar{Width = 19, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,14),new Vector2(4,4),new Vector2(4,4),new Vector2(5,1),new Vector2(5,1),new Vector2(7,0),new Vector2(7,0),new Vector2(10,0),new Vector2(10,0),new Vector2(12,1),new Vector2(12,1),new Vector2(15,4),new Vector2(15,14),new Vector2(15,0)})},
|
||||
/*v*/ new LineChar{Width = 16, Vertices = new List<Vector2>(new Vector2[]{new Vector2(2,14),new Vector2(8,0),new Vector2(14,14),new Vector2(8,0)})},
|
||||
/*w*/ new LineChar{Width = 22, Vertices = new List<Vector2>(new Vector2[]{new Vector2(3,14),new Vector2(7,0),new Vector2(11,14),new Vector2(7,0),new Vector2(11,14),new Vector2(15,0),new Vector2(19,14),new Vector2(15,0)})},
|
||||
/*x*/ new LineChar{Width = 17, Vertices = new List<Vector2>(new Vector2[]{new Vector2(3,14),new Vector2(14,0),new Vector2(14,14),new Vector2(3,0)})},
|
||||
/*y*/ new LineChar{Width = 16, Vertices = new List<Vector2>(new Vector2[]{new Vector2(2,14),new Vector2(8,0),new Vector2(14,14),new Vector2(8,0),new Vector2(8,0),new Vector2(6,-4),new Vector2(6,-4),new Vector2(4,-6),new Vector2(4,-6),new Vector2(2,-7),new Vector2(2,-7),new Vector2(1,-7)})},
|
||||
/*z*/ new LineChar{Width = 17, Vertices = new List<Vector2>(new Vector2[]{new Vector2(14,14),new Vector2(3,0),new Vector2(3,14),new Vector2(14,14),new Vector2(3,0),new Vector2(14,0)})},
|
||||
/*{*/ new LineChar{Width = 14, Vertices = new List<Vector2>(new Vector2[]{new Vector2(9,25),new Vector2(7,24),new Vector2(7,24),new Vector2(6,23),new Vector2(6,23),new Vector2(5,21),new Vector2(5,21),new Vector2(5,19),new Vector2(5,19),new Vector2(6,17),new Vector2(6,17),new Vector2(7,16),new Vector2(7,16),new Vector2(8,14),new Vector2(8,14),new Vector2(8,12),new Vector2(8,12),new Vector2(6,10),new Vector2(7,24),new Vector2(6,22),new Vector2(6,22),new Vector2(6,20),new Vector2(6,20),new Vector2(7,18),new Vector2(7,18),new Vector2(8,17),new Vector2(8,17),new Vector2(9,15),new Vector2(9,15),new Vector2(9,13),new Vector2(9,13),new Vector2(8,11),new Vector2(8,11),new Vector2(4,9),new Vector2(4,9),new Vector2(8,7),new Vector2(8,7),new Vector2(9,5),new Vector2(9,5),new Vector2(9,3),new Vector2(9,3),new Vector2(8,1),new Vector2(8,1),new Vector2(7,0),new Vector2(7,0),new Vector2(6,-2),new Vector2(6,-2),new Vector2(6,-4),new Vector2(6,-4),new Vector2(7,-6),new Vector2(6,8),new Vector2(8,6),new Vector2(8,6),new Vector2(8,4),new Vector2(8,4),new Vector2(7,2),new Vector2(7,2),new Vector2(6,1),new Vector2(6,1),new Vector2(5,-1),new Vector2(5,-1),new Vector2(5,-3),new Vector2(5,-3),new Vector2(6,-5),new Vector2(6,-5),new Vector2(7,-6),new Vector2(7,-6),new Vector2(9,-7)})},
|
||||
/*|*/ new LineChar{Width = 8, Vertices = new List<Vector2>(new Vector2[]{new Vector2(4,25),new Vector2(4,-7)})},
|
||||
/*}*/ new LineChar{Width = 14, Vertices = new List<Vector2>(new Vector2[]{new Vector2(5,25),new Vector2(7,24),new Vector2(7,24),new Vector2(8,23),new Vector2(8,23),new Vector2(9,21),new Vector2(9,21),new Vector2(9,19),new Vector2(9,19),new Vector2(8,17),new Vector2(8,17),new Vector2(7,16),new Vector2(7,16),new Vector2(6,14),new Vector2(6,14),new Vector2(6,12),new Vector2(6,12),new Vector2(8,10),new Vector2(7,24),new Vector2(8,22),new Vector2(8,22),new Vector2(8,20),new Vector2(8,20),new Vector2(7,18),new Vector2(7,18),new Vector2(6,17),new Vector2(6,17),new Vector2(5,15),new Vector2(5,15),new Vector2(5,13),new Vector2(5,13),new Vector2(6,11),new Vector2(6,11),new Vector2(10,9),new Vector2(10,9),new Vector2(6,7),new Vector2(6,7),new Vector2(5,5),new Vector2(5,5),new Vector2(5,3),new Vector2(5,3),new Vector2(6,1),new Vector2(6,1),new Vector2(7,0),new Vector2(7,0),new Vector2(8,-2),new Vector2(8,-2),new Vector2(8,-4),new Vector2(8,-4),new Vector2(7,-6),new Vector2(8,8),new Vector2(6,6),new Vector2(6,6),new Vector2(6,4),new Vector2(6,4),new Vector2(7,2),new Vector2(7,2),new Vector2(8,1),new Vector2(8,1),new Vector2(9,-1),new Vector2(9,-1),new Vector2(9,-3),new Vector2(9,-3),new Vector2(8,-5),new Vector2(8,-5),new Vector2(7,-6),new Vector2(7,-6),new Vector2(5,-7)})},
|
||||
/*~*/ new LineChar{Width = 24, Vertices = new List<Vector2>(new Vector2[]{new Vector2(3,6),new Vector2(3,8),new Vector2(3,8),new Vector2(4,11),new Vector2(4,11),new Vector2(6,12),new Vector2(6,12),new Vector2(8,12),new Vector2(8,12),new Vector2(10,11),new Vector2(10,11),new Vector2(14,8),new Vector2(14,8),new Vector2(16,7),new Vector2(16,7),new Vector2(18,7),new Vector2(18,7),new Vector2(20,8),new Vector2(20,8),new Vector2(21,10),new Vector2(3,8),new Vector2(4,10),new Vector2(4,10),new Vector2(6,11),new Vector2(6,11),new Vector2(8,11),new Vector2(8,11),new Vector2(10,10),new Vector2(10,10),new Vector2(14,7),new Vector2(14,7),new Vector2(16,6),new Vector2(16,6),new Vector2(18,6),new Vector2(18,6),new Vector2(20,7),new Vector2(20,7),new Vector2(21,10),new Vector2(21,10),new Vector2(21,12)})}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c9480cef8fc2254ba178e579a238c6e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,50 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class LineFontMeshWriter : ProceduralMeshFilter {
|
||||
public LineFontMeshWriter(IProceduralMeshFilter next):base(next)
|
||||
{ }
|
||||
|
||||
public LineFontMeshWriter WriteText(string text)
|
||||
{
|
||||
float tabLength = 4 * LineFont.Chars[0].Width;
|
||||
float lineSize = 32 + 2;
|
||||
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
|
||||
char firstChar = (char)32;
|
||||
char lastChar = (char)(firstChar + LineFont.Chars.Count - 1);
|
||||
|
||||
for (int i = 0; i < text.Length; ++i)
|
||||
{
|
||||
char charID = text[i];
|
||||
|
||||
if (charID >= firstChar && charID <= lastChar) {
|
||||
int p = charID - firstChar;
|
||||
var vChar = LineFont.Chars[p];
|
||||
for (int j = 0; j < vChar.Vertices.Count; j++) {
|
||||
Next.Vertex(vChar.Vertices[j] + new Vector2(x, y));
|
||||
//appendVertex(position, lineFont[p].vertices[i] + ScreenOffsetType(x, y));
|
||||
}
|
||||
x += vChar.Width;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (charID == '\n') {
|
||||
x = 0;
|
||||
y -= lineSize;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (charID == '\t') {
|
||||
x += tabLength;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bfba57277abceb942bcc5682d11de69f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,313 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class LineListMeshConstructor : IMeshConstructor, IProceduralMeshFilter {
|
||||
|
||||
private List<Vector3> _vertices = new List<Vector3>();
|
||||
private List<Color> _colors = new List<Color>();
|
||||
private int[] _indices = new int[] { };
|
||||
|
||||
private Dictionary<int, List<Vector2>> _uvs = new Dictionary<int, List<Vector2>>();
|
||||
|
||||
public List<Vector3> Vertices => _vertices;
|
||||
public int[] Indices {
|
||||
get {
|
||||
RebuildIndexBuffer();
|
||||
return _indices;
|
||||
}
|
||||
}
|
||||
public List<Color> Colors => _colors;
|
||||
|
||||
public Color Color { get; set; } = Color.red;
|
||||
public uint SegmentsCount { get; set; } = 16;
|
||||
|
||||
public MeshTopology Topology {
|
||||
get {
|
||||
return MeshTopology.Lines;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Vector3> Normals { get; set; } = null;
|
||||
|
||||
public Dictionary<int, List<Vector2>> UvChannels { get { return _uvs; } }
|
||||
|
||||
public static T Concat<T>(params T[] contructors) where T : LineListMeshConstructor {
|
||||
LineListMeshConstructor result = new LineListMeshConstructor();
|
||||
result._colors = contructors.SelectMany(v => v._colors).ToList();
|
||||
result._vertices = contructors.SelectMany(v => v._vertices).ToList();
|
||||
return (T)result;
|
||||
}
|
||||
|
||||
|
||||
public virtual void Clear() {
|
||||
_vertices.Clear();
|
||||
_colors.Clear();
|
||||
}
|
||||
|
||||
public void Line(Vector3 begin, Vector3 end) {
|
||||
Vertex(begin);
|
||||
Vertex(end);
|
||||
}
|
||||
|
||||
public void Line(Vector3 begin, Color beginColor, Vector3 end, Color endColor) {
|
||||
Vertex(begin, beginColor);
|
||||
Vertex(end, endColor);
|
||||
}
|
||||
|
||||
//[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public virtual void Vertex(Vector3 vertex) {
|
||||
_vertices.Add(vertex);
|
||||
_colors.Add(Color);
|
||||
}
|
||||
|
||||
public virtual void Vertex(Vector3 vertex, Color color) {
|
||||
_vertices.Add(vertex);
|
||||
_colors.Add(color);
|
||||
}
|
||||
|
||||
public void Circle(Vector3 position, float radius) {
|
||||
Vector3 first = position;
|
||||
first.y += radius;
|
||||
Vertex(first);
|
||||
float stepSize = (3.14159265358979f * 2) / SegmentsCount;
|
||||
for (int i = 1; i < SegmentsCount; i++) {
|
||||
float angle = stepSize * i;
|
||||
var v = new Vector3(Mathf.Sin(angle) * radius, Mathf.Cos(angle) * radius, 0) + position;
|
||||
Vertex(v);
|
||||
Vertex(v);
|
||||
}
|
||||
Vertex(first);
|
||||
}
|
||||
|
||||
public void Grid(float width, float height, int widthSegments, int heightSegments) {
|
||||
if(widthSegments < 1) {
|
||||
widthSegments = 1;
|
||||
}
|
||||
if (heightSegments < 1) {
|
||||
heightSegments = 1;
|
||||
}
|
||||
|
||||
float halfWidth = width / 2.0f;
|
||||
float halfHeight = height / 2.0f;
|
||||
|
||||
//Vertical lines
|
||||
for(int i = 0; i <= widthSegments; ++i) {
|
||||
float x = width / widthSegments * i - halfWidth;
|
||||
Vertex(new Vector3(x, height / 2, 0));
|
||||
Vertex(new Vector3(x, -height / 2, 0));
|
||||
}
|
||||
|
||||
//Horizontal lines
|
||||
for (int i = 0; i <= heightSegments; ++i) {
|
||||
float y = height / heightSegments * i - halfHeight;
|
||||
Vertex(new Vector3(-halfWidth, y, 0));
|
||||
Vertex(new Vector3(halfWidth, y, 0));
|
||||
}
|
||||
}
|
||||
|
||||
public void Box(Vector2 size) {
|
||||
float halfX = size.x / 2;
|
||||
float halfY = size.y / 2;
|
||||
Line(new Vector3(-halfX, halfY), new Vector3(halfX, halfY));
|
||||
Line(new Vector3(halfX, halfY), new Vector3(halfX, -halfY));
|
||||
Line(new Vector3(halfX, -halfY), new Vector3(-halfX,-halfY));
|
||||
Line(new Vector3(-halfX, -halfY), new Vector3(-halfX, halfY));
|
||||
}
|
||||
|
||||
public void Box(Vector3 size) {
|
||||
float halfX = size.x / 2;
|
||||
float halfY = size.y / 2;
|
||||
float halfZ = size.z / 2;
|
||||
|
||||
Vector3[] vertices = new Vector3[] {
|
||||
new Vector3(-halfX, halfY, halfZ),
|
||||
new Vector3(halfX, halfY, halfZ),
|
||||
new Vector3(halfX, halfY, -halfZ),
|
||||
new Vector3(-halfX, halfY, -halfZ),
|
||||
|
||||
new Vector3(-halfX, -halfY, halfZ),
|
||||
new Vector3(halfX, -halfY, halfZ),
|
||||
new Vector3(halfX, -halfY, -halfZ),
|
||||
new Vector3(-halfX, -halfY, -halfZ),
|
||||
};
|
||||
|
||||
int[] indices = new int[] {
|
||||
0,1,
|
||||
1,2,
|
||||
2,3,
|
||||
3,0,
|
||||
|
||||
4,5,
|
||||
5,6,
|
||||
6,7,
|
||||
7,4,
|
||||
|
||||
0,4,
|
||||
1,5,
|
||||
2,6,
|
||||
3,7
|
||||
};
|
||||
|
||||
for(int i = 0; i < indices.Length; ++i) {
|
||||
Vertex(vertices[indices[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
public void CoordinateSystem() {
|
||||
var oldColor = Color;
|
||||
Color = Color.red;
|
||||
Line(Vector3.zero, Vector3.right);
|
||||
Color = Color.green;
|
||||
Line(Vector3.zero, Vector3.up);
|
||||
Color = Color.blue;
|
||||
Line(Vector3.zero, Vector3.forward);
|
||||
}
|
||||
|
||||
public void Cross2D(float extent) {
|
||||
Line(new Vector3(-extent, 0, 0), new Vector3(extent, 0, 0));
|
||||
Line(new Vector3(0, -extent, 0), new Vector3(0, extent, 0));
|
||||
}
|
||||
|
||||
public void Cross3D(float extent) {
|
||||
Line(new Vector3(-extent, 0, 0), new Vector3(extent, 0, 0));
|
||||
Line(new Vector3(0, -extent, 0), new Vector3(0, extent, 0));
|
||||
Line(new Vector3(0, 0, -extent), new Vector3(0, 0, extent));
|
||||
}
|
||||
|
||||
public void QuadraticBezier(Vector3 p0, Vector3 p1, Vector3 p2) {
|
||||
Vector3 previous = p0;
|
||||
for (int i = 1; i <= SegmentsCount; ++i) {
|
||||
float t = 1.0f / SegmentsCount * i;
|
||||
float rcpT = 1.0f - t;
|
||||
|
||||
float tPow2 = t * t;
|
||||
float rcpTPow2 = rcpT * rcpT;
|
||||
|
||||
Vector3 b = rcpTPow2 * p0 + 2.0f * rcpT * t * p1 + tPow2 * p2;
|
||||
Vertex(previous);
|
||||
Vertex(b);
|
||||
previous = b;
|
||||
}
|
||||
}
|
||||
|
||||
public void QubicBezier(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3) {
|
||||
Vector3 previous = p0;
|
||||
for (int i = 1; i <= SegmentsCount; ++i) {
|
||||
float t = 1.0f / SegmentsCount * i;
|
||||
float rcpT = 1.0f - t;
|
||||
float tPow2 = t * t;
|
||||
float tPow3 = tPow2 * t;
|
||||
float rcpTPow2 = rcpT * rcpT;
|
||||
float rcpTPow3 = rcpTPow2 * rcpT;
|
||||
Vector3 b = rcpTPow3 * p0 + 3 * rcpTPow2 * t * p1 + 3 * rcpT * tPow2 * p2 + tPow3 * p3;
|
||||
Vertex(previous);
|
||||
Vertex(b);
|
||||
previous = b;
|
||||
}
|
||||
}
|
||||
|
||||
int[] PascalTriangleRow(int row) {
|
||||
int[] result = new int[row + 1];
|
||||
result[0] = 1;
|
||||
for (int i = 0; i < row; ++i)
|
||||
result[1 + i] = result[i] * (row - i) / (i + 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Bezier(Vector3[] controlPoints) {
|
||||
if(controlPoints == null || controlPoints.Length < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 previous = controlPoints[0];
|
||||
int n = controlPoints.Length - 1;
|
||||
|
||||
var row = PascalTriangleRow(n);
|
||||
|
||||
for (int s = 1; s <= SegmentsCount; ++s) {
|
||||
float t = 1.0f / SegmentsCount * s;
|
||||
float rcpT = 1.0f - t;
|
||||
Vector3 b = Vector3.zero;
|
||||
for (int i = 0; i < controlPoints.Length; ++i) {
|
||||
b += Mathf.Pow(rcpT, n - i) * Mathf.Pow(t, i) * controlPoints[i] * row[i];
|
||||
}
|
||||
Vertex(previous);
|
||||
Vertex(b);
|
||||
previous = b;
|
||||
}
|
||||
}
|
||||
|
||||
public void PolyLine(IEnumerable<Vector3> pointsList) {
|
||||
using(var enumerator = pointsList.GetEnumerator()) {
|
||||
if (!enumerator.MoveNext()) {
|
||||
return;
|
||||
}
|
||||
Vector3 previous = enumerator.Current;
|
||||
while (enumerator.MoveNext()) {
|
||||
var current = enumerator.Current;
|
||||
Vertex(previous);
|
||||
Vertex(current);
|
||||
previous = current;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Sphere(Vector3 position, float radius) {
|
||||
Vector3[] first = new Vector3[] { position, position, position };
|
||||
first[0].x += radius;
|
||||
first[1].y += radius;
|
||||
first[2].y += radius;
|
||||
|
||||
Vector3[] previous = new Vector3[] { first[0], first[1], first[2] };
|
||||
|
||||
float stepSize = (3.14159265358979f * 2) / SegmentsCount;
|
||||
for (int i = 1; i < SegmentsCount; i++) {
|
||||
float angle = stepSize * i;
|
||||
float a = Mathf.Sin(angle) * radius;
|
||||
float b = Mathf.Cos(angle) * radius;
|
||||
|
||||
var v = new Vector3(b, 0, -a) + position;
|
||||
Vertex(previous[0]);
|
||||
Vertex(v);
|
||||
previous[0] = v;
|
||||
|
||||
v = new Vector3(a, b, 0) + position;
|
||||
Vertex(previous[1]);
|
||||
Vertex(v);
|
||||
previous[1] = v;
|
||||
|
||||
v = new Vector3(0, b, a) + position;
|
||||
Vertex(previous[2]);
|
||||
Vertex(v);
|
||||
previous[2] = v;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
Vertex(previous[i]);
|
||||
Vertex(first[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void RebuildIndexBuffer() {
|
||||
if (_indices.Length > _vertices.Count) {
|
||||
System.Array.Resize(ref _indices, _vertices.Count);
|
||||
} else if (_indices.Length < _vertices.Count) {
|
||||
int beginIndex = _indices.Length;
|
||||
int endIndex = _vertices.Count;
|
||||
System.Array.Resize(ref _indices, _vertices.Count);
|
||||
for (; beginIndex < endIndex; ++beginIndex) {
|
||||
_indices[beginIndex] = beginIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Vector2> UvChannel(int id) {
|
||||
if (!_uvs.ContainsKey(id)) {
|
||||
_uvs.Add(id, new List<Vector2>());
|
||||
}
|
||||
return _uvs[id];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aae56a92c6db38549acc6fd0e6700c46
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class LineListMeshConstructorExtended : LineListMeshConstructor {
|
||||
|
||||
public Matrix4x4 Matrix = Matrix4x4.identity;
|
||||
|
||||
public override void Clear() {
|
||||
base.Clear();
|
||||
Matrix = Matrix4x4.identity;
|
||||
}
|
||||
|
||||
public override void Vertex(Vector3 vertex) {
|
||||
base.Vertex(Matrix.MultiplyPoint(vertex));
|
||||
}
|
||||
|
||||
public override void Vertex(Vector3 vertex, Color color) {
|
||||
base.Vertex(Matrix.MultiplyPoint(vertex), color);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc45f1d4570c2954a80ee6a7b6b905b5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class LineStripMeshWriter {
|
||||
public LineListMeshConstructor Constructor { get; private set; }
|
||||
private Vector3 _lastVertex = Vector3.zero;
|
||||
private bool _newStrip = true;
|
||||
|
||||
public Vector3 LastVertex {
|
||||
get { return _lastVertex; }
|
||||
}
|
||||
|
||||
public int StripLength { get; private set; }
|
||||
public LineStripMeshWriter(LineListMeshConstructor constructor) {
|
||||
Constructor = constructor;
|
||||
}
|
||||
|
||||
public void Vertex(Vector3 value) {
|
||||
if (_newStrip) {
|
||||
_newStrip = false;
|
||||
} else {
|
||||
Constructor.Line(_lastVertex, value);
|
||||
}
|
||||
_lastVertex = value;
|
||||
StripLength++;
|
||||
}
|
||||
|
||||
public void Restart() {
|
||||
_newStrip = true;
|
||||
StripLength = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d7e052f1e6b03d4fa745ec28e9a4958
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MatrixTransformMeshFilter : ProceduralMeshFilter
|
||||
{
|
||||
public Matrix4x4 Matrix = Matrix4x4.identity;
|
||||
public MatrixTransformMeshFilter(IProceduralMeshFilter next) : base(next)
|
||||
{
|
||||
}
|
||||
public MatrixTransformMeshFilter(IProceduralMeshFilter next, Matrix4x4 matrix) : base(next)
|
||||
{
|
||||
Matrix = matrix;
|
||||
}
|
||||
|
||||
public override void Vertex(Vector3 vertex)
|
||||
{
|
||||
base.Vertex(Matrix.MultiplyPoint(vertex));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f2f5f1934e356640ab505a70c21d4cb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public interface IMeshConstructor {
|
||||
List<Vector3> Vertices { get; }
|
||||
int[] Indices { get; }
|
||||
List<Color> Colors { get; }
|
||||
|
||||
List<Vector3> Normals { get; }
|
||||
|
||||
MeshTopology Topology { get; }
|
||||
|
||||
List<Vector2> UvChannel(int id);
|
||||
|
||||
Dictionary<int, List<Vector2>> UvChannels { get; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e82ba4b3a4c32be4ab51315aee5d863f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class OffsetMeshFilter : ProceduralMeshFilter
|
||||
{
|
||||
public Vector3 Offset = Vector3.zero;
|
||||
public OffsetMeshFilter(IProceduralMeshFilter next) : base(next)
|
||||
{
|
||||
}
|
||||
public OffsetMeshFilter(IProceduralMeshFilter next, Vector3 offset) : base(next)
|
||||
{
|
||||
Offset = offset;
|
||||
}
|
||||
public override void Vertex(Vector3 vertex)
|
||||
{
|
||||
base.Vertex(vertex + Offset);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65379463b8f8e1b43ab58fd9c90a1b44
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(MeshRenderer))]
|
||||
[RequireComponent(typeof(MeshFilter))]
|
||||
[ExecuteInEditMode]
|
||||
public class ProceduralMesh : MonoBehaviour {
|
||||
|
||||
private Mesh _mesh;
|
||||
private void Awake() {
|
||||
|
||||
}
|
||||
|
||||
private void ValidateMeshCreated() {
|
||||
if(_mesh == null) {
|
||||
_mesh = new Mesh();
|
||||
}
|
||||
var filter = GetComponent<MeshFilter>();
|
||||
filter.sharedMesh = _mesh;
|
||||
}
|
||||
|
||||
public void Rebuild(IMeshConstructor constructor, bool recalculateBounds = true) {
|
||||
ValidateMeshCreated();
|
||||
_mesh.Clear();
|
||||
_mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
|
||||
_mesh.SetVertices(constructor.Vertices);
|
||||
_mesh.SetColors(constructor.Colors);
|
||||
|
||||
|
||||
var uvs = constructor.UvChannels;
|
||||
|
||||
foreach(var uv in uvs) {
|
||||
_mesh.SetUVs(uv.Key, uv.Value);
|
||||
}
|
||||
|
||||
_mesh.SetIndices(constructor.Indices, constructor.Topology, 0);
|
||||
|
||||
var normals = constructor.Normals;
|
||||
if (normals != null)
|
||||
{
|
||||
_mesh.SetNormals(normals);
|
||||
}
|
||||
|
||||
if (recalculateBounds) {
|
||||
_mesh.RecalculateBounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 643f8821158cc4e4ea3be87268a48107
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public interface IProceduralMeshFilter
|
||||
{
|
||||
void Vertex(Vector3 vertex);
|
||||
}
|
||||
|
||||
public class ProceduralMeshFilter : IProceduralMeshFilter {
|
||||
public IProceduralMeshFilter Next { get; }
|
||||
public ProceduralMeshFilter(IProceduralMeshFilter next)
|
||||
{
|
||||
Next = next;
|
||||
}
|
||||
public virtual void Vertex(Vector3 vertex)
|
||||
{
|
||||
Next.Vertex(vertex);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c1b37139ea48004b84c9aba4f4ea648
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class RotationMeshFilter : ProceduralMeshFilter
|
||||
{
|
||||
public Quaternion Rotation = Quaternion.identity;
|
||||
public RotationMeshFilter(IProceduralMeshFilter next) : base(next)
|
||||
{
|
||||
}
|
||||
|
||||
public RotationMeshFilter(IProceduralMeshFilter next, Quaternion rotation) : base(next)
|
||||
{
|
||||
Rotation = rotation;
|
||||
}
|
||||
|
||||
public override void Vertex(Vector3 vertex)
|
||||
{
|
||||
base.Vertex(Rotation * vertex);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 936a27603138b00478b618fa44a0d110
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ScaleMeshFilter : ProceduralMeshFilter
|
||||
{
|
||||
public Vector3 Scale = Vector3.one;
|
||||
public ScaleMeshFilter(IProceduralMeshFilter next, Vector3 scale) : base(next)
|
||||
{
|
||||
Scale = scale;
|
||||
}
|
||||
|
||||
public override void Vertex(Vector3 vertex)
|
||||
{
|
||||
vertex.x *= Scale.x;
|
||||
vertex.y *= Scale.y;
|
||||
vertex.z *= Scale.z;
|
||||
|
||||
base.Vertex(vertex);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e45e268c3d226a4c8d41b0dfa4e38a3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,127 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class TriangleMeshConstructor : IMeshConstructor {
|
||||
public List<Vector3> Vertices { get; set; } = new List<Vector3>();
|
||||
|
||||
public List<Vector3> UV { get; set; } = new List<Vector3>();
|
||||
|
||||
public int[] Indices { get; set; }
|
||||
|
||||
public List<Color> Colors { get; set; } = new List<Color>();
|
||||
|
||||
public MeshTopology Topology { get { return MeshTopology.Triangles; } }
|
||||
|
||||
public Color Color { get; set; } = Color.white;
|
||||
|
||||
public List<Vector3> Normals { get; set; } = null;
|
||||
|
||||
public Dictionary<int, List<Vector2>> UvChannels { get { return _uvs; } }
|
||||
|
||||
private Dictionary<int, List<Vector2>> _uvs = new Dictionary<int, List<Vector2>>();
|
||||
|
||||
public void RecalculateIndicesAsTriangleList() {
|
||||
if(Vertices == null) {
|
||||
return;
|
||||
}
|
||||
if(Vertices.Count % 3 != 0) {
|
||||
throw new System.Exception("Vertex count is not multiple of 3");
|
||||
}
|
||||
Indices = Enumerable.Range(0, Vertices.Count).ToArray();
|
||||
}
|
||||
|
||||
public void BreakVertices()
|
||||
{
|
||||
List<Vector3> newVertices = new List<Vector3>();
|
||||
List<Color> newColors = new List<Color>();
|
||||
Dictionary<int, List<Vector2>> newUvs = new Dictionary<int, List<Vector2>>();
|
||||
|
||||
for (int i = 0; i < Indices.Length; ++i)
|
||||
{
|
||||
newVertices.Add(Vertices[Indices[i]]);
|
||||
newColors.Add(Colors[Indices[i]]);
|
||||
|
||||
foreach(var u in _uvs) {
|
||||
if (!newUvs.ContainsKey(u.Key)) {
|
||||
newUvs.Add(u.Key, new List<Vector2>());
|
||||
}
|
||||
newUvs[u.Key].Add(u.Value[Indices[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vertices = newVertices;
|
||||
Colors = newColors;
|
||||
_uvs = newUvs;
|
||||
|
||||
RecalculateIndicesAsTriangleList();
|
||||
}
|
||||
|
||||
public void RecalculateFlatNormals()
|
||||
{
|
||||
Normals = new List<Vector3>();
|
||||
//norma
|
||||
for (int i = 0; i < Vertices.Count; i+=3)
|
||||
{
|
||||
var p0 = Vertices[i + 0];
|
||||
var p1 = Vertices[i + 1];
|
||||
var p2 = Vertices[i + 2];
|
||||
|
||||
var v0 = p0 - p2;
|
||||
var v1 = p1 - p2;
|
||||
|
||||
var normal = Vector3.Cross(v0.normalized, v1.normalized).normalized;
|
||||
Normals.Add(normal);
|
||||
Normals.Add(normal);
|
||||
Normals.Add(normal);
|
||||
}
|
||||
}
|
||||
|
||||
public void AssingColors(Color c) {
|
||||
Colors = Enumerable.Repeat(c, Vertices.Count).ToList();
|
||||
}
|
||||
|
||||
public delegate Color ColorGenerator(int verticesCount, int vertexId);
|
||||
public delegate Color ColorGenerator2(int verticesCount, int vertexId, Vector3 vertex);
|
||||
|
||||
public void AssingColors(ColorGenerator generator) {
|
||||
Colors = new List<Color>();
|
||||
for (int i = 0; i < Vertices.Count; ++i) {
|
||||
Colors.Add(generator(Vertices.Count, i));
|
||||
}
|
||||
}
|
||||
|
||||
public void AssingColors(ColorGenerator2 generator) {
|
||||
Colors = new List<Color>();
|
||||
for (int i = 0; i < Vertices.Count; ++i) {
|
||||
Colors.Add(generator(Vertices.Count, i, Vertices[i]));
|
||||
}
|
||||
}
|
||||
|
||||
public void Vertex(Vector3 v, Color c) {
|
||||
Vertices.Add(v);
|
||||
Colors.Add(c);
|
||||
}
|
||||
|
||||
public void Vertex(Vector3 v) {
|
||||
Vertices.Add(v);
|
||||
Colors.Add(Color);
|
||||
}
|
||||
|
||||
public void Triangle(Vector3 p0, Vector3 p1, Vector3 p2) {
|
||||
Vertex(p0);
|
||||
Vertex(p1);
|
||||
Vertex(p2);
|
||||
}
|
||||
|
||||
public List<Vector2> UvChannel(int id) {
|
||||
if (!_uvs.ContainsKey(id)) {
|
||||
_uvs.Add(id, new List<Vector2>());
|
||||
}
|
||||
return _uvs[id];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5675208650ee81348890a166c109f94e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
public class PtgFile {
|
||||
|
||||
private List<TimFile> _timData = new List<TimFile>();
|
||||
|
||||
public List<TimFile> Textures {
|
||||
get { return _timData; }
|
||||
}
|
||||
|
||||
public static PtgFile Parse(byte[] data) {
|
||||
PtgFile result = new PtgFile();
|
||||
|
||||
MemoryStream src = new MemoryStream(data);
|
||||
|
||||
BinaryReader r = new BinaryReader(src);
|
||||
var texCount = r.ReadInt32();
|
||||
var texSize = (data.Length - 4) / texCount;
|
||||
|
||||
for (int i = 0; i < texCount; ++i) {
|
||||
var texData = r.ReadBytes(texSize);
|
||||
result._timData.Add(TimFile.Parse(texData));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a76348b2eaeb224bb8e8f3814365bf1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f3d7034ef7532fe4ab3e67d37828314c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fc0d4010bbf28b4594072e72b8655ab
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,77 @@
|
||||
%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: Terrain
|
||||
m_Shader: {fileID: 4800000, guid: bef99a420ff986049a61f700baaebfde, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
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}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.29
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0cfce0a529a72184f9de66750cefb67d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,63 @@
|
||||
Shader "Unlit/Terrain"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
// make fog work
|
||||
#pragma multi_compile_fog
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
UNITY_FOG_COORDS(1)
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : TEXCOORD5;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_ST;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
UNITY_TRANSFER_FOG(o,o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
// sample the texture
|
||||
fixed4 col = tex2D(_MainTex, i.uv);
|
||||
// apply fog
|
||||
UNITY_APPLY_FOG(i.fogCoord, col);
|
||||
|
||||
return i.color * col;
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bef99a420ff986049a61f700baaebfde
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
public class TimFile {
|
||||
|
||||
public enum Format : byte {
|
||||
Bpp4Bit = 0,
|
||||
Bpp8Bit = 1,
|
||||
Bpp16Bit = 2,
|
||||
Bpp24Bit = 3
|
||||
}
|
||||
[Serializable]
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct Header {
|
||||
public uint h1;
|
||||
public uint h2;
|
||||
|
||||
public byte Tag {
|
||||
get { return (byte)(h1 & 0xff); }
|
||||
}
|
||||
public byte Version {
|
||||
get { return (byte)((h1 >> 8) & 0xff); }
|
||||
}
|
||||
|
||||
public Format Format {
|
||||
get { return (Format)(h2 & 0x3); }
|
||||
}
|
||||
|
||||
public bool ColorLutPresent {
|
||||
get { return (h2 & 0x08) != 0; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct ImageBlockHeader {
|
||||
public uint length;
|
||||
public ushort x;
|
||||
public ushort y;
|
||||
public ushort width;
|
||||
public ushort height;
|
||||
}
|
||||
|
||||
public class ImageBlock {
|
||||
public ImageBlockHeader header;
|
||||
public ushort[] data;
|
||||
}
|
||||
|
||||
public Header header;
|
||||
public ImageBlock lut;
|
||||
public ImageBlock image;
|
||||
|
||||
|
||||
public int ImageWidth {
|
||||
get {
|
||||
switch (header.Format) {
|
||||
case Format.Bpp4Bit:
|
||||
return image.header.width * 4;
|
||||
case Format.Bpp8Bit:
|
||||
return image.header.width * 2;
|
||||
case Format.Bpp16Bit:
|
||||
return image.header.width * 1;
|
||||
case Format.Bpp24Bit:
|
||||
return (int)(image.header.width / 1.5f);
|
||||
default:
|
||||
return image.header.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int ImageHeight {
|
||||
get {
|
||||
return image.header.height;
|
||||
}
|
||||
}
|
||||
|
||||
private static ImageBlock ReadImageBlock(BinaryReader reader) {
|
||||
ImageBlock result = new ImageBlock();
|
||||
|
||||
result.header.length = reader.ReadUInt32();
|
||||
result.header.x = reader.ReadUInt16();
|
||||
result.header.y = reader.ReadUInt16();
|
||||
result.header.width = reader.ReadUInt16();
|
||||
result.header.height = reader.ReadUInt16();
|
||||
|
||||
|
||||
var dataSize = result.header.length - 12;
|
||||
|
||||
result.data = new ushort[dataSize / 2];
|
||||
|
||||
for (int i = 0; i < result.data.Length; ++i) {
|
||||
result.data[i] = reader.ReadUInt16();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static TimFile Parse(byte[] data) {
|
||||
|
||||
TimFile result = new TimFile();
|
||||
|
||||
MemoryStream src = new MemoryStream(data);
|
||||
BinaryReader r = new BinaryReader(src);
|
||||
|
||||
result.header.h1 = r.ReadUInt32();
|
||||
result.header.h2 = r.ReadUInt32();
|
||||
|
||||
if (result.header.ColorLutPresent) {
|
||||
result.lut = ReadImageBlock(r);
|
||||
}
|
||||
|
||||
result.image = ReadImageBlock(r);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48075a2063acc65469153cb213abe93b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user