• 大小: 14.96MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-07-08
  • 语言: 其他
  • 标签: Unity3D  室内  源文件  

资源简介

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\PrepareBatchscript.cs

     文件      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\maxscriptEngine.ms

     文件       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个文件信息

评论

共有 条评论