added Cube.fbx model to SampleContent project
some work on Primitives sample
This commit is contained in:
parent
81d2290b6a
commit
53b77d0e45
@ -22,6 +22,42 @@ namespace Primitives
|
||||
SpriteFont font;
|
||||
Texture2D bgTexture;
|
||||
|
||||
BasicEffect basicEffect;
|
||||
Matrix viewMatrix;
|
||||
Matrix projectionMatrix;
|
||||
Matrix worldMatrix;
|
||||
|
||||
VertexBuffer cubeNoIndicesBuffer;
|
||||
|
||||
#region Corners of cube
|
||||
static Vector3 topLeftFront = new Vector3( -1.0f, 1.0f, 1.0f );
|
||||
static Vector3 bottomLeftFront = new Vector3(-1.0f, -1.0f, 1.0f);
|
||||
static Vector3 topRightFront = new Vector3(1.0f, 1.0f, 1.0f);
|
||||
static Vector3 bottomRightFront = new Vector3(1.0f, -1.0f, 1.0f);
|
||||
static Vector3 topLeftBack = new Vector3(-1.0f, 1.0f, -1.0f);
|
||||
static Vector3 topRightBack = new Vector3(1.0f, 1.0f, -1.0f);
|
||||
static Vector3 bottomLeftBack = new Vector3(-1.0f, -1.0f, -1.0f);
|
||||
static Vector3 bottomRightBack = new Vector3(1.0f, -1.0f, -1.0f);
|
||||
|
||||
#endregion
|
||||
|
||||
VertexPositionColor[] cubeNoIndices = new VertexPositionColor[] { new VertexPositionColor(topLeftFront, Color.White),
|
||||
new VertexPositionColor(bottomRightFront, Color.White),
|
||||
new VertexPositionColor(bottomLeftFront, Color.White),
|
||||
|
||||
new VertexPositionColor(topLeftFront, Color.White),
|
||||
new VertexPositionColor(topRightFront, Color.White),
|
||||
new VertexPositionColor(bottomRightFront, Color.White),
|
||||
|
||||
new VertexPositionColor(topLeftBack, Color.White),
|
||||
new VertexPositionColor(bottomLeftBack, Color.White),
|
||||
new VertexPositionColor(bottomRightBack, Color.White),
|
||||
|
||||
new VertexPositionColor(topLeftBack, Color.White),
|
||||
new VertexPositionColor(bottomRightBack, Color.White),
|
||||
new VertexPositionColor(topRightBack, Color.White)
|
||||
};
|
||||
|
||||
public Game1()
|
||||
{
|
||||
graphics = new GraphicsDeviceManager(this);
|
||||
@ -45,10 +81,23 @@ namespace Primitives
|
||||
{
|
||||
spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||
|
||||
this.basicEffect = new BasicEffect(GraphicsDevice);
|
||||
|
||||
this.worldMatrix = Matrix.Identity;
|
||||
this.projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, GraphicsDevice.Viewport.AspectRatio, 0.1f, 10.0f);
|
||||
this.viewMatrix = Matrix.CreateLookAt(new Vector3(5, 5, 5), new Vector3(0, 0, 0), Vector3.Up);
|
||||
|
||||
this.font = Content.Load<SpriteFont>(@"Fonts/Debug");
|
||||
|
||||
this.bgTexture = new Texture2D(GraphicsDevice, 1, 1);
|
||||
this.bgTexture.SetData<Color>(new Color[] { Color.White });
|
||||
|
||||
//
|
||||
// create a VertexBuffer for a cube without indices
|
||||
//
|
||||
|
||||
this.cubeNoIndicesBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), cubeNoIndices.Length, BufferUsage.None);
|
||||
this.cubeNoIndicesBuffer.SetData<VertexPositionColor>(cubeNoIndices);
|
||||
}
|
||||
|
||||
protected override void UnloadContent()
|
||||
@ -86,6 +135,16 @@ namespace Primitives
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
this.GraphicsDevice.RasterizerState = new RasterizerState() { CullMode = CullMode.None, FillMode = FillMode.WireFrame };
|
||||
|
||||
this.basicEffect.World = this.worldMatrix;
|
||||
this.basicEffect.View = this.viewMatrix;
|
||||
this.basicEffect.Projection = this.projectionMatrix;
|
||||
|
||||
this.basicEffect.CurrentTechnique.Passes[0].Apply();
|
||||
GraphicsDevice.SetVertexBuffer(this.cubeNoIndicesBuffer);
|
||||
GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, cubeNoIndices.Length / 3);
|
||||
|
||||
base.Draw(gameTime);
|
||||
}
|
||||
|
||||
|
313
Samples/SampleContent/Models/Cube.fbx
Normal file
313
Samples/SampleContent/Models/Cube.fbx
Normal file
@ -0,0 +1,313 @@
|
||||
; FBX 6.1.0 project file
|
||||
; Created by Blender FBX Exporter
|
||||
; for support mail: ideasman42@gmail.com
|
||||
; ----------------------------------------------------
|
||||
|
||||
FBXHeaderExtension: {
|
||||
FBXHeaderVersion: 1003
|
||||
FBXVersion: 6100
|
||||
CreationTimeStamp: {
|
||||
Version: 1000
|
||||
Year: 2011
|
||||
Month: 12
|
||||
Day: 02
|
||||
Hour: 18
|
||||
Minute: 39
|
||||
Second: 32
|
||||
Millisecond: 0
|
||||
}
|
||||
Creator: "FBX SDK/FBX Plugins build 20070228"
|
||||
OtherFlags: {
|
||||
FlagPLE: 0
|
||||
}
|
||||
}
|
||||
CreationTime: "2011-12-02 18:39:32:000"
|
||||
Creator: "Blender version 2.60 (sub 0)"
|
||||
|
||||
; Object definitions
|
||||
;------------------------------------------------------------------
|
||||
|
||||
Definitions: {
|
||||
Version: 100
|
||||
Count: 3
|
||||
ObjectType: "Model" {
|
||||
Count: 1
|
||||
}
|
||||
ObjectType: "Geometry" {
|
||||
Count: 1
|
||||
}
|
||||
ObjectType: "Material" {
|
||||
Count: 1
|
||||
}
|
||||
ObjectType: "Pose" {
|
||||
Count: 1
|
||||
}
|
||||
ObjectType: "GlobalSettings" {
|
||||
Count: 1
|
||||
}
|
||||
}
|
||||
|
||||
; Object properties
|
||||
;------------------------------------------------------------------
|
||||
|
||||
Objects: {
|
||||
Model: "Model::Cube", "Mesh" {
|
||||
Version: 232
|
||||
Properties60: {
|
||||
Property: "QuaternionInterpolate", "bool", "",0
|
||||
Property: "Visibility", "Visibility", "A+",1
|
||||
Property: "Lcl Translation", "Lcl Translation", "A+",0.000000000000000,0.000000000000000,0.000000000000000
|
||||
Property: "Lcl Rotation", "Lcl Rotation", "A+",0.000000000000000,-0.000000000000000,0.000000000000000
|
||||
Property: "Lcl Scaling", "Lcl Scaling", "A+",1.000000000000000,1.000000000000000,1.000000000000000
|
||||
Property: "RotationOffset", "Vector3D", "",0,0,0
|
||||
Property: "RotationPivot", "Vector3D", "",0,0,0
|
||||
Property: "ScalingOffset", "Vector3D", "",0,0,0
|
||||
Property: "ScalingPivot", "Vector3D", "",0,0,0
|
||||
Property: "TranslationActive", "bool", "",0
|
||||
Property: "TranslationMin", "Vector3D", "",0,0,0
|
||||
Property: "TranslationMax", "Vector3D", "",0,0,0
|
||||
Property: "TranslationMinX", "bool", "",0
|
||||
Property: "TranslationMinY", "bool", "",0
|
||||
Property: "TranslationMinZ", "bool", "",0
|
||||
Property: "TranslationMaxX", "bool", "",0
|
||||
Property: "TranslationMaxY", "bool", "",0
|
||||
Property: "TranslationMaxZ", "bool", "",0
|
||||
Property: "RotationOrder", "enum", "",0
|
||||
Property: "RotationSpaceForLimitOnly", "bool", "",0
|
||||
Property: "AxisLen", "double", "",10
|
||||
Property: "PreRotation", "Vector3D", "",0,0,0
|
||||
Property: "PostRotation", "Vector3D", "",0,0,0
|
||||
Property: "RotationActive", "bool", "",0
|
||||
Property: "RotationMin", "Vector3D", "",0,0,0
|
||||
Property: "RotationMax", "Vector3D", "",0,0,0
|
||||
Property: "RotationMinX", "bool", "",0
|
||||
Property: "RotationMinY", "bool", "",0
|
||||
Property: "RotationMinZ", "bool", "",0
|
||||
Property: "RotationMaxX", "bool", "",0
|
||||
Property: "RotationMaxY", "bool", "",0
|
||||
Property: "RotationMaxZ", "bool", "",0
|
||||
Property: "RotationStiffnessX", "double", "",0
|
||||
Property: "RotationStiffnessY", "double", "",0
|
||||
Property: "RotationStiffnessZ", "double", "",0
|
||||
Property: "MinDampRangeX", "double", "",0
|
||||
Property: "MinDampRangeY", "double", "",0
|
||||
Property: "MinDampRangeZ", "double", "",0
|
||||
Property: "MaxDampRangeX", "double", "",0
|
||||
Property: "MaxDampRangeY", "double", "",0
|
||||
Property: "MaxDampRangeZ", "double", "",0
|
||||
Property: "MinDampStrengthX", "double", "",0
|
||||
Property: "MinDampStrengthY", "double", "",0
|
||||
Property: "MinDampStrengthZ", "double", "",0
|
||||
Property: "MaxDampStrengthX", "double", "",0
|
||||
Property: "MaxDampStrengthY", "double", "",0
|
||||
Property: "MaxDampStrengthZ", "double", "",0
|
||||
Property: "PreferedAngleX", "double", "",0
|
||||
Property: "PreferedAngleY", "double", "",0
|
||||
Property: "PreferedAngleZ", "double", "",0
|
||||
Property: "InheritType", "enum", "",0
|
||||
Property: "ScalingActive", "bool", "",0
|
||||
Property: "ScalingMin", "Vector3D", "",1,1,1
|
||||
Property: "ScalingMax", "Vector3D", "",1,1,1
|
||||
Property: "ScalingMinX", "bool", "",0
|
||||
Property: "ScalingMinY", "bool", "",0
|
||||
Property: "ScalingMinZ", "bool", "",0
|
||||
Property: "ScalingMaxX", "bool", "",0
|
||||
Property: "ScalingMaxY", "bool", "",0
|
||||
Property: "ScalingMaxZ", "bool", "",0
|
||||
Property: "GeometricTranslation", "Vector3D", "",0,0,0
|
||||
Property: "GeometricRotation", "Vector3D", "",0,0,0
|
||||
Property: "GeometricScaling", "Vector3D", "",1,1,1
|
||||
Property: "LookAtProperty", "object", ""
|
||||
Property: "UpVectorProperty", "object", ""
|
||||
Property: "Show", "bool", "",1
|
||||
Property: "NegativePercentShapeSupport", "bool", "",1
|
||||
Property: "DefaultAttributeIndex", "int", "",0
|
||||
Property: "Color", "Color", "A",0.8,0.8,0.8
|
||||
Property: "Size", "double", "",100
|
||||
Property: "Look", "enum", "",1
|
||||
}
|
||||
MultiLayer: 0
|
||||
MultiTake: 1
|
||||
Shading: Y
|
||||
Culling: "CullingOff"
|
||||
Vertices: 1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,-1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,0.999999,1.000000,0.999999,-1.000001,1.000000,-1.000000,-1.000000,1.000000
|
||||
,-1.000000,1.000000,1.000000
|
||||
PolygonVertexIndex: 0,1,2,-4,4,7,6,-6,0,4,5,-2,1,5,6,-3,2,6,7,-4,4,0,3,-8
|
||||
Edges:
|
||||
GeometryVersion: 124
|
||||
LayerElementNormal: 0 {
|
||||
Version: 101
|
||||
Name: ""
|
||||
MappingInformationType: "ByVertice"
|
||||
ReferenceInformationType: "Direct"
|
||||
Normals: 0.577349185943604,0.577349185943604,-0.577349185943604,0.577349185943604,-0.577349185943604,-0.577349185943604
|
||||
,-0.577349185943604,-0.577349185943604,-0.577349185943604,-0.577349185943604,0.577349185943604,-0.577349185943604
|
||||
,0.577349185943604,0.577349185943604,0.577349185943604,0.577349185943604,-0.577349185943604,0.577349185943604
|
||||
,-0.577349185943604,-0.577349185943604,0.577349185943604,-0.577349185943604,0.577349185943604,0.577349185943604
|
||||
}
|
||||
LayerElementUV: 0 {
|
||||
Version: 101
|
||||
Name: "UVTex"
|
||||
MappingInformationType: "ByPolygonVertex"
|
||||
ReferenceInformationType: "IndexToDirect"
|
||||
UV: 0.250005,0.499999,0.250002,0.250000,0.500002,0.249998,0.500004,0.499997,1.000000,0.499995,0.750002,0.499995,0.750002,0.249997
|
||||
,1.000000,0.249996,0.250005,0.499999,0.000005,0.500002,0.000002,0.250002,0.250002,0.250000,0.250002,0.250000,0.000002,0.250002
|
||||
,0.000000,0.000002,0.250000,0.000000,0.500002,0.249998,0.750002,0.249997,0.750002,0.499995,0.500004,0.499997,0.000005,0.500002
|
||||
,0.250005,0.499999,0.250007,0.749999,0.000007,0.750001
|
||||
UVIndex: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23
|
||||
}
|
||||
LayerElementTexture: 0 {
|
||||
Version: 101
|
||||
Name: ""
|
||||
MappingInformationType: "NoMappingInformation"
|
||||
ReferenceInformationType: "IndexToDirect"
|
||||
BlendMode: "Translucent"
|
||||
TextureAlpha: 1
|
||||
TextureId:
|
||||
}
|
||||
LayerElementMaterial: 0 {
|
||||
Version: 101
|
||||
Name: ""
|
||||
MappingInformationType: "AllSame"
|
||||
ReferenceInformationType: "IndexToDirect"
|
||||
Materials: 0
|
||||
}
|
||||
Layer: 0 {
|
||||
Version: 100
|
||||
LayerElement: {
|
||||
Type: "LayerElementNormal"
|
||||
TypedIndex: 0
|
||||
}
|
||||
LayerElement: {
|
||||
Type: "LayerElementMaterial"
|
||||
TypedIndex: 0
|
||||
}
|
||||
LayerElement: {
|
||||
Type: "LayerElementUV"
|
||||
TypedIndex: 0
|
||||
}
|
||||
},1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,-1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,0.999999,1.000000,0.999999,-1.000001,1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,1.000000
|
||||
}
|
||||
Material: "Material::Material", "" {
|
||||
Version: 102
|
||||
ShadingModel: "lambert"
|
||||
MultiLayer: 0
|
||||
Properties60: {
|
||||
Property: "ShadingModel", "KString", "", "Lambert"
|
||||
Property: "MultiLayer", "bool", "",0
|
||||
Property: "EmissiveColor", "ColorRGB", "",0.8000,0.8000,0.8000
|
||||
Property: "EmissiveFactor", "double", "",0.0000
|
||||
Property: "AmbientColor", "ColorRGB", "",0.0000,0.0000,0.0000
|
||||
Property: "AmbientFactor", "double", "",1.0000
|
||||
Property: "DiffuseColor", "ColorRGB", "",0.8000,0.8000,0.8000
|
||||
Property: "DiffuseFactor", "double", "",0.8000
|
||||
Property: "Bump", "Vector3D", "",0,0,0
|
||||
Property: "TransparentColor", "ColorRGB", "",1,1,1
|
||||
Property: "TransparencyFactor", "double", "",0.0000
|
||||
Property: "SpecularColor", "ColorRGB", "",1.0000,1.0000,1.0000
|
||||
Property: "SpecularFactor", "double", "",0.2500
|
||||
Property: "ShininessExponent", "double", "",80.0
|
||||
Property: "ReflectionColor", "ColorRGB", "",0,0,0
|
||||
Property: "ReflectionFactor", "double", "",1
|
||||
Property: "Emissive", "ColorRGB", "",0,0,0
|
||||
Property: "Ambient", "ColorRGB", "",0.0,0.0,0.0
|
||||
Property: "Diffuse", "ColorRGB", "",0.8,0.8,0.8
|
||||
Property: "Specular", "ColorRGB", "",1.0,1.0,1.0
|
||||
Property: "Shininess", "double", "",9.6
|
||||
Property: "Opacity", "double", "",1.0
|
||||
Property: "Reflectivity", "double", "",0
|
||||
}
|
||||
}
|
||||
Pose: "Pose::BIND_POSES", "BindPose" {
|
||||
Type: "BindPose"
|
||||
Version: 100
|
||||
Properties60: {
|
||||
}
|
||||
NbPoseNodes: 1
|
||||
PoseNode: {
|
||||
Node: "Model::Cube"
|
||||
Matrix: 1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,1.000000000000000
|
||||
}
|
||||
}
|
||||
GlobalSettings: {
|
||||
Version: 1000
|
||||
Properties60: {
|
||||
Property: "UpAxis", "int", "",1
|
||||
Property: "UpAxisSign", "int", "",1
|
||||
Property: "FrontAxis", "int", "",2
|
||||
Property: "FrontAxisSign", "int", "",1
|
||||
Property: "CoordAxis", "int", "",0
|
||||
Property: "CoordAxisSign", "int", "",1
|
||||
Property: "UnitScaleFactor", "double", "",1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
; Object relations
|
||||
;------------------------------------------------------------------
|
||||
|
||||
Relations: {
|
||||
Model: "Model::Cube", "Mesh" {
|
||||
}
|
||||
Model: "Model::Producer Perspective", "Camera" {
|
||||
}
|
||||
Model: "Model::Producer Top", "Camera" {
|
||||
}
|
||||
Model: "Model::Producer Bottom", "Camera" {
|
||||
}
|
||||
Model: "Model::Producer Front", "Camera" {
|
||||
}
|
||||
Model: "Model::Producer Back", "Camera" {
|
||||
}
|
||||
Model: "Model::Producer Right", "Camera" {
|
||||
}
|
||||
Model: "Model::Producer Left", "Camera" {
|
||||
}
|
||||
Model: "Model::Camera Switcher", "CameraSwitcher" {
|
||||
}
|
||||
Material: "Material::Material", "" {
|
||||
}
|
||||
}
|
||||
|
||||
; Object connections
|
||||
;------------------------------------------------------------------
|
||||
|
||||
Connections: {
|
||||
Connect: "OO", "Model::Cube", "Model::Scene"
|
||||
Connect: "OO", "Material::Material", "Model::Cube"
|
||||
}
|
||||
;Takes and animation section
|
||||
;----------------------------------------------------
|
||||
|
||||
Takes: {
|
||||
Current: "Default Take"
|
||||
}
|
||||
;Version 5 settings
|
||||
;------------------------------------------------------------------
|
||||
|
||||
Version5: {
|
||||
AmbientRenderSettings: {
|
||||
Version: 101
|
||||
AmbientLightColor: 0.0,0.0,0.0,0
|
||||
}
|
||||
FogOptions: {
|
||||
FlogEnable: 0
|
||||
FogMode: 0
|
||||
FogDensity: 0.000
|
||||
FogStart: 5.000
|
||||
FogEnd: 25.000
|
||||
FogColor: 0.1,0.1,0.1,1
|
||||
}
|
||||
Settings: {
|
||||
FrameRate: "24"
|
||||
TimeFormat: 1
|
||||
SnapOnFrames: 0
|
||||
ReferenceTimeIndex: -1
|
||||
TimeLineStartTime: 0
|
||||
TimeLineStopTime: 479181389250
|
||||
}
|
||||
RendererSetting: {
|
||||
DefaultCamera: "Producer Perspective"
|
||||
DefaultViewingMode: 0
|
||||
}
|
||||
}
|
@ -97,6 +97,14 @@
|
||||
<Processor>TextureProcessor</Processor>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Compile Include="Models\Cube.fbx">
|
||||
<Name>Cube</Name>
|
||||
<Importer>FbxImporter</Importer>
|
||||
<Processor>ModelProcessor</Processor>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
Loading…
x
Reference in New Issue
Block a user