예제 #1
0
 // Generates data from unity material
 public void generate()
 {
     material = LoziMaterial.getMaterial(obj);
     objName  = material.name;
     objectId = material.GetInstanceID();
     getProperties();
 }
예제 #2
0
        public LoziTextureCollection(GameObject obj)
        {
            textureCollection = new List <LoziTexture>();

            foreach (Transform transform in obj.GetComponentsInChildren <Transform>())
            {
                Material material = LoziMaterial.getMaterial(transform.gameObject);

                if (material != null)
                {
                    List <Texture> texturesArr = getMaterialTexures(material);

                    for (int num = 0; num < texturesArr.Count; num++)
                    {
                        if (texturesArr[num] != null && canAddInArray(texturesArr[num]))
                        {
                            textureCollection.Add(new LoziTexture(texturesArr[num], false));
                        }
                    }
                }

                Texture lightmap = getLightMap(transform.gameObject);

                if (lightmap != null)
                {
                    textureCollection.Add(new LoziTexture(lightmap, true));
                }
            }
        }
예제 #3
0
        public int getMaterialIdByMaterial(Material material)
        {
            LoziMaterial materialObj = getMaterialByMaterial(material);

            if (materialObj != null)
            {
                return(materialObj.id);
            }
            return(0);
        }
예제 #4
0
        public LoziMaterialCollection(GameObject obj)
        {
            materialObjects = new List <LoziMaterial>();

            foreach (Transform transform in obj.GetComponentsInChildren <Transform>())
            {
                Material material = LoziMaterial.getMaterial(transform.gameObject);
                if (material != null && canAddInArray(material))
                {
                    int         lightMapID = -1;
                    LoziTexture tex        = LoziExporter.instance.textureCollection.getLightMapByGameObject(transform.gameObject);

                    if (tex != null)
                    {
                        lightMapID = tex.id;
                    }
                    materialObjects.Add(new LoziMaterial(transform.gameObject, lightMapID));
                }
            }
        }
예제 #5
0
 //sets component of type if exists
 private void setComponents()
 {
     if (LoziMesh.hasMesh(obj))
     {
         mesh = LoziExporter.instance.meshCollection.getMeshByGameObject(obj);
     }
     if (LoziMaterial.hasMaterial(obj))
     {
         material = LoziExporter.instance.materialCollection.getMaterialByGameObject(obj);
     }
     if (LoziCamera.hasCamera(obj))
     {
         camera = new LoziCamera(obj);
     }
     if (LoziLight.hasLight(obj))
     {
         light = new LoziLight(obj);
     }
     if (LoziAnimation.hasAnimation(obj))
     {
         animation = LoziExporter.instance.animationCollection.getAnimationByGameObject(obj);
     }
 }
예제 #6
0
 public LoziMaterial getMaterialByGameObject(GameObject obj)
 {
     return(getMaterialByMaterial(LoziMaterial.getMaterial(obj)));
 }