Beispiel #1
0
 public ProceduralObjectContainer(ProceduralObject baseObject)
 {
     id             = baseObject.id;
     basePrefabName = baseObject.basePrefabName;
     objectType     = baseObject.baseInfoType;
     // meshStatus = baseObject.meshStatus;
     renderDistance = baseObject.renderDistance;
     position       = new SerializableVector3(baseObject.m_position);
     rotation       = new SerializableQuaternion(baseObject.m_rotation);
     scale          = 1f;
     // if (meshStatus > 0)
     vertices             = SerializableVector3.ToSerializableArray(baseObject.m_mesh.vertices);
     hasCustomTexture     = baseObject.customTexture != null;
     visibility           = baseObject.m_visibility;
     disableRecalculation = baseObject.disableRecalculation;
     layerId = (baseObject.layer == null) ? 0 : baseObject.layer.m_id;
     // flipFaces = baseObject.flipFaces;
     tilingFactor = baseObject.tilingFactor;
     if (baseObject.m_textParameters != null)
     {
         textParam = TextParameters.Clone(baseObject.m_textParameters, false);
         for (int i = 0; i < textParam.Count(); i++)
         {
             textParam[i].serializableColor = null;
         }
     }
     if (hasCustomTexture == true)
     {
         customTextureName = baseObject.customTexture.name;
     }
     else
     {
         customTextureName = string.Empty;
     }
 }
Beispiel #2
0
 public ProceduralObjectContainer(ProceduralObject baseObject)
 {
     id               = baseObject.id;
     basePrefabName   = baseObject.basePrefabName;
     objectType       = baseObject.baseInfoType;
     renderDistance   = baseObject.renderDistance;
     renderDistLocked = baseObject.renderDistLocked;
     position         = new SerializableVector3(baseObject.m_position);
     rotation         = new SerializableQuaternion(baseObject.m_rotation);
     scale            = 1f;
     if (baseObject.group != null)
     {
         belongsToGroup = true;
         if (baseObject.isRootOfGroup)
         {
             groupRootId = -1; // = we are a group root
         }
         else
         {
             groupRootId = baseObject.group.root.id;
         }
     }
     else
     {
         belongsToGroup = false; // we don't have a group
     }
     color = baseObject.m_color;
     // if (meshStatus > 0)
     meshStatus = baseObject.meshStatus;
     if (meshStatus != 1)
     {
         /*
          * try
          * {
          *  serializedMeshData = new POSerializableMeshData(baseObject);
          *  vertices = null;
          * }
          * catch (Exception e)
          * {
          *  Debug.LogWarning("[ProceduralObjects] Warning : error while compressing Mesh data for object #" + baseObject.id + " (" + baseObject.baseInfoType + ", " + baseObject.basePrefabName + "). Saving uncompressed raw data instead\n" + e);
          *
          *
          * */
         vertices           = SerializableVector3.ToSerializableArray(baseObject.m_mesh.vertices);
         serializedMeshData = null;
         //   }
     }
     else
     {
         serializedMeshData = null;
         vertices           = null;
     }
     hasCustomTexture     = baseObject.customTexture != null;
     visibility           = baseObject.m_visibility;
     disableRecalculation = baseObject.disableRecalculation;
     normalsRecalculation = baseObject.normalsRecalcMode;
     layerId            = (baseObject.layer == null) ? 0 : baseObject.layer.m_id;
     flipFaces          = baseObject.flipFaces;
     disableCastShadows = baseObject.disableCastShadows;
     // recalculateNormals = baseObject.recalculateNormals;
     tilingFactor = baseObject.tilingFactor;
     if (baseObject.m_textParameters != null)
     {
         textParam = TextParameters.Clone(baseObject.m_textParameters, false);
         for (int i = 0; i < textParam.Count(); i++)
         {
             textParam[i].serializableColor = null;
         }
     }
     if (hasCustomTexture == true)
     {
         customTextureName = baseObject.customTexture.name;
     }
     else
     {
         customTextureName = string.Empty;
     }
     modulesData = new List <Dictionary <string, string> >();
     if (baseObject.m_modules != null)
     {
         foreach (POModule m in baseObject.m_modules)
         {
             modulesData.Add(m._get_data(true));
         }
     }
 }