public PAKFile(PAKResourcePool pool, PAKDirectory parent, PAKArchiveEntry entry) { this.pool = pool; Parent = parent; Path = entry.path; this.entry = entry; }
private void LoadActorNow(IResource resource) { if (resource.Equals(CurrentResource)) { return; } CurrentResource = null; using var contentStream = resource.OpenContent(); if (contentStream == null) { throw new IOException($"Could not open actor at {resource.Path.ToPOSIXString()}"); } description = ActorExDescription.ReadNew(contentStream); body = new Part(localDiContainer, description.body.model, description.body.animations); body.location.Parent = actorLocation; wings = null; if (description.HasWings) { wings = new Part(localDiContainer, description.wings.model, description.wings.animations); wings.location.Parent = body.skeleton.Bones[description.attachWingsToBone]; } controls.ResetView(); fbArea.IsDirty = true; CurrentResource = resource; }
public CombinedDirectory(IResourcePool pool, IResource?parent, FilePath path, IEnumerable <IResource> sources) { this.sources = sources.ToArray(); Path = path; Pool = pool; Parent = parent; }
private void LoadEffectNow(IResource resource) { if (resource.Equals(CurrentResource)) { return; } CurrentResource = null; emptyEffect = new EffectCombiner(); effectRenderer?.Dispose(); effectRenderer = new EffectCombinerRenderer(diContainer, resource); effectRenderer.Location.LocalPosition = Vector3.Zero; effectRenderer.Location.LocalRotation = Quaternion.Identity; editor.ClearInfoSections(); editor.AddInfoSection("Info", HandleInfoContent); editor.AddInfoSection("Playback", HandlePlaybackContent); foreach (var(partRenderer, i) in effectRenderer.Parts.Indexed()) { var part = Effect.parts[i]; editor.AddInfoSection($"{part.Type} \"{part.Name}\"", part switch { MovingPlanes mp => () => HandlePart(mp, (MovingPlanesRenderer)partRenderer), RandomPlanes rp => () => HandlePart(rp, (RandomPlanesRenderer)partRenderer), ParticleEmitter pe => () => HandlePart(pe, (ParticleEmitterRenderer)partRenderer), BeamStar bs => () => HandlePart(bs, (BeamStarRenderer)partRenderer), _ => () => { } // ignore for now }, defaultOpen: false, () => HandlePartPreContent(i));
private void LoadModelNow(IResource resource) { if (resource.Equals(CurrentResource)) { return; } CurrentResource = null; var texturePaths = new[] { textureLoader.GetTexturePathFromModel(resource.Path), new FilePath("resources/textures/models"), new FilePath("resources/textures/worlds"), }; geometryBuffers = new ClumpBuffers(diContainer, resource); AddDisposable(geometryBuffers); foreach (var oldTexture in materials.Select(m => m.MainTexture.Texture)) { imGuiRenderer.RemoveImGuiBinding(oldTexture); } materials = new ModelStandardMaterial[geometryBuffers.SubMeshes.Count]; foreach (var(rwMaterial, index) in geometryBuffers.SubMeshes.Select(s => s.Material).Indexed()) { var material = materials[index] = new ModelStandardMaterial(diContainer); (material.MainTexture.Texture, material.Sampler.Sampler) = textureLoader.LoadTexture(texturePaths, rwMaterial); material.LinkTransformsTo(camera); material.World.Ref = Matrix4x4.Identity; material.Uniforms.Ref = ModelStandardMaterialUniforms.Default; material.Uniforms.Ref.vertexColorFactor = 0.0f; // they seem to be set to some gray for models? material.Uniforms.Ref.tint = rwMaterial.color.ToFColor(); AddDisposable(material); } modelMaterialEdit.Materials = materials; skeletonRenderer = null; if (geometryBuffers.Skin != null) { var skeleton = new Skeleton(geometryBuffers.Skin); skeletonRenderer = new DebugSkeletonRenderer(diContainer.ExtendedWith(camera, locationBuffer), geometryBuffers, skeleton); AddDisposable(skeletonRenderer); } collider = geometryBuffers.RWGeometry.FindChildById(zzio.rwbs.SectionId.CollisionPLG, true) == null ? null : new GeometryTreeCollider(geometryBuffers.RWGeometry, location: null); controls.ResetView(); HighlightSplit(-1); fbArea.IsDirty = true; CurrentResource = resource; Window.Title = $"Model Viewer - {resource.Path.ToPOSIXString()}"; }
public LorahostTheme(IResource?header, string?copyright, string?title, string?subtitle, string?action, string?actionTitle) { _Copyright = copyright; _Title = title; _Subtitle = subtitle; _Action = action; _ActionTitle = actionTitle; var resources = Layout.Create() .Fallback(Modules.IO.Resources.From(ResourceTree.FromAssembly("Lorahost.resources"))); if (header != null) { resources.Add("header.jpg", Download.From(header).Type(ContentType.ImageJpg)); } Resources = resources; ErrorHandler = ModScriban.Template <ErrorModel>(Resource.FromAssembly("Error.html")).Build(); Renderer = ModScriban.Template <WebsiteModel>(Resource.FromAssembly("Template.html")).Build(); }
public bool TryConvertToResourceInstance(ResourceDocument resourceDocument, [NotNullWhen(true)] out IResource?resourceInstance) { return(TryConvertToResourceInstanceImpl(resourceDocument, out resourceInstance)); }
protected abstract bool TryConvertToResourceInstanceImpl(ResourceDocument resourceDocument, [NotNullWhen(true)] out IResource?resourceInstance);
public CombinedDirectory(IResourcePool pool, IResource?parent, string pathText, IEnumerable <IResource> sources) : this(pool, parent, new FilePath(pathText), sources) { }
public FileResource(FileResourcePool pool, IResource?parent, FilePath path) { Path = path; Parent = parent; this.pool = pool; }
public DirectoryResource(FileResourcePool pool, IResource?parent, string pathText) : this(pool, parent, new FilePath(pathText)) { }
public LorahostBuilder Header(IResource headerProvider) { _Header = headerProvider; return(this); }
public PAKDirectory(PAKArchiveResourcePool pool, IResource?parent, FilePath path) { this.pool = pool; Path = path; Parent = parent; }
public PAKDirectory(PAKArchiveResourcePool pool, IResource?parent, string pathText) : this(pool, parent, new FilePath(pathText)) { }
public InMemoryDirectory(IResourcePool pool, IResource?parent, FilePath path) { Pool = pool; Path = path; Parent = parent; }
public InMemoryDirectory(IResourcePool pool, IResource?parent, string pathText) : this(pool, parent, new FilePath(pathText)) { }