public void CopyValuesTo(HEU_VolumeCache destCache) { destCache.UIExpanded = UIExpanded; destCache._terrainData = Object.Instantiate(_terrainData); if (_detailProperties != null) { if (destCache._detailProperties == null) { destCache._detailProperties = new HEU_DetailProperties(); } CopyDetailProperties(_detailProperties, destCache._detailProperties); } else { destCache._detailProperties = null; } foreach (HEU_VolumeLayer srcLayer in _layers) { HEU_VolumeLayer destLayer = destCache.GetLayer(srcLayer._layerName); if (destLayer != null) { CopyLayer(srcLayer, destLayer); } } }
public void CopyValuesTo(HEU_VolumeCache destCache) { destCache.UIExpanded = UIExpanded; foreach(HEU_VolumeLayer srcLayer in _layers) { HEU_VolumeLayer destLayer = destCache.GetLayer(srcLayer._layerName); if(destLayer != null) { CopyLayer(srcLayer, destLayer); } } }
public void CopyValuesTo(HEU_VolumeCache destCache) { destCache.UIExpanded = UIExpanded; destCache._terrainData = Object.Instantiate(_terrainData); foreach (HEU_VolumeLayer srcLayer in _layers) { HEU_VolumeLayer destLayer = destCache.GetLayer(srcLayer._layerName); if(destLayer != null) { CopyLayer(srcLayer, destLayer); } } }
public void CopyValuesTo(HEU_VolumeCache destCache) { destCache.UIExpanded = UIExpanded; foreach(HEU_VolumeLayer srcLayer in _layers) { HEU_VolumeLayer destLayer = destCache.GetLayer(srcLayer._layerName); if(destLayer != null) { destLayer._strength = srcLayer._strength; destLayer._splatTexture = srcLayer._splatTexture; destLayer._normalTexture = srcLayer._normalTexture; destLayer._tileSize = srcLayer._tileSize; destLayer._tileOffset = srcLayer._tileOffset; destLayer._metallic = srcLayer._metallic; destLayer._smoothness = srcLayer._smoothness; destLayer._uiExpanded = srcLayer._uiExpanded; } } }
public void ProcessVolumeParts(HEU_SessionBase session, List <HEU_PartData> volumeParts, bool bRebuild) { int numVolumeParts = volumeParts.Count; if (numVolumeParts == 0) { DestroyVolumeCache(); } else if (_volumeCaches == null) { _volumeCaches = new List <HEU_VolumeCache>(); } // First update volume caches. Each volume cache represents a set of terrain layers grouped by tile index. // Therefore each volume cache represents a potential Unity Terrain (containing layers) _volumeCaches = HEU_VolumeCache.UpdateVolumeCachesFromParts(session, this, volumeParts, _volumeCaches); // Heightfield scatter nodes come in as mesh-type parts with attribute instancing. // So process them here to get all the tree/detail instance scatter information. int numParts = _parts.Count; for (int i = 0; i < numParts; ++i) { // Find the terrain tile (use primitive attr). Assume 0 tile if not set (i.e. not split into tiles) int terrainTile = 0; HAPI_AttributeInfo tileAttrInfo = new HAPI_AttributeInfo(); int[] tileAttrData = new int[0]; if (HEU_GeneralUtility.GetAttribute(session, GeoID, _parts[i].PartID, HEU_Defines.HAPI_HEIGHTFIELD_TILE_ATTR, ref tileAttrInfo, ref tileAttrData, session.GetAttributeIntData)) { if (tileAttrData != null && tileAttrData.Length > 0) { terrainTile = tileAttrData[0]; } } // Find the volumecache associated with this part using the terrain tile index HEU_VolumeCache volumeCache = GetVolumeCacheByTileIndex(terrainTile); if (volumeCache == null) { continue; } HEU_VolumeLayer volumeLayer = volumeCache.GetLayer(_parts[i].GetVolumeLayerName()); if (volumeLayer != null && volumeLayer._layerType == HFLayerType.DETAIL) { // Clear out outputs since it might have been created when the part was created. _parts[i].DestroyAllData(); volumeCache.PopulateDetailPrototype(session, GeoID, _parts[i].PartID, volumeLayer); } else if (_parts[i].IsAttribInstancer()) { HAPI_AttributeInfo treeInstAttrInfo = new HAPI_AttributeInfo(); if (HEU_GeneralUtility.GetAttributeInfo(session, GeoID, _parts[i].PartID, HEU_Defines.HEIGHTFIELD_TREEINSTANCE_PROTOTYPEINDEX, ref treeInstAttrInfo)) { if (treeInstAttrInfo.exists && treeInstAttrInfo.count > 0) { // Clear out outputs since it might have been created when the part was created. _parts[i].DestroyAllData(); // Mark the instancers as having been created so that the object instancer step skips this. _parts[i].ObjectInstancesBeenGenerated = true; // Now populate scatter trees based on attributes on this part volumeCache.PopulateScatterTrees(session, GeoID, _parts[i].PartID, treeInstAttrInfo.count); } } } } // Now generate the terrain for each volume cache foreach (HEU_VolumeCache cache in _volumeCaches) { cache.GenerateTerrainWithAlphamaps(session, ParentAsset, bRebuild); cache.IsDirty = false; } }