void addModelStubs(GeoSet geoset) { RuntimeData rd = RuntimeData.get(); foreach (Model m in geoset.subs) { GeometryModifiersData gmod = rd.m_modifiers.findGeomModifier(m.name, ""); if (gmod != null) { if (null == m.trck_node) { m.trck_node = new ModelModifiers(); } if (m.name == "_FLRSHPS_WIN_H__FLRSHPS_Window") { Debug.LogFormat("GMod for geoset model {0}", gmod); } m.trck_node = gmod.node.clone(); m.src_mod = gmod; } } }
/// /// \brief Will split the \arg texpath into directories, and finds the closest TextureModifiers /// that matches a directory /// \param texpath contains a full path to the texture /// \return texture modifier object, if any /// static TextureModifiers_Data modFromTextureName(string texpath) { RuntimeData rd = RuntimeData.get(); List <string> split = texpath.Split('/').ToList(); while (split.Count != 0) { if (split[0] == "texture_library") { split.RemoveAt(0); break; } split.RemoveAt(0); } SceneModifiers mods = rd.m_modifiers; var texmods = mods.m_texture_path_to_mod; // scan from the back of the texture path, until a modifier is found. if (texpath.Contains("shape")) { Debug.LogFormat("Mod for {0} -{1}", texpath, string.Join(",", split)); } while (split.Count != 0) { TextureModifiers_Data texmod_val; if (texmods.TryGetValue(split[split.Count - 1].ToLower(), out texmod_val)) { return(texmod_val); } split.RemoveAt(split.Count - 1); } return(null); }
static public TextureWrapper loadTexHeader(string tex_name) { string fname = getNamedTexturePath(tex_name); if (String.IsNullOrEmpty(fname)) { Debug.LogFormat("LoadTexHeader failed for asset {0}->{1}", tex_name, fname); return(null); } RuntimeData rd = RuntimeData.get(); TextureWrapper res; FileInfo tex_path = new FileInfo(fname); string lookupstring = Path.GetFileNameWithoutExtension(tex_path.Name).ToLower(); if (rd.m_loaded_textures.TryGetValue(lookupstring, out res)) { return(res); } res = new TextureWrapper(); res.tex = AssetDatabase.LoadAssetAtPath <Texture>(fname); res.info = modFromTextureName(Path.GetDirectoryName(fname) + "/" + Path.GetFileNameWithoutExtension(fname)); TexOpt texopt_flags = 0; if (res.info != null) { texopt_flags = (TexOpt)res.info.Flags; } string upname = fname.ToUpper(); if (upname.Contains("PLAYERS/") || upname.Contains("ENEMIES/") || upname.Contains("NPCS/")) { res.flags |= TextureWrapper.TexFlag.BUMPMAP_MIRROR | TextureWrapper.TexFlag.CLAMP; } if (upname.Contains("MAPS/")) { res.flags |= TextureWrapper.TexFlag.CLAMP; } if (texopt_flags.HasFlag(TexOpt.REPLACEABLE)) { res.flags |= TextureWrapper.TexFlag.REPLACEABLE; } if (texopt_flags.HasFlag(TexOpt.BUMPMAP)) { res.flags |= TextureWrapper.TexFlag.BUMPMAP; } res.scaleUV0 = new Vector2(1, 1); res.scaleUV1 = new Vector2(1, 1); if (res.info != null && 0 != res.info.BumpMap.Length) { res.bumpmap = res.info.BumpMap; } string detailname; if (texopt_flags.HasFlag(TexOpt.DUAL)) { if (res.info.Blend.Length != 0) { res.flags |= TextureWrapper.TexFlag.DUAL; res.BlendType = (CoHBlendMode)res.info.BlendType; res.scaleUV0 = res.info.ScaleST0; res.scaleUV1 = res.info.ScaleST1; res.detailname = res.info.Blend; if (res.BlendType == CoHBlendMode.ADDGLOW && res.detailname.ToLower() == "grey") { res.detailname = "black"; } // copy the 'res' into the handle based storage, and record the handle rd.m_loaded_textures[lookupstring] = res; return(res); } Debug.Log("Detail texture " + res.info.Blend + " does not exist for texture mod" + res.info.name); detailname = "grey"; } else if (lookupstring.ToLower() == "invisible") { detailname = "invisible"; } else { detailname = "grey"; } if (res.BlendType == CoHBlendMode.ADDGLOW && detailname.ToLower() == "grey") { detailname = "black"; } res.detailname = detailname; // copy the 'res' into the handle based storage, and record the handle rd.m_loaded_textures[lookupstring] = res; return(res); }
public RuntimeData() { s_instance = this; }
public void groupApplyModifiers() { RuntimeData rd = RuntimeData.get(); Model model = m_model; if (null == model) { return; } GeometryModifiersData mods = rd.m_modifiers.findGeomModifier(model.name, m_dir); if (null == mods) { return; } if (mods.LodNear != 0.0f) { lod_near = mods.LodNear; } if (mods.LodFar != 0.0f) { lod_far = mods.LodFar; } if (mods.LodNearFade != 0.0f) { lod_near_fade = mods.LodNearFade; } if (mods.LodFarFade != 0.0f) { lod_far_fade = mods.LodFarFade; } if (mods.LodScale != 0.0f) { lod_scale = mods.LodScale; } GroupFlags v1 = (GroupFlags)mods.GroupFlags; shadow_dist = mods.ShadowDist; parent_fade = v1.HasFlag(GroupFlags.ParentFade); region_marker = v1.HasFlag(GroupFlags.RegionMarker); volume_trigger = v1.HasFlag(GroupFlags.VolumeTrigger); water_volume = v1.HasFlag(GroupFlags.WaterVolume); lava_volume = v1.HasFlag(GroupFlags.LavaVolume); sewer_volume = v1.HasFlag(GroupFlags.SewerWaterVolume); door_volume = v1.HasFlag(GroupFlags.DoorVolume); key_light = v1.HasFlag(GroupFlags.KeyLight); tray = v1.HasFlag(GroupFlags.VisTray) | v1.HasFlag(GroupFlags.VisOutside); if (mods.LodNear != 0.0f || mods.LodFar != 0.0f || mods.LodNearFade != 0.0f || mods.LodFarFade != 0.0f || mods.LodScale != 0.0f) { lod_fromtrick = true; } /* * if (mods.node._TrickFlags.HasFlag(TrickFlags.NoColl)) * ; //TODO: disable collisions for this node * if (mods.node._TrickFlags.HasFlag(TrickFlags.SelectOnly)) * ; // set the model's triangles as only selectable ?? ( selection mesh ? ) * if (mods.node._TrickFlags.HasFlag(TrickFlags.NotSelectable)) * ; // */ }