yea. lazy.

This commit is contained in:
alexiscatnip
2022-03-28 21:29:45 +08:00
parent 9cd495c190
commit 5e8a6cbf2b
376 changed files with 24377 additions and 86366 deletions
-23
View File
@@ -1,23 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using OpenMetaverse.Stats;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[RequireComponent(typeof(Button))]
public class ButtonTriggerModal : MonoBehaviour
{
private Button button;
// Start is called before the first frame update
void Awake()
{
button = GetComponent<Button>();
button.onClick.AddListener(OnButtonDown);
}
private void OnButtonDown()
{
throw new System.NotImplementedException();
}
}
+21
View File
@@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
public class Button_DestroyModal : MonoBehaviour
{
public Button btn;
public GameObject modal;
void Awake()
{
btn.onClick.AddListener(destroy);
}
private void destroy()
{
Destroy(modal);
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 66441a43fb359434c944c394b81c6f95
guid: bc72cc9fab928ac4782c55aa480bf423
MonoImporter:
externalObjects: {}
serializedVersion: 2
-23
View File
@@ -1,23 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ExitAppBehaviorCallable : MonoBehaviour
{
public void closeApp()
{
Application.Quit();
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B

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

After

Width:  |  Height:  |  Size: 17 KiB

+96
View File
@@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 0bfa4b2f9adbc7d4ba1e22b8447631b9
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -1 +0,0 @@
success!
@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 78820f90ef9de5c4097157289abea5d0
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+17
View File
@@ -0,0 +1,17 @@
using UnityEngine;
public class LoadingCircle : MonoBehaviour
{
private RectTransform rectComponent;
private float rotateSpeed = 200f;
private void Start()
{
rectComponent = GetComponent<RectTransform>();
}
private void Update()
{
rectComponent.Rotate(0f, 0f, rotateSpeed * Time.deltaTime);
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6befae5e0c3878c4aa57f9eb76409c4b
guid: 61f8c7009cd55d14c880a628ffac17e0
MonoImporter:
externalObjects: {}
serializedVersion: 2
@@ -1,510 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 8
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657892, g: 0.4964128, b: 0.5748171, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 9
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 0
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVRFiltering: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousColorSigma: 1
m_PVRFilteringAtrousNormalSigma: 1
m_PVRFilteringAtrousPositionSigma: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &70076753
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 70076757}
- component: {fileID: 70076756}
- component: {fileID: 70076755}
- component: {fileID: 70076754}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &70076754
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 70076753}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &70076755
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 70076753}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &70076756
Canvas:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 70076753}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &70076757
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 70076753}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 1916147957}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &329145529
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 329145535}
- component: {fileID: 329145534}
- component: {fileID: 329145533}
- component: {fileID: 329145532}
- component: {fileID: 329145531}
- component: {fileID: 329145530}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &329145530
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 329145529}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e254ae11057fcdf4a894dcf319700de7, type: 3}
m_Name:
m_EditorClassIdentifier:
InProgressText: {fileID: 1916147958}
EditorApkPath: BetterStreamingAssetsTest.apk
RepetitionCount: 10
LogToFile: 0
--- !u!81 &329145531
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 329145529}
m_Enabled: 1
--- !u!124 &329145532
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 329145529}
m_Enabled: 1
--- !u!92 &329145533
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 329145529}
m_Enabled: 1
--- !u!20 &329145534
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 329145529}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
m_StereoMirrorMode: 0
--- !u!4 &329145535
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 329145529}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1496189342
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1496189345}
- component: {fileID: 1496189344}
- component: {fileID: 1496189343}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1496189343
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1496189342}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1496189344
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1496189342}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 5
--- !u!4 &1496189345
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1496189342}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1570752177
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1570752179}
- component: {fileID: 1570752178}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &1570752178
Light:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1570752177}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &1570752179
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1570752177}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1916147956
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1916147957}
- component: {fileID: 1916147959}
- component: {fileID: 1916147958}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1916147957
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1916147956}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 70076757}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1916147958
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1916147956}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Testing in progress...
--- !u!222 &1916147959
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1916147956}
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 2bef88fd675ce3f4fa61ff5f18aa8242
timeCreated: 1506210412
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -14,7 +14,7 @@ PluginImporter:
- first:
Android: Android
second:
enabled: 0
enabled: 1
settings:
CPU: ARM64
- first:
@@ -14,7 +14,7 @@ PluginImporter:
- first:
Android: Android
second:
enabled: 1
enabled: 0
settings:
CPU: ARM64
- first:
@@ -14,7 +14,7 @@ PluginImporter:
- first:
Android: Android
second:
enabled: 0
enabled: 1
settings:
CPU: ARM64
- first:
@@ -14,7 +14,7 @@ PluginImporter:
- first:
Android: Android
second:
enabled: 1
enabled: 0
settings:
CPU: ARM64
- first:
@@ -14,7 +14,7 @@ PluginImporter:
- first:
Android: Android
second:
enabled: 0
enabled: 1
settings:
CPU: ARMv7
- first:
@@ -14,7 +14,7 @@ PluginImporter:
- first:
Android: Android
second:
enabled: 1
enabled: 0
settings:
CPU: ARMv7
- first:
@@ -14,7 +14,7 @@ PluginImporter:
- first:
Android: Android
second:
enabled: 0
enabled: 1
settings:
CPU: ARMv7
- first:
@@ -14,7 +14,7 @@ PluginImporter:
- first:
Android: Android
second:
enabled: 1
enabled: 0
settings:
CPU: ARMv7
- first:
@@ -14,7 +14,7 @@ PluginImporter:
- first:
Android: Android
second:
enabled: 0
enabled: 1
settings:
CPU: x86
- first:
@@ -14,7 +14,7 @@ PluginImporter:
- first:
Android: Android
second:
enabled: 1
enabled: 0
settings:
CPU: x86
- first:
@@ -14,7 +14,7 @@ PluginImporter:
- first:
Android: Android
second:
enabled: 0
enabled: 1
settings:
CPU: x86
- first:
@@ -14,7 +14,7 @@ PluginImporter:
- first:
Android: Android
second:
enabled: 1
enabled: 0
settings:
CPU: x86
- first:
+15 -1
View File
@@ -4498,7 +4498,21 @@ namespace OpenMetaverse
{
foreach (var gesture in reply.Gestures)
{
ActiveGestures.Add(gesture.Key, gesture.Value);
try
{
ActiveGestures.Add(gesture.Key, gesture.Value);
}
catch (Exception e)
{
Logger.Log($"Login Response Gestures had a collsion:" +
$"key: {gesture.Key.ToString()}" +
$"original value: {ActiveGestures[gesture.Key].ToString()}" +
$"replace with this value: {gesture.Value.ToString()}"
,Helpers.LogLevel.Warning);
}
}
}
}
@@ -647,7 +647,11 @@ namespace OpenMetaverse
update.AgentData.Flags = (byte)Flags;
Client.Network.SendPacket(update, simulator);
Logger.DebugLog("sent out a packet of agent movement!");
string flagsbinary = Convert.ToString(AgentControls, 2);
// Logger.DebugLog("sent Agent Movement: \n"
// + "flags: " + flagsbinary + "\n"
// + "Body Heading: " + BodyRotation.Z
// + "Duplicate count:" + duplicateCount);
if (AutoResetControls) {
ResetControlFlags();
-1
View File
@@ -554,6 +554,5 @@ namespace OpenMetaverse
}
#endregion Properties
}
}
@@ -350,7 +350,7 @@ namespace OpenMetaverse.Http
Logger.Log(ex.Message, Helpers.LogLevel.Error, ex);
}
}
Logger.DebugLog("CapsCleint, firecompletecallback : "+ error.ToString());
Logger.DebugLog("CapsClient, FireCompleteCallback : "+ error.ToString());
_Response = result;
_ResponseEvent.Set();
@@ -206,10 +206,21 @@ namespace OpenMetaverse
handler(request, response, responseData, error);
}
}
else if (error.Message.Contains("403")) //forbidden - means no point in retrying, i think.
{
Logger.Log($"{item.Address} HTTP download failed with 403 forbidden: {error.Message}, trying again retry {item.Attempt}/{item.Retries}",
Helpers.LogLevel.Warning);
foreach (CapsBase.RequestCompletedEventHandler handler in activeDownload.CompletedHandlers)
{
handler(request, response, responseData, error);
}
}
else
{
//do retry:
item.Attempt++;
Logger.Log($"{item.Address} HTTP download failed, trying again retry {item.Attempt}/{item.Retries}",
Logger.Log($"{item.Address} HTTP download failed with error message {error.Message}, trying again retry {item.Attempt}/{item.Retries}",
Helpers.LogLevel.Warning);
lock (queue) queue.Enqueue(item);
}
@@ -265,6 +265,7 @@ namespace OpenMetaverse.Imaging
/// Convert the channels in the image. Channels are created or destroyed as required.
/// </summary>
/// <param name="channels">new channel flags</param>
[Obsolete] // do not wish to use managed image when there are better alternatives for this raindrop.
public void ConvertChannels(ImageChannels channels)
{
if (Channels == channels)
@@ -1506,5 +1506,11 @@ namespace OpenMetaverse
}
#endregion Parameter Unpacking Methods
public bool HasNoParent()
{
return (ParentID == 0);
}
}
}
+1 -1
View File
@@ -58,7 +58,7 @@ namespace OpenMetaverse
public static System.Net.IPAddress BIND_ADDR = System.Net.IPAddress.Any;
/// <summary>Use XML-RPC Login or LLSD Login, default is XML-RPC Login</summary>
public bool USE_LLSD_LOGIN = true; //why is the false by default?
public bool USE_LLSD_LOGIN = false; //why is the false by default?
/// <summary>
/// Maximum number of HTTP connections to open to a particular endpoint.
+16 -2
View File
@@ -1065,7 +1065,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: db4ffcad09f8494894233824ed3e9f8c, type: 3}
m_Name:
m_EditorClassIdentifier:
DestChatInputAcceptor: {fileID: 3569416747332443002}
DestChatInputAcceptor: {fileID: 0}
ChatInputField: {fileID: 3569416748185201347}
SendButton: {fileID: 3569416747492323496}
--- !u!1 &3569416747285251776
@@ -2534,7 +2534,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 3569416746466999048}
m_HandleRect: {fileID: 3569416746466999051}
m_Direction: 2
m_Value: 0
m_Value: 1
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
@@ -2749,6 +2749,7 @@ GameObject:
- component: {fileID: 3569416748396480285}
- component: {fileID: 3569416748396480284}
- component: {fileID: 3569416748396480287}
- component: {fileID: 1017426359738601571}
m_Layer: 5
m_Name: chatHistoryBox
m_TagString: Untagged
@@ -2861,3 +2862,16 @@ MonoBehaviour:
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!114 &1017426359738601571
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3569416748396480281}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b016682f9b874ac7ab37c8636c1fa8f6, type: 3}
m_Name:
m_EditorClassIdentifier:
chatTextboxPrefab: {fileID: 0}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ca0f04ba563073d4493ce2a56aa70db4
guid: 55a41f46cc4fc6d4a90426738d1d2a63
folderAsset: yes
DefaultImporter:
externalObjects: {}
+52 -2
View File
@@ -1,4 +1,6 @@
using System.Threading;
using System;
using System.Threading;
using OpenMetaverse.Rendering;
using UnityEngine;
namespace Raindrop.Services.Bootstrap
@@ -6,11 +8,59 @@ namespace Raindrop.Services.Bootstrap
public class Globals : MonoBehaviour
{
public static Thread GMainThread;
public Texture2D DefaultTexture;
public static MeshmerizerR renderer { get; set; }
public static string FullAppName { get; set; }
public static string SimpleAppName { get; set; }
public static bool isOnMainThread()
{
return Globals.GMainThread.Equals(System.Threading.Thread.CurrentThread);
}
public static void Init()
{
GMainThread = System.Threading.Thread.CurrentThread;
InitDefaultTextures();
void InitDefaultTextures()
{
//init void map's # hex 1D475F
Textures.DefaultMapVoidTexture = new Texture2D(1, 1, TextureFormat.ARGB32, false);
Color color;
ColorUtility.TryParseHtmlString("#1D475F", out color);
Textures.DefaultMapVoidTexture.SetPixel(0, 0, color);
Textures.DefaultMapVoidTexture.Apply();
}
renderer = new MeshmerizerR();
FullAppName = Application.productName + " " + Application.version;
SimpleAppName = Application.productName;
}
public static class Textures
{
public static Texture2D DefaultMapVoidTexture { get; set; }
}
}
public class DefaultTextures
{
public static Texture2D DefaultUnknownTexture;
public DefaultTextures(Texture2D defaultTexture)
{
DefaultUnknownTexture = defaultTexture;
}
public Texture2D GetDefaultUnknownTexture()
{
return DefaultUnknownTexture;
}
}
}
@@ -5,93 +5,91 @@ using log4net;
using log4net.Appender;
using log4net.Layout;
using log4net.Repository.Hierarchy;
using Raindrop.Services.Bootstrap;
using UnityEngine;
public static class LoggingConfiguration
namespace Raindrop.Bootstrap
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void Configure()
public static class LoggingConfiguration
{
// var key = "log4net.Internal.Debug";
// string value = true.ToString();
//
// try
// {
// var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
// var settings = configFile.AppSettings.Settings;
// if (settings[key] == null)
// {
// settings.Add(key, value);
// }
// else
// {
// settings[key].Value = value;
// }
// configFile.Save(ConfigurationSaveMode.Modified);
// ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name);
// }
// catch (ConfigurationErrorsException)
// {
// Debug.Log("Error writing app settings");
// }
//
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void Configure()
{
// var key = "log4net.Internal.Debug";
// string value = true.ToString();
//
// try
// {
// var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
// var settings = configFile.AppSettings.Settings;
// if (settings[key] == null)
// {
// settings.Add(key, value);
// }
// else
// {
// settings[key].Value = value;
// }
// configFile.Save(ConfigurationSaveMode.Modified);
// ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name);
// }
// catch (ConfigurationErrorsException)
// {
// Debug.Log("Error writing app settings");
// }
//
var logpath = Path.Combine(DirectoryHelpers.GetInternalStorageDir(), "log.txt");
Debug.Log("Application is configuring the global logger. \n" +
"log file is at : " +
logpath);
ConfigureLoggers(logpath);
}
public static void ConfigureLoggers(string filepath)
{
try
{
// log4net.Config.XmlConfigurator.Configure();
Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
//1. log to unity console.
var unityDebugAppender = new UnityDebugAppender();
unityDebugAppender.Layout = new PatternLayout("%date{HH:mm:ss} [%level] - %message");
//appender.Layout = new PatternLayout("%timestamp [%thread] %-5level - %message%newline");
// BasicConfigurator.Configure(unityDebugAppender);
hierarchy.Root.AddAppender(unityDebugAppender);
Debug.Log("ConfigureLoggers : created unity console appender");
}
catch (Exception e)
{
Debug.LogError("failed to create unity console appender: " + e.ToString());
}
try
{
Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
var logFileAppender = new FileAppender();
logFileAppender.Layout = new PatternLayout("%date{HH:mm:ss} [%level] - %message%newline");
logFileAppender.File = filepath;
logFileAppender.AppendToFile = true;
//logFileAppender.RollingStyle = RollingFileAppender.RollingMode.Size;
//logFileAppender.MaxSizeRollBackups = 10;
//logFileAppender.MaxFileSize = 250 * 1000; // 250KB
//logFileAppender.StaticLogFileName = true;
logFileAppender.ActivateOptions();
// XmlConfigurator.Configure();
hierarchy.Root.AddAppender(logFileAppender);
Debug.Log("Application is configuring the global logger. \n" +
"log file is at : "
+ $"{Path.Combine(DirectoryHelpers.GetInternalStorageDir())}/log.txt");
// var res = XmlConfigurator.Configure(new FileInfo($"{DirectoryHelpers.GetInternalCacheDir()}/log4net.xml"));
ConfigureLoggers(
Path.Combine(DirectoryHelpers.GetInternalStorageDir(), "log.txt"));
hierarchy.Configured = true;
Debug.Log("ConfigureLoggers : created filelogger");
}
catch (Exception e)
{
Debug.LogError("failed to create filelogger, error is : " + e.ToString());
}
}
public static void ConfigureLoggers(string filepath)
{
try
{
// log4net.Config.XmlConfigurator.Configure();
Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
//1. log to unity console.
var unityDebugAppender = new UnityDebugAppender();
unityDebugAppender.Layout = new PatternLayout("%date{HH:mm:ss} [%level] - %message");
//appender.Layout = new PatternLayout("%timestamp [%thread] %-5level - %message%newline");
// BasicConfigurator.Configure(unityDebugAppender);
hierarchy.Root.AddAppender(unityDebugAppender);
Debug.Log("created unity console appender");
}
catch (Exception e)
{
Debug.LogError("failed to create unity console appender: " + e.ToString());
}
try
{
Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
var logFileAppender = new FileAppender();
logFileAppender.Layout = new PatternLayout("%date{HH:mm:ss} [%level] - %message%newline");
logFileAppender.File = filepath;
logFileAppender.AppendToFile = true;
//logFileAppender.RollingStyle = RollingFileAppender.RollingMode.Size;
//logFileAppender.MaxSizeRollBackups = 10;
//logFileAppender.MaxFileSize = 250 * 1000; // 250KB
//logFileAppender.StaticLogFileName = true;
logFileAppender.ActivateOptions();
// XmlConfigurator.Configure();
hierarchy.Root.AddAppender(logFileAppender);
hierarchy.Configured = true;
Debug.Log("created filelogger");
}
catch (Exception e)
{
Debug.LogError("failed to create filelogger, error is : " + e.ToString());
}
}
}
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,6 @@
using System;
using UnityEngine;
using UnityEngine.Assertions;
namespace Raindrop.Services.Bootstrap
{
@@ -11,19 +12,21 @@ namespace Raindrop.Services.Bootstrap
// if the app terminated normally, I will ask the user if they want to reconnect.
public class PersistenceLayer : MonoBehaviour
{
private void Awake()
private void Start()
{
AskUser_LoginUsingPreviousCredentials();
}
// "would you like to login to the last active connection?"
private void AskUser_LoginUsingPreviousCredentials()
{
var ui = ServiceLocator.ServiceLocator.Instance.Get<UIService>();
var instance = ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>();
ui.modalManager.showModalNotification("Quick Re-log",
"Would you like to login with previous credentials: \n" +
instance.GlobalSettings["a"]
);
Assert.IsNotNull(ui, "ui is not found.");
// var instance = ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>();
// ui.modalManager.showModal_NtfGeneric("Quick Re-log",
// "Would you like to login with previous credentials: \n" +
// instance.GlobalSettings["a"]
// );
}
}
}
@@ -1,14 +1,10 @@
using System.IO;
using System.Reflection;
using System.Threading;
using Disk;
using log4net;
using log4net.Appender;
using log4net.Config;
using log4net.Layout;
using OpenMetaverse;
using Raindrop.Netcom;
using UnityEngine;
using UnityScripts.Disk;
using Logger = OpenMetaverse.Logger;
namespace Raindrop.Services.Bootstrap
@@ -19,19 +15,20 @@ namespace Raindrop.Services.Bootstrap
//Just attach this script as a component of the game manager. You don't need anything else, unless you want the UI.
public class RaindropBootstrapper : MonoBehaviour
{
//private RaindropInstance instance => ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>();
//private RaindropNetcom netcom => instance.Netcom;
private void Awake()
{
Start_Raindrop_CoreDependencies();
}
//create the gameobject that helps to create the filesystem
private static void Init_StaticFileSystem()
//perform check-copy operation.
private static void CheckAndUpdate_StaticFileSystem()
{
// start the startupCopier
var startupCopierObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
var startupCopier = startupCopierObj.AddComponent<CopyStreamingAssetsToPersistentDataPath>();
var copier = StaticFilesCopier.GetInstance();
var copy_result = copier.Work();
if (copy_result == -1)
{
Logger.Log("static files copier failed", Helpers.LogLevel.Error);
}
}
private static void SendStartupMessageToLogger()
@@ -46,9 +43,9 @@ namespace Raindrop.Services.Bootstrap
startupPrintLogger();
Assign_MainThreadReference();
Init_Globals();
Init_StaticFileSystem();
CheckAndUpdate_StaticFileSystem();
//0. start servicelocator pattern.
StartServiceLocator();
@@ -57,9 +54,9 @@ namespace Raindrop.Services.Bootstrap
CreateAndRegister_RaindropInstance();
}
private static void Assign_MainThreadReference()
private static void Init_Globals()
{
Globals.GMainThread = System.Threading.Thread.CurrentThread;
Globals.Init();
}
@@ -91,7 +88,13 @@ namespace Raindrop.Services.Bootstrap
}
void OnApplicationQuit()
public void OnApplicationQuit()
{
Quit_Application();
}
// globally- accessible quit method.
public void Quit_Application()
{
void SaveInventoryToDiskAndLogout(RaindropInstance raindropInstance, RaindropNetcom raindropNetcom)
{
@@ -119,9 +122,9 @@ namespace Raindrop.Services.Bootstrap
}
RaindropNetcom netcom = instance.Netcom;
OpenMetaverse.Logger.Log("Application ending after " + Time.time + " seconds"
, Helpers.LogLevel.Debug);
, Helpers.LogLevel.Debug);
// if (statusTimer != null)
// {
@@ -154,10 +157,10 @@ namespace Raindrop.Services.Bootstrap
// instance.UnregisterClientEvents(client);
// }
//if (instance?.Names != null)
//{
// instance.Names.NameUpdated -= new EventHandler<UUIDNameReplyEventArgs>(Names_NameUpdated);
//}
// if (instance?.Names != null)
// {
// instance.Names.NameUpdated -= new EventHandler<UUIDNameReplyEventArgs>(Names_NameUpdated);
// }
instance.CleanUp();
}
+19
View File
@@ -0,0 +1,19 @@
using System.Collections.Generic;
using Raindrop.Presenters;
using Raindrop.UI.LoadingScreen;
using UnityEngine;
namespace Raindrop.Services.Bootstrap
{
//this class is in the main scene, where you can give it references to monobehaviors in order to inject them.
// of course, runtime- created monobehaviors cannot be injected this way, so you will need to find some other way for those.
public class References : Singleton<References>
{
[SerializeField] public ModalsManager mm;
[SerializeField] public ScreenStackManager sm;
[SerializeField] public LoadingView ll;
[SerializeField] public ChatPresenter chatPresenter;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5b48e92542044be69b420df1069c800e
timeCreated: 1645448340
@@ -0,0 +1,50 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Raindrop.Services.Bootstrap
{
[CreateAssetMenu]
public class TextureCollection : ScriptableObject
{
public Texture2D[] Textures;
public int Count
{
get
{
if (Textures != null) return Textures.Length;
return 0;
}
}
public Texture2D Find( string searchFor, bool ignoreCase = true)
{
if (ignoreCase)
{
searchFor = searchFor.ToLower();
}
foreach( var m in Textures)
{
var n = m.name;
if (ignoreCase)
{
n = n.ToLower();
}
if (n == searchFor)
{
return m;
}
}
return null;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 032b469ffdd74491973e21c1868dd4a2
timeCreated: 1647105433
+27 -17
View File
@@ -4,21 +4,18 @@ using Raindrop.Map.Model;
using Raindrop.Netcom;
using Raindrop.Presenters;
using UnityEngine;
using UnityEngine.Serialization;
namespace Raindrop.Services.Bootstrap
{
// link all the UI together
// show the first UI panel to the user.
class UIBootstrapper : MonoBehaviour
{
private RaindropInstance instance => ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>();
private RaindropNetcom netcom => instance.Netcom;
[SerializeField] public ModalManager mm;
[SerializeField] public ScreensManager sm;
[SerializeField] public LoadingPresenter ll;
[FormerlySerializedAs("Injector")] [SerializeField] public References references;
[SerializeField] public int DelayMs;
// bootstraps the UI.
// 1. it first bootstraps the base layer of RaindropInstance
// 2. then it find all the canvasmanager and modal managers.
@@ -30,10 +27,17 @@ namespace Raindrop.Services.Bootstrap
{
RaindropBootstrapper.Start_Raindrop_CoreDependencies(); // hacky - to ensure that the UI's dependencies are ready.
OpenMetaverse.Logger.Log("UI variant of application Started. Logging Started.", OpenMetaverse.Helpers.LogLevel.Info);
InitialiseUIVariant();
}
// initialise the UI items
private void Start()
{
//Invoke("InitialiseUIVariant", DelayMs);
}
//warn: if this init method is called too early, there can be issues.
private void InitialiseUIVariant()
{
//1. mapfetcher - logic, not ui. please refactor
if (!ServiceLocator.ServiceLocator.Instance.IsRegistered<MapService>())
@@ -42,19 +46,25 @@ namespace Raindrop.Services.Bootstrap
}
//2. ui services
//getcomponent only can handle active objects.
// var cm = GetComponentInChildren<ScreensManager>();
if (sm == null)
if (references.sm == null)
Debug.LogError("ScreensManager not present");
// var mm = GetComponentInChildren<ModalManager>();
if (mm == null)
references.sm.Init();
if (references.mm == null)
Debug.LogError("ModalManager not present");
// var ll = GetComponentInChildren<LoadingCanvasPresenter>();
if (ll == null)
Debug.LogError("loadingscreen not present");
ServiceLocator.ServiceLocator.Instance.Register<UIService>(new UIService(sm, mm, ll));
}
references.mm.Init();
if (references.ll == null)
Debug.LogError("loadingscreen not present");
references.ll.Init();
ServiceLocator.ServiceLocator.Instance.Register<UIService>(new UIService(
references.sm,
references.mm,
references.ll,
references.chatPresenter));
//3. start the chat window right.
references.chatPresenter.Initialise();
}
}
}
@@ -0,0 +1,24 @@
using log4net.Appender;
using log4net.Core;
using UnityEngine;
public class UnityDebugAppender : AppenderSkeleton
{
protected override void Append(LoggingEvent loggingEvent)
{
var level = loggingEvent.Level;
if (level == Level.Warn)
{
Debug.LogWarning(RenderLoggingEvent(loggingEvent));
return;
}
if (level == Level.Error)
{
Debug.LogError(RenderLoggingEvent(loggingEvent));
return;
}
Debug.Log(RenderLoggingEvent(loggingEvent));
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f913c89d10eef774db3f83625383f86f
guid: ff1e974ffb940a94bb6e432a71ba5036
folderAsset: yes
DefaultImporter:
externalObjects: {}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a4804f9a0f80e3341ac117f8fc36fab6
guid: 719089d86832c8b44bcfa20559f12589
folderAsset: yes
DefaultImporter:
externalObjects: {}
@@ -126,6 +126,8 @@ public class JoystickCameraRelativeCharacterControl : MonoBehaviour
public void OnDrawGizmos()
{
Gizmos.DrawLine(player.transform.position ,player.transform.position + agent_DirectionOfMovement*100);
if (player){
Gizmos.DrawLine(player.transform.position ,player.transform.position + agent_DirectionOfMovement*100);
}
}
}
+284
View File
@@ -0,0 +1,284 @@
using System;
using System.Collections.Generic;
using OpenMetaverse;
using Raindrop.Services.Bootstrap;
namespace Raindrop
{
//belonging to raindropinstance, this class keeps track of known avatars and the region they are in.
// in particular, it tracks :
// region handle
//
public class AgentsTracker
{
//hashtable of agents, and the sim they are last known to reside in.
public readonly Dictionary<UUID, NearbyAvatar> agentInfos = new Dictionary<UUID, NearbyAvatar>();
private readonly RaindropInstance instance;
private GridClient client => instance.Client;
/// <summary>
/// List of nearby avatars (radar data)
/// </summary>
public List<NearbyAvatar> NearbyAvatars
{
get
{
List<NearbyAvatar> res = new List<NearbyAvatar>();
lock (agentInfos)
{
foreach (var kvPair in agentInfos)
{
res.Add(kvPair.Value);
}
}
return res;
}
}
public AgentsTracker(RaindropInstance instance)
{
this.instance = instance;
RegisterClientEvents(instance.Client);
}
private void RegisterClientEvents(GridClient client)
{
client.Grid.CoarseLocationUpdate += new EventHandler<CoarseLocationUpdateEventArgs>(Grid_CoarseLocationUpdate);
// client.Self.TeleportProgress += new EventHandler<TeleportEventArgs>(Self_TeleportProgress);
client.Network.SimDisconnected += new EventHandler<SimDisconnectedEventArgs>(Network_SimDisconnected);
}
#region eventHandlers
void Grid_CoarseLocationUpdate(object sender, CoarseLocationUpdateEventArgs e)
{
try
{
UpdateRadar(e);
}
catch { }
}
void UpdateRadar(CoarseLocationUpdateEventArgs e)
{
//guard: if the current sim is not known, we should not update the radar.
if (client.Network.CurrentSim == null /*|| client.Network.CurrentSim.Handle != sim.Handle*/)
{
return;
}
//guard: if we are on non-main thread, we should give this function call to the main thread.
if (!Globals.isOnMainThread())
{
UnityMainThreadDispatcher.Instance().Enqueue(() => {
UpdateRadar(e);
});
return;
}
// later on we can set this with something from the GUI
const double MAX_DISTANCE = 362.0; // one sim a corner to corner distance
lock (agentInfos)
try
{
Vector3d mypos = e.Simulator.AvatarPositions.ContainsKey(client.Self.AgentID)
? StateManager.ToVector3D(e.Simulator.Handle, e.Simulator.AvatarPositions[client.Self.AgentID])
: client.Self.GlobalPosition;
// CoarseLocationUpdate gives us height of 0 when actual height is
// between 1024-4096m.
if (mypos.Z < 0.1)
{
mypos.Z = client.Self.GlobalPosition.Z;
}
List<UUID> existing = new List<UUID>();
List<UUID> removed = new List<UUID>(e.RemovedEntries);
//1 for each avatar that is in the coarseupdate packet, if it is new to us, we start to track it.
e.Simulator.AvatarPositions.ForEach(delegate(KeyValuePair<UUID, Vector3> avi)
{
existing.Add(avi.Key);
//is avatar is new to us:
if (!agentInfos.ContainsKey(avi.Key))
{
// string name = instance.Names.Get(avi.Key);
// item.Tag = avi.Key;
agentInfos[avi.Key] = new NearbyAvatar()
{
//Distance = d, --will be set in the next lines...
ID = avi.Key,
Name = instance.Names.Get(avi.Key),
simHandle = e.Simulator.Handle
};
// e.Simulator.Handle;
}
});
//2 for each avatar that we are tracking,
// compute the distance-away and update it
foreach (var agentInfo in agentInfos)
{
UUID agentID = (UUID)agentInfo.Key;
if (agentInfos[agentID].simHandle != e.Simulator.Handle)
{
// not for this sim
continue;
}
if (agentID == client.Self.AgentID)
{
if (instance.Names.Mode != NameMode.Standard)
agentInfos[agentID].Name = instance.Names.Get(agentID);
continue;
}
//the AvatarPostions is checked once more because it changes wildly on its own
//even though the !existing should have been adequate
Vector3 agentPos;
if (!existing.Contains(agentID) || !e.Simulator.AvatarPositions.TryGetValue(agentID, out agentPos))
{
// not here anymore
removed.Add(agentID);
continue;
}
Avatar foundAvi = e.Simulator.ObjectsAvatars.Find(av => av.ID == agentID);
// fix: replace CoarseLocationUpdate's height with known, more accurate height. due to edge case.
// CoarseLocationUpdate gives us height of 0 when actual height is
// between 1024-4096m on OpenSim grids. 1020 on SL
bool unknownAltitude = instance.Netcom.LoginOptions.Grid.Platform == "SecondLife" ? agentPos.Z == 1020f : agentPos.Z == 0f;
if (unknownAltitude && (foundAvi != null))
{
ExtractAltitudeFromSimulatorModel(e, foundAvi, ref agentPos);
void ExtractAltitudeFromSimulatorModel(
CoarseLocationUpdateEventArgs _eventArg,
Avatar avatar,
ref Vector3 agentPos_reference)
{
if (avatar.HasNoParent())
{
agentPos_reference.Z = avatar.Position.Z;
}
else
{
if (_eventArg.Simulator.ObjectsPrimitives.ContainsKey(avatar.ParentID))
{
agentPos_reference.Z = _eventArg.Simulator.ObjectsPrimitives[avatar.ParentID].Position.Z;
}
}
return;
}
}
//distance calculation and updating:
Vector3d agentPos_Double = StateManager.ToVector3D(e.Simulator.Handle, agentPos);
int d = (int)Vector3d.Distance(
agentPos_Double,
mypos);
//guard clause:
if (IsTooFarAway(d))
{
removed.Add(agentID);
continue;
}
//finally, update the distance
NearbyAvatar avatarData = agentInfo.Value;
if (unknownAltitude)
{
avatarData.Distance = -1;
}
else
{
avatarData.Distance = d;
}
}
//3. removal of de-tracked avis.
foreach (UUID key in removed)
{
agentInfos.Remove(key);
}
}
catch (Exception ex)
{
Logger.Log("Grid_OnCoarseLocationUpdate: " + ex, Helpers.LogLevel.Error, client);
}
bool IsTooFarAway(int d)
{
return e.Simulator != client.Network.CurrentSim && d > MAX_DISTANCE;
}
}
private void Network_SimDisconnected(object sender, SimDisconnectedEventArgs e)
{
//when the sim is disconnected, avatars in that sim are no longer tracked.
try
{
if (!Globals.isOnMainThread())
{
UnityMainThreadDispatcher.Instance().Enqueue(() => {
Network_SimDisconnected(sender, e);
});
return;
}
lock (agentInfos)
{
var h = e.Simulator.Handle;
//1. create removal list.
List<UUID> remove = new List<UUID>();
foreach (var agentInfo in agentInfos)
{
var agentData = agentInfo.Value;
if (agentData.simHandle == h)
{
remove.Add(agentInfo.Key);
}
}
if (remove.Count == 0) return;
//2. use removal list to remove items from dictionary:
try
{
foreach (UUID key in remove)
{
agentInfos.Remove(key);
}
}
finally
{
}
}
}
catch (Exception ex)
{
Logger.DebugLog("Failed to update radar: " + ex);
}
}
#endregion
}
/// <summary>
/// Element of list of nearby avatars
/// </summary>
public class NearbyAvatar
{
public UUID ID { get; set; }
public ulong simHandle { get; set; }
public string Name { get; set; }
public int Distance { get; set; }
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8db4830319b747f89f2bb47e07d07bd9
timeCreated: 1647145694
+11 -3
View File
@@ -110,6 +110,10 @@ namespace Raindrop
}
}
/*
* Grid.xml manager + reader/writer class.
* user-accessible grids_custom.xml file replaces entries in the packaged grids.xml
*/
public class GridManager : IDisposable
{
public List<Grid> Grids;
@@ -165,10 +169,14 @@ namespace Raindrop
customGrids.Add(item);
}
var bytesToWrite = OSDParser.SerializeLLSDXmlBytes(customGrids);
// var bytesToWrite = OSDParser.SerializeLLSDXmlBytes(customGrids);
// string customGridsFile = Path.Combine(datadir, gridsFileCustom);
// DirectoryHelpers.WriteToFile(bytesToWrite, customGridsFile);
string customGridsFile = Path.Combine(datadir, gridsFileCustom);
DirectoryHelpers.WriteToFile(bytesToWrite, customGridsFile);
string toWrite = OSDParser.SerializeLLSDXmlString(customGrids);
DirectoryHelpers.WriteToFile(toWrite, customGridsFile);
}
catch (Exception ex)
{
+13 -13
View File
@@ -85,19 +85,19 @@ namespace Raindrop
s["password"] = string.Empty;
}
public static bool getRememberFromSettings (Settings settings)
{
Settings s = settings;
return (bool) s["remember_login"];
}
public static void setRememberToSettings(Settings settings, bool isRemember)
{
Settings s = settings;
settings["remember_login"] = isRemember;
}
//
// public static bool getRememberFromSettings (Settings settings)
// {
// Settings s = settings;
// return (bool) s["remember_login"];
//
// }
// public static void setRememberToSettings(Settings settings, bool isRemember)
// {
// Settings s = settings;
// settings["remember_login"] = isRemember;
//
// }
@@ -292,7 +292,6 @@ namespace Raindrop.Media
}
catch (Exception ex)
{
UnityEngine.Debug.LogError("Failed to initialize the sound system: ");
Logger.Log("Failed to initialize the sound system: " + ex, Helpers.LogLevel.Warning);
SoundSystemAvailable = false;
}
-8
View File
@@ -1,8 +0,0 @@
using UnityEngine;
namespace Raindrop
{
static public class Imaging
{
}
}
-3
View File
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 5e6d3f8d6dc14aa789dac461ba18717e
timeCreated: 1642595706
+9 -5
View File
@@ -66,14 +66,18 @@ namespace Raindrop.Utilities
UnityEngine.Vector3 agentInMapSpace = MapSpaceConverters.Handle2MapSpace(handle, 0);
Assert.IsTrue(agentInMapSpace.x > 0);
Assert.IsTrue(agentInMapSpace.y > 0);
Assert.IsTrue(agentInMapSpace.x < 65536);
Assert.IsTrue(agentInMapSpace.y < 65536);
Assert.IsFalse(PostionIsOOB(agentInMapSpace), "OOB: Present map-pos is : " + agentInMapSpace);
return agentInMapSpace;
}
private static bool PostionIsOOB(UE.Vector3 agentInMapSpace)
{
return ((agentInMapSpace.x < 0) ||
(agentInMapSpace.y < 0) ||
agentInMapSpace.x > 65536 ||
agentInMapSpace.y > 65536 );
}
#endregion
@@ -1,7 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// to make the sprites in map scene scale to same "absolute size", regardless of zoom level
public class SpriteSizeManager : MonoBehaviour
{
public SpriteRenderer sprite;
@@ -19,7 +18,5 @@ public class SpriteSizeManager : MonoBehaviour
var bounds = sprite.sprite.bounds;
var factor = targetHeight / bounds.size.y;
transform.localScale = new Vector3(factor, factor, factor);
}
}
+2 -4
View File
@@ -52,8 +52,7 @@ namespace Raindrop.Netcom
private bool teleporting = false;
private bool agreeToTos = false;
public bool AgreeToTos { get { return agreeToTos; } set { agreeToTos = value; } }
private Grid grid;
public Grid Grid { get { return grid; } }
public Grid Grid => loginOptions.Grid;
// NetcomSync is used for raising certain events on the
// GUI/main thread. Useful if you're modifying GUI controls
@@ -365,10 +364,9 @@ namespace Raindrop.Netcom
loginOptions.FirstName, loginOptions.LastName, password,
loginOptions.Channel, loginOptions.Version);
grid = loginOptions.Grid;
loginParams.Start = startLocation;
loginParams.AgreeToTos = AgreeToTos;
loginParams.URI = grid.LoginURI;
loginParams.URI = Grid.LoginURI;
loginParams.LastExecEvent = loginOptions.LastExecEvent;
client.Network.BeginLogin(loginParams);
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c1c3e3bb3935490a85e19279ec467afc
timeCreated: 1648124622
+71 -54
View File
@@ -1,34 +1,4 @@
//
// Radegast Metaverse Client
// Copyright (c) 2009-2014, Radegast Development Team
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the application "Radegast", nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// $Id$
//
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
@@ -40,6 +10,7 @@ using Raindrop.Media;
using Raindrop.UI.Notification;
using OpenMetaverse;
using Raindrop.ServiceLocator;
using UnityEditor;
using UnityEngine;
using Logger = OpenMetaverse.Logger;
@@ -54,18 +25,11 @@ namespace Raindrop
private RaindropNetcom _netcom;
private StateManager _state;
//private frmMain mainForm; //frmMain is a class that inherits RadegastForm. It seems to be the code-behind of the overall UI, that includes the view and buttons.
// Singleton, there can be only one instance
// managed the chats that are loaded in memory. (including local chat.)
public ChatManager ChatManger { get { return chatManger; } }
private ChatManager chatManger;
// public ChatManager ChatManger { get { return chatManger; } }
// private ChatManager chatManger;
/// <summary>
/// Manages retrieving avatar names
/// </summary>
@@ -261,7 +225,7 @@ namespace Raindrop
public RaindropInstance(GridClient client)
{
InitializeLoggingAndConfig();
InitializeLoggingAndConfigAndUserDirectory();
_client = client;
@@ -276,9 +240,6 @@ namespace Raindrop
Logger.Log("Mono runtime is detected. This should not happen except in the editor.", Helpers.LogLevel.Warning);
}
//Keyboard = new Keyboard();
//Application.AddMessageFilter(Keyboard);
_netcom = new RaindropNetcom(this);
_state = new StateManager(this);
MediaManager = new MediaManager(this);
@@ -295,7 +256,8 @@ namespace Raindrop
_names = new NameManager(this);
Cof = new CurrentOutfitFolder(this);
_agentsTracker = new AgentsTracker(this);
//ui_manager = new UIManager(this);
//mainCanvas.InitializeControls();
@@ -304,22 +266,68 @@ namespace Raindrop
//pluginManager = new PluginManager(this);
//pluginManager.ScanAndLoadPlugins();
//chatManger = new ChatManager(this);
// chatManger = new ChatManager(this);
}
private void InitializeClient(GridClient client)
{
string LightweightNetwork = "LightweightNetwork"; //i think this is like a only-retrieve simple data like chats mode.
bool isLightweightNetwork = false;
try
{
isLightweightNetwork = GlobalSettings[LightweightNetwork];
} catch (Exception ex)
{
Logger.Log("Failed loading Settings.LightweightNetwork: ", Helpers.LogLevel.Warning, client, ex);
GlobalSettings[LightweightNetwork] = isLightweightNetwork; //set some defaults so that next run may succeed.
}
string LightweightCPU = "LightweightCPU"; //i think this is like a no-render mode.
bool isLightweightCPU = false;
try
{
isLightweightCPU = GlobalSettings[LightweightCPU];
} catch (Exception ex)
{
Logger.Log("Failed loading Settings.LightweightCPU: ", Helpers.LogLevel.Warning, client, ex);
GlobalSettings[LightweightCPU] = isLightweightCPU; //set some defaults so that next run may succeed.
}
if (isLightweightNetwork)
{
client.Settings.ALWAYS_REQUEST_OBJECTS = false;
client.Settings.SEND_AGENT_UPDATES = false;
}
else
{
client.Settings.ALWAYS_REQUEST_OBJECTS = true;
client.Settings.SEND_AGENT_UPDATES = true;
}
if (isLightweightCPU)
{
client.Settings.STORE_LAND_PATCHES = false;
client.Settings.ALWAYS_DECODE_OBJECTS = false;
client.Settings.ENABLE_SIMSTATS = false;
}
else
{
client.Settings.STORE_LAND_PATCHES = true;
client.Settings.ALWAYS_DECODE_OBJECTS = true;
client.Settings.ENABLE_SIMSTATS = true;
}
client.Settings.MULTIPLE_SIMS = false;
client.Settings.USE_INTERPOLATION_TIMER = false;
client.Settings.ALWAYS_REQUEST_OBJECTS = true;
client.Settings.ALWAYS_DECODE_OBJECTS = true;
client.Settings.OBJECT_TRACKING = true;
client.Settings.ENABLE_SIMSTATS = true;
// client.Settings.FETCH_MISSING_INVENTORY = true;
client.Settings.SEND_AGENT_THROTTLE = true;
client.Settings.SEND_AGENT_UPDATES = true;
client.Settings.STORE_LAND_PATCHES = true;
client.Settings.USE_ASSET_CACHE = true;
client.Settings.ASSET_CACHE_DIR = Path.Combine(UserDir, "cache");
@@ -609,7 +617,7 @@ namespace Raindrop
}
// for simplicity, we will always use internal dir for settings.
private void InitializeLoggingAndConfig()
private void InitializeLoggingAndConfigAndUserDirectory()
{
try
{
@@ -626,6 +634,10 @@ namespace Raindrop
#if !UNITY_EDITOR
Application.Quit();
#endif
#if UNITY_EDITOR
EditorApplication.isPlaying = false;
#endif
};
_globalLogFile = Path.Combine(UserDir, _programname + ".log");
@@ -648,6 +660,11 @@ namespace Raindrop
get { return _state; }
}
public AgentsTracker AgentsTracker {
get { return _agentsTracker; }
}
private AgentsTracker _agentsTracker;
//public TabsConsole TabConsole
//{
// get { return mainForm.TabConsole; }
+2 -1
View File
@@ -15,7 +15,8 @@
"GUID:11f3455556175aa41b2b4d4f2ec8b146",
"GUID:75469ad4d38634e559750d17036d5f7c",
"GUID:a8cf6376c8aac1e43b688324ad3f22de",
"GUID:4307f53044263cf4b835bd812fc161a4"
"GUID:4307f53044263cf4b835bd812fc161a4",
"GUID:ac91f998f4b21304f8b880ec4b8c042c"
],
"includePlatforms": [],
"excludePlatforms": [],
+547
View File
@@ -0,0 +1,547 @@
using OpenMetaverse;
using Raindrop.Rendering;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using OpenMetaverse.Imaging;
using OpenMetaverse.Rendering;
using Raindrop.Render;
using Raindrop.Services.Bootstrap;
using UniRx.Toolkit;
using UE = UnityEngine ;
using UnityEngine ;
using UnityEngine.Serialization;
using Logger = OpenMetaverse.Logger;
using RenderSettings = Raindrop.Rendering.RenderSettings;
namespace Raindrop.Presenters
{
// subscribes to object-data events and delegates them to the various other rendering managers.
// - creates objects
// - gives these objects positions
// - gives these objects textures.
public class ObjectManager : MonoBehaviour
{
public bool RenderingEnabled { get; set; }
[FormerlySerializedAs("ObjectPrefab")] public GameObject PrimPrefab;
private object objectsLock = new object();
private Dictionary<uint, RenderPrimitive> Prims
= new Dictionary<uint, RenderPrimitive>(); //user UUID -> user gameobject
List<SceneObject> SortedObjects;
MeshmerizerR renderer => Globals.renderer;
delegate void GenericTask();
readonly ConcurrentQueue<GenericTask> PendingTasks = new ConcurrentQueue<GenericTask>();
private readonly SemaphoreSlim PendingTasksAvailable = new SemaphoreSlim(0);
private ObjectPool<RenderPrimitive> PrimPool;
// simple counter to prevent lag from too many meshings in a single frame.
private int meshingsRequestedThisFrame;
// a cache for decoded scuplties
Dictionary<UUID, Texture2D> sculptCache = new Dictionary<UUID, Texture2D>();
private RaindropInstance instance { get { return ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>(); } }
private GridClient Client { get { return instance?.Client; } }
bool Active => instance.Client.Network.Connected;
void Start()
{
instance.Client.Objects.ObjectUpdate += ObjectsOnObjectUpdate; //prims, foilage, attachments (for those that are static and we-just-saw-it)
instance.Client.Objects.TerseObjectUpdate += ObjectsOnTerseObjectUpdate; //prims, avatars (for those that move often and hap-hazardly)
}
private void Update()
{
//call main render loop
MainRenderLoop();
}
private void MainRenderLoop()
{
if (!RenderingEnabled) return;
MeshThePrimsAndItsChildren();
//what should we do?
//delegate to the other managers?
}
// do prims -> mesh conversion for some of them
private void MeshThePrimsAndItsChildren()
{
lock (Prims)
{
foreach (RenderPrimitive obj in Prims.Values)
{
//skip if not root.
if (obj.BasePrim.ParentID != 0) continue;
DoMeshIfRequired(obj);
//calculate and set rotations of children of this root object.
foreach (RenderPrimitive child_obj in Prims.Values)
{
DoMeshIfRequired(child_obj);
}
}
}
// generate mesh from the primitive.
void DoMeshIfRequired(RenderPrimitive obj)
{
if (!obj.Initialized) obj.Initialize();
//do mesh conversions if needed.
if (!obj.Meshed)
{
if (!obj.Meshing && meshingsRequestedThisFrame < RenderSettings.MeshesPerFrame)
{
meshingsRequestedThisFrame++;
MeshPrim(obj);
}
}
//early exit
if (obj.Faces == null) return;
obj.Attached = false;
//here is do avatar, but this class don't render avatars.
}
}
// generate the mesh for the prim using its data.
private void MeshPrim(RenderPrimitive rprim)
{
if (rprim.Meshing) return;
rprim.Meshing = true;
Primitive prim = rprim.BasePrim;
// Regular prim can go in main thread....
if (prim.Sculpt == null || prim.Sculpt.SculptTexture == UUID.Zero)
{
GenerateMeshPrim(rprim, prim);
}
// ..but mesh and sculptie needs to go in worker-thread
else
{
PendingTasks.Enqueue(GenerateSculptOrMeshPrim(rprim, prim));
PendingTasksAvailable.Release();
}
}
private void GenerateMeshPrim(RenderPrimitive rprim, Primitive prim)
{
DetailLevel detailLevel = RenderSettings.PrimRenderDetail;
if (RenderSettings.AllowQuickAndDirtyMeshing)
{
//Its a box or something else that can use lower meshing
if (prim.Flexible == null && prim.Type == PrimType.Box &&
prim.PrimData.ProfileHollow == 0 &&
prim.PrimData.PathTwist == 0 &&
prim.PrimData.PathTaperX == 0 &&
prim.PrimData.PathTaperY == 0 &&
prim.PrimData.PathSkew == 0 &&
prim.PrimData.PathShearX == 0 &&
prim.PrimData.PathShearY == 0 &&
prim.PrimData.PathRevolutions == 1 &&
prim.PrimData.PathRadiusOffset == 0)
detailLevel = DetailLevel.Low;
}
FacetedMesh mesh = renderer.GenerateFacetedMesh(prim, detailLevel);
rprim.Faces = mesh.Faces;
PrimGen.CalculateBoundingBox(rprim);
rprim.Meshing = false;
rprim.Meshed = true;
}
// an sync way to generate mesh. used for more complex prims and all sculpties.
private GenericTask GenerateSculptOrMeshPrim(RenderPrimitive rprim, Primitive prim)
{
return () =>
{
FacetedMesh mesh = null;
try
{
if (prim.Sculpt.Type != SculptType.Mesh)
{ // Regular sculptie ...
Texture2D img = null;
lock (sculptCache)
{
if (sculptCache.ContainsKey(prim.Sculpt.SculptTexture))
{
img = sculptCache[prim.Sculpt.SculptTexture];
}
}
if (img == null)
{
if (LoadTexture(prim.Sculpt.SculptTexture, ref img, true))
{
sculptCache[prim.Sculpt.SculptTexture] = (Texture2D)img;
}
else
{
return;
}
}
mesh = renderer.GenerateFacetedSculptMesh(prim, (Texture2D)img, RenderSettings.SculptRenderDetail);
}
else
{ // ... or Mesh
AutoResetEvent gotMesh = new AutoResetEvent(false);
Client.Assets.RequestMesh(prim.Sculpt.SculptTexture, (success, meshAsset) =>
{
if (!success || !FacetedMesh.TryDecodeFromAsset(prim, meshAsset, RenderSettings.MeshRenderDetail, out mesh))
{
Logger.Log("Failed to fetch or decode the mesh asset", Helpers.LogLevel.Warning, Client);
}
gotMesh.Set();
});
gotMesh.WaitOne(20 * 1000, false);
}
}
catch
{ }
if (mesh != null)
{
rprim.Faces = mesh.Faces;
PrimGen.CalculateBoundingBox(rprim);
rprim.Meshing = false;
rprim.Meshed = true;
}
else
{
lock (Prims)
{
Prims.Remove(rprim.BasePrim.LocalID);
}
}
};
}
private void ObjectsOnTerseObjectUpdate(object sender, TerseObjectUpdateEventArgs e)
{
if (e.Simulator != instance.Client.Network.CurrentSim)
return;
//ignore avatars.
if (e.Prim.PrimData.PCode == PCode.Avatar)
return;
UpdatePrim_QueueToMainThread(e.Prim);
}
private void ObjectsOnObjectUpdate(object sender, PrimEventArgs e)
{
if (e.Simulator.Handle != instance.Client.Network.CurrentSim.Handle)
return;
if (e.IsAttachment)
return;
UpdatePrim_QueueToMainThread(e.Prim);
}
// using the event's prim data, update the prims involved.
// queued on the main thread, as we will be using Unity APIs
public void UpdatePrim_QueueToMainThread(Primitive prim)
{
if (!RenderingEnabled) return;
if (Globals.isOnMainThread())
{
//work.
UpdatePrim(prim);
} else
{
UnityMainThreadDispatcher.Instance().Enqueue(() =>
{
UpdatePrim_QueueToMainThread(prim);
});
}
void UpdatePrim(Primitive primitive)
{
//create and insert prim's data into the hashtable.
switch (primitive.PrimData.PCode)
{
case PCode.Avatar:
//ignore avatars.
return;
case PCode.Prim:
if (primitive.Textures == null) return;
RenderPrimitive rPrim;
if (Prims.TryGetValue(primitive.LocalID, out rPrim))
{
rPrim.AttachedStateKnown = false;
}
else
{
rPrim = PrimPool.Rent();
//give the prim its default, uninitialised properties
rPrim.Meshed = false;
rPrim.BoundingVolume = new BoundingVolume();
rPrim.BoundingVolume.FromScale(primitive.Scale);
}
rPrim.BasePrim = primitive;
//locking is important, as the current code may be executing on the non-main thread where the network callback occur.
lock (Prims) Prims[primitive.LocalID] = rPrim;
break;
case PCode.ParticleSystem:
// todo
default:
// unimplemented foliage
break;
}
//render the prims data on the main thread.
// note: looks like there is no need to run this on main thread, as we can just lock it (exclusive section).
lock (objectsLock)
{
RenderPrimitive obj;
Prims.TryGetValue(primitive.LocalID, out obj);
if (obj != null)
{
SetPrimTransforms_RequiresOnMainThread(primitive, obj.gameObject);
}
else
{
RezNewObject_RequiresOnMainThread(primitive, out obj);
Prims[primitive.LocalID] = obj;
SetPrimTransforms_RequiresOnMainThread(primitive, obj.gameObject);
}
}
}
}
// rez, position and rot is at zero.
// warn: MUST be run by main thread.
private void RezNewObject_RequiresOnMainThread(Primitive e, out RenderPrimitive newObj)
{
if (Thread.CurrentThread != Globals.GMainThread)
{
Debug.LogError("thou must run RezNewObject_RequiresOnMainThread on main thread..");
newObj = null;
return;
}
if (e == null)
{
Debug.LogError("null e in RezNewObject_RequiresOnMainThread" + this.ToString());
}
RezNewObject(e, out newObj);;
// Debug.LogError("fixme");
// Transform parent = this.gameObject.transform;
// newObj = Instantiate(PrimPrefab, UE.Vector3.zero, UE.Quaternion.identity, parent);
// GameObject go = new GameObject();
// if (Globals.isOnMainThread())
// {
// RezNewObject(e, out newObj);
//
// } else
// {
// UnityMainThreadDispatcher.Instance().Enqueue(() =>
// {
// RezNewObject_RequiresOnMainThread(e, newObj);
// });
// }
// return;
}
//make sure to run this only on Main thread.
private void RezNewObject(Primitive e, out RenderPrimitive rp)
{
if (e.Text != "" || e.Text != null)
{
// Debug.Log("prim has no props. " + e.Prim.ID); //this is for most prims.
}
else if (e.Properties.Name == null)
{
Debug.Log("prim has property, but no name . " + e.ID); //i have never seen this before.
}
var go = CreatePrimGameObject(e);
//get the controller class on this obj:
rp = go.GetComponent<RenderPrimitive>();
if (rp == null)
{
Debug.LogError("wtf why prim prefab has no RenderPrimitive script?");
}
//objects[e.ID] = primGO;
//return primGO;
return;
}
// sets object position on the main thread.
// WARN: MUST be run on main thread
private static void SetPrimTransforms_RequiresOnMainThread(Primitive prim, GameObject GO_ToSet)
{
//it might be possible that the object is removed at this point. handle it.
if (GO_ToSet == null)
{
return; //object is already removed from scene.
}
if (Thread.CurrentThread != Globals.GMainThread)
{
Debug.LogError("thou shalt not run SetPrimTransforms_RequiresOnMainThread on main thread..");
return;
}
// UnityMainThreadDispatcher.Instance().Enqueue(() => {
UE.Vector3 pos = RHelp.TKVector3(prim.Position);
GO_ToSet.transform.position = pos;
UE.Quaternion rot = RHelp.TKQuaternion4(prim.Rotation);
GO_ToSet.transform.rotation = rot;
// });
}
//make the agent:
// mesh it
// nametag - todo: remove me.
// scaling
// position
// rotation
private GameObject CreatePrimGameObject(Primitive ePrim)
{
string objname;
if (ePrim.Properties == null)
{
objname = "";
}
else
{
objname = ePrim.Properties.Name;
}
UUID uuid = ePrim.ID;
GameObject go = Instantiate(PrimPrefab, this.transform);
UE.Vector3 objScale = RHelp.TKVector3(ePrim.Scale);
go.transform.localScale = objScale;
UE.Vector3 objPos = RHelp.TKVector3(ePrim.Position);
go.transform.position = objPos;
UE.Quaternion objRot = RHelp.TKQuaternion4(ePrim.Rotation);
go.transform.rotation = objRot;
go.name = uuid.ToString();
return go;
}
// a function that loads textures from the various possible places it can be from.
// in order of priority:
// 1. TGA cache (decoded texture on disk ; if enabled in Rendersettings)
// 2. Asset cache of OMV
// 3. network
private bool LoadTexture(UUID textureID, ref Texture2D texture, bool removeAlpha)
{
ManualResetEvent gotImage = new ManualResetEvent(false);
Texture2D img = null;
try
{
gotImage.Reset();
bool hasAlpha, fullAlpha, isMask;
byte[] tgaData;
if (RHelp.LoadCachedImage(textureID, out tgaData, out hasAlpha, out fullAlpha, out isMask))
{
img = LoadTGAClass.LoadTGA(new MemoryStream(tgaData));
}
else
{
instance.Client.Assets.RequestImage(textureID, (state, assetTexture) =>
{
if (state == TextureRequestState.Finished)
{
lock (img)
{
img = TexturePool.Get(TextureFormat.RGB24);
T2D.LoadT2DWithoutMipMaps(assetTexture.AssetData, img); //blocking.
try
{
// remove alpha (required for scuplty)
// ManagedImage mi = new ManagedImage(reader.DecodeToBitmap());
// if (removeAlpha)
// {
// if ((mi.Channels & ManagedImage.ImageChannels.Alpha) != 0)
// {
// mi.ConvertChannels(mi.Channels &
// ~ManagedImage.ImageChannels.Alpha);
// }
// }
//todo: caching of decoded texture.
// tgaData = mi.ExportTGA();
// img = LoadTGAClass.LoadTGA(new MemoryStream(tgaData));
// RHelp.SaveCachedImage(tgaData, textureID,
// (mi.Channels & ManagedImage.ImageChannels.Alpha) != 0, false,
// false);
}
catch (Exception)
{
Logger.Log("Failed to decode texture " + assetTexture.AssetID,
Helpers.LogLevel.Warning, instance.Client);
}
}
}
gotImage.Set();
}
);
gotImage.WaitOne(30 * 1000, false);
}
if (img != null)
{
texture = img;
return true;
}
return false;
}
catch (Exception e)
{
Logger.Log(e.Message, Helpers.LogLevel.Error, instance.Client, e);
return false;
}
}
}
}
+144
View File
@@ -0,0 +1,144 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &697190485811209644
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 697190485811209641}
- component: {fileID: 697190485811209646}
- component: {fileID: 697190485811209647}
- component: {fileID: 697190485811209640}
- component: {fileID: 697190485811209643}
m_Layer: 0
m_Name: Prim
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &697190485811209641
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 697190485811209644}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &697190485811209646
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 697190485811209644}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8dcd2942ba7a85946a37e9269f5df10c, type: 3}
m_Name:
m_EditorClassIdentifier:
InterpolatedPosition:
X: 0
Y: 0
Z: 0
InterpolatedRotation:
X: 0
Y: 0
Z: 0
W: 0
RenderPosition:
X: 0
Y: 0
Z: 0
RenderRotation:
X: 0
Y: 0
Z: 0
W: 0
DistanceSquared: 0
PositionCalculated: 0
Type: 1
Initialized: 0
IsDisposed: 0
AlphaQueryID: -1
SimpleQueryID: -1
HasAlphaFaces: 0
HasSimpleFaces: 0
HasInvisibleFaces: 0
Attached: 0
AttachedStateKnown: 0
Meshed: 0
Meshing: 0
--- !u!114 &697190485811209647
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 697190485811209644}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bcde33ff241848041a3f6518e96a445b, type: 3}
m_Name:
m_EditorClassIdentifier:
renderer: {fileID: 697190485811209640}
isReady: 0
isMapTile: 0
--- !u!23 &697190485811209640
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 697190485811209644}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &697190485811209643
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 697190485811209644}
m_Mesh: {fileID: 0}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e382a0696c76ef743871e0e752a894eb
guid: 64452e6dbd873ee488ebc4bef9be3820
PrefabImporter:
externalObjects: {}
userData:
+56
View File
@@ -0,0 +1,56 @@
using OpenMetaverse;
using OpenMetaverse.Rendering;
using Raindrop.Rendering;
namespace Raindrop.Render
{
public class PrimGen
{
static MeshmerizerR renderer;
public static void CalculateBoundingBox(RenderPrimitive rprim)
{
Primitive prim = rprim.BasePrim;
// Calculate bounding volumes for each prim and adjust textures
rprim.BoundingVolume = new BoundingVolume();
for (int j = 0; j < rprim.Faces.Count; j++)
{
Primitive.TextureEntryFace teFace = prim.Textures.GetFace((uint)j);
if (teFace == null) continue;
Face face = rprim.Faces[j];
FaceData data = new FaceData();
data.BoundingVolume.CreateBoundingVolume(face, prim.Scale);
rprim.BoundingVolume.AddVolume(data.BoundingVolume, prim.Scale);
// With linear texture animation in effect, texture repeats and offset are ignored
if ((prim.TextureAnim.Flags & Primitive.TextureAnimMode.ANIM_ON) != 0
&& (prim.TextureAnim.Flags & Primitive.TextureAnimMode.ROTATE) == 0
&& (prim.TextureAnim.Face == 255 || prim.TextureAnim.Face == j))
{
teFace.RepeatU = 1;
teFace.RepeatV = 1;
teFace.OffsetU = 0;
teFace.OffsetV = 0;
}
// Sculpt UV vertically flipped compared to prims. Flip back
if (prim.Sculpt != null && prim.Sculpt.SculptTexture != UUID.Zero && prim.Sculpt.Type != SculptType.Mesh)
{
teFace = (Primitive.TextureEntryFace)teFace.Clone();
teFace.RepeatV *= -1;
}
// Texture transform for this face
renderer.TransformTexCoords(face.Vertices, face.Center, teFace, prim.Scale);
// Set the UserData for this face to our FaceData struct
face.UserData = data;
rprim.Faces[j] = face;
}
}
}
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4f5b833109dd4c50bb63bcbe52d36c1e
timeCreated: 1648222803
@@ -1,177 +0,0 @@
////
//// Radegast Metaverse Client
//// Copyright (c) 2009-2014, Radegast Development Team
//// All rights reserved.
////
//// Redistribution and use in source and binary forms, with or without
//// modification, are permitted provided that the following conditions are met:
////
//// * Redistributions of source code must retain the above copyright notice,
//// this list of conditions and the following disclaimer.
//// * Redistributions in binary form must reproduce the above copyright
//// notice, this list of conditions and the following disclaimer in the
//// documentation and/or other materials provided with the distribution.
//// * Neither the name of the application "Radegast", nor the names of its
//// contributors may be used to endorse or promote products derived from
//// this software without specific prior written permission.
////
//// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
//// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
//// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
//// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
//// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
//// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
//// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
//// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
//// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
//// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
////
//// $Id$
////
//using OpenMetaverse;
//using System.Collections.Generic;
//using UnityEngine;
//using Raindrop.Rendering;
//using Raindrop.Render;
//using System.Threading;
//using OpenMetaverse.Rendering;
//namespace Raindrop
//{
// //I render stuff into the unity scene!
// public class RaindropUnitySceneRenderer: MonoBehaviour
// {
// RaindropInstance Instance;
// GridClient Client => Instance.Client;
// Simulator sim => Instance.Client.Network.CurrentSim;
// public bool Modified = true;
// float[,] heightTable = new float[256, 256];
// Face terrainFace;
// uint[] terrainIndices;
// ColorVertex[] terrainVertices;
// bool terrainInProgress = false;
// bool terrainTextureNeedsUpdate = false;
// float terrainTimeSinceUpdate = Rendering.RenderSettings.MinimumTimeBetweenTerrainUpdated + 1f; // Update terrain om first run
// bool fetchingTerrainTexture = false;
// Texture2D terrainImage = null;
// MeshmerizerR meshrenderer;
// private GameObject land;
// private GameObject Avatar;
// private List<GameObject> SimAvatarList;
// public RaindropUnitySceneRenderer()
// {
// //terrainImage = new Texture2D(1024,1024);
// //terrainImage.hideFlags = HideFlags.HideAndDontSave;
// terrainImage = TempImageManager.CreateTexture2D(1024, 1024);
// }
// public void ResetTerrain()
// {
// ResetTerrain(true);
// }
// public void ResetTerrain(bool removeImage)
// {
// if (terrainImage != null)
// {
// TempImageManager.Destroy(terrainImage);
// //RenderedTextureManager.dispose();
// //terrainImage.Dispose();
// terrainImage = null;
// }
// fetchingTerrainTexture = false;
// Modified = true;
// }
// private void UpdateTerrain()
// {
// if (sim == null || sim.Terrain == null) return;
// ThreadPool.QueueUserWorkItem(sync =>
// {
// int step = 1;
// for (int x = 0; x < 256; x += step)
// {
// for (int y = 0; y < 256; y += step)
// {
// float z = 0;
// int patchNr = ((int)x / 16) * 16 + (int)y / 16;
// if (sim.Terrain[patchNr] != null
// && sim.Terrain[patchNr].Data != null)
// {
// float[] data = sim.Terrain[patchNr].Data;
// z = data[(int)x % 16 * 16 + (int)y % 16];
// }
// heightTable[x, y] = z;
// }
// }
// terrainFace = meshrenderer.TerrainMesh(heightTable, 0f, 255f, 0f, 255f);
// terrainVertices = new ColorVertex[terrainFace.Vertices.Count];
// for (int i = 0; i < terrainFace.Vertices.Count; i++)
// {
// byte[] part = Utils.IntToBytes(i);
// terrainVertices[i] = new ColorVertex()
// {
// Vertex = terrainFace.Vertices[i],
// Color = new Color4b()
// {
// R = part[0],
// G = part[1],
// B = part[2],
// A = 253 // terrain picking
// }
// };
// }
// terrainIndices = new uint[terrainFace.Indices.Count];
// for (int i = 0; i < terrainIndices.Length; i++)
// {
// terrainIndices[i] = terrainFace.Indices[i];
// }
// terrainInProgress = false;
// Modified = false;
// terrainTextureNeedsUpdate = true;
// terrainTimeSinceUpdate = 0f;
// });
// }
// void UpdateTerrainTexture()
// {
// if (!fetchingTerrainTexture)
// {
// fetchingTerrainTexture = true;
// ThreadPool.QueueUserWorkItem(sync =>
// {
// Simulator sim = Client.Network.CurrentSim;
// terrainImage = TerrainSplat.Splat(Instance, heightTable,
// new UUID[] { sim.TerrainDetail0, sim.TerrainDetail1, sim.TerrainDetail2, sim.TerrainDetail3 },
// new float[] { sim.TerrainStartHeight00, sim.TerrainStartHeight01, sim.TerrainStartHeight10, sim.TerrainStartHeight11 },
// new float[] { sim.TerrainHeightRange00, sim.TerrainHeightRange01, sim.TerrainHeightRange10, sim.TerrainHeightRange11 });
// fetchingTerrainTexture = false;
// terrainTextureNeedsUpdate = false;
// });
// }
// }
// }
//}
+199 -217
View File
@@ -1,24 +1,4 @@
/**
* Radegast Metaverse Client
* Copyright(c) 2009-2014, Radegast Development Team
* Copyright(c) 2016-2020, Sjofn, LLC
* All rights reserved.
*
* Radegast is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program.If not, see<https://www.gnu.org/licenses/>.
*/
using System;
using System;
using System.Collections.Generic;
//using OpenTK.Graphics.OpenGL;
using OpenMetaverse;
@@ -71,202 +51,12 @@ namespace Raindrop.Rendering
/// Perform texture manipulation to implement texture animations
/// </summary>
/// <param name="lastFrameTime">Time passed since the last run (in seconds)</param>
//public void Step(float lastFrameTime)
//{
// float numFrames = 1f;
// float fullLength = 1f;
// if (PrimAnimInfo.Length > 0)
// {
// numFrames = PrimAnimInfo.Length;
// }
// else
// {
// numFrames = Math.Max(1f, (float)(PrimAnimInfo.SizeX * PrimAnimInfo.SizeY));
// }
// if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.PING_PONG) != 0)
// {
// if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.SMOOTH) != 0)
// {
// fullLength = 2f * numFrames;
// }
// else if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.LOOP) != 0)
// {
// fullLength = 2f * numFrames - 2f;
// fullLength = Math.Max(1f, fullLength);
// }
// else
// {
// fullLength = 2f * numFrames - 1f;
// fullLength = Math.Max(1f, fullLength);
// }
// }
// else
// {
// fullLength = numFrames;
// }
// float frameCounter;
// if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.SMOOTH) != 0)
// {
// frameCounter = lastFrameTime * PrimAnimInfo.Rate + LastTime;
// }
// else
// {
// TotalTime += lastFrameTime;
// frameCounter = TotalTime * PrimAnimInfo.Rate;
// }
// LastTime = frameCounter;
// if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.LOOP) != 0)
// {
// frameCounter %= fullLength;
// }
// else
// {
// frameCounter = Math.Min(fullLength - 1f, frameCounter);
// }
// if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.SMOOTH) == 0)
// {
// frameCounter = (float)Math.Floor(frameCounter + 0.01f);
// }
// if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.PING_PONG) != 0)
// {
// if (frameCounter > numFrames)
// {
// if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.SMOOTH) != 0)
// {
// frameCounter = numFrames - (frameCounter - numFrames);
// }
// else
// {
// frameCounter = (numFrames - 1.99f) - (frameCounter - numFrames);
// }
// }
// }
// if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.REVERSE) != 0)
// {
// if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.SMOOTH) != 0)
// {
// frameCounter = numFrames - frameCounter;
// }
// else
// {
// frameCounter = (numFrames - 0.99f) - frameCounter;
// }
// }
// frameCounter += PrimAnimInfo.Start;
// if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.SMOOTH) == 0)
// {
// frameCounter = (float)Math.Round(frameCounter);
// }
// GL.MatrixMode(MatrixMode.Texture);
// GL.LoadIdentity();
// if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.ROTATE) != 0)
// {
// //GL.Translate(0.5f, 0.5f, 0f);
// GL.Rotate(Utils.RAD_TO_DEG * frameCounter, OpenTK.Vector3d.UnitZ);
// //GL.Translate(-0.5f, -0.5f, 0f);
// }
// else if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.SCALE) != 0)
// {
// GL.Scale(frameCounter, frameCounter, 0);
// }
// else // Translate
// {
// float sizeX = Math.Max(1f, (float)PrimAnimInfo.SizeX);
// float sizeY = Math.Max(1f, (float)PrimAnimInfo.SizeY);
// GL.Scale(1f / sizeX, 1f / sizeY, 0);
// GL.Translate(frameCounter % sizeX, Math.Floor(frameCounter / sizeY), 0);
// }
// GL.MatrixMode(MatrixMode.Modelview);
//}
//[Obsolete("Use Step() instead")]
//public void ExperimentalStep(float time)
//{
// int reverseFactor = 1;
// float rate = PrimAnimInfo.Rate;
// if (rate < 0)
// {
// rate = -rate;
// reverseFactor = -reverseFactor;
// }
// if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.REVERSE) != 0)
// {
// reverseFactor = -reverseFactor;
// }
// CurrentTime += time;
// float totalTime = 1 / rate;
// uint x = Math.Max(1, PrimAnimInfo.SizeX);
// uint y = Math.Max(1, PrimAnimInfo.SizeY);
// uint nrFrames = x * y;
// if (PrimAnimInfo.Length > 0 && PrimAnimInfo.Length < nrFrames)
// {
// nrFrames = (uint)PrimAnimInfo.Length;
// }
// GL.MatrixMode(MatrixMode.Texture);
// GL.LoadIdentity();
// if (CurrentTime >= totalTime)
// {
// CurrentTime = 0;
// CurrentFrame++;
// if (CurrentFrame > nrFrames) CurrentFrame = (uint)PrimAnimInfo.Start;
// if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.PING_PONG) != 0)
// {
// PingPong = !PingPong;
// }
// }
// float smoothOffset = 0f;
// if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.SMOOTH) != 0)
// {
// smoothOffset = (CurrentTime / totalTime) * reverseFactor;
// }
// float f = CurrentFrame;
// if (reverseFactor < 0)
// {
// f = nrFrames - CurrentFrame;
// }
// if ((PrimAnimInfo.Flags & Primitive.TextureAnimMode.ROTATE) == 0) // not rotating
// {
// GL.Scale(1f / x, 1f / y, 0f);
// GL.Translate((f % x) + smoothOffset, f / y, 0);
// }
// else
// {
// smoothOffset = (CurrentTime * PrimAnimInfo.Rate);
// float startAngle = PrimAnimInfo.Start;
// float endAngle = PrimAnimInfo.Length;
// float angle = startAngle + (endAngle - startAngle) * smoothOffset;
// GL.Translate(0.5f, 0.5f, 0f);
// GL.Rotate(Utils.RAD_TO_DEG * angle, OpenTK.Vector3d.UnitZ);
// GL.Translate(-0.5f, -0.5f, 0f);
// }
// GL.MatrixMode(MatrixMode.Modelview);
//}
public void Step(float lastFrameTime)
{
//todo: animation of textures.
}
}
@@ -373,6 +163,198 @@ namespace Raindrop.Rendering
base.Initialize();
}
/// Render Primitive
/// update the state in this view.
public void Render()
{
throw new NotImplementedException();
// //filter out attached objects if not rendering people
// if (!RenderSettings.AvatarRenderingEnabled && Attached) return;
//
// // Prim rotation and position and scale
// GameObject_SetPosition(Prim.Scale, RenderPosition);
// GameObject_SetPosition(Prim.Scale, RenderRotation);
//
// // Do we have animated texture on this face
// bool animatedTexture = false;
//
// // Initialise flags tracking what type of faces this prim has
// if (pass == RenderPass.Simple)
// {
// HasSimpleFaces = false;
// }
// else if (pass == RenderPass.Alpha)
// {
// HasAlphaFaces = false;
//
//
// }
// else if (pass == RenderPass.Invisible)
// {
// HasInvisibleFaces = false;
//
//
// if (!data.TextureInfo.IsInvisible) return animatedTexture;
// HasInvisibleFaces = true;
//
// }
//
// // Draw the prim faces
// for (int j = 0; j < Faces.Count; j++)
// {
// animatedTexture = DrawPrim(j);
// }
//
// RHelp.ResetMaterial();
//
//
// unsafe bool DrawPrim(int j)
// {
// Primitive.TextureEntryFace teFace = Prim.Textures.GetFace((uint) j);
// Face face = Faces[j];
// FaceData data = (FaceData) face.UserData;
//
// if (data == null)
// return animatedTexture;
//
// if (teFace == null)
// return animatedTexture;
//
// // Don't render transparent faces
// Color4 RGBA = teFace.RGBA;
//
// if (data.TextureInfo.FullAlpha || RGBA.A <= 0.01f) return animatedTexture;
//
// if
// {
// if (data.TextureInfo.IsInvisible) return animatedTexture;
// bool belongToAlphaPass = (RGBA.A < 0.99f) || (data.TextureInfo.HasAlpha && !data.TextureInfo.IsMask);
//
// if (belongToAlphaPass && pass != RenderPass.Alpha) return animatedTexture;
// if (!belongToAlphaPass && pass == RenderPass.Alpha) return animatedTexture;
//
// if (pass == RenderPass.Simple)
// {
// HasSimpleFaces = true;
// }
// else if (pass == RenderPass.Alpha)
// {
// HasAlphaFaces = true;
// }
//
//
// float shiny = 0f;
// switch (teFace.Shiny)
// {
// case Shininess.High:
// shiny = 0.96f;
// break;
//
// case Shininess.Medium:
// shiny = 0.64f;
// break;
//
// case Shininess.Low:
// shiny = 0.24f;
// break;
// }
//
// if (shiny > 0f)
// {
// scene.StartShiny();
// }
//
// GL.Material(MaterialFace.Front, MaterialParameter.Shininess, shiny);
// var faceColor = new float[] {RGBA.R, RGBA.G, RGBA.B, RGBA.A};
// GL.Color4(faceColor);
//
// GL.Material(MaterialFace.Front, MaterialParameter.Specular, new float[] {0.5f, 0.5f, 0.5f, 1f});
//
// if (data.TextureInfo.TexturePointer == 0)
// {
// TextureInfo teInfo;
// if (scene.TryGetTextureInfo(teFace.TextureID, out teInfo))
// {
// data.TextureInfo = teInfo;
// }
// }
//
// if (data.TextureInfo.TexturePointer == 0)
// {
//
// if (!data.TextureInfo.FetchFailed)
// {
// scene.DownloadTexture(new TextureLoadItem()
// {
// Prim = Prim,
// TeFace = teFace,
// Data = data
// }, false);
// }
// }
// else
// {
// // Is this face using texture animation
// if ((Prim.TextureAnim.Flags & Primitive.TextureAnimMode.ANIM_ON) != 0
// && (Prim.TextureAnim.Face == j || Prim.TextureAnim.Face == 255))
// {
// if (data.AnimInfo == null)
// {
// data.AnimInfo = new TextureAnimationInfo();
// }
//
// data.AnimInfo.PrimAnimInfo = Prim.TextureAnim;
// data.AnimInfo.Step(time);
// animatedTexture = true;
// }
//
// data.AnimInfo = null;
//
// GL.Enable(EnableCap.Texture2D);
// GL.BindTexture(TextureTarget.Texture2D, data.TextureInfo.TexturePointer);
// }
// }
//
// if (!RenderSettings.UseVBO || data.VBOFailed)
// {
// Vertex[] verts = face.Vertices.ToArray();
// ushort[] indices = face.Indices.ToArray();
//
// unsafe
// {
// fixed (float* normalPtr = &verts[0].Normal.X)
// fixed (float* texPtr = &verts[0].TexCoord.X)
// {
// GL.NormalPointer(NormalPointerType.Float, FaceData.VertexSize, (IntPtr) normalPtr);
// GL.TexCoordPointer(2, TexCoordPointerType.Float, FaceData.VertexSize, (IntPtr) texPtr);
// GL.VertexPointer(3, VertexPointerType.Float, FaceData.VertexSize, verts);
// GL.DrawElements(PrimitiveType.Triangles, indices.Length, DrawElementsType.UnsignedShort, indices);
// }
// }
// }
// else
// {
// if (data.CheckVBO(face))
// {
// Compat.BindBuffer(BufferTarget.ArrayBuffer, data.VertexVBO);
// Compat.BindBuffer(BufferTarget.ElementArrayBuffer, data.IndexVBO);
// GL.NormalPointer(NormalPointerType.Float, FaceData.VertexSize, (IntPtr) 12);
// GL.TexCoordPointer(2, TexCoordPointerType.Float, FaceData.VertexSize, (IntPtr) (24));
// GL.VertexPointer(3, VertexPointerType.Float, FaceData.VertexSize, (IntPtr) (0));
//
// GL.DrawElements(PrimitiveType.Triangles, face.Indices.Count, DrawElementsType.UnsignedShort, IntPtr.Zero);
// }
//
// Compat.BindBuffer(BufferTarget.ArrayBuffer, 0);
// Compat.BindBuffer(BufferTarget.ElementArrayBuffer, 0);
// }
//
// return animatedTexture;
// }
}
/// <summary>
/// String representation of the object
+17 -36
View File
@@ -1,32 +1,10 @@
/**
* Radegast Metaverse Client
* Copyright(c) 2009-2014, Radegast Development Team
* Copyright(c) 2016-2020, Sjofn, LLC
* All rights reserved.
*
* Radegast is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program.If not, see<https://www.gnu.org/licenses/>.
*/
using System;
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.IO.Compression;
//using OpenTK.Graphics.OpenGL;
using System.Runtime.InteropServices;
using System.Drawing;
using System.Drawing.Imaging;
using OpenMetaverse;
using OpenMetaverse.Rendering;
using UnityEngine;
@@ -70,18 +48,18 @@ namespace Raindrop.Rendering
public bool FetchFailed;
}
//public class TextureLoadItem
//{
// public FaceData Data;
// public Primitive Prim;
// public Primitive.TextureEntryFace TeFace;
// public byte[] TextureData = null;
// public byte[] TGAData = null;
// public bool LoadAssetFromCache = false;
// public ImageType ImageType = ImageType.Normal;
// public string BakeName = string.Empty;
// public UUID AvatarID = UUID.Zero;
//}
public class TextureLoadItem
{
public FaceData Data;
public Primitive Prim;
public Primitive.TextureEntryFace TeFace;
public byte[] TextureData = null;
public byte[] TGAData = null;
public bool LoadAssetFromCache = false;
public ImageType ImageType = ImageType.Normal;
public string BakeName = string.Empty;
public UUID AvatarID = UUID.Zero;
}
//public enum RenderPass
//{
@@ -362,7 +340,10 @@ namespace Raindrop.Rendering
try
{
string fname = ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>().ComputeCacheName(ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>().Client.Settings.ASSET_CACHE_DIR, textureID) + ".rzi";
string fname =
ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>()
.ComputeCacheName(ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>()
.Client.Settings.ASSET_CACHE_DIR, textureID) + ".rzi";
using (var f = File.Open(fname, FileMode.Open, FileAccess.Read, FileShare.Read))
{
+242
View File
@@ -0,0 +1,242 @@
using System.Collections.Generic;
using OpenMetaverse.Rendering;
using Raindrop.Rendering;
using UnityEngine;
using UnityEngine.Assertions;
using Mesh = UnityEngine.Mesh;
namespace Raindrop.Render
{
//mesher functions for unity.
public static class UniMesher
{
//generate a generic cube.
public static void Mesh_Cube(uint width, ref Mesh mesh)
{
//1. size.
float length = width;
//float _width = width;
float height = width;
//2. const declaration of the verts.
Vector3[] c = new Vector3[8];
c[0] = new Vector3(-length * .5f, -width * .5f, height * .5f);
c[1] = new Vector3(length * .5f, -width * .5f, height * .5f);
c[2] = new Vector3(length * .5f, -width * .5f, -height * .5f);
c[3] = new Vector3(-length * .5f, -width * .5f, -height * .5f);
c[4] = new Vector3(-length * .5f, width * .5f, height * .5f);
c[5] = new Vector3(length * .5f, width * .5f, height * .5f);
c[6] = new Vector3(length * .5f, width * .5f, -height * .5f);
c[7] = new Vector3(-length * .5f, width * .5f, -height * .5f);
//3. ordering of vertices.
// 1 way: use
//I have used 16 vertices (4 vertices per side).
//This is because I want the vertices of each side to have separate normals.
//(so the object renders light/shade correctly)
Vector3[] vertices = new Vector3[]
{
c[0], c[1], c[2], c[3], // Bottom
c[7], c[4], c[0], c[3], // Left
c[4], c[5], c[1], c[0], // Front
c[6], c[7], c[3], c[2], // Back
c[5], c[6], c[2], c[1], // Right
c[7], c[6], c[5], c[4] // Top
};
//5) Define each vertex's Normal
Vector3 up = Vector3.up;
Vector3 down = Vector3.down;
Vector3 forward = Vector3.forward;
Vector3 back = Vector3.back;
Vector3 left = Vector3.left;
Vector3 right = Vector3.right;
Vector3[] normals = new Vector3[]
{
down, down, down, down, // Bottom
left, left, left, left, // Left
forward, forward, forward, forward, // Front
back, back, back, back, // Back
right, right, right, right, // Right
up, up, up, up // Top
};
//6) Define each vertex's UV co-ordinates
Vector2 uv00 = new Vector2(0f, 0f);
Vector2 uv10 = new Vector2(1f, 0f);
Vector2 uv01 = new Vector2(0f, 1f);
Vector2 uv11 = new Vector2(1f, 1f);
Vector2[] uvs = new Vector2[]
{
uv11, uv01, uv00, uv10, // Bottom
uv11, uv01, uv00, uv10, // Left
uv11, uv01, uv00, uv10, // Front
uv11, uv01, uv00, uv10, // Back
uv11, uv01, uv00, uv10, // Right
uv11, uv01, uv00, uv10 // Top
};
//7) Define the Polygons (triangles) that make up the our Mesh (cube)
//IMPORTANT: Unity uses a 'Clockwise Winding Order' for determining front-facing polygons.
//This means that a polygon's vertices must be defined in
//a clockwise order (relative to the camera) in order to be rendered/visible.
int[] triangles = new int[]
{
3, 1, 0, 3, 2, 1, // Bottom
7, 5, 4, 7, 6, 5, // Left
11, 9, 8, 11, 10, 9, // Front
15, 13, 12, 15, 14, 13, // Back
19, 17, 16, 19, 18, 17, // Right
23, 21, 20, 23, 22, 21, // Top
};
//8) Build the Mesh
lock (mesh)
{
mesh.Clear();
mesh.vertices = vertices;
mesh.triangles = triangles;
mesh.normals = normals;
mesh.uv = uvs;
mesh.Optimize();
//mesh.RecalculateNormals();
}
//9) Give it a Material
// Material cubeMaterial = new Material(Shader.Find("Standard"));
// cubeMaterial.SetColor("_Color", new Color(0f, 0.7f, 0f)); //green main color
// _cube.GetComponent<Renderer>().material = cubeMaterial;
//9 return
} //generate a generic cube.
//give OMV.rendering.face, return unity mesh.
public static void Mesh_Face(Face face, ref Mesh mesh)
{
if (mesh == null)
{
Debug.LogError("given a null mesh to generate into! wtf? ");
}
mesh.Clear();
//2. copy the verts as-is.
// consider if we want to re-use verts to achive a blended look.
var verticesCount = face.Vertices.Count;
Vector3[] vertices = new Vector3[verticesCount];
for (int i = 0; i < verticesCount; i++)
{
var OMVPos = face.Vertices[i].Position;
var UnityPos = RHelp.TKVector3(OMVPos);
vertices[i] = UnityPos;
}
//5) Define each vertex's Normal
// Vector3 up = Vector3.up;
// Vector3 down = Vector3.down;
// Vector3 forward = Vector3.forward;
// Vector3 back = Vector3.back;
// Vector3 left = Vector3.left;
// Vector3 right = Vector3.right;
// Vector3[] normals = new Vector3[]
// {
// down, down, down, down, // Bottom
// left, left, left, left, // Left
// forward, forward, forward, forward, // Front
// back, back, back, back, // Back
// right, right, right, right, // Right
// up, up, up, up // Top
// };
Vector3[] normals = new Vector3[verticesCount];
for (int i = 0; i < verticesCount; i++)
{
var OMVPos = face.Vertices[i].Normal;
var UnityPos = RHelp.TKVector3(OMVPos);
normals[i] = UnityPos;
}
//6) Define each vertex's UV co-ordinates
// todo: I do not know how the UV is defined as in the prim's face.
Vector2[] uvs = new Vector2[verticesCount];
for (int i = 0; i < verticesCount; i++)
{
//no need to transform any axis, since 2d-wise x and y are same in OMV and unity.
uvs[i].x = face.Vertices[i].TexCoord.X;
uvs[i].y = face.Vertices[i].TexCoord.Y;
}
//7) Define the Polygons (triangles) that make up the our Mesh (cube)
//IMPORTANT: Unity uses a 'Clockwise Winding Order' for determining front-facing polygons.
//This means that a polygon's vertices must be defined in
//a clockwise order (relative to the camera) in order to be rendered/visible.
// int[] triangles = new int[]
// {
// 3, 1, 0, 3, 2, 1, // Bottom
// 7, 5, 4, 7, 6, 5, // Left
// 11, 9, 8, 11, 10, 9, // Front
// 15, 13, 12, 15, 14, 13, // Back
// 19, 17, 16, 19, 18, 17, // Right
// 23, 21, 20, 23, 22, 21, // Top
// };
List<ushort> OMV_ACW_triangleIndex = face.Indices;
FlipIndicesOrdering(ref OMV_ACW_triangleIndex);
int[] triangles = new int[OMV_ACW_triangleIndex.Count]; //warn: if data from library is bad, we are not checking its integrity...
// Assert.IsTrue(verticesCount * 3 == OMV_ACW_triangleIndex.Count,
// "wrong count of indices for defining triangles of your mesh: " +
// "expected: " + verticesCount*3 +
// "actual provided data: " + OMV_ACW_triangleIndex.Count
// );
for (int i = 0; i < triangles.Length; i++)
{
triangles[i] = OMV_ACW_triangleIndex[i];
}
//8) Build the Mesh
lock (mesh)
{
mesh.Clear();
mesh.vertices = vertices;
mesh.triangles = triangles;
mesh.normals = normals;
mesh.uv = uvs;
mesh.Optimize();
//mesh.RecalculateNormals();
}
//9) Give it a Material
// Material cubeMaterial = new Material(Shader.Find("Standard"));
// cubeMaterial.SetColor("_Color", new Color(0f, 0.7f, 0f)); //green main color
// _cube.GetComponent<Renderer>().material = cubeMaterial;
//9 return
}
//flip the Ordering of each group of 3 indexes.
// exmaple:
// visially the face looks like: 2 3
// 0 1
// input indices: <0 | 3 | 2> , <0 | 1 | 3> (ACW; OMV style.)
// output indices : <0 | 2 | 3> , <0 | 3 | 1> (CW; Unity style.)
private static void FlipIndicesOrdering(ref List<ushort> omvAcwTriangleIndex)
{
int IndexCount = omvAcwTriangleIndex.Count;
Assert.IsTrue(IndexCount % 3 == 0, "indices should be divible by 3");
for (int i = 0; i < IndexCount; i += 3)
{
//swap.
(omvAcwTriangleIndex[i + 1], omvAcwTriangleIndex[i + 2]) =
(omvAcwTriangleIndex[i + 2], omvAcwTriangleIndex[i + 1]);
}
}
}
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 165726bc82244c30989156704fdda56a
timeCreated: 1645172560
+27 -26
View File
@@ -3,6 +3,7 @@ using OpenMetaverse;
using Raindrop.Netcom;
using Raindrop.Presenters;
using Raindrop.ServiceLocator;
using Raindrop.UI.LoadingScreen;
using UnityEngine;
namespace Raindrop.Services
@@ -18,19 +19,23 @@ namespace Raindrop.Services
// Notification - manages app-wide notifications.
// <deprecated> LoadingCanvasPresenter - this particular modal/screen is tricky; it appears only when the scene is loading.
private RaindropInstance instance;
private RaindropInstance instance => ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>();
private RaindropNetcom netcom { get { return instance.Netcom; } }
private GridClient client { get { return instance.Client; } }
// canvases are stack-based. only 1 is top-most and active at any time.
public ScreensManager ScreensManager { set; get; }
public ScreenStackManager ScreenStackManager { set; get; }
// modals are single-display. however, there is a modal queue, such that when the current modal is dismissed, the next-in-queue will appear.
//care has to be taken not to spam the user with modals.
public ModalManager modalManager { set; get; }
public ModalsManager ModalsManager { set; get; }
// fade into loading screen.
public LoadingController _loadingController;
//chat screen.
public ChatPresenter chatFacade;
// refactor:
/* initial: UIService(ScreensManager cm, ModalManager mm)
@@ -38,25 +43,14 @@ namespace Raindrop.Services
* +UIService.showScreen(UIBuilder(CanvasType.Login))
* +UIService.showModal
*/
public UIService(ScreensManager cm, ModalManager mm, LoadingPresenter loadingPresenter)
public UIService(ScreenStackManager cm, ModalsManager mm, LoadingView loadingView,
ChatPresenter ChatPresenter)
{
ScreensManager = cm;
modalManager = mm;
_loadingController = new LoadingController(loadingPresenter);
// UI depends on raindrop business layer.
try
{
this.instance = ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>();
} catch (InvalidOperationException)
{
Debug.LogError("UIService failed to get raindrop service");
//failed to find service.
return;
}
ScreenStackManager = cm;
ModalsManager = mm;
_loadingController = new LoadingController(loadingView);
chatFacade = ChatPresenter;
// Callbacks
netcom.ClientLoginStatus += new EventHandler<LoginProgressEventArgs>(netcom_ClientLoginStatus);
netcom.ClientLoggedOut += new EventHandler(netcom_ClientLoggedOut);
@@ -88,13 +82,13 @@ namespace Raindrop.Services
protected void startUIInitialView()
{
ScreensManager.ResetToInitialScreen();
modalManager.showModalNotification("Disclaimer", "This software is a work in progress. There is no guarantee about its stability. ");
ScreenStackManager.ResetToInitialScreen();
ModalsManager.showModal_NotificationGeneric("Disclaimer", "This software is a work in progress. There is no guarantee about its stability. ");
}
public GameObject getCurrentForegroundPresenter()
{
return ScreensManager.GetForegroundCanvas();
return ScreenStackManager.GetForegroundCanvas();
}
private void RegisterClientEvents(GridClient client)
@@ -110,7 +104,11 @@ namespace Raindrop.Services
client.Self.MoneyBalanceReply -= new EventHandler<MoneyBalanceReplyEventArgs>(Self_MoneyBalanceReply);
client.Self.MoneyBalance -= new EventHandler<BalanceEventArgs>(Self_MoneyBalance);
}
#region chats
#endregion
@@ -151,7 +149,7 @@ namespace Raindrop.Services
{
//modalManager.showModalNotification("Logged out", "you have/were logged out");
ScreensManager.ResetToInitialScreen();
ScreenStackManager.ResetToInitialScreen();
//RefreshStatusBar();
//RefreshWindowTitle();
@@ -166,7 +164,7 @@ namespace Raindrop.Services
if (e.Reason == NetworkManager.DisconnectType.ClientInitiated) return;
netcom_ClientLoggedOut(sender, EventArgs.Empty);
ScreensManager.ResetToInitialScreen();
ScreenStackManager.ResetToInitialScreen();
//if (instance.GlobalSettings["auto_reconnect"].AsBoolean())
//{
@@ -244,5 +242,8 @@ namespace Raindrop.Services
throw new NotImplementedException();
}
}
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: fced7c496efbd3b44b49b42f755dd657
guid: f8d3f85ce66122f4cafb7f1e660ab51c
folderAsset: yes
DefaultImporter:
externalObjects: {}
@@ -0,0 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using OpenMetaverse;
using OpenMetaverse.Stats;
using Raindrop.Presenters;
using Raindrop.ServiceLocator;
using Raindrop.Services;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using Logger = OpenMetaverse.Logger;
[RequireComponent(typeof(Button))]
public class ButtonTriggerModal : MonoBehaviour
{
private Button button;
[SerializeField]
public GameObject modal;
// Start is called before the first frame update
void Awake()
{
button = GetComponent<Button>();
button.onClick.AddListener(OnButtonDown);
}
private void OnButtonDown()
{
if (modal == null)
{
Logger.Log("modal not implemented/link", Helpers.LogLevel.Error);
ModalsManager.PushModal_NotImplementedYet(this.gameObject.name.ToString() + " modal");
return;
}
ServiceLocator.Instance.Get<UIService>().ModalsManager.Show(modal);
}
}
@@ -14,6 +14,7 @@ using Logger = OpenMetaverse.Logger;
public class ButtonTriggerViewTransition : MonoBehaviour
{
public CanvasType canvasTypeToPush;
[Tooltip("If pop and push is true, it means the UI stack will be popped first, then pushed. Ala, the current UI you seeing will be gone.")]
public bool popAndPush;
private void Start()
{
@@ -38,16 +39,16 @@ public class ButtonTriggerViewTransition : MonoBehaviour
{
if (canvasTypeToPush == CanvasType.POP)
{
ServiceLocator.Instance.Get<UIService>().ScreensManager.PopCanvas();
ServiceLocator.Instance.Get<UIService>().ScreenStackManager.PopCanvas();
return;
}
if (popAndPush)
{
ServiceLocator.Instance.Get<UIService>().ScreensManager.PopAndPush(canvasTypeToPush);
ServiceLocator.Instance.Get<UIService>().ScreenStackManager.PopAndPush(canvasTypeToPush);
} else
{
ServiceLocator.Instance.Get<UIService>().ScreensManager.Push(canvasTypeToPush);
ServiceLocator.Instance.Get<UIService>().ScreenStackManager.Push(canvasTypeToPush);
}
}
}

Some files were not shown because too many files have changed in this diff Show More