add view resource

This commit is contained in:
Zhuangkh 2023-05-08 18:06:07 +08:00
parent 1e340f2621
commit 4b960489c8
4 changed files with 474 additions and 454 deletions

View File

@ -49,7 +49,7 @@
public enum ViewAttributeScreenUnit
{
PIXEL,
PERCENTAGE
PERCENT
}
/* Types for the "MODEL RESOURCE_LIST" */

View File

@ -201,8 +201,8 @@ namespace IDTF.Net
public void WriteOutput(StreamWriter toStream)
{
toStream.WriteLine("\tVIEW_DATA {");
toStream.WriteLine("\t\tVIEW_TYPE \"{0}\"", this.ViewType.ToString());
toStream.WriteLine("\t\tVIEW_ATTRIBUTE_SCREEN_UNIT \"{0}\"", this.ViewAttributeScreenUnit.ToString());
toStream.WriteLine("\t\tVIEW_TYPE \"{0}\"", this.ViewType.ToString());
toStream.WriteLine("\t\tVIEW_PROJECTION {0}", this.Projection.ToString(Format.SixDecPlFormat));
//TODO - More View settings

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
namespace IDTF.Net
{
@ -24,11 +25,11 @@ namespace IDTF.Net
public abstract class Resource
{
public string Name { get; set; }
public abstract ResourceListType ResourceType {get; }
public abstract ResourceListType ResourceType { get; }
public abstract void Export(StreamWriter toStream);
}
public class LightResource: Resource
public class LightResource : Resource
{
public LightType Type { get; set; }
public Color Color { get; set; }
@ -52,7 +53,7 @@ namespace IDTF.Net
get { return ResourceListType.LIGHT; }
}
}
public class ModelResource: Resource
public class ModelResource : Resource
{
public ModelResource(ModelType type)
: base()
@ -64,7 +65,7 @@ namespace IDTF.Net
public MeshData Mesh { get; set; }
public LineSetData LineSet { get; set; }
public PointSetData PointSet {get; set;}
public PointSetData PointSet { get; set; }
public override void Export(StreamWriter toStream)
{
@ -92,7 +93,7 @@ namespace IDTF.Net
get { return ResourceListType.MODEL; }
}
}
public class ShaderResource: Resource
public class ShaderResource : Resource
{
public string ShaderMaterialName { get; set; }
@ -140,7 +141,7 @@ namespace IDTF.Net
get { return ResourceListType.SHADER; }
}
}
public class MaterialResource: Resource
public class MaterialResource : Resource
{
public bool? AttributeAmbientEnabled { get; set; } //optional
public bool? AttributeDiffuseEnabled { get; set; } //optional
@ -229,14 +230,18 @@ namespace IDTF.Net
}
}
/* NOT IMPLEMENTED */
public class ViewResource : Resource
{
//NOT IMPLEMENTED
public override void Export(StreamWriter toStream)
{
toStream.WriteLine(String.Format("\t\tRESOURCE_NAME \"{0}\"", this.Name));
toStream.WriteLine("\t\tVIEW_PASS_COUNT 1");
toStream.WriteLine("\t\tVIEW_ROOT_NODE_LIST {");
toStream.WriteLine("\t\t\tROOT_NODE 0 {");
toStream.WriteLine("\t\t\t\tROOT_NODE_NAME \"<NULL>\"");
toStream.WriteLine("\t\t\t}");
toStream.WriteLine("\t\t}");
}
public override ResourceListType ResourceType

View File

@ -68,8 +68,8 @@ namespace IDTF.Net
}
private Dictionary<string,LightResource> _lightResources;
public Dictionary<string,LightResource> LightResources
private Dictionary<string, LightResource> _lightResources;
public Dictionary<string, LightResource> LightResources
{
get
{
@ -96,7 +96,7 @@ namespace IDTF.Net
{
get
{
if (_viewResources == null) { _viewResources = new Dictionary<string,ViewResource>(); }
if (_viewResources == null) { _viewResources = new Dictionary<string, ViewResource>(); }
return _viewResources;
}
set { _viewResources = value; }
@ -201,6 +201,21 @@ namespace IDTF.Net
m.WriteOutput(output);
}
//<RESOURCE_LISTS> - View
if (this.ViewResources.Any())
{
output.WriteLine("RESOURCE_LIST \"VIEW\" {");
output.WriteLine("\tRESOURCE_COUNT {0}", this.ViewResources.Count().ToString());
for (int i = 0; i < this.ViewResources.Count(); i++)
{
output.WriteLine("\tRESOURCE {0} {{", i.ToString());
this.ViewResources.ElementAt(i).Value.Export(output);
output.WriteLine("\t}");
}
output.WriteLine("}");
output.WriteLine();
}
//<RESOURCE_LISTS> - Light
if (this.LightResources.Count() > 0)