迁移命名空间

This commit is contained in:
Zhuangkh 2023-04-25 15:48:55 +08:00
parent 59ca1e5c79
commit 1d630cd41d
20 changed files with 181 additions and 220 deletions

View File

@ -1,13 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; namespace IDTF.Net
using System.IO;
namespace Duffer
{ {
public class Point3 public class Point3
{ {

View File

@ -1,9 +1,4 @@
using System; namespace IDTF.Net
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Duffer
{ {
public enum NodeType public enum NodeType
{ {

View File

@ -1,10 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Duffer namespace IDTF.Net
{ {
internal static class ExtensionMethods internal static class ExtensionMethods
{ {

View File

@ -1,4 +1,4 @@
namespace Duffer namespace IDTF.Net
{ {
public sealed class Format public sealed class Format
{ {

View File

@ -1,10 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; using System.IO;
namespace Duffer namespace IDTF.Net
{ {
/* Modifiers /* Modifiers
* Possible modifier types: Animation, Shading, Bone weight, Clod, Subdiv, Glyph * Possible modifier types: Animation, Shading, Bone weight, Clod, Subdiv, Glyph

View File

@ -1,9 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; namespace IDTF.Net
namespace Duffer
{ {
// References: // References:
// http://jmol.svn.sourceforge.net/viewvc/jmol/trunk/Jmol/src/org/jmol/export/_IdtfExporter.java?revision=HEAD&view=markup // http://jmol.svn.sourceforge.net/viewvc/jmol/trunk/Jmol/src/org/jmol/export/_IdtfExporter.java?revision=HEAD&view=markup

View File

@ -1,12 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Drawing; using System.Drawing;
using System.IO;
namespace IDTF.Net
namespace Duffer
{ {
/* Resource lists /* Resource lists
* Possible Resource_List types: View, Light, Model, Shader, Material, Texture, Motion * Possible Resource_List types: View, Light, Model, Shader, Material, Texture, Motion

View File

@ -1,10 +1,8 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
namespace Duffer namespace IDTF.Net
{ {
/// <summary> /// <summary>
/// The Scene is the root node in the IDTF file, all objects should be aded to the scene, /// The Scene is the root node in the IDTF file, all objects should be aded to the scene,

View File

@ -1,10 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO;
namespace Duffer namespace IDTF.Net
{ {
static class ListExtensions static class ListExtensions
{ {

View File

@ -1,10 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
namespace Duffer namespace IDTF.Net
{ {
public class MetaData public class MetaData
{ {

View File

@ -1,10 +1,7 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
namespace Duffer namespace IDTF.Net
{ {
public abstract class MetaDataItem public abstract class MetaDataItem
{ {

View File

@ -1,9 +1,6 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Duffer namespace IDTF.Net
{ {
public class Shader public class Shader
{ {

View File

@ -1,10 +1,7 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; using System.IO;
namespace Duffer namespace IDTF.Net
{ {
public class Parent public class Parent

View File

@ -6,7 +6,7 @@ using System.IO;
using System.Drawing; using System.Drawing;
namespace Duffer namespace IDTF.Net
{ {
/* This file contains data descriptions for the resource_lists. */ /* This file contains data descriptions for the resource_lists. */
@ -21,7 +21,7 @@ namespace Duffer
{ {
public ShadingDescription(int id = 0) public ShadingDescription(int id = 0)
{ {
this.ShaderID = id; ShaderID = id;
} }
public int ShaderID { get; set; } public int ShaderID { get; set; }
@ -42,12 +42,12 @@ namespace Duffer
internal void Export(StreamWriter toStream) internal void Export(StreamWriter toStream)
{ {
toStream.WriteLine(String.Format("\t\t\t\t\tTEXTURE_LAYER_COUNT {0}", this.TextureCoordDimensionList.Count())); toStream.WriteLine(string.Format("\t\t\t\t\tTEXTURE_LAYER_COUNT {0}", TextureCoordDimensionList.Count()));
if (_textureCoordDimList != null) if (_textureCoordDimList != null)
{ {
ListExtensions.ExportTextureCoordListToStream(_textureCoordDimList, toStream); ListExtensions.ExportTextureCoordListToStream(_textureCoordDimList, toStream);
} }
toStream.WriteLine(String.Format("\t\t\t\t\tSHADER_ID {0}", this.ShaderID)); toStream.WriteLine(string.Format("\t\t\t\t\tSHADER_ID {0}", ShaderID));
} }
} }
@ -124,149 +124,149 @@ namespace Duffer
{ {
get get
{ {
if (this._shadingDescriptionList == null) this._shadingDescriptionList = new List<ShadingDescription>(); if (_shadingDescriptionList == null) _shadingDescriptionList = new List<ShadingDescription>();
return this._shadingDescriptionList; return _shadingDescriptionList;
} }
set { this._shadingDescriptionList = value; } set { _shadingDescriptionList = value; }
} }
public List<Int3> MeshFacePositionList public List<Int3> MeshFacePositionList
{ {
get get
{ {
if (this._meshFacePositionList == null) this._meshFacePositionList = new List<Int3>(); if (_meshFacePositionList == null) _meshFacePositionList = new List<Int3>();
return this._meshFacePositionList; return _meshFacePositionList;
} }
set { this._meshFacePositionList = value; } set { _meshFacePositionList = value; }
} }
public List<Int3> MeshFaceNormalList public List<Int3> MeshFaceNormalList
{ {
get get
{ {
if (this._meshFaceNormalList == null) this._meshFaceNormalList = new List<Int3>(); if (_meshFaceNormalList == null) _meshFaceNormalList = new List<Int3>();
return this._meshFaceNormalList; return _meshFaceNormalList;
} }
set { this._meshFaceNormalList = value; } set { _meshFaceNormalList = value; }
} }
public List<int> MeshFaceShadingList public List<int> MeshFaceShadingList
{ {
get get
{ {
if (this._meshFaceShadingList == null) this._meshFaceShadingList = new List<int>(); if (_meshFaceShadingList == null) _meshFaceShadingList = new List<int>();
return this._meshFaceShadingList; return _meshFaceShadingList;
} }
set { this._meshFaceShadingList = value; } set { _meshFaceShadingList = value; }
} }
public List<FaceTextureCoord> MeshFaceTextureCoordinateList public List<FaceTextureCoord> MeshFaceTextureCoordinateList
{ {
get get
{ {
if (this._meshFaceTextureCoordinateList == null) this._meshFaceTextureCoordinateList = new List<FaceTextureCoord>(); if (_meshFaceTextureCoordinateList == null) _meshFaceTextureCoordinateList = new List<FaceTextureCoord>();
return this._meshFaceTextureCoordinateList; return _meshFaceTextureCoordinateList;
} }
set { this._meshFaceTextureCoordinateList = value; } set { _meshFaceTextureCoordinateList = value; }
} }
public List<Int3> MeshFaceDiffuseColorList public List<Int3> MeshFaceDiffuseColorList
{ {
get get
{ {
if (this._meshFaceDiffuseColorList == null) this._meshFaceDiffuseColorList = new List<Int3>(); if (_meshFaceDiffuseColorList == null) _meshFaceDiffuseColorList = new List<Int3>();
return this._meshFaceDiffuseColorList; return _meshFaceDiffuseColorList;
} }
set { this._meshFaceDiffuseColorList = value; } set { _meshFaceDiffuseColorList = value; }
} }
public List<Int3> MeshFaceSpecularColorList public List<Int3> MeshFaceSpecularColorList
{ {
get get
{ {
if (this._meshFaceSpecularColorList == null) this._meshFaceSpecularColorList = new List<Int3>(); if (_meshFaceSpecularColorList == null) _meshFaceSpecularColorList = new List<Int3>();
return this._meshFaceSpecularColorList; return _meshFaceSpecularColorList;
} }
set { this._meshFaceSpecularColorList = value; } set { _meshFaceSpecularColorList = value; }
} }
public List<Point3> ModelPositionList public List<Point3> ModelPositionList
{ {
get get
{ {
if (this._modelPositionList == null) this._modelPositionList = new List<Point3>(); if (_modelPositionList == null) _modelPositionList = new List<Point3>();
return this._modelPositionList; return _modelPositionList;
} }
set { this._modelPositionList = value; } set { _modelPositionList = value; }
} }
public List<Point3> ModelNormalList public List<Point3> ModelNormalList
{ {
get get
{ {
if (this._modelNormalList == null) this._modelNormalList = new List<Point3>(); if (_modelNormalList == null) _modelNormalList = new List<Point3>();
return this._modelNormalList; return _modelNormalList;
} }
set { this._modelNormalList = value; } set { _modelNormalList = value; }
} }
public List<Color> ModelDiffuseColorList public List<Color> ModelDiffuseColorList
{ {
get get
{ {
if (this._modelDiffuseColorList == null) this._modelDiffuseColorList = new List<Color>(); if (_modelDiffuseColorList == null) _modelDiffuseColorList = new List<Color>();
return this._modelDiffuseColorList; return _modelDiffuseColorList;
} }
set { this._modelDiffuseColorList = value; } set { _modelDiffuseColorList = value; }
} }
public List<Color> ModelSpecularColorList public List<Color> ModelSpecularColorList
{ {
get get
{ {
if (this._modelSpecularColorList == null) this._modelSpecularColorList = new List<Color>(); if (_modelSpecularColorList == null) _modelSpecularColorList = new List<Color>();
return this._modelSpecularColorList; return _modelSpecularColorList;
} }
set { this._modelSpecularColorList = value; } set { _modelSpecularColorList = value; }
} }
public List<Vector4> ModelTextureCoordList public List<Vector4> ModelTextureCoordList
{ {
get get
{ {
if (this._modelTextureCoordList == null) this._modelTextureCoordList = new List<Vector4>(); if (_modelTextureCoordList == null) _modelTextureCoordList = new List<Vector4>();
return this._modelTextureCoordList; return _modelTextureCoordList;
} }
set { this._modelTextureCoordList = value; } set { _modelTextureCoordList = value; }
} }
public List<int> MeshBasePositionList public List<int> MeshBasePositionList
{ {
get get
{ {
if (this._meshBasePositionList == null) this._meshBasePositionList = new List<int>(); if (_meshBasePositionList == null) _meshBasePositionList = new List<int>();
return this._meshBasePositionList; return _meshBasePositionList;
} }
set { this._meshBasePositionList = value; } set { _meshBasePositionList = value; }
} }
public void Export(StreamWriter toStream) public void Export(StreamWriter toStream)
{ {
toStream.WriteLine(String.Format("\t\tMESH {{")); toStream.WriteLine(string.Format("\t\tMESH {{"));
toStream.WriteLine(String.Format("\t\t\tFACE_COUNT {0}", this.MeshFacePositionList.Count().ToString())); toStream.WriteLine(string.Format("\t\t\tFACE_COUNT {0}", MeshFacePositionList.Count().ToString()));
toStream.WriteLine(String.Format("\t\t\tMODEL_POSITION_COUNT {0}", this.ModelPositionList.Count().ToString())); toStream.WriteLine(string.Format("\t\t\tMODEL_POSITION_COUNT {0}", ModelPositionList.Count().ToString()));
// toStream.WriteLine(String.Format("\t\t\tMODEL_BASE_POSITION_COUNT {0} {{", this.MeshBasePositionList.Count().ToString())); // toStream.WriteLine(String.Format("\t\t\tMODEL_BASE_POSITION_COUNT {0} {{", this.MeshBasePositionList.Count().ToString()));
toStream.WriteLine(String.Format("\t\t\tMODEL_NORMAL_COUNT {0}", this.ModelNormalList.Count().ToString())); toStream.WriteLine(string.Format("\t\t\tMODEL_NORMAL_COUNT {0}", ModelNormalList.Count().ToString()));
toStream.WriteLine(String.Format("\t\t\tMODEL_DIFFUSE_COLOR_COUNT {0}", this.ModelDiffuseColorList.Count().ToString())); toStream.WriteLine(string.Format("\t\t\tMODEL_DIFFUSE_COLOR_COUNT {0}", ModelDiffuseColorList.Count().ToString()));
toStream.WriteLine(String.Format("\t\t\tMODEL_SPECULAR_COLOR_COUNT {0}", this.ModelSpecularColorList.Count().ToString())); toStream.WriteLine(string.Format("\t\t\tMODEL_SPECULAR_COLOR_COUNT {0}", ModelSpecularColorList.Count().ToString()));
toStream.WriteLine(String.Format("\t\t\tMODEL_TEXTURE_COORD_COUNT {0}", this.ModelTextureCoordList.Count().ToString())); toStream.WriteLine(string.Format("\t\t\tMODEL_TEXTURE_COORD_COUNT {0}", ModelTextureCoordList.Count().ToString()));
toStream.WriteLine(String.Format("\t\t\tMODEL_BONE_COUNT {0}", 0)); //What does this count??? toStream.WriteLine(string.Format("\t\t\tMODEL_BONE_COUNT {0}", 0)); //What does this count???
toStream.WriteLine(String.Format("\t\t\tMODEL_SHADING_COUNT {0}", this.ShadingDescriptionList.Count().ToString())); toStream.WriteLine(string.Format("\t\t\tMODEL_SHADING_COUNT {0}", ShadingDescriptionList.Count().ToString()));
ListExtensions.ExportShadingListToStream(this.ShadingDescriptionList, toStream); ListExtensions.ExportShadingListToStream(ShadingDescriptionList, toStream);
ListExtensions.ExportInt3ListToStream(this.MeshFacePositionList, toStream, "MESH_FACE_POSITION_LIST"); ListExtensions.ExportInt3ListToStream(MeshFacePositionList, toStream, "MESH_FACE_POSITION_LIST");
ListExtensions.ExportInt3ListToStream(this.MeshFaceNormalList, toStream, "MESH_FACE_NORMAL_LIST"); ListExtensions.ExportInt3ListToStream(MeshFaceNormalList, toStream, "MESH_FACE_NORMAL_LIST");
ListExtensions.ExportIntListToStream(this.MeshFaceShadingList, toStream, "MESH_FACE_SHADING_LIST"); ListExtensions.ExportIntListToStream(MeshFaceShadingList, toStream, "MESH_FACE_SHADING_LIST");
ListExtensions.ExportMeshFaceTextureCoordListToStream(this.MeshFaceTextureCoordinateList, toStream); ListExtensions.ExportMeshFaceTextureCoordListToStream(MeshFaceTextureCoordinateList, toStream);
ListExtensions.ExportInt3ListToStream(this.MeshFaceDiffuseColorList, toStream, "MESH_FACE_DIFFUSE_COLOR_LIST"); ListExtensions.ExportInt3ListToStream(MeshFaceDiffuseColorList, toStream, "MESH_FACE_DIFFUSE_COLOR_LIST");
ListExtensions.ExportInt3ListToStream(this.MeshFaceSpecularColorList, toStream, "MESH_FACE_SPECULAR_COLOR_LIST"); ListExtensions.ExportInt3ListToStream(MeshFaceSpecularColorList, toStream, "MESH_FACE_SPECULAR_COLOR_LIST");
ListExtensions.ExportPoint3ListToStream(this.ModelPositionList, toStream, "MODEL_POSITION_LIST"); ListExtensions.ExportPoint3ListToStream(ModelPositionList, toStream, "MODEL_POSITION_LIST");
ListExtensions.ExportPoint3ListToStream(this.ModelNormalList, toStream, "MODEL_NORMAL_LIST"); ListExtensions.ExportPoint3ListToStream(ModelNormalList, toStream, "MODEL_NORMAL_LIST");
ListExtensions.ExportColor4ListToStream(this.ModelDiffuseColorList, toStream, "MODEL_DIFFUSE_COLOR_LIST"); ListExtensions.ExportColor4ListToStream(ModelDiffuseColorList, toStream, "MODEL_DIFFUSE_COLOR_LIST");
ListExtensions.ExportColor4ListToStream(this.ModelSpecularColorList, toStream, "MODEL_NORMAL_LIST"); ListExtensions.ExportColor4ListToStream(ModelSpecularColorList, toStream, "MODEL_NORMAL_LIST");
ListExtensions.ExportVector4ListToStream(this.ModelTextureCoordList, toStream, "MODEL_TEXTURE_COORD_LIST"); ListExtensions.ExportVector4ListToStream(ModelTextureCoordList, toStream, "MODEL_TEXTURE_COORD_LIST");
ListExtensions.ExportIntListToStream(this.MeshBasePositionList, toStream, "MESH_BASE_POSITION_LIST"); ListExtensions.ExportIntListToStream(MeshBasePositionList, toStream, "MESH_BASE_POSITION_LIST");
toStream.WriteLine(String.Format("\t\t}}")); toStream.WriteLine(string.Format("\t\t}}"));
} }
} }
@ -292,7 +292,7 @@ namespace Duffer
if (_shadingDescriptionList == null) _shadingDescriptionList = new List<ShadingDescription>(); if (_shadingDescriptionList == null) _shadingDescriptionList = new List<ShadingDescription>();
return _shadingDescriptionList; return _shadingDescriptionList;
} }
set { this._shadingDescriptionList = value; } set { _shadingDescriptionList = value; }
} }
public List<Int2> LinePositionList public List<Int2> LinePositionList
{ {
@ -316,10 +316,10 @@ namespace Duffer
{ {
get get
{ {
if (this._lineShadingList == null) this._lineShadingList = new List<int>(); if (_lineShadingList == null) _lineShadingList = new List<int>();
return this._lineShadingList; return _lineShadingList;
} }
set { this._lineShadingList = value; } set { _lineShadingList = value; }
} }
public List<LineTextureCoord> LineTextureCoordinateList public List<LineTextureCoord> LineTextureCoordinateList
{ {
@ -334,10 +334,10 @@ namespace Duffer
{ {
get get
{ {
if (this._lineDiffuseColorList == null) this._lineDiffuseColorList = new List<Int2>(); if (_lineDiffuseColorList == null) _lineDiffuseColorList = new List<Int2>();
return this._lineDiffuseColorList; return _lineDiffuseColorList;
} }
set { this._lineDiffuseColorList = value; } set { _lineDiffuseColorList = value; }
} }
public List<Int2> LineSpecularColorList public List<Int2> LineSpecularColorList
{ {
@ -352,60 +352,60 @@ namespace Duffer
{ {
get get
{ {
if (this._modelPositionList == null) this._modelPositionList = new List<Point3>(); if (_modelPositionList == null) _modelPositionList = new List<Point3>();
return this._modelPositionList; return _modelPositionList;
} }
set { this._modelPositionList = value; } set { _modelPositionList = value; }
} }
public List<Point3> ModelNormalList public List<Point3> ModelNormalList
{ {
get get
{ {
if (this._modelNormalList == null) this._modelNormalList = new List<Point3>(); if (_modelNormalList == null) _modelNormalList = new List<Point3>();
return this._modelNormalList; return _modelNormalList;
} }
set { this._modelNormalList = value; } set { _modelNormalList = value; }
} }
public List<Color> ModelDiffuseColorList public List<Color> ModelDiffuseColorList
{ {
get get
{ {
if (this._modelDiffuseColorList == null) this._modelDiffuseColorList = new List<Color>(); if (_modelDiffuseColorList == null) _modelDiffuseColorList = new List<Color>();
return this._modelDiffuseColorList; return _modelDiffuseColorList;
} }
set { this._modelDiffuseColorList = value; } set { _modelDiffuseColorList = value; }
} }
public List<Color> ModelSpecularColorList public List<Color> ModelSpecularColorList
{ {
get get
{ {
if (this._modelSpecularColorList == null) this._modelSpecularColorList = new List<Color>(); if (_modelSpecularColorList == null) _modelSpecularColorList = new List<Color>();
return this._modelSpecularColorList; return _modelSpecularColorList;
} }
set { this._modelSpecularColorList = value; } set { _modelSpecularColorList = value; }
} }
public List<Vector4> ModelTextureCoordList public List<Vector4> ModelTextureCoordList
{ {
get get
{ {
if (this._modelTextureCoordList == null) this._modelTextureCoordList = new List<Vector4>(); if (_modelTextureCoordList == null) _modelTextureCoordList = new List<Vector4>();
return this._modelTextureCoordList; return _modelTextureCoordList;
} }
set { this._modelTextureCoordList = value; } set { _modelTextureCoordList = value; }
} }
public void Export(StreamWriter toStream) public void Export(StreamWriter toStream)
{ {
toStream.WriteLine(String.Format("\t\tLINE_SET {{")); toStream.WriteLine(string.Format("\t\tLINE_SET {{"));
toStream.WriteLine(String.Format("\t\t\tLINE_COUNT {0}", LinePositionList.Count().ToString())); toStream.WriteLine(string.Format("\t\t\tLINE_COUNT {0}", LinePositionList.Count().ToString()));
toStream.WriteLine(String.Format("\t\t\tMODEL_POSITION_COUNT {0}", ModelPositionList.Count().ToString())); toStream.WriteLine(string.Format("\t\t\tMODEL_POSITION_COUNT {0}", ModelPositionList.Count().ToString()));
toStream.WriteLine(String.Format("\t\t\tMODEL_NORMAL_COUNT {0}", ModelNormalList.Count().ToString())); toStream.WriteLine(string.Format("\t\t\tMODEL_NORMAL_COUNT {0}", ModelNormalList.Count().ToString()));
toStream.WriteLine(String.Format("\t\t\tMODEL_DIFFUSE_COLOR_COUNT {0}", ModelDiffuseColorList.Count().ToString())); toStream.WriteLine(string.Format("\t\t\tMODEL_DIFFUSE_COLOR_COUNT {0}", ModelDiffuseColorList.Count().ToString()));
toStream.WriteLine(String.Format("\t\t\tMODEL_SPECULAR_COLOR_COUNT {0}", ModelSpecularColorList.Count().ToString())); toStream.WriteLine(string.Format("\t\t\tMODEL_SPECULAR_COLOR_COUNT {0}", ModelSpecularColorList.Count().ToString()));
toStream.WriteLine(String.Format("\t\t\tMODEL_TEXTURE_COORD_COUNT {0}", ModelTextureCoordList.Count().ToString())); toStream.WriteLine(string.Format("\t\t\tMODEL_TEXTURE_COORD_COUNT {0}", ModelTextureCoordList.Count().ToString()));
toStream.WriteLine(String.Format("\t\t\tMODEL_SHADING_COUNT {0}", ShadingDescriptionList.Count().ToString())); toStream.WriteLine(string.Format("\t\t\tMODEL_SHADING_COUNT {0}", ShadingDescriptionList.Count().ToString()));
ListExtensions.ExportShadingListToStream(ShadingDescriptionList, toStream); ListExtensions.ExportShadingListToStream(ShadingDescriptionList, toStream);
ListExtensions.ExportInt2ListToStream(LinePositionList, toStream, "LINE_POSITION_LIST"); ListExtensions.ExportInt2ListToStream(LinePositionList, toStream, "LINE_POSITION_LIST");
@ -420,7 +420,7 @@ namespace Duffer
ListExtensions.ExportColor4ListToStream(ModelSpecularColorList, toStream, "MODEL_NORMAL_LIST"); ListExtensions.ExportColor4ListToStream(ModelSpecularColorList, toStream, "MODEL_NORMAL_LIST");
ListExtensions.ExportVector4ListToStream(ModelTextureCoordList, toStream, "MODEL_TEXTURE_COORD_LIST"); ListExtensions.ExportVector4ListToStream(ModelTextureCoordList, toStream, "MODEL_TEXTURE_COORD_LIST");
toStream.WriteLine(String.Format("\t\t}}")); toStream.WriteLine(string.Format("\t\t}}"));
} }
} }
@ -445,19 +445,19 @@ namespace Duffer
public void Export(StreamWriter toStream) public void Export(StreamWriter toStream)
{ {
if (TextureLayerIntensity != null) if (TextureLayerIntensity != null)
toStream.WriteLine(String.Format("\t\t\t\tTEXTURE_LAYER_INTENSITY {0}", ((float)TextureLayerIntensity).ToString(Format.SixDecPlFormat))); toStream.WriteLine(string.Format("\t\t\t\tTEXTURE_LAYER_INTENSITY {0}", ((float)TextureLayerIntensity).ToString(Format.SixDecPlFormat)));
if (TextureLayerBlendFunction != null) if (TextureLayerBlendFunction != null)
toStream.WriteLine(String.Format("\t\t\t\tTEXTURE_LAYER_BLEND_FUNCTION \"{0}\"", TextureLayerBlendFunction.ToString())); toStream.WriteLine(string.Format("\t\t\t\tTEXTURE_LAYER_BLEND_FUNCTION \"{0}\"", TextureLayerBlendFunction.ToString()));
if (TextureLayerBlendSource != null) if (TextureLayerBlendSource != null)
toStream.WriteLine(String.Format("\t\t\t\tTEXTURE_LAYER_BLEND_SOURCE \"{0}\"", TextureLayerBlendSource.ToString())); toStream.WriteLine(string.Format("\t\t\t\tTEXTURE_LAYER_BLEND_SOURCE \"{0}\"", TextureLayerBlendSource.ToString()));
if (TextureLayerBlendConstant != null) if (TextureLayerBlendConstant != null)
toStream.WriteLine(String.Format("\t\t\t\tTEXTURE_LAYER_BLEND_CONSTANT {0}", ((float)TextureLayerBlendConstant).ToString(Format.SixDecPlFormat))); toStream.WriteLine(string.Format("\t\t\t\tTEXTURE_LAYER_BLEND_CONSTANT {0}", ((float)TextureLayerBlendConstant).ToString(Format.SixDecPlFormat)));
if (TextureLayerMode != null) if (TextureLayerMode != null)
toStream.WriteLine(String.Format("\t\t\t\tTEXTURE_LAYER_MODE {0}", TextureLayerMode)); toStream.WriteLine(string.Format("\t\t\t\tTEXTURE_LAYER_MODE {0}", TextureLayerMode));
if (TextureLayerAlphaEnabled != null) if (TextureLayerAlphaEnabled != null)
toStream.WriteLine(String.Format("\t\t\t\tTEXTURE_LAYER_ALPHA_ENABLED \"{0}\"", TextureLayerAlphaEnabled.ToString().ToUpper())); toStream.WriteLine(string.Format("\t\t\t\tTEXTURE_LAYER_ALPHA_ENABLED \"{0}\"", TextureLayerAlphaEnabled.ToString().ToUpper()));
toStream.WriteLine(String.Format("\t\t\t\tTEXTURE_NAME \"{0}\"", TextureName)); toStream.WriteLine(string.Format("\t\t\t\tTEXTURE_NAME \"{0}\"", TextureName));
} }
} }
@ -489,22 +489,22 @@ namespace Duffer
public void Export(StreamWriter toStream) public void Export(StreamWriter toStream)
{ {
if (this.Type != null) if (Type != null)
toStream.WriteLine(String.Format("\t\t\t\tCOMPRESSION_TYPE \"{0}\"", this.Type.ToString())); toStream.WriteLine(string.Format("\t\t\t\tCOMPRESSION_TYPE \"{0}\"", Type.ToString()));
if (this.AlphaChannel != null) if (AlphaChannel != null)
toStream.WriteLine(String.Format("\t\t\t\tALPHA_CHANNEL \"{0}\"", this.AlphaChannel.ToString().ToUpper())); toStream.WriteLine(string.Format("\t\t\t\tALPHA_CHANNEL \"{0}\"", AlphaChannel.ToString().ToUpper()));
if (this.BlueChannel != null) if (BlueChannel != null)
toStream.WriteLine(String.Format("\t\t\t\tBLUE_CHANNEL \"{0}\"", this.BlueChannel.ToString().ToUpper())); toStream.WriteLine(string.Format("\t\t\t\tBLUE_CHANNEL \"{0}\"", BlueChannel.ToString().ToUpper()));
if (this.GreenChannel != null) if (GreenChannel != null)
toStream.WriteLine(String.Format("\t\t\t\tGREEN_CHANNEL \"{0}\"", this.GreenChannel.ToString().ToUpper())); toStream.WriteLine(string.Format("\t\t\t\tGREEN_CHANNEL \"{0}\"", GreenChannel.ToString().ToUpper()));
if (this.RedChannel != null) if (RedChannel != null)
toStream.WriteLine(String.Format("\t\t\t\tRED_CHANNEL \"{0}\"", this.RedChannel.ToString().ToUpper())); toStream.WriteLine(string.Format("\t\t\t\tRED_CHANNEL \"{0}\"", RedChannel.ToString().ToUpper()));
if (this.Luminance != null) if (Luminance != null)
toStream.WriteLine(String.Format("\t\t\t\tLUMINANCE \"{0}\"", this.Luminance.ToString().ToUpper())); toStream.WriteLine(string.Format("\t\t\t\tLUMINANCE \"{0}\"", Luminance.ToString().ToUpper()));
if (this.ExternalReference != null) if (ExternalReference != null)
toStream.WriteLine(String.Format("\t\t\t\tEXERNAL_REFERENCE \"{0}\"", this.ExternalReference.ToString().ToUpper())); toStream.WriteLine(string.Format("\t\t\t\tEXERNAL_REFERENCE \"{0}\"", ExternalReference.ToString().ToUpper()));
ListExtensions.ExportUrlListToStream(this.UrltList, toStream); ListExtensions.ExportUrlListToStream(UrltList, toStream);
} }
} }
public class Url : IResourceData public class Url : IResourceData

View File

@ -1,12 +1,7 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
namespace IDTF.Net
namespace Duffer
{ {
/// <summary> /// <summary>
/// A geometric transform, in column/row format /// A geometric transform, in column/row format

View File

@ -1,7 +1,6 @@
using Autodesk.Revit.Attributes; using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB; using Autodesk.Revit.DB;
using Autodesk.Revit.UI; using Autodesk.Revit.UI;
using Duffer;
using iText.Kernel.Pdf; using iText.Kernel.Pdf;
using iText.Kernel.Pdf.Annot; using iText.Kernel.Pdf.Annot;
using System; using System;

View File

@ -4,7 +4,9 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Autodesk.Revit.DB; using Autodesk.Revit.DB;
using Duffer; using IDTF.Net;
using Group = IDTF.Net.Group;
namespace PDF3D.Addin namespace PDF3D.Addin
{ {
internal class IDTFBuilder internal class IDTFBuilder
@ -13,8 +15,8 @@ namespace PDF3D.Addin
private IDTFScene _scene; private IDTFScene _scene;
private Dictionary<string, int> _shaderIndex = new Dictionary<string, int>(); private Dictionary<string, int> _shaderIndex = new Dictionary<string, int>();
private Parent nullParent = new Duffer.Parent() { Name = "<NULL>", Transform = new Duffer.Transform4x4() }; private Parent nullParent = new Parent() { Name = "<NULL>", Transform = new Transform4x4() };
private ShadingDescription defaultShadingDesc = new Duffer.ShadingDescription() { TextureCoordDimensionList = new List<int>(), ShaderID = 0 }; private ShadingDescription defaultShadingDesc = new ShadingDescription() { TextureCoordDimensionList = new List<int>(), ShaderID = 0 };
public IDTFBuilder(Autodesk.Revit.DB.Document document) public IDTFBuilder(Autodesk.Revit.DB.Document document)
{ {
@ -24,7 +26,7 @@ namespace PDF3D.Addin
} }
private void AddDefault() private void AddDefault()
{ {
var mat = new Duffer.MaterialResource() var mat = new MaterialResource()
{ {
Name = "default", Name = "default",
AttributeDiffuseEnabled = true, AttributeDiffuseEnabled = true,
@ -43,7 +45,7 @@ namespace PDF3D.Addin
} }
else else
{ {
var group = new Duffer.Group() { Name = name, Parents = new List<Duffer.Parent>() { _scene.Groups.Any(x => x.Name == patrent) ? new Parent(patrent) : nullParent } }; var group = new Group() { Name = name, Parents = new List<Parent>() { _scene.Groups.Any(x => x.Name == patrent) ? new Parent(patrent) : nullParent } };
this._scene.Groups.Add(group); this._scene.Groups.Add(group);
return true; return true;
} }
@ -60,7 +62,7 @@ namespace PDF3D.Addin
} }
else if (!this._scene.MaterialResources.ContainsKey(material.Name)) else if (!this._scene.MaterialResources.ContainsKey(material.Name))
{ {
var mat = new Duffer.MaterialResource() var mat = new MaterialResource()
{ {
Name = material.Name, Name = material.Name,
MaterialDiffuse = System.Drawing.Color.FromArgb(255, material.Color.Red, material.Color.Green, material.Color.Blue), MaterialDiffuse = System.Drawing.Color.FromArgb(255, material.Color.Red, material.Color.Green, material.Color.Blue),
@ -75,15 +77,15 @@ namespace PDF3D.Addin
} }
public bool InsertElement(Element element) public bool InsertElement(Element element)
{ {
Duffer.Parent parent; Parent parent;
if (element is FamilyInstance fi) if (element is FamilyInstance fi)
{ {
this.InsertGroup(fi.Symbol.FamilyName, fi.Category.Name); this.InsertGroup(fi.Symbol.FamilyName, fi.Category.Name);
parent = new Duffer.Parent(fi.Symbol.FamilyName); parent = new Parent(fi.Symbol.FamilyName);
} }
else else
{ {
parent = new Duffer.Parent(element.Category.Name); parent = new Parent(element.Category.Name);
} }
var option = new Options(); var option = new Options();
@ -95,13 +97,13 @@ namespace PDF3D.Addin
if (meshData != null && meshData.ModelPositionList.Any()) if (meshData != null && meshData.ModelPositionList.Any())
{ {
var name = element.Name + " " + element.Id.ToString(); var name = element.Name + " " + element.Id.ToString();
var model = new Duffer.Model var model = new Model
{ {
Name = name, Name = name,
Parents = new List<Duffer.Parent>() { parent }, Parents = new List<Parent>() { parent },
Visibility = ModelVisibility.BOTH Visibility = ModelVisibility.BOTH
}; };
var modelRes = new Duffer.ModelResource(Duffer.ModelType.MESH) { Name = name }; var modelRes = new ModelResource(ModelType.MESH) { Name = name };
modelRes.Mesh = meshData; modelRes.Mesh = meshData;
model.Resource = modelRes; model.Resource = modelRes;

View File

@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PDFGenerator", "PDFGenerato
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PDF3D.Addin", "PDF3D.Addin\PDF3D.Addin.csproj", "{CF96214C-74FB-419D-84FE-295FA107D367}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PDF3D.Addin", "PDF3D.Addin\PDF3D.Addin.csproj", "{CF96214C-74FB-419D-84FE-295FA107D367}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duffer", "Duffer\Duffer.csproj", "{6EAA9D99-766E-4772-AA87-A219559089DB}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IDTF.Net", "IDTF.Net\IDTF.Net.csproj", "{6EAA9D99-766E-4772-AA87-A219559089DB}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -22,7 +22,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Duffer\Duffer.csproj" /> <ProjectReference Include="..\IDTF.Net\IDTF.Net.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>