~openracing/openracing/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
using System;
using Math3D;

namespace OpenRacing.Core.Track
{
#region physics
	public interface PhysicalSurface
	{
		// Returns the list of vertices
        Vector3[] GetVertices();
		// Returns the number of vertices
        int NumVertices();
		
		// Returns the list of normals
        Vector3[] GetNormals();
		// Returns the number of normals
        int NumNormals();
		
		// Returns the list of indices, each 3 indices gives a triangle
        int[] GetIndices();
		// Returns the number of indices
        int NumIndices();
		
		// Returns the resistance to rolling of the surface
		float GetRollingResistance();
		// Returns the friction of the surface
		float GetFriction();
	}
	
	public interface PhysicalScene
	{
		// Returns the number of surfaces in the physical scene
		int NumSurfaces();
		// Returns the surface at index i
		PhysicalSurface GetSurface(int i);
	}
#endregion
	
#region logical
	public struct StartingPosition
	{
		public Math3D.Vector3 Position;
		public Math3D.Quaternion Orientation;
	}
	

	
	public interface LogicalScene
	{
		int NumStartingPositions();
		StartingPosition GetStartingPosition(int i);
	}
#endregion
	
#region visual
	public interface VisualMesh
	{
		// Returns the list of vertices
        Vector3[] GetVertices();
		// Returns the number of vertices
        int NumVertices();
		
		// Returns the list of normals
        Vector3[] GetNormals();
		// Returns the number of normals
        int NumNormals();
		
		// Returns the list of tangents
        Vector2[] GetTangents();
		// Returns the number of tangents
        int NumTangents();
		
		// Returns the list of texture coordinates
        Vector2[] GetTexcoords();
		// Returns the number of texture coordinates
        int NumTexcoords();
		
		// Returns the list of indices, each 3 indices gives a triangle
		int[] GetIndices();
		// Returns the number of indices
        int NumIndices();
		
		// Material associated with this mesh
		string GetMaterialName();
	}
	
	// A material with its attributes
	public struct VisualMaterial
	{
		public string Name; // Name of the material
		public string Type; // Type of material: shader to apply
		// Shader's parameters
		public System.Collections.Generic.Dictionary<string, string> StringProperties;
		public System.Collections.Generic.Dictionary<string, int> IntProperties;
		public System.Collections.Generic.Dictionary<string, double> FloatProperties;
	}
	
	public interface VisualScene
	{
		// Returns the number of meshes composing the track
		int NumMeshes();
		// Returns mesh at index i
		VisualMesh GetMesh(int i);

		// Returns the number of materials
		int NumMaterials();
		// Returns material at index i
		VisualMaterial GetMaterial(int i);
	}
#endregion
	
	public interface UTI
	{
        void Init();
        void Shutdown();

		PhysicalScene PhysicalScene { get; }
		VisualScene   VisualScene   { get; }
		LogicalScene  LogicalScene  { get; }
		
        string GetFullPath(string fileName);
	}
}