• 大小: 1.13MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-28
  • 语言: 其他
  • 标签:

资源简介

U3D自带刷地形 直接转OBJ模型,MAX MAYA 通用 U3D自带刷地形 直接转OBJ模型,MAX MAYA 通用

资源截图

代码片段和文件信息

/*       INFINITY CODE 2013         */
/*   http://www.infinity-code.com   */

using UnityEditor;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;

public class MeshToTerrain : EditorWindow 
{
[MenuItem(“Window/Infinity Code/Mesh to Terrain“ false 2)] 
static void OpenWindow () 
{
EditorWindow.GetWindow(false “Mesh to Terrain“);
}

private int baseMapResolution = 1024;
private MeshToTerrainBounds bounds = MeshToTerrainBounds.autoDetect;
private Gameobject boundsGameobject;
private Gameobject container;
private int detailResolution = 2048;
private int heightmapResolution = 128;
private Vector3 maxBounds = Vector3.zero;
private Listject> mesh = new Listject>();
private MeshToTerrainFindType meshFindType = MeshToTerrainFindType.gameobjects;
private int meshlayer = 31;
private Vector3 minBounds = Vector3.zero;
private int newTerrainCountX = 1;
private int newTerrainCountY = 1;
private bool overwriteExists = false;
private float raycastDistance = 1000;
private int resolutionPerPatch = 16;
private Vector2 scrollPos = Vector2.zero;
private bool showMeshes = true;
private bool showTerrains = true;
private bool showTextures = true;
private List tempColliders;
private List terrain = new List();
private MeshToTerrainSelectTerrainType terrainType = MeshToTerrainSelectTerrainType.existTerrains;
private MeshToTerrainTextureType textureType = MeshToTerrainTextureType.noTexture;
private Color textureEmptyColor = Color.white;
private int textureHeight = 1024;
private int textureWidth = 1024;

private void OnGUI()
{
scrollPos = EditorGUILayout.BeginScrollView(scrollPos);

showMeshes = EditorGUILayout.Foldout(showMeshes “Meshes: “);
if (showMeshes)
{
meshFindType = (MeshToTerrainFindType)EditorGUILayout.EnumPopup(“Mesh select type: “ meshFindType);

if (meshFindType == MeshToTerrainFindType.gameobjects)
{
for( int i = 0; i < mesh.Count; i++ ) 
{
mesh[i] = (Gameobject)EditorGUILayout.objectField( mesh[i] typeof(Gameobject) true);
if (mesh[i] == null) 
{
mesh.RemoveAt(i);
i--;
}
}
Gameobject newMesh = (Gameobject)EditorGUILayout.objectField( null typeof(Gameobject) true);
if (newMesh != null) 
{
bool findedMesh = false;
foreach(Gameobject cMesh in mesh) if (newMesh == cMesh) { findedMesh = true; break; }
if (!findedMesh) mesh.Add(newMesh);
else EditorUtility.DisplayDialog(“Warning“ “Gameobject already added“ “OK“);
}
}
else if (meshFindType == MeshToTerrainFindType.layers)
{
meshlayer = EditorGUILayout.layerField(“layer: “ meshlayer);
}

EditorGUILayout.Space();
}

showTerrains = EditorGUILayout.Foldout(showTerrains “Terrains: “);
if (showTerrains)
{
terrainType = (MeshToTerrainSelectTerrainTyp

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-02-29 15:37  U3D与OBJ互转\
     目录           0  2016-02-29 15:37  U3D与OBJ互转\Editor\
     文件        6775  2015-03-02 11:35  U3D与OBJ互转\Editor\ExportTerrain.js
     文件         178  2015-10-29 14:45  U3D与OBJ互转\Editor\ExportTerrain.js.meta
     文件       18631  2013-05-17 21:15  U3D与OBJ互转\Editor\MeshToTerrain.cs
     文件         178  2015-10-29 14:48  U3D与OBJ互转\Editor\MeshToTerrain.cs.meta
     文件        3026  2013-04-17 17:40  U3D与OBJ互转\Editor\MountainsCreate.js
     文件         178  2015-10-29 14:45  U3D与OBJ互转\Editor\MountainsCreate.js.meta
     目录           0  2016-02-29 15:37  U3D与OBJ互转\Editor_01\
     文件        6775  2015-03-02 11:35  U3D与OBJ互转\Editor_01\ExportTerrain.js
     目录           0  2016-02-29 15:37  U3D与OBJ互转\Editor_01\Materials\
     文件        4220  2015-03-02 11:40  U3D与OBJ互转\Editor_01\Materials\defaultMat.mat
     文件        3026  2013-04-17 17:40  U3D与OBJ互转\Editor_01\MountainsCreate.js
     文件     6227313  2015-03-02 11:37  U3D与OBJ互转\Editor_01\Terrain.obj

评论

共有 条评论

相关资源