资源简介
Unity3D制作的室内效果(含有源文件)
代码片段和文件信息
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
/*
Coded for Unity Summer of Code 2009 by Michal Mandrysz
Feel free to modify for your own needs
http://masteranza.wordpress.com/unity/lightmapping/
http://unity3d.com
*/
class CalcArea
{
static public int whichLightmap=1;
public static Rect[] CalculateArea(MeshFilter[] mf int resolution ArrayList transformedVerticles)
{
ArrayList surfaces = new ArrayList();
MeshFilter temp;
float totalArea = 0;
Vector3[] transVert;
for (int i = 0; i < mf.Length; i++)
{
transVert = (Vector3[]) transformedVerticles[i];
temp = (MeshFilter)mf[i];
float area = 0;
int count = temp.sharedMesh.triangles.Length / 3;
for (int j = 0; j < count; j++)
{
area += Math.Abs(Vector3.Cross(transVert[temp.sharedMesh.triangles[j * 3]] - transVert[temp.sharedMesh.triangles[j * 3 + 1]] transVert[temp.sharedMesh.triangles[j * 3]] - transVert[temp.sharedMesh.triangles[j * 3 + 2]]).magnitude);
}
surfaces.Add(area);
totalArea += Math.Abs(area);
}
return Packobjects(mf surfaces totalArea 1.00f resolution);
}
public static void CheckIfNormalized(MeshFilter temp)
{
//Path search
Transform current = temp.transform;
while (current.parent!=null)
{
current = current.parent;
}
UnityEngine.object prefabed = EditorUtility.GetPrefabParent(current);
string path = AssetDatabase.GetAssetPath(prefabed);
if (path.Length<1) path = “primitive.notAFile“;
if (temp.sharedMesh.uv2.Length == temp.sharedMesh.vertexCount)
{
Vector2[] uvs = temp.sharedMesh.uv2;
bool normalized = true;
for (int j = 0; j < uvs.Length && normalized; j++)
{
if (uvs[j].x > 1 || uvs[j].x < 0 || uvs[j].y < 0 || uvs[j].y > 1)
{
LightmappingTool.notNormalized2.Add(path);
LightmappingTool.notNormalized2.Add(temp.transform);
normalized = false;
}
}
//Overlapping test
if (SystemInfo.supportsRenderTextures)
{
Shader finded = Shader.Find(“ExternalLightmappingTool/uvDebug“);
if (finded == null)
{
Debug.LogError(“Cannot find uvDebug shader within LightmappingTools folder!“);
return;
}
int res = 128;
RenderTexture rt = RenderTexture.GetTemporary(res res 0);
RenderTexture.active = rt;
if (Camera.current == null)
{
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 68937 2009-10-19 02:24 exampleproject\Assets\LightmappingTools\conversor.mse
文件 13147 2009-11-07 15:11 exampleproject\Assets\LightmappingTools\Editor\CalcArea.cs
文件 234 2009-09-09 00:48 exampleproject\Assets\LightmappingTools\Editor\Help.cs
文件 55533 2009-11-07 14:32 exampleproject\Assets\LightmappingTools\Editor\LightmappingTool.cs
文件 2681 2009-10-19 01:24 exampleproject\Assets\LightmappingTools\Editor\LookForLightmaps.cs
文件 6044 2009-10-19 01:24 exampleproject\Assets\LightmappingTools\Editor\PrepareBatchsc
文件 50386 2009-11-08 19:40 exampleproject\Assets\LightmappingTools\Editor\SaveFBX.cs
文件 5902 2009-10-19 01:24 exampleproject\Assets\LightmappingTools\Editor\StorePreferences.cs
文件 2642 2009-10-19 01:24 exampleproject\Assets\LightmappingTools\Editor\SwitchWindows.cs
文件 514 2009-10-19 02:24 exampleproject\Assets\LightmappingTools\ExternalLightmappingTool-BumpedDiffuse.shader
文件 723 2009-10-19 02:24 exampleproject\Assets\LightmappingTools\ExternalLightmappingTool-BumpedSpecular.shader
文件 456 2009-10-19 02:24 exampleproject\Assets\LightmappingTools\ExternalLightmappingTool-Diffuse.shader
文件 3488 2009-10-19 02:24 exampleproject\Assets\LightmappingTools\ExternalLightmappingTool-VertexLit.shader
文件 9678 2009-10-19 02:24 exampleproject\Assets\LightmappingTools\logo.png
文件 9605 2009-10-19 02:24 exampleproject\Assets\LightmappingTools\logo2.png
文件 8737 2009-10-19 02:24 exampleproject\Assets\LightmappingTools\maxsc
文件 1077 2009-10-19 02:24 exampleproject\Assets\LightmappingTools\uvDebug.shader
文件 7214231 2009-09-11 18:35 exampleproject\Assets\Lightmaps\scene\lightmap1.png
I.A.... 4016 2009-09-29 13:01 exampleproject\Assets\Materials\shop_scene-corner_closet.mat
I.A.... 4003 2009-09-29 13:01 exampleproject\Assets\Materials\shop_scene-dressoir.mat
I.A.... 3998 2009-09-29 13:01 exampleproject\Assets\Materials\shop_scene-hat.mat
文件 3837 2009-09-11 15:18 exampleproject\Assets\Materials\shop_scene-lamps.mat
I.A.... 4003 2009-09-29 13:01 exampleproject\Assets\Materials\shop_scene-manequin.mat
I.A.... 3998 2009-09-29 13:01 exampleproject\Assets\Materials\shop_scene-red.mat
I.A.... 4001 2009-09-29 13:01 exampleproject\Assets\Materials\shop_scene-saddle.mat
I.A.... 4000 2009-09-29 13:01 exampleproject\Assets\Materials\shop_scene-shelf.mat
I.A.... 4000 2009-09-29 13:01 exampleproject\Assets\Materials\shop_scene-shoes.mat
I.A.... 3999 2009-09-29 13:01 exampleproject\Assets\Materials\shop_scene-shop.mat
I.A.... 4015 2009-09-29 13:01 exampleproject\Assets\Materials\shop_scene-shop_stand_1.mat
I.A.... 4015 2009-09-29 13:01 exampleproject\Assets\Materials\shop_scene-shop_stand_2.mat
............此处省略288个文件信息
- 上一篇:中国邮编数据省市区/县街道
- 下一篇:Hibernate在线考试项目
相关资源
- 基于Unity3d的打飞机小游戏雷电
- 基于3d max 的室内客厅max文件+期末报告
- Unity3D狙击手游戏源码
- 模拟Unity中的Hierarchy层级面板功能
- Unity非常炫酷的技能特效粒子
- UGUI超级简单的摇杆制作,摇杆控制物
- Unity3D 连连看游戏161883
- Unity3D 连连看游戏
- UNITY3d类似LOL5v5地图
- Unity3D RPG角色扮演游戏 源代码下
- 飞机大战-unity3d源码
- unity3d 跑酷游戏的源代码
- Unity 2D 游戏开发教程
- Unity 室内漫游房地产
- Unity3D网络游戏实战
- unity3d联网斗地主服务端+客户端
- Obi Fluidv4.0.1+Obi Cloth 4.0.1
- 3D Infinite Runner Toolkit
- Axure常用案例
- authorware课件作品含源文件素材
- 我测试用的pcm文件
- untiy3d 简单td防守+射击游戏
- Unity3D树木、地皮贴图
- 用Unity3d做一个魔方
- zemax2009EE版win10安装教程及源文件
- Unity 2018 Shaders and Effects Cookbook 3rd Ed
- 3个精品Ps源文件(PSD)
- 关于Unity3D脚本的800个教程合集完整版
- mega fiers 3.49
- unity3D战争塔防源码.zip
评论
共有 条评论