public static void AddTestComponent( Entity entity, GeometricPrimitiveType primitiveType, float size ) { Transform transform = new Transform(); entity.AddAttribute( Attributes.TRANSFORM, transform ); PrimitiveRenderComponent renderComponent = new PrimitiveRenderComponent( entity ); renderComponent.GeometricPrimitiveType = primitiveType; renderComponent.Color = Color.LimeGreen; renderComponent.Wireframe = false; renderComponent.m_size = size; entity.AddComponent( renderComponent ); }
public static void AddShipTestComponent(Entity entity) { ModelRenderComponent component = new ModelRenderComponent( entity ); ModelRenderData componentData = new ModelRenderData(); componentData.Model = "Models/Ship"; Transform modelTransform = new Transform(); modelTransform.Scale = new Vector3( 0.001f ); componentData.Transform = modelTransform; component.LoadData( componentData ); entity.AddComponent( component ); }
public ScenegraphNode FindByTransform(Transform searchTransform) { ScenegraphNode result = null; if ( m_transform == searchTransform ) { result = this; } else { foreach ( ScenegraphNode childNode in Children ) { result = childNode.FindByTransform( searchTransform ); if ( result != null ) { break; } } } return result; }
public override void Initialize() { m_primitive = GeometricPrimitive.Factory( this.m_primitiveType, m_size ); m_transform = this.Entity.GetAttribute<Transform>( Attributes.TRANSFORM ); m_primitive.Color = m_color; m_primitive.Wireframe = m_wireframe; m_primitive.Initialize(); }
public void UpdateWorld(Transform parent) { if ( parent != null ) { m_world = Local * parent.World; } else { m_world = Local; } m_isDirty = false; }
public static Transform CreateFromType( TransformType type, float value ) { Transform result = new Transform(); switch ( type ) { case TransformType.RotationX: result.Rotation = Matrix.CreateRotationX( value ); break; case TransformType.RotationY: result.Rotation = Matrix.CreateRotationY( value ); break; case TransformType.RotationZ: result.Rotation = Matrix.CreateRotationZ( value ); break; case TransformType.TranslationX: result.Position = new Vector3(value, 0, 0); break; case TransformType.TranslationY: result.Position = new Vector3(0, value, 0); break; case TransformType.TranslationZ: result.Position = new Vector3(0, 0, value); break; case TransformType.ScaleX: result.Scale = new Vector3( value, 1, 1 ); break; case TransformType.ScaleY: result.Scale = new Vector3( 1, value, 1 ); break; case TransformType.ScaleZ: result.Scale = new Vector3( 1, 1, value ); break; } return result; }
public override void Initialize() { m_transform = this.Entity.GetAttribute<Transform>( Attributes.TRANSFORM ); m_velocity = this.Entity.GetAttribute<Vector3>( Attributes.VELOCITY ); }
public ScenegraphNode(Transform transform) { m_transform = transform; Children = new List<ScenegraphNode>(); }
public ModelRenderComponent( Entity entity ) : base(entity) { m_localTransform = new Transform(); }
public override void LoadData( ComponentData componentData ) { ModelRenderData data = componentData as ModelRenderData; if ( data != null ) { m_modelName = data.Model; m_localTransform = data.Transform; } }
public override void Initialize() { m_model = new XEngineModel( m_modelName ); m_model.Initialize(); m_entityTransform = this.Entity.GetAttribute<Transform>( Attributes.TRANSFORM ); //BoundingSphere boundingSphere = ModelUtils.GetGlobalBoundingSphere( m_model ); //BoundingSphere boundingSphere = m_model.Meshes[1].BoundingSphere; //boundingSphere = boundingSphere.Transform( m_localTransform.Local ); //this.Entity.AddAttribute( Attributes.BOUNDING_SPHERE, boundingSphere ); }
public override void Initialize() { m_transform = this.Entity.GetAttribute<Transform>( Attributes.TRANSFORM ); }