场景管理
parent
b9bfbd5d0e
commit
3b89e03acc
|
|
@ -0,0 +1,138 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: fake
|
||||
m_Shader: {fileID: 4800000, guid: 650dd9526735d5b46b79224bc6e94025, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords:
|
||||
- _SURFACE_TYPE_TRANSPARENT
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap:
|
||||
RenderType: Transparent
|
||||
disabledShaderPasses:
|
||||
- DepthOnly
|
||||
- SHADOWCASTER
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BaseMap:
|
||||
m_Texture: {fileID: 2800000, guid: 050185da63382a443b691579dfa41ac6, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_LightmapsInd:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_ShadowMasks:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _AlphaClip: 0
|
||||
- _AlphaToMask: 0
|
||||
- _Blend: 0
|
||||
- _BlendModePreserveSpecular: 1
|
||||
- _BlendOp: 0
|
||||
- _BumpScale: 1
|
||||
- _ClearCoatMask: 0
|
||||
- _ClearCoatSmoothness: 0
|
||||
- _Cull: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 10
|
||||
- _DstBlendAlpha: 10
|
||||
- _EnvironmentReflections: 1
|
||||
- _GlossMapScale: 0
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _Metallic: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.005
|
||||
- _QueueOffset: 0
|
||||
- _ReceiveShadows: 1
|
||||
- _SampleGI: 0
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 5
|
||||
- _SrcBlendAlpha: 1
|
||||
- _Surface: 1
|
||||
- _WorkflowMode: 1
|
||||
- _ZWrite: 0
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
--- !u!114 &6252362025242632844
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 11
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 7
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b737b08ceb61d944aa8c4cc0af83fc0f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -121,7 +121,7 @@ Material:
|
|||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _BaseTint: {r: 0.31372523, g: 0.29019585, b: 0.11372524, a: 1}
|
||||
- _BaseTint: {r: 0.3137251, g: 0.29019573, b: 0.1137251, a: 0.78431374}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _ShadowColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,86 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1261262978292087713
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 14590638047720827}
|
||||
- component: {fileID: 3731444667308317324}
|
||||
- component: {fileID: 4318251823745557388}
|
||||
m_Layer: 0
|
||||
m_Name: pineTree
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &14590638047720827
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1261262978292087713}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -4.91, y: -0.00000035762787, z: 36.38}
|
||||
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &3731444667308317324
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1261262978292087713}
|
||||
m_Mesh: {fileID: 4301210, guid: 788593057ddc5744eba68cbd173a6c14, type: 3}
|
||||
--- !u!23 &4318251823745557388
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1261262978292087713}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 064b99959cf952e419796be74cfb3348, type: 2}
|
||||
- {fileID: 2100000, guid: a76375f4a10df244cab366914c11a23c, type: 2}
|
||||
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: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 15201, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c7d31f8960865524284fc9722f142696
|
||||
guid: 5c1f70249db1c48498ae0051ab23de31
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
|
@ -1,258 +0,0 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1348404472823600637
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6354088036587312540}
|
||||
m_Layer: 0
|
||||
m_Name: trees
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &6354088036587312540
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1348404472823600637}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -64.83601, y: -8.983191, z: 0.89721495}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2562105078343232839}
|
||||
- {fileID: 6893927218285529627}
|
||||
- {fileID: 2680947511517968487}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &563052819491371018
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 6354088036587312540}
|
||||
m_Modifications:
|
||||
- target: {fileID: 1576211200591678752, guid: b91a36bfe91fa9041856038af455c654,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: tree1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2620586390824408397, guid: b91a36bfe91fa9041856038af455c654,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0.185
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2620586390824408397, guid: b91a36bfe91fa9041856038af455c654,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2620586390824408397, guid: b91a36bfe91fa9041856038af455c654,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0.375
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2620586390824408397, guid: b91a36bfe91fa9041856038af455c654,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2620586390824408397, guid: b91a36bfe91fa9041856038af455c654,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2620586390824408397, guid: b91a36bfe91fa9041856038af455c654,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2620586390824408397, guid: b91a36bfe91fa9041856038af455c654,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2620586390824408397, guid: b91a36bfe91fa9041856038af455c654,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2620586390824408397, guid: b91a36bfe91fa9041856038af455c654,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2620586390824408397, guid: b91a36bfe91fa9041856038af455c654,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: b91a36bfe91fa9041856038af455c654, type: 3}
|
||||
--- !u!4 &2562105078343232839 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 2620586390824408397, guid: b91a36bfe91fa9041856038af455c654,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 563052819491371018}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &2759543689304063967
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 6354088036587312540}
|
||||
m_Modifications:
|
||||
- target: {fileID: 5288699503557865334, guid: 97fb61751e45e2843bca3d4d1f9d6b4e,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: tree2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8784262392359810500, guid: 97fb61751e45e2843bca3d4d1f9d6b4e,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8784262392359810500, guid: 97fb61751e45e2843bca3d4d1f9d6b4e,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8784262392359810500, guid: 97fb61751e45e2843bca3d4d1f9d6b4e,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8784262392359810500, guid: 97fb61751e45e2843bca3d4d1f9d6b4e,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8784262392359810500, guid: 97fb61751e45e2843bca3d4d1f9d6b4e,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8784262392359810500, guid: 97fb61751e45e2843bca3d4d1f9d6b4e,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8784262392359810500, guid: 97fb61751e45e2843bca3d4d1f9d6b4e,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8784262392359810500, guid: 97fb61751e45e2843bca3d4d1f9d6b4e,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8784262392359810500, guid: 97fb61751e45e2843bca3d4d1f9d6b4e,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8784262392359810500, guid: 97fb61751e45e2843bca3d4d1f9d6b4e,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 97fb61751e45e2843bca3d4d1f9d6b4e, type: 3}
|
||||
--- !u!4 &6893927218285529627 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 8784262392359810500, guid: 97fb61751e45e2843bca3d4d1f9d6b4e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2759543689304063967}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &6073318192371662809
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 6354088036587312540}
|
||||
m_Modifications:
|
||||
- target: {fileID: 3685415337165099194, guid: e933893cf9d2d244b860424c10a97122,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: tree3
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8177517922672183230, guid: e933893cf9d2d244b860424c10a97122,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -0.279
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8177517922672183230, guid: e933893cf9d2d244b860424c10a97122,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8177517922672183230, guid: e933893cf9d2d244b860424c10a97122,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 1.08
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8177517922672183230, guid: e933893cf9d2d244b860424c10a97122,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8177517922672183230, guid: e933893cf9d2d244b860424c10a97122,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8177517922672183230, guid: e933893cf9d2d244b860424c10a97122,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8177517922672183230, guid: e933893cf9d2d244b860424c10a97122,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8177517922672183230, guid: e933893cf9d2d244b860424c10a97122,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8177517922672183230, guid: e933893cf9d2d244b860424c10a97122,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8177517922672183230, guid: e933893cf9d2d244b860424c10a97122,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: e933893cf9d2d244b860424c10a97122, type: 3}
|
||||
--- !u!4 &2680947511517968487 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 8177517922672183230, guid: e933893cf9d2d244b860424c10a97122,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 6073318192371662809}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
Binary file not shown.
|
|
@ -0,0 +1,140 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d53c0e444a0f16b429b5c416a14dc8a9
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 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: 0
|
||||
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
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 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
|
||||
ignorePlatformSupport: 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
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,140 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2b4bb6b15c8cd1540b563b9f60892a50
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 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: 0
|
||||
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
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 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
|
||||
ignorePlatformSupport: 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
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,140 @@
|
|||
fileFormatVersion: 2
|
||||
guid: cf1247d8598a4724d883dfd5473f1d18
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 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: 0
|
||||
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
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 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
|
||||
ignorePlatformSupport: 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
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,208 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using Sirenix.OdinInspector;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
public class RenderObjectToTexture : MonoBehaviour
|
||||
{
|
||||
private const string TEX_FOLDER = "Assets/Art/Scene/Trees/Texture";
|
||||
private const string RENDER_TOOL_LAYER_NAME = "RenderTool";
|
||||
|
||||
//camera old value
|
||||
private float _oldAspect;
|
||||
private float _oldSize;
|
||||
private Vector3 _oldPosition;
|
||||
private RenderTexture _oldRT;
|
||||
private LayerMask _oldCullingMask;
|
||||
private CameraClearFlags _oldClearFlags;
|
||||
private Color _oldBkgColor;
|
||||
|
||||
//obj old value
|
||||
private int _oldLayer;
|
||||
|
||||
//RT old value
|
||||
private RenderTexture _oldActiveRT;
|
||||
|
||||
private void SaveCameraValue(Camera cam)
|
||||
{
|
||||
_oldAspect = cam.aspect;
|
||||
_oldSize = cam.orthographicSize;
|
||||
_oldPosition = cam.transform.position;
|
||||
_oldRT = cam.targetTexture;
|
||||
_oldCullingMask = cam.cullingMask;
|
||||
_oldClearFlags = cam.clearFlags;
|
||||
_oldBkgColor = cam.backgroundColor;
|
||||
}
|
||||
|
||||
private void RevertCameraValue(Camera cam)
|
||||
{
|
||||
cam.aspect = _oldAspect;
|
||||
cam.orthographicSize = _oldSize;
|
||||
cam.transform.position = _oldPosition;
|
||||
cam.targetTexture = _oldRT;
|
||||
cam.cullingMask = _oldCullingMask;
|
||||
cam.clearFlags = _oldClearFlags;
|
||||
cam.backgroundColor = _oldBkgColor;
|
||||
}
|
||||
|
||||
private void SaveObjValue(GameObject obj)
|
||||
{
|
||||
_oldLayer = obj.layer;
|
||||
}
|
||||
|
||||
private void RevertObjValue(GameObject obj)
|
||||
{
|
||||
obj.layer = _oldLayer;
|
||||
}
|
||||
|
||||
private void SaveRT()
|
||||
{
|
||||
_oldActiveRT = RenderTexture.active;
|
||||
}
|
||||
|
||||
private void RevertRT()
|
||||
{
|
||||
RenderTexture.active = _oldActiveRT;
|
||||
}
|
||||
|
||||
// [Button("恢复全部")]
|
||||
// private void RevertAll()
|
||||
// {
|
||||
// RevertCameraValue(Camera.main);
|
||||
// RevertObjValue(gameObject);
|
||||
// RevertRT();
|
||||
// }
|
||||
|
||||
[Button("渲染到贴图")]
|
||||
private void Render()
|
||||
{
|
||||
if (gameObject == null || Camera.main == null)
|
||||
return;
|
||||
var cam = Camera.main;
|
||||
SaveCameraValue(cam);
|
||||
SaveObjValue(gameObject);
|
||||
SaveRT();
|
||||
try
|
||||
{
|
||||
var newLayer = LayerMask.NameToLayer(RENDER_TOOL_LAYER_NAME);
|
||||
gameObject.layer = newLayer;
|
||||
var objPos = gameObject.GetComponent<MeshRenderer>()?.bounds.center ?? gameObject.transform.position;
|
||||
var viewPortPoints = GetMeshBorder(gameObject.GetComponent<MeshFilter>().sharedMesh, transform, cam);
|
||||
var left = viewPortPoints[0].x;
|
||||
var right = viewPortPoints[1].x;
|
||||
var bottom = viewPortPoints[2].y;
|
||||
var top = viewPortPoints[3].y;
|
||||
cam.transform.position = cam.ViewportToWorldPoint(viewPortPoints[4]);
|
||||
cam.cullingMask = 1 << newLayer;
|
||||
var rtWidth = Mathf.FloorToInt(1920 * (right - left));
|
||||
var rtHeight = Mathf.FloorToInt(1080 * (top - bottom));
|
||||
RenderTexture rt = RenderTexture.GetTemporary(rtWidth, rtHeight, 0, RenderTextureFormat.ARGB32);
|
||||
cam.aspect = (float)rtWidth / rtHeight;
|
||||
cam.orthographicSize *= (top - bottom);
|
||||
cam.targetTexture = rt;
|
||||
cam.clearFlags = CameraClearFlags.Color;
|
||||
cam.backgroundColor = Color.clear;
|
||||
cam.Render();
|
||||
RenderTexture.active = rt;
|
||||
Texture2D tex = new Texture2D(rtWidth, rtHeight);
|
||||
tex.ReadPixels(new Rect(0, 0, rtWidth, rtHeight), 0, 0);
|
||||
tex.Apply();
|
||||
Byte[] bytes = tex.EncodeToPNG();
|
||||
var path = $"{TEX_FOLDER}/{gameObject.name}.png";
|
||||
FileStream fs = File.Open(path, FileMode.Create);
|
||||
BinaryWriter writer = new BinaryWriter(fs);
|
||||
writer.Write(bytes);
|
||||
writer.Flush();
|
||||
writer.Close();
|
||||
fs.Close();
|
||||
DestroyImmediate(tex);
|
||||
RenderTexture.ReleaseTemporary(rt);
|
||||
AssetDatabase.Refresh();
|
||||
var savedTex = AssetDatabase.LoadAssetAtPath<Texture2D>(path);
|
||||
if (savedTex != null)
|
||||
EditorGUIUtility.PingObject(savedTex);
|
||||
Debug.Log("保存成功!" + path);
|
||||
}
|
||||
finally
|
||||
{
|
||||
RevertCameraValue(cam);
|
||||
RevertObjValue(gameObject);
|
||||
RevertRT();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取mesh在当前相机视角下的边界视口坐标
|
||||
/// </summary>
|
||||
/// <param name="mesh"></param>
|
||||
/// <param name="trans"></param>
|
||||
/// <param name="cam"></param>
|
||||
/// <returns>前四个值是左右下上,最后一个值是中心点</returns>
|
||||
private Vector3[] GetMeshBorder(Mesh mesh, Transform trans, Camera cam)
|
||||
{
|
||||
Vector3[] result = new Vector3[5];
|
||||
float left = float.PositiveInfinity;
|
||||
float right = float.NegativeInfinity;
|
||||
float top = float.NegativeInfinity;
|
||||
float bottom = float.PositiveInfinity;
|
||||
Vector3 leftPosSS = Vector3.zero;
|
||||
Vector3 rightPosSS = Vector3.zero;
|
||||
Vector3 bottomPosSS = Vector3.zero;
|
||||
Vector3 topPosSS = Vector3.zero;
|
||||
for (int i = 0; i < mesh.vertexCount; i++)
|
||||
{
|
||||
var vertex = mesh.vertices[i];
|
||||
var positionWS = trans.TransformPoint(vertex);
|
||||
var positionSS = cam.WorldToViewportPoint(positionWS);
|
||||
if (positionSS.x < left)
|
||||
{
|
||||
left = positionSS.x;
|
||||
leftPosSS = positionSS;
|
||||
}
|
||||
|
||||
if (positionSS.x > right)
|
||||
{
|
||||
right = positionSS.x;
|
||||
rightPosSS = positionSS;
|
||||
}
|
||||
|
||||
if (positionSS.y < bottom)
|
||||
{
|
||||
bottom = positionSS.y;
|
||||
bottomPosSS = positionSS;
|
||||
}
|
||||
|
||||
if (positionSS.y > top)
|
||||
{
|
||||
top = positionSS.y;
|
||||
topPosSS = positionSS;
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 centerSS = new Vector3((left + right) / 2, (top + bottom) / 2, 0);
|
||||
result[0] = leftPosSS;
|
||||
result[1] = rightPosSS;
|
||||
result[2] = bottomPosSS;
|
||||
result[3] = topPosSS;
|
||||
result[4] = centerSS;
|
||||
// CreatePointMark(cam.ViewportToWorldPoint(centerSS));
|
||||
// CreatePointMark(cam.ViewportToWorldPoint(leftPosSS));
|
||||
// CreatePointMark(cam.ViewportToWorldPoint(rightPosSS));
|
||||
// CreatePointMark(cam.ViewportToWorldPoint(bottomPosSS));
|
||||
// CreatePointMark(cam.ViewportToWorldPoint(topPosSS));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void CreatePointMark(Vector3 position)
|
||||
{
|
||||
var go = GameObject.CreatePrimitive(PrimitiveType.Sphere);
|
||||
go.transform.position = position;
|
||||
go.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 011ebe1d0c97ed549baece4a5a3a7842
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -7,9 +7,7 @@ namespace Gameplay
|
|||
public partial class Map
|
||||
{
|
||||
private TerrainGridSystem _terrainGridSystem;
|
||||
// private GameObject _gameObject;
|
||||
private MapData _mapData;
|
||||
private MeshRenderer _groundMeshRenderer;
|
||||
private int _showInfoMask;
|
||||
|
||||
private Dictionary<int, int> _terrainTypeIndexDic = new Dictionary<int, int>();
|
||||
|
|
@ -25,92 +23,29 @@ namespace Gameplay
|
|||
private Map()
|
||||
{
|
||||
}
|
||||
|
||||
//public GameObject GameObject => _gameObject;
|
||||
|
||||
public MapData MapData => _mapData;
|
||||
public TerrainGridSystem TerrainGridSystem => _terrainGridSystem;
|
||||
public MeshRenderer GroundMeshRenderer => _groundMeshRenderer;
|
||||
|
||||
public Dictionary<int, int> TerrainTypeIndexDic => _terrainTypeIndexDic;
|
||||
|
||||
public static Map Create(TerrainGridSystem tgs, MapData data)
|
||||
{
|
||||
const string ERROR_PRE = "Create Map Instance Error: {0}";
|
||||
|
||||
var meshRenderer = tgs.GetComponent<MeshRenderer>();
|
||||
if (meshRenderer == null)
|
||||
{
|
||||
DebugUtil.LogError(ERROR_PRE ,"GameObject has no MeshRenderer Component");
|
||||
//return null;
|
||||
}
|
||||
|
||||
var map = new Map
|
||||
{
|
||||
_terrainGridSystem = tgs,
|
||||
_mapData = data,
|
||||
_groundMeshRenderer = meshRenderer
|
||||
};
|
||||
map.ResetByData();
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public static Map Create(GameObject go, MapData data)
|
||||
{
|
||||
const string ERROR_PRE = "Create Map Instance Error: {0}";
|
||||
if (go == null)
|
||||
{
|
||||
DebugUtil.LogError(ERROR_PRE ,"no GameObject");
|
||||
return null;
|
||||
}
|
||||
|
||||
var tgs = go.GetComponentInChildren<TerrainGridSystem>();
|
||||
if (tgs == null)
|
||||
{
|
||||
DebugUtil.LogError(ERROR_PRE , "GameObject has no TerrainGridSystem Component");
|
||||
return null;
|
||||
}
|
||||
|
||||
var meshRenderer = tgs.GetComponent<MeshRenderer>();
|
||||
if (meshRenderer == null)
|
||||
{
|
||||
DebugUtil.LogError(ERROR_PRE ,"GameObject has no MeshRenderer Component");
|
||||
//return null;
|
||||
}
|
||||
|
||||
var map = new Map
|
||||
{
|
||||
_terrainGridSystem = tgs,
|
||||
//_gameObject = go,
|
||||
_mapData = data,
|
||||
_groundMeshRenderer = meshRenderer
|
||||
};
|
||||
map.ResetByData();
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
//Object.DestroyImmediate(GameObject);
|
||||
}
|
||||
|
||||
public void SetGroundTexture(Texture2D texture)
|
||||
{
|
||||
|
||||
_terrainGridSystem.canvasTexture = texture;
|
||||
}
|
||||
public void SetGroundTexture(Material material)
|
||||
{
|
||||
_groundMeshRenderer.material = material;
|
||||
}
|
||||
|
||||
public void SetGroundSortingLayer(int order)
|
||||
{
|
||||
_groundMeshRenderer.sortingOrder = order;
|
||||
}
|
||||
|
||||
public MapBlockData GetBlockData(Vector2Int position)
|
||||
{
|
||||
return _mapData.GetBlockData(position);
|
||||
|
|
@ -127,12 +62,6 @@ namespace Gameplay
|
|||
return _mapData.CheckPosition(position);
|
||||
}
|
||||
|
||||
public string GetMapFileName()
|
||||
{
|
||||
//return _mapData.name;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void SetTerrainType(int tgsCellIndex, int terrainTypeIndex)
|
||||
{
|
||||
var blockIndex = TGSCellIndex2BlockIndex(tgsCellIndex);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f16d2816c806daa44adfa59aac3a99e6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,208 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
public class TwoDimensionRenderUtil
|
||||
{
|
||||
private const string TEX_FOLDER = "Assets/Art/Scene/Trees/Texture";
|
||||
private const string RENDER_TOOL_LAYER_NAME = "RenderTool";
|
||||
|
||||
private static Camera _camera;
|
||||
private static GameObject _gameObject;
|
||||
|
||||
//camera old value
|
||||
private static float _oldAspect;
|
||||
private static float _oldSize;
|
||||
private static Vector3 _oldPosition;
|
||||
private static RenderTexture _oldRT;
|
||||
private static LayerMask _oldCullingMask;
|
||||
private static CameraClearFlags _oldClearFlags;
|
||||
private static Color _oldBkgColor;
|
||||
|
||||
//obj old value
|
||||
private static int _oldLayer;
|
||||
|
||||
//RT old value
|
||||
private static RenderTexture _oldActiveRT;
|
||||
|
||||
private static void SaveCameraValue()
|
||||
{
|
||||
_oldAspect = _camera.aspect;
|
||||
_oldSize = _camera.orthographicSize;
|
||||
_oldPosition = _camera.transform.position;
|
||||
_oldRT = _camera.targetTexture;
|
||||
_oldCullingMask = _camera.cullingMask;
|
||||
_oldClearFlags = _camera.clearFlags;
|
||||
_oldBkgColor = _camera.backgroundColor;
|
||||
}
|
||||
|
||||
private static void RevertCameraValue()
|
||||
{
|
||||
_camera.aspect = _oldAspect;
|
||||
_camera.orthographicSize = _oldSize;
|
||||
_camera.transform.position = _oldPosition;
|
||||
_camera.targetTexture = _oldRT;
|
||||
_camera.cullingMask = _oldCullingMask;
|
||||
_camera.clearFlags = _oldClearFlags;
|
||||
_camera.backgroundColor = _oldBkgColor;
|
||||
}
|
||||
|
||||
private static void SaveObjValue()
|
||||
{
|
||||
_oldLayer = _gameObject.layer;
|
||||
}
|
||||
|
||||
private static void RevertObjValue()
|
||||
{
|
||||
_gameObject.layer = _oldLayer;
|
||||
}
|
||||
|
||||
private static void SaveRT()
|
||||
{
|
||||
_oldActiveRT = RenderTexture.active;
|
||||
}
|
||||
|
||||
private static void RevertRT()
|
||||
{
|
||||
RenderTexture.active = _oldActiveRT;
|
||||
}
|
||||
|
||||
public static Texture2D RenderToTexture(GameObject gameObject, Camera camera)
|
||||
{
|
||||
if (gameObject == null || camera == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
_gameObject = gameObject;
|
||||
_camera = camera;
|
||||
SaveCameraValue();
|
||||
SaveObjValue();
|
||||
SaveRT();
|
||||
try
|
||||
{
|
||||
var newLayer = LayerMask.NameToLayer(RENDER_TOOL_LAYER_NAME);
|
||||
gameObject.layer = newLayer;
|
||||
var viewPortPoints = GetMeshBorder(gameObject.GetComponent<MeshFilter>().sharedMesh, gameObject.transform,
|
||||
camera);
|
||||
var left = viewPortPoints[0].x;
|
||||
var right = viewPortPoints[1].x;
|
||||
var bottom = viewPortPoints[2].y;
|
||||
var top = viewPortPoints[3].y;
|
||||
camera.transform.position = camera.ViewportToWorldPoint(viewPortPoints[4]);
|
||||
camera.cullingMask = 1 << newLayer;
|
||||
var rtWidth = Mathf.FloorToInt(1920 * (right - left));
|
||||
var rtHeight = Mathf.FloorToInt(1080 * (top - bottom));
|
||||
RenderTexture rt = RenderTexture.GetTemporary(rtWidth, rtHeight, 0, RenderTextureFormat.ARGB32);
|
||||
camera.aspect = (float)rtWidth / rtHeight;
|
||||
camera.orthographicSize *= (top - bottom);
|
||||
camera.targetTexture = rt;
|
||||
camera.clearFlags = CameraClearFlags.Color;
|
||||
camera.backgroundColor = Color.clear;
|
||||
camera.Render();
|
||||
RenderTexture.active = rt;
|
||||
Texture2D tex = new Texture2D(rtWidth, rtHeight);
|
||||
tex.ReadPixels(new Rect(0, 0, rtWidth, rtHeight), 0, 0);
|
||||
tex.Apply();
|
||||
Byte[] bytes = tex.EncodeToPNG();
|
||||
var path = $"{TEX_FOLDER}/{gameObject.name}.png";
|
||||
FileStream fs = File.Open(path, FileMode.Create);
|
||||
BinaryWriter writer = new BinaryWriter(fs);
|
||||
writer.Write(bytes);
|
||||
writer.Flush();
|
||||
writer.Close();
|
||||
fs.Close();
|
||||
Object.DestroyImmediate(tex);
|
||||
RenderTexture.ReleaseTemporary(rt);
|
||||
AssetDatabase.Refresh();
|
||||
var savedTex = AssetDatabase.LoadAssetAtPath<Texture2D>(path);
|
||||
if (savedTex != null)
|
||||
{
|
||||
EditorGUIUtility.PingObject(savedTex);
|
||||
Debug.Log("保存成功!" + path);
|
||||
}
|
||||
|
||||
return savedTex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
RevertCameraValue();
|
||||
RevertObjValue();
|
||||
RevertRT();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取mesh在当前相机视角下的边界视口坐标
|
||||
/// </summary>
|
||||
/// <param name="mesh"></param>
|
||||
/// <param name="trans"></param>
|
||||
/// <param name="cam"></param>
|
||||
/// <returns>前四个值是左右下上,最后一个值是中心点</returns>
|
||||
private static Vector3[] GetMeshBorder(Mesh mesh, Transform trans, Camera cam)
|
||||
{
|
||||
Vector3[] result = new Vector3[5];
|
||||
float left = float.PositiveInfinity;
|
||||
float right = float.NegativeInfinity;
|
||||
float top = float.NegativeInfinity;
|
||||
float bottom = float.PositiveInfinity;
|
||||
Vector3 leftPosSS = Vector3.zero;
|
||||
Vector3 rightPosSS = Vector3.zero;
|
||||
Vector3 bottomPosSS = Vector3.zero;
|
||||
Vector3 topPosSS = Vector3.zero;
|
||||
for (int i = 0; i < mesh.vertexCount; i++)
|
||||
{
|
||||
var vertex = mesh.vertices[i];
|
||||
var positionWS = trans.TransformPoint(vertex);
|
||||
var positionSS = cam.WorldToViewportPoint(positionWS);
|
||||
if (positionSS.x < left)
|
||||
{
|
||||
left = positionSS.x;
|
||||
leftPosSS = positionSS;
|
||||
}
|
||||
|
||||
if (positionSS.x > right)
|
||||
{
|
||||
right = positionSS.x;
|
||||
rightPosSS = positionSS;
|
||||
}
|
||||
|
||||
if (positionSS.y < bottom)
|
||||
{
|
||||
bottom = positionSS.y;
|
||||
bottomPosSS = positionSS;
|
||||
}
|
||||
|
||||
if (positionSS.y > top)
|
||||
{
|
||||
top = positionSS.y;
|
||||
topPosSS = positionSS;
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 centerSS = new Vector3((left + right) / 2, (top + bottom) / 2, 0);
|
||||
result[0] = leftPosSS;
|
||||
result[1] = rightPosSS;
|
||||
result[2] = bottomPosSS;
|
||||
result[3] = topPosSS;
|
||||
result[4] = centerSS;
|
||||
// CreatePointMark(cam.ViewportToWorldPoint(centerSS));
|
||||
// CreatePointMark(cam.ViewportToWorldPoint(leftPosSS));
|
||||
// CreatePointMark(cam.ViewportToWorldPoint(rightPosSS));
|
||||
// CreatePointMark(cam.ViewportToWorldPoint(bottomPosSS));
|
||||
// CreatePointMark(cam.ViewportToWorldPoint(topPosSS));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void CreatePointMark(Vector3 position)
|
||||
{
|
||||
var go = GameObject.CreatePrimitive(PrimitiveType.Sphere);
|
||||
go.transform.position = position;
|
||||
go.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c94fb594760b75640b683c8cfe51c778
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -17,7 +17,7 @@ TagManager:
|
|||
- Skill
|
||||
- TeamEdit
|
||||
- MainPanel
|
||||
-
|
||||
- RenderTool
|
||||
-
|
||||
-
|
||||
-
|
||||
|
|
|
|||
Loading…
Reference in New Issue