Example #1
0
    THREE.Geometry AddRenderObject(THREE.Geometry geo, Material material, Vector3 position, Vector3 angle)
    {
        //int def = geo.mergeVertices();

        geo.computeFaceNormals();
        geo.copyFaceNormalToVertexNormals();
        //geo.computeVertexNormals(true);

        UnityEngine.Mesh mesh = geo.GetMesh(30.0f);
//		mesh.RecalculateBounds();
//		mesh.RecalculateNormals();

        //UnityMeshUtils.MeshSmoothNormals2(mesh);

        position.y += -95;

        GameObject gObj = new GameObject();

        gObj.transform.SetParent(this.transform);

        gObj.transform.localPosition    = position * 0.01f;
        gObj.transform.localEulerAngles = angle;
        gObj.transform.localScale       = Vector3.one * 0.01f;

        MeshFilter   mf = gObj.AddComponent <MeshFilter>();
        MeshRenderer mr = gObj.AddComponent <MeshRenderer>();

        mf.mesh     = mesh;
        mr.material = material;

        //UnityMeshUtils.checkVertices(mesh);

        return(geo);
    }
Example #2
0
    THREE.Geometry AddRenderObject(THREE.Geometry geo, Material material, Vector3 position, float smooth = 0.0f)     // 60
    {
        UnityEngine.Mesh mesh = geo.GetMesh(smooth);

        GameObject gObj = new GameObject();

        gObj.transform.SetParent(this.transform);
        gObj.transform.localPosition = position;

        MeshFilter   mf = gObj.AddComponent <MeshFilter>();
        MeshRenderer mr = gObj.AddComponent <MeshRenderer>();

        mf.mesh     = mesh;
        mr.material = material;

        return(geo);
    }
    THREE.Geometry AddRenderObject(THREE.Geometry geo, Material material, Vector3 position)
    {
        UnityEngine.Mesh mesh = geo.GetMesh();

        GameObject gObj = new GameObject();

        gObj.transform.SetParent(this.transform);
        gObj.transform.localPosition = position * 0.01f;
        gObj.transform.localScale    = Vector3.one * 0.01f;

        MeshFilter   mf = gObj.AddComponent <MeshFilter>();
        MeshRenderer mr = gObj.AddComponent <MeshRenderer>();

        mf.mesh     = mesh;
        mr.material = material;

        return(geo);
    }