//private Texture cubeTex; #region Constructors and Destructors public Base3DEditorContent(ToeGraphicsContext graphicsContext, IStreamConverterFactory streamConverterFactory) { this.graphicsContext = graphicsContext; this.streamConverterFactory = streamConverterFactory; var cubeBytes = Properties.Resources.xyzcube; if (cubeBytes != null) { IScene scene = (new AseReader(streamConverterFactory)).Load(new MemoryStream(cubeBytes), null); foreach (var node in scene.Nodes) { if (node.Mesh != null) { this.cube = node.Mesh; } } //this.cubeTex = new Toe.Marmalade.IwGx.Texture (); //cubeTex.Image = new Toe.Marmalade.IwGx.Image (Toe.Editors.Properties.Resources.xyzcube1); this.cube.Submeshes.First().Material = new SceneMaterial { Effect = new SceneEffect { CullMode = CullMode.Front, Diffuse = new ImageColorSource { Image = new EmbeddedImage(Properties.Resources.xyzcube1) { } } } }; } }
public GenericSceneEditor( IEditorEnvironment editorEnvironment, IComponentContext context, ToeGraphicsContext graphicsContext, IEditorOptions<Base3DEditorOptions> options) { this.editorEnvironment = editorEnvironment; this.context = context; this.graphicsContext = graphicsContext; this.options = options; this.history = new CommandHistory(); this.InitializeComponent(); this.InitializeEditor(); }
public MaterialEditor( IEditorEnvironment editorEnvironment, IResourceManager resourceManager, ICommandHistory history, ToeGraphicsContext graphicsContext, IComponentContext context) { this.editorEnvironment = editorEnvironment; this.resourceManager = resourceManager; this.history = history; this.graphicsContext = graphicsContext; this.context = context; this.InitializeComponent(); this.InitializeEditor(); }
public MaterialPreview( MaterialEditor editor, ToeGraphicsContext graphicsContext, IComponentContext context, IEditorOptions<Base3DEditorOptions> options, Base3DEditorContent content, IStreamConverterFactory streamConverterFactory) : base(context, options, content) { this.editor = editor; this.graphicsContext = graphicsContext; this.Camera.Ortho = false; this.Camera.ZNear = 16.0f; this.Camera.ZFar = 2048.0f; base.RenderScene += this.RenderMaterialScene; this.box = BoxBuilder.BuildSoftEdgedBox(250, streamConverterFactory); }
public TextureEditor( IEditorEnvironment editorEnvironment, IResourceManager resourceManager, IComponentContext context, ToeGraphicsContext graphicsContext, IEditorOptions<Base3DEditorOptions> options, Base3DEditorContent content) : base(context, options, content) { this.editorEnvironment = editorEnvironment; this.resourceManager = resourceManager; this.graphicsContext = graphicsContext; this.InitializeComponent(); this.InitializeEditor(); base.RenderScene += this.RenderTexScene; }
public SkinEditor( IEditorEnvironment editorEnvironment, IResourceManager resourceManager, ICommandHistory history, ToeGraphicsContext graphicsContext, IComponentContext context) { this.editorEnvironment = editorEnvironment; this.resourceManager = resourceManager; this.history = history; this.graphicsContext = graphicsContext; this.context = context; this.InitializeComponent(); this.InitializeEditor(); this.base3DEditor1.RenderScene += this.RenderScene; }
public ModelEditor( IEditorEnvironment editorEnvironment, IResourceManager resourceManager, IComponentContext context, ToeGraphicsContext graphicsContext, IEditorOptions<Base3DEditorOptions> options, ICommandHistory history) { this.editorEnvironment = editorEnvironment; this.resourceManager = resourceManager; this.context = context; this.graphicsContext = graphicsContext; this.options = options; this.history = history; this.dataContext.DataContextChanged += ResetModel; this.InitializeComponent(); this.InitializeEditor(); }
//private GLControl glControl; #region Constructors and Destructors public Base3DEditor( IComponentContext context, IEditorOptions<Base3DEditorOptions> options, Base3DEditorContent content) { this.options = options; this.content = content; this.graphicsContext = context.Resolve<ToeGraphicsContext>(); this.camera = new EditorCamera(context.Resolve<IEditorOptions<EditorCameraOptions>>()); this.camera.PropertyChanged += this.OnCameraPropertyChanged; this.InitializeComponent(); this.Dock = DockStyle.Fill; //this.glControl = new GLControl(GraphicsMode.Default, 1, 0, GraphicsContextFlags.Default); //this.glControl.Dock = DockStyle.Fill; this.glControl.Load += this.GLControlLoad; this.glControl.Paint += this.GLControlPaint; this.glControl.Resize += this.GLControlResize; this.Controls.Add(this.glControl); this.glControl.MouseMove += this.OnSceneMouseMove; this.glControl.MouseEnter += this.OnSceneMouseEnter; this.glControl.MouseLeave += this.OnSceneMouseLeave; this.glControl.MouseWheel += this.OnSceneMouseWheel; this.glControl.KeyDown += this.OnControlKeyDown; this.glControl.KeyUp += this.OnControlKeyUp; this.glControl.GotFocus += this.OnSceneGotFocus; this.glControl.LostFocus += this.OnSceneLostFocus; this.Camera.LookAt(new Vector3(512, 64, 1024), new Vector3(0, 0, 0)); this.CameraController = new TargetCameraController { Camera = this.Camera }; this.yUpToolStripMenuItem.Click += this.SelectYUp; this.zUpToolStripMenuItem.Click += this.SelectZUp; this.UpdateCoordinateSystemIcon(); this.UpdateLighingIcon(); this.UpdateWireframeIcon(); this.UpdateNormalIcon(); }
private void SetupViewport(ToeGraphicsContext context) { if (!this.loaded) { return; } if (GraphicsContext.CurrentContext == null) { return; } int w = Math.Max(1, this.glControl.Width); int h = Math.Max(1, this.glControl.Height); // Use all of the glControl painting area this.graphicsContext.SetViewport(0, 0, w, h); this.Camera.AspectRatio = w / (float)h; }
public void SetProjection(ToeGraphicsContext graphicsContext) { Matrix4 projection; if (this.ortho) { float w = 1024; float h = 1024 / this.aspectRatio; CreateOrthographicOffCenter(-w / 2, w / 2, -h / 2, h / 2, -this.zFar, this.zFar, out projection); } else { CreatePerspectiveFieldOfView(this.fovy, this.aspectRatio, this.zNear, this.zFar, out projection); } graphicsContext.SetProjection(ref projection); Matrix4 view = Matrix4.Rotate(this.rot) * Matrix4.CreateTranslation(this.pos); view.Invert(); graphicsContext.SetView(ref view); }