/// <summary> /// 从文件中导入系列贴图资源。 /// 资源名由固定的头名字和名字后的阿拉伯数字索引组成。 /// </summary> /// <param name="engine">渲染组件</param> /// <param name="path">贴图资源的路径</param> /// <param name="fileHeadName">头名字</param> /// <param name="extension">扩展名</param> /// <param name="firstNo">第一个数字索引</param> /// <param name="sumFrame">索引总数</param> /// <param name="supportInterDect">是否添加冲突检测的支持</param> public void LoadSeriesFromFiles ( RenderEngine engine, string path, string fileHeadName, string extension, int firstNo, int sumFrame, bool supportInterDect ) { if (alreadyLoad) throw new Exception( "重复导入动画资源。" ); alreadyLoad = true; mSprites = new Sprite[sumFrame]; try { for (int i = 0; i < sumFrame; i++) { mSprites[i] = new Sprite( engine ); mSprites[i].LoadTextureFromFile( Path.Combine( path, fileHeadName + (i + firstNo) + extension ), supportInterDect ); } } catch (Exception) { mSprites = null; alreadyLoad = false; throw new Exception( "导入动画资源错误,请检查图片资源是否完整" ); } mSumFrame = sumFrame; mCurFrameIndex = 0; }
/// <summary> /// /// </summary> /// <param name="engine">渲染组件</param> public BasicGraphics ( RenderEngine engine ) { pointTexture = Texture2D.FromFile( engine.Device, Path.Combine( engine.contentPath, "point.png" ) ); lineTexture = Texture2D.FromFile( engine.Device, Path.Combine( engine.contentPath, "line.png" ) ); retangleTexture = Texture2D.FromFile( engine.Device, Path.Combine( engine.contentPath, "retangle.png" ) ); this.engine = engine; }
public void CreateFaceEngine(GraphicsEngine m_engine, Projector m_projector, RenderEngine m_renderEngine) { this.m_engine = m_engine; this.m_renderEngine = m_renderEngine; this.m_projector = m_projector; }
public void launch(RenderEngine renderer) { this.renderer = renderer; updateList(renderer.models.texture); }
public Sphere(RenderEngine theRenderEngine) { base.SetRenderEngine(theRenderEngine); }
public override void Draw(GameTime gameTime, RenderEngine renderer) { renderer.AddRenderTask(symbol, Position + textureOffset, Color4.White, -0.5f); base.Draw(gameTime, renderer); }
/// <summary> /// 提供字符的绘制功能 /// </summary> /// <param name="engine">渲染组件</param> /// <param name="contentMgr">素材管理者</param> public FontMgr ( RenderEngine engine, ContentManager contentMgr ) { this.engine = engine; chineseWriter = new ChineseWriter( engine ); fonts = new Dictionary<string, SpriteFont>(); LoadFonts( contentMgr ); }
/// <summary> /// 从多幅图中建立动画的动画类 /// </summary> /// <param name="engine">渲染组件</param> public AnimatedSpriteSeries ( RenderEngine engine ) { }
/// <summary> /// 从一副包含多个子图的图片中建立动画 /// </summary> /// <param name="engine">渲染组件</param> public AnimatedSpriteSingle(RenderEngine engine) { this.engine = engine; }
protected override void SceneInitialization(IContextState context, RenderEngine engine, ElementTag camera) { var smanager = Context.GetSystemManager(); smanager.CreateSystem <DefaultInputSystem>(); smanager.CreateSystem <ZoomToAllObjectsSystem>(); smanager.CreateSystem <MovingSystem>(); smanager.CreateSystem <CollidingSystem>(); smanager.CreateSystem <DefaultOrthographicCameraSystem>(); smanager.CreateSystem <LightsSystem>(); smanager .CreateSystem <RenderSystem>() .Init(engine.Graphics) .CreateNested <StensilTest_TriangleColoredVertexRenderTechnique <ToolkitRenderProperties> >() .CreateNested <LineVertexRenderTechnique <ToolkitRenderProperties> >() ; var manager = Context.GetEntityManager(); cameraObject = CameraObject.UpdateOrthographic <RenderSystem>(camera, Context, Surface); LightObject.CreateAmbientLight(manager, 0.2f); //0.05f LightObject.CreateFollowCameraDirectLight(manager, System.Numerics.Vector3.UnitZ, 0.8f); //0.95f InvokeLoaded(); { var pos0 = new[] { new Vector3(0, 40, 0), new Vector3(-30, -20, 0), new Vector3(30, -20, 0), }; var en0 = EntityBuilders.BuildColored(context, pos0, new int[] { 0, 1, 2 }, new[] { Vector3.UnitZ, Vector3.UnitZ, Vector3.UnitZ }, V4Colors.Red, SharpDX.Direct3D11.CullMode.Front); var dd = D3DDepthStencilDefinition.Default(0).Description; //dd.DepthComparison = Comparison.LessEqual; var _default = new D3DDepthStencilDefinition(dd, 0); en0.UpdateComponent(RenderableComponent.AsTriangleColoredList(SharpDX.Direct3D11.CullMode.None, _default)); } { var pos = new[] { new Vector3(0, 20, 0), new Vector3(-20, 0, 0), new Vector3(20, 0, 0), }; var en1 = EntityBuilders.BuildColored(context, pos, new int[] { 0, 1, 2 }, new[] { Vector3.UnitZ, Vector3.UnitZ, Vector3.UnitZ }, V4Colors.Blue, SharpDX.Direct3D11.CullMode.Front); var dd = new DepthStencilStateDescription() { IsDepthEnabled = true, IsStencilEnabled = true, DepthWriteMask = DepthWriteMask.All, DepthComparison = Comparison.LessEqual, StencilWriteMask = 0xFF, StencilReadMask = 0xFF, BackFace = new DepthStencilOperationDescription() { PassOperation = StencilOperation.Keep, Comparison = Comparison.Never, DepthFailOperation = StencilOperation.Keep, FailOperation = StencilOperation.Replace }, FrontFace = new DepthStencilOperationDescription() { PassOperation = StencilOperation.Increment, Comparison = Comparison.Never, DepthFailOperation = StencilOperation.Keep, FailOperation = StencilOperation.Replace } }; var stensilNever = new D3DDepthStencilDefinition(dd, 2); en1.UpdateComponent(RenderableComponent.AsTriangleColoredList(SharpDX.Direct3D11.CullMode.None, stensilNever)); } { var pos2 = new[] { new Vector3(20, 10, 0), new Vector3(-20, 10, 0), new Vector3(0, -10, 0), }; var en2 = EntityBuilders.BuildColored(context, pos2, new int[] { 0, 1, 2 }, new[] { Vector3.UnitZ, Vector3.UnitZ, Vector3.UnitZ }, V4Colors.Green, SharpDX.Direct3D11.CullMode.Front); var ddd = new DepthStencilStateDescription() { IsDepthEnabled = true, IsStencilEnabled = true, DepthWriteMask = DepthWriteMask.All, DepthComparison = Comparison.LessEqual, StencilWriteMask = 0xFF, StencilReadMask = 0xFF, BackFace = new DepthStencilOperationDescription() { PassOperation = StencilOperation.Replace, Comparison = Comparison.Greater, DepthFailOperation = StencilOperation.Keep, FailOperation = StencilOperation.Replace }, FrontFace = new DepthStencilOperationDescription() { PassOperation = StencilOperation.Increment, Comparison = Comparison.Greater, DepthFailOperation = StencilOperation.Keep, FailOperation = StencilOperation.Replace } }; var stensilGrater = new D3DDepthStencilDefinition(ddd, 1); en2.UpdateComponent(RenderableComponent.AsTriangleColoredList(SharpDX.Direct3D11.CullMode.None, stensilGrater)); } }
public void Execute(RenderEngine renderEngine) { _chunk.Render(); }
public Shape(string name, RenderEngine re) { this.name = name; this.re = re; }
public Sphere(string name, RenderEngine engine) : base(name, engine) { }
private static void Main(string[] args) { // Default execution options Options options = new Options() { Mode = EngineMode.Debugger, ItemURI = null, TemplateURI = null, PublicationTargetURI = null }; InitializeConsole(); if (Parser.Default.ParseArguments(args, options)) { LegacyInterface legacyInterface = null; try { using (new PreviewServer()) { // Initialize TcmDebugger.COM legacyInterface = new LegacyInterface(); legacyInterface.SetProvider(new LegacyProvider()); switch (options.Mode) { case EngineMode.LocalServer: using (new CompoundTemplateService2011()) { Logger.Log(System.Diagnostics.TraceEventType.Information, "Press any key to exit."); Console.ReadKey(); } break; case EngineMode.Debugger: case EngineMode.Publisher: if (String.IsNullOrEmpty(options.ItemURI)) { throw new Exception("ItemUri is required for Debugger or Publisher engines"); } if (!TcmUri.IsValid(options.ItemURI)) { throw new Exception(String.Format("Invalid tcm uri {0}", options.ItemURI)); } TcmUri tcmItemUri = new TcmUri(options.ItemURI); if (tcmItemUri.ItemType != ItemType.Page || options.Mode != EngineMode.Publisher) { if (String.IsNullOrEmpty(options.TemplateURI)) { throw new Exception("Template tcm uri is required for non-page type objects or debug engine"); } if (!TcmUri.IsValid(options.TemplateURI)) { throw new Exception(String.Format("Invalid template tcm uri {0}", options.TemplateURI)); } } if (!String.IsNullOrEmpty(options.PublicationTargetURI) && !TcmUri.IsValid(options.PublicationTargetURI)) { throw new Exception(String.Format("Invalid publication target tcm uri {0}", options.TemplateURI)); } Engine engine = null; switch (options.Mode) { case EngineMode.Debugger: engine = new Engines.DebugEngine(); break; case EngineMode.Publisher: engine = new RenderEngine(); break; } String output = engine.Execute(options.ItemURI, options.TemplateURI, options.PublicationTargetURI); output += ""; Console.WriteLine(); Console.WriteLine("{0} [!] {1}", DateTime.Now.ToString("HH:mm:ss"), "Execution finished. Press any key to exit."); Console.ReadKey(); break; } } } catch (Exception ex) { Logger.Log(System.Diagnostics.TraceEventType.Error, ex.Message); } finally { if (legacyInterface != null) { Marshal.ReleaseComObject(legacyInterface); } } } }
public Sphere(RenderEngine re) : base(re) { }
public Cylinder(RenderEngine re) : base(re) { }
public override void Draw(GameTime gameTime, RenderEngine renderer) { renderer.AddRenderTask(texture, Position, Size, textColor, -1f); base.Draw(gameTime, renderer); }
/// <summary> /// 获得当前帧鼠标的逻辑位置 /// </summary> static public Vector2 GetCurMousePosInLogic(RenderEngine engine) { return(engine.CoordinMgr.LogicPos(ConvertHelper.PointToVector2(CurMousePos))); }
public BodyEngine AttchBodyEngineToObject(GameObject gb, GameObject viewer, GraphicsEngine ge, Projector proj, RenderEngine re, FaceEngine fe, List <Vector2> axis, bool iscurve) { BodyEngine be = gb.AddComponent <BodyEngine>() as BodyEngine; be.CreateBodyEngine(viewer, ge, proj, re, fe, axis, iscurve); return(be); }
public BodyEngine AttchHandleEngineToObject(GameObject gb, GameObject viewer, GraphicsEngine ge, Projector proj, RenderEngine re, FaceEngine fe, BodyEngine be, Image <Gray, byte> img, List <Vector2> axis, bool iscurve) { BodyEngine he = gb.AddComponent <BodyEngine>() as BodyEngine; bool isHandle = true; he.CreateHandleEngine(viewer, ge, proj, re, fe, be, axis, img, iscurve, isHandle); return(he); }
/// <summary> /// 获得当前帧鼠标的逻辑位置 /// </summary> static public Vector2 GetCurMousePosInLogic ( RenderEngine engine ) { return engine.CoordinMgr.LogicPos( ConvertHelper.PointToVector2( CurMousePos ) ); }
/// <summary> /// Constructor for our changequeue implementation /// </summary> /// <param name="pluginId">Id of the plugin instantiating the render change queue</param> /// <param name="engine">Reference to our render engine</param> /// <param name="createPreviewEventArgs">preview event arguments</param> internal ChangeDatabase(Guid pluginId, RenderEngine engine, CreatePreviewEventArgs createPreviewEventArgs) : base(pluginId, createPreviewEventArgs) { _renderEngine = engine; _modalRenderer = true; _objectShaderDatabase = new ObjectShaderDatabase(_objectDatabase); _shaderConverter = new ShaderConverter(engine.Settings); }
void paintThumb(ref Graphics graphics, ref Bitmap bitmap) { if (mRectThumb.Left == 0 && mRectThumb.Top == 0 && mRectThumb.Right == 0 && mRectThumb.Bottom == 0) { return; } if (!isEnabled()) { mThumbState |= (int)ControlFlag.UISTATE_DISABLED; } else { mThumbState &= ~(int)ControlFlag.UISTATE_DISABLED; } mImageModify = ""; mImageModify = string.Format("dest='{0},{1},{2},{3}'", mRectThumb.Left - mRectItem.Left, mRectThumb.Top - mRectItem.Top, mRectThumb.Right - mRectItem.Left, mRectThumb.Bottom - mRectItem.Top); if ((mThumbState & (int)ControlFlag.UISTATE_DISABLED) != 0) { if (mThumbDisabledImage != "") { if (!drawImage(ref graphics, ref bitmap, mThumbDisabledImage, mImageModify)) { mThumbDisabledImage = ""; } else { return; } } } else if ((mThumbState & (int)ControlFlag.UISTATE_PUSHED) != 0) { if (mThumbPushedImage != "") { if (!drawImage(ref graphics, ref bitmap, mThumbPushedImage, mImageModify)) { mThumbPushedImage = ""; } else { return; } } } else if ((mThumbState & (int)ControlFlag.UISTATE_HOT) != 0) { if (mThumbHotImage != "") { if (!drawImage(ref graphics, ref bitmap, mThumbHotImage, mImageModify)) { mThumbHotImage = ""; } else { return; } } } if (mThumbNormalImage != "") { if (!drawImage(ref graphics, ref bitmap, mThumbNormalImage, mImageModify)) { mThumbNormalImage = ""; } else { return; } } uint dwBorderColor = 0xFF85E4FF; int nBorderSize = 2; RenderEngine.drawRect(ref graphics, ref bitmap, ref mRectThumb, nBorderSize, (int)dwBorderColor); }
public void SetRenderEngine(RenderEngine theRenderEngine) { m_RenderEngine = theRenderEngine; }
/// <summary> /// Convert a Rhino light into a <c>CyclesLight</c>. /// </summary> /// <param name="lg">The Rhino light to convert</param> /// <param name="gamma"></param> /// <returns><c>CyclesLight</c></returns> internal CyclesLight ConvertLight(Rhino.Geometry.Light lg, float gamma) { var enabled = lg.IsEnabled ? 1.0 : 0.0; var spotangle = 0.0; var smooth = 0.0; var size = 0.0f; var strength = (float)(lg.Intensity * RcCore.It.EngineSettings.PointlightFactor * enabled); var axisu = new float4(0.0f); var axisv = new float4(0.0f); var useMis = false; var sizeU = 0.0f; var sizeV = 0.0f; var co = RenderEngine.CreateFloat4(lg.Location.X, lg.Location.Y, lg.Location.Z); var dir = RenderEngine.CreateFloat4(lg.Direction.X, lg.Direction.Y, lg.Direction.Z); var color = RenderEngine.CreateFloat4(lg.Diffuse.R, lg.Diffuse.G, lg.Diffuse.B, lg.Diffuse.A); var lt = LightType.Point; if (lg.IsDirectionalLight) { lt = LightType.Distant; strength = (float)(lg.Intensity * RcCore.It.EngineSettings.SunlightFactor * enabled); //size = 0.01f; } else if (lg.IsSpotLight) { lt = LightType.Spot; spotangle = lg.SpotAngleRadians * 2; smooth = 1.0 / Math.Max(lg.HotSpot, 0.001f) - 1.0; strength = (float)(lg.Intensity * RcCore.It.EngineSettings.SpotlightFactor * enabled); } else if (lg.IsRectangularLight) { lt = LightType.Area; strength = (float)(lg.Intensity * RcCore.It.EngineSettings.ArealightFactor * enabled); var width = lg.Width; var length = lg.Length; sizeU = (float)width.Length; sizeV = (float)length.Length; size = 1.0f; var rectLoc = lg.Location + (lg.Width * 0.5) + (lg.Length * 0.5); co = RenderEngine.CreateFloat4(rectLoc.X, rectLoc.Y, rectLoc.Z); width.Unitize(); length.Unitize(); axisu = RenderEngine.CreateFloat4(width.X, width.Y, width.Z); axisv = RenderEngine.CreateFloat4(length.X, length.Y, length.Z); useMis = true; } else if (lg.IsLinearLight) { throw new Exception("Linear light handled in wrong place. Contact developer [email protected]"); } var clight = new CyclesLight { Type = lt, Co = co, Dir = dir, DiffuseColor = color, Size = size, SizeU = sizeU, SizeV = sizeV, AxisU = axisu, AxisV = axisv, UseMis = useMis, SpotAngle = (float)spotangle, SpotSmooth = (float)smooth, Strength = strength, CastShadow = lg.ShadowIntensity > 0.0, Gamma = gamma, Id = lg.Id }; return(clight); }
public Cube(RenderEngine theRenderEngine) { base.SetRenderEngine(theRenderEngine); }
public override void Draw(GameTime gameTime, RenderEngine renderer) { renderer.AddRenderTask(textBox.Texture, this.Position, textBox.Size, textBox.TextColor, -3f); }
protected override void Draw(RenderEngine renderEngine) { }
/// <summary> /// 构造未导入贴图的Sprite对象 /// </summary> public Sprite ( RenderEngine engine ) { this.engine = engine; Rata = 0f; Color = Color.White; LayerDepth = 0f; }
public IShape(RenderEngine tmpRE) { m_renderEngine = tmpRE; }
/// <summary> /// 构造Sprite对象并导入贴图 /// </summary> /// <param name="engine">渲染组件</param> /// <param name="texturePath">贴图路径</param> /// <param name="SupportIntersectDect"></param> public Sprite ( RenderEngine engine, string texturePath, bool SupportIntersectDect ) : this( engine ) { LoadTextureFromFile( texturePath, SupportIntersectDect ); }
public Cube(RenderEngine re) : base(re) { }
/// <summary> /// 构造Sprite对象并导入贴图 /// </summary> /// <param name="engine">渲染组件</param> /// <param name="contentMgr">素材管理者</param> /// <param name="assetPath">素材路径</param> /// <param name="SupportIntersectDect">是否添加冲突检测支持</param> public Sprite ( RenderEngine engine, ContentManager contentMgr, string assetPath, bool SupportIntersectDect ) : this( engine ) { LoadTextureFromContent( contentMgr, assetPath, SupportIntersectDect ); }
public void drawItemBk(ref Graphics graphics, ref Bitmap bitmap, ref Rectangle rcItem) { if (mOwner == null) { return; } TListInfoUI pInfo = mOwner.getListInfo(); int iBackColor = pInfo.mBkColor; if ((mButtonState & (int)PaintFlags.UISTATE_HOT) != 0) { iBackColor = pInfo.mHotBkColor; } if (isSelected()) { iBackColor = pInfo.mSelectedBkColor; } if (!isEnabled()) { iBackColor = pInfo.mDisabledBkColor; } if (iBackColor != 0) { RenderEngine.drawColor(ref graphics, ref bitmap, ref mRectItem, iBackColor); } if (!isEnabled()) { if (pInfo.mDisabledImage != "") { if (!drawImage(ref graphics, ref bitmap, pInfo.mDisabledImage)) { pInfo.mDisabledImage = ""; } else { return; } } } if (isSelected()) { if (pInfo.mSelectedImage != "") { if (!drawImage(ref graphics, ref bitmap, pInfo.mSelectedImage)) { pInfo.mSelectedImage = ""; } else { return; } } } if ((mButtonState & (int)PaintFlags.UISTATE_HOT) != 0) { if (pInfo.mHotImage != "") { if (!drawImage(ref graphics, ref bitmap, pInfo.mHotImage)) { pInfo.mHotImage = ""; } else { return; } } } if (mBkImage != "") { if (!drawImage(ref graphics, ref bitmap, mBkImage)) { mBkImage = ""; } } if (mBkImage == "") { if (pInfo.mImage != "") { if (!drawImage(ref graphics, ref bitmap, pInfo.mImage)) { pInfo.mImage = ""; } else { return; } } } if (pInfo.mLineColor != 0) { Rectangle rcLine = new Rectangle(mRectItem.Left, mRectItem.Bottom - 1, mRectItem.Right, mRectItem.Bottom - 1); RenderEngine.drawLine(ref graphics, ref bitmap, ref rcLine, 1, pInfo.mLineColor); } }
private void RenderJob(Material selectedMaterial, AtumPrinter selectedPrinter, DriveInfo selectedDrive) { //load calibration model for (var objectViewModelIndex = ObjectView.Objects3D.Count - 1; objectViewModelIndex > 1; objectViewModelIndex--) { ObjectView.Objects3D.RemoveAt(objectViewModelIndex); } RenderEngine.PrintJob = new DAL.Print.PrintJob(); RenderEngine.PrintJob.Name = "Calibration"; RenderEngine.PrintJob.Material = selectedMaterial; RenderEngine.PrintJob.SelectedPrinter = this.AtumPrinter; var basicCorrection = new BasicCorrectionModel(); basicCorrection.Open((string)null, false, selectedMaterial.ModelColor, ObjectView.NextObjectIndex, basicCorrection.Triangles, enableProgressStatus: false); basicCorrection.UpdateBoundries(); for (var modelIndex = ObjectView.Objects3D.Count - 1; modelIndex > 0; modelIndex--) { ObjectView.Objects3D.RemoveAt(modelIndex); } ObjectView.AddModel(basicCorrection, false, false, false); RenderEngine.RenderAsync(); try { while (RenderEngine.TotalAmountSlices != RenderEngine.TotalProcessedSlices && !RenderEngine.PrintJob.PostRenderCompleted) { var progress = (((decimal)RenderEngine.TotalProcessedSlices / (decimal)RenderEngine.TotalAmountSlices) * 100); Thread.Sleep(250); } } catch (Exception exc) { Atum.DAL.Managers.LoggingManager.WriteToLog("GeneratePrintJobAsync", "Exc", exc); new frmMessageBox("GeneratePrintJobAsync", exc.Message, MessageBoxButtons.OK, MessageBoxDefaultButton.Button2).ShowDialog(); } try { var usbPrintjobPath = string.Format(@"{0}{1}", selectedDrive.Name, RenderEngine.PrintJob.Name); var pathPrinterJobXml = Path.Combine(Path.GetTempPath(), "printjob.xml"); //serialize first to temp var serializer = new System.Xml.Serialization.XmlSerializer(typeof(DAL.Print.PrintJob)); using (var streamWriter = new StreamWriter(pathPrinterJobXml, false)) { serializer.Serialize(streamWriter, RenderEngine.PrintJob); } var pathPrinterJobChecksumXml = Path.Combine(System.IO.Path.GetTempPath(), "checksum.crc"); using (var checksumWriter = new StreamWriter(pathPrinterJobChecksumXml, false)) { checksumWriter.WriteLine(DateTime.Now.Ticks.ToString()); } var osPathSeparator = "\\"; if (!Directory.Exists(usbPrintjobPath)) { Directory.CreateDirectory(usbPrintjobPath); } var zipCopied = false; while (!zipCopied) { try { File.Copy(RenderEngine.PrintJob.SlicesPath, usbPrintjobPath + osPathSeparator + "slices.zip", true); File.Copy(pathPrinterJobXml, usbPrintjobPath + osPathSeparator + "printjob.apj", true); File.Copy(pathPrinterJobChecksumXml, usbPrintjobPath + osPathSeparator + "checksum.crc", true); zipCopied = true; } catch { Thread.Sleep(250); } } } catch (Exception exc) { new frmMessageBox("Failed to save printjob", "Failed to save printjob", MessageBoxButtons.OK, MessageBoxDefaultButton.Button2).ShowDialog(); } }
private void RenderJobAsync(object sender, DoWorkEventArgs e) { var t = sender as BackgroundWorker; if (t != null) { t.ReportProgress(0, new WaitWindowUserState(0.01d, "Printjob initializing")); } RenderEngine renderEngine = new RenderEngine(); //var renderSliceInfo = new Core.Slices.RenderSliceInfo(); try { // renderSliceInfo.Material = MaterialManager.CurrentMaterial; RenderEngine.PrintJob = new DAL.Print.PrintJob(); RenderEngine.PrintJob.Name = "Calibration"; RenderEngine.PrintJob.Option_TurnProjectorOff = true; RenderEngine.PrintJob.Option_TurnProjectorOn = true; if (this._selectedPrinter is AtumV20Printer) { RenderEngine.PrintJob.SelectedPrinter = new AtumV15Printer() { CorrectionFactorX = this._selectedPrinter.CorrectionFactorX, CorrectionFactorY = this._selectedPrinter.CorrectionFactorY, Default = this._selectedPrinter.Default, Description = this._selectedPrinter.Description, DisplayName = this._selectedPrinter.DisplayName, DisplayText = this._selectedPrinter.DisplayText, PrinterXYResolution = this._selectedPrinter.PrinterXYResolution, Projectors = this._selectedPrinter.Projectors, Properties = this._selectedPrinter.Properties, Selected = this._selectedPrinter.Selected, TrapeziumCorrectionInputA = this._selectedPrinter.TrapeziumCorrectionInputA, TrapeziumCorrectionInputB = this._selectedPrinter.TrapeziumCorrectionInputB, TrapeziumCorrectionInputC = this._selectedPrinter.TrapeziumCorrectionInputC, TrapeziumCorrectionInputD = this._selectedPrinter.TrapeziumCorrectionInputD, TrapeziumCorrectionInputE = this._selectedPrinter.TrapeziumCorrectionInputE, TrapeziumCorrectionInputF = this._selectedPrinter.TrapeziumCorrectionInputF, TrapeziumCorrectionSideA = this._selectedPrinter.TrapeziumCorrectionSideA, TrapeziumCorrectionSideB = this._selectedPrinter.TrapeziumCorrectionSideB, TrapeziumCorrectionSideC = this._selectedPrinter.TrapeziumCorrectionSideC, TrapeziumCorrectionSideD = this._selectedPrinter.TrapeziumCorrectionSideD, TrapeziumCorrectionSideE = this._selectedPrinter.TrapeziumCorrectionSideE, TrapeziumCorrectionSideF = this._selectedPrinter.TrapeziumCorrectionSideF }; } else if (this._selectedPrinter is AtumDLPStation5 || this._selectedPrinter is LoctiteV10) { RenderEngine.PrintJob.SelectedPrinter = new AtumV15Printer() { CorrectionFactorX = this._selectedPrinter.CorrectionFactorX, CorrectionFactorY = this._selectedPrinter.CorrectionFactorY, Default = this._selectedPrinter.Default, Description = this._selectedPrinter.Description, DisplayName = this._selectedPrinter.DisplayName, DisplayText = this._selectedPrinter.DisplayText, PrinterXYResolution = this._selectedPrinter.PrinterXYResolution, Projectors = this._selectedPrinter.Projectors, Properties = this._selectedPrinter.Properties, Selected = this._selectedPrinter.Selected, ProjectorResolutionX = 1920, ProjectorResolutionY = 1080, TrapeziumCorrectionInputA = this._selectedPrinter.TrapeziumCorrectionInputA, TrapeziumCorrectionInputB = this._selectedPrinter.TrapeziumCorrectionInputB, TrapeziumCorrectionInputC = this._selectedPrinter.TrapeziumCorrectionInputC, TrapeziumCorrectionInputD = this._selectedPrinter.TrapeziumCorrectionInputD, TrapeziumCorrectionInputE = this._selectedPrinter.TrapeziumCorrectionInputE, TrapeziumCorrectionInputF = this._selectedPrinter.TrapeziumCorrectionInputF, TrapeziumCorrectionSideA = this._selectedPrinter.TrapeziumCorrectionSideA, TrapeziumCorrectionSideB = this._selectedPrinter.TrapeziumCorrectionSideB, TrapeziumCorrectionSideC = this._selectedPrinter.TrapeziumCorrectionSideC, TrapeziumCorrectionSideD = this._selectedPrinter.TrapeziumCorrectionSideD, TrapeziumCorrectionSideE = this._selectedPrinter.TrapeziumCorrectionSideE, TrapeziumCorrectionSideF = this._selectedPrinter.TrapeziumCorrectionSideF }; } else { RenderEngine.PrintJob.SelectedPrinter = this._selectedPrinter; } RenderEngine.PrintJob.Option_TurnProjectorOn = RenderEngine.PrintJob.Option_TurnProjectorOff = true; //turn projectors on RenderEngine.PrintJob.Material = printerConnectionMaterialTabPanel1.SelectedMaterial; RenderEngine.PrintJob.CalibrationJob = true; RenderEngine.RenderAsync(); t.ReportProgress(0, new WaitWindowUserState(0.01d, "Printjob initializing")); while (RenderEngine.TotalAmountSlices != RenderEngine.TotalProcessedSlices || !RenderEngine.PrintJob.PostRenderCompleted) { var progress = (((decimal)RenderEngine.TotalProcessedSlices / (decimal)RenderEngine.TotalAmountSlices) * 100); t.ReportProgress((int)progress, new WaitWindowUserState((int)progress, string.Format("Generating calibration printjob: {0:N2}%", progress))); System.Threading.Thread.Sleep(250); } } catch (Exception exc) { Atum.DAL.Managers.LoggingManager.WriteToLog("GeneratePrintJobAsync", "Exc", exc); MessageBox.Show(exc.Message); } try { t.ReportProgress(0, new WaitWindowUserState(0.01d, "Saving printjob")); Application.DoEvents(); var selectedDriveLetter = (this.selectedDrive).DriveLetter; var usbPrintjobPath = string.Format(@"{0}{1}", selectedDriveLetter, RenderEngine.PrintJob.Name); var printingTime = RenderEngine.PrintJob.PrintingTimeRemaining(0, RenderEngine.TotalAmountSlices); if (RenderEngine.PrintJob.UseProjectorOptions) { printingTime = printingTime.Add(new TimeSpan(0, 0, RenderEngine.PrintJob.Option_TurnProjectorOn ? RenderEngine.PrintJob.SelectedPrinter.ProjectorTurnOnDelay : 0)); } else { RenderEngine.PrintJob.Option_TurnProjectorOff = RenderEngine.PrintJob.Option_TurnProjectorOff = false; } RenderEngine.PrintJob.JobTimeInSeconds = printingTime.TotalSeconds; var pathPrinterJobXml = Path.Combine(Path.GetTempPath(), "printjob.xml"); //serialize first to temp var serializer = new System.Xml.Serialization.XmlSerializer(typeof(DAL.Print.PrintJob)); using (var streamWriter = new StreamWriter(pathPrinterJobXml, false)) { serializer.Serialize(streamWriter, RenderEngine.PrintJob); } var pathPrinterJobChecksumXml = Path.Combine(System.IO.Path.GetTempPath(), "checksum.crc"); using (var checksumWriter = new StreamWriter(pathPrinterJobChecksumXml, false)) { checksumWriter.WriteLine(DateTime.Now.Ticks.ToString()); } var osPathSeparator = "\\"; if (!DAL.OS.OSProvider.IsWindows) { osPathSeparator = "/"; } if (!Directory.Exists(usbPrintjobPath)) { Directory.CreateDirectory(usbPrintjobPath); } File.Copy(RenderEngine.PrintJob.SlicesPath, usbPrintjobPath + osPathSeparator + "slices.zip", true); File.Copy(pathPrinterJobXml, usbPrintjobPath + osPathSeparator + "printjob.apj", true); File.Copy(pathPrinterJobChecksumXml, usbPrintjobPath + osPathSeparator + "checksum.crc", true); } catch (Exception exc) { Debug.WriteLine(exc.Message); MessageBox.Show("Failed to save printjob", "Failed to save printjob", MessageBoxButtons.OK, MessageBoxIcon.Information); } //close wait dialog t.ReportProgress(100, new WaitWindowUserState(100, string.Empty)); }
/// <summary> /// 构造Sprite对象并导入贴图 /// </summary> /// <param name="engine">渲染组件</param> /// <param name="texturePath">贴图路径</param> /// <param name="SupportIntersectDect"></param> public Sprite(RenderEngine engine, string texturePath, bool SupportIntersectDect) : this( engine ) { LoadTextureFromFile(texturePath, SupportIntersectDect); }
/// <summary> /// 使用素材管道导入贴图文件。 /// 资源名由固定的头名字和名字后的阿拉伯数字索引组成 /// </summary> /// <param name="engine">渲染组件</param> /// <param name="contentMgr">素材管理者</param> /// <param name="assetHead">资源的路径以及头名字</param> /// <param name="firstNo">索引开始的数字</param> /// <param name="sumFrame">系列贴图文件的数量</param> /// <param name="supportInterDect">是否提供冲突检测的支持</param> public void LoadSeriesFormContent ( RenderEngine engine, ContentManager contentMgr, string assetHead, int firstNo, int sumFrame, bool supportInterDect ) { if (alreadyLoad) throw new Exception( "重复导入动画资源。" ); alreadyLoad = true; mSprites = new Sprite[sumFrame]; try { for (int i = 0; i < sumFrame; i++) { mSprites[i] = new Sprite( engine ); mSprites[i].LoadTextureFromContent( contentMgr, assetHead + (firstNo + i), supportInterDect ); } } catch (Exception) { mSprites = null; alreadyLoad = false; throw new Exception( "导入动画资源错误,请检查图片资源是否完整" ); } mSumFrame = sumFrame; mCurFrameIndex = 0; }
/// <summary> /// 构造Sprite对象并导入贴图 /// </summary> /// <param name="engine">渲染组件</param> /// <param name="contentMgr">素材管理者</param> /// <param name="assetPath">素材路径</param> /// <param name="SupportIntersectDect">是否添加冲突检测支持</param> public Sprite(RenderEngine engine, ContentManager contentMgr, string assetPath, bool SupportIntersectDect) : this( engine ) { LoadTextureFromContent(contentMgr, assetPath, SupportIntersectDect); }
public ChineseWriter( RenderEngine engine ) { this.engine = engine; this.fonts = new Dictionary<string, System.Drawing.Font>(); }
private ShaderNode GetShaderPart(ShaderBody part) { var texcoord60 = new TextureCoordinateNode("texcoord"); var invert_transparency79 = new MathNode("invert_transparency"); invert_transparency79.ins.Value1.Value = 1f; invert_transparency79.ins.Value2.Value = part.Transparency; invert_transparency79.Operation = MathNode.Operations.Subtract; invert_transparency79.UseClamp = false; var diffuse_texture61 = new ImageTextureNode("diffuse_texture"); diffuse_texture61.ins.Vector.Value = new ccl.float4(0f, 0f, 0f, 1f); diffuse_texture61.Projection = TextureNode.TextureProjection.Flat; diffuse_texture61.ColorSpace = TextureNode.TextureColorSpace.None; diffuse_texture61.Extension = part.DiffuseTexture.Repeat ? TextureNode.TextureExtension.Repeat : TextureNode.TextureExtension.Clip; diffuse_texture61.Interpolation = InterpolationType.Linear; diffuse_texture61.UseAlpha = true; diffuse_texture61.IsLinear = false; var weight_diffuse_amount_by_transparency_inv78 = new MathNode("weight_diffuse_amount_by_transparency_inv"); weight_diffuse_amount_by_transparency_inv78.ins.Value1.Value = part.DiffuseTexture.Amount; weight_diffuse_amount_by_transparency_inv78.ins.Value2.Value = 0f; weight_diffuse_amount_by_transparency_inv78.Operation = MathNode.Operations.Multiply; weight_diffuse_amount_by_transparency_inv78.UseClamp = false; var invert_alpha76 = new MathNode("invert_alpha"); invert_alpha76.ins.Value1.Value = 1f; invert_alpha76.ins.Value2.Value = 0f; invert_alpha76.Operation = MathNode.Operations.Subtract; invert_alpha76.UseClamp = false; var diffuse_texture_amount65 = new MixNode("diffuse_texture_amount"); diffuse_texture_amount65.ins.Color1.Value = part.BaseColor; diffuse_texture_amount65.ins.Color2.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); diffuse_texture_amount65.ins.Fac.Value = 0f; diffuse_texture_amount65.BlendType = ccl.ShaderNodes.MixNode.BlendTypes.Add; diffuse_texture_amount65.UseClamp = false; var honor_texture_repeat77 = new MathNode("honor_texture_repeat"); honor_texture_repeat77.ins.Value1.Value = 1f; honor_texture_repeat77.ins.Value2.Value = part.DiffuseTexture.InvertRepeatAsFloat; honor_texture_repeat77.Operation = MathNode.Operations.Multiply; honor_texture_repeat77.UseClamp = false; var repeat_mixer75 = new MixNode("repeat_mixer"); repeat_mixer75.ins.Color1.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); repeat_mixer75.ins.Color2.Value = part.BaseColor; repeat_mixer75.ins.Fac.Value = 1f; repeat_mixer75.BlendType = ccl.ShaderNodes.MixNode.BlendTypes.Mix; repeat_mixer75.UseClamp = false; var diffuse_behind_texture_through_alpha119 = new MixNode("diffuse_behind_texture_through_alpha"); diffuse_behind_texture_through_alpha119.ins.Color1.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); diffuse_behind_texture_through_alpha119.ins.Color2.Value = new ccl.float4(0f, 0f, 0f, 1f); diffuse_behind_texture_through_alpha119.ins.Fac.Value = part.Transparency; diffuse_behind_texture_through_alpha119.BlendType = ccl.ShaderNodes.MixNode.BlendTypes.Mix; diffuse_behind_texture_through_alpha119.UseClamp = false; var multiply120 = new MathNode("multiply"); multiply120.ins.Value1.Value = 0f; multiply120.ins.Value2.Value = part.DiffuseTexture.Amount; multiply120.Operation = MathNode.Operations.Multiply; multiply120.UseClamp = false; var multiply129 = new MathNode("multiply"); multiply129.ins.Value1.Value = 0f; multiply129.ins.Value2.Value = 0f; multiply129.Operation = MathNode.Operations.Multiply; multiply129.UseClamp = false; var mix125 = new MixNode("mix"); mix125.ins.Color1.Value = new ccl.float4(0f, 0f, 0f, 1f); mix125.ins.Color2.Value = part.BaseColor; mix125.ins.Fac.Value = 0f; mix125.BlendType = ccl.ShaderNodes.MixNode.BlendTypes.Mix; mix125.UseClamp = false; var separate_base_color73 = new SeparateRgbNode("separate_base_color"); separate_base_color73.ins.Image.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); var separate_diffuse_texture_color72 = new SeparateRgbNode("separate_diffuse_texture_color"); separate_diffuse_texture_color72.ins.Image.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); var subtract126 = new MathNode("subtract"); subtract126.ins.Value1.Value = 0f; subtract126.ins.Value2.Value = 0f; subtract126.Operation = MathNode.Operations.Subtract; subtract126.UseClamp = false; var subtract127 = new MathNode("subtract"); subtract127.ins.Value1.Value = 0f; subtract127.ins.Value2.Value = 0f; subtract127.Operation = MathNode.Operations.Subtract; subtract127.UseClamp = false; var subtract128 = new MathNode("subtract"); subtract128.ins.Value1.Value = 0f; subtract128.ins.Value2.Value = 0f; subtract128.Operation = MathNode.Operations.Subtract; subtract128.UseClamp = false; var bump_texture69 = new ImageTextureNode("bump_texture"); bump_texture69.ins.Vector.Value = new ccl.float4(0f, 0f, 0f, 1f); bump_texture69.Projection = TextureNode.TextureProjection.Flat; bump_texture69.ColorSpace = TextureNode.TextureColorSpace.None; bump_texture69.Extension = TextureNode.TextureExtension.Repeat; bump_texture69.Interpolation = InterpolationType.Linear; bump_texture69.UseAlpha = true; bump_texture69.IsLinear = false; var bump_texture_to_bw70 = new RgbToBwNode("bump_texture_to_bw"); bump_texture_to_bw70.ins.Color.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); var bump_amount71 = new MathNode("bump_amount"); bump_amount71.ins.Value1.Value = 4.66f; bump_amount71.ins.Value2.Value = part.BumpTexture.Amount; bump_amount71.Operation = MathNode.Operations.Multiply; bump_amount71.UseClamp = false; var final_base_color74 = new CombineRgbNode("final_base_color"); final_base_color74.ins.R.Value = 0f; final_base_color74.ins.G.Value = 0f; final_base_color74.ins.B.Value = 0f; var bump68 = new BumpNode("bump"); bump68.ins.Height.Value = 0f; bump68.ins.Normal.Value = new ccl.float4(0f, 0f, 0f, 1f); bump68.ins.Strength.Value = 0f; bump68.ins.Distance.Value = 0.1f; var diffuse82 = new DiffuseBsdfNode("diffuse"); diffuse82.ins.Color.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); diffuse82.ins.Roughness.Value = 0f; diffuse82.ins.Normal.Value = new ccl.float4(0f, 0f, 0f, 1f); var shadeless_bsdf94 = new EmissionNode("shadeless_bsdf"); shadeless_bsdf94.ins.Color.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); shadeless_bsdf94.ins.Strength.Value = 1f; var attenuated_reflection_color104 = new MixNode("attenuated_reflection_color"); attenuated_reflection_color104.ins.Color1.Value = new ccl.float4(0f, 0f, 0f, 1f); attenuated_reflection_color104.ins.Color2.Value = part.ReflectionColorGamma; attenuated_reflection_color104.ins.Fac.Value = part.Reflectivity; attenuated_reflection_color104.BlendType = ccl.ShaderNodes.MixNode.BlendTypes.Mix; attenuated_reflection_color104.UseClamp = false; var fresnel_based_on_constant124 = new FresnelNode("fresnel_based_on_constant"); fresnel_based_on_constant124.ins.IOR.Value = part.FresnelIOR; fresnel_based_on_constant124.ins.Normal.Value = new ccl.float4(0f, 0f, 0f, 1f); var simple_reflection110 = new CombineRgbNode("simple_reflection"); simple_reflection110.ins.R.Value = part.Reflectivity; simple_reflection110.ins.G.Value = 0f; simple_reflection110.ins.B.Value = 0f; var fresnel_reflection111 = new CombineRgbNode("fresnel_reflection"); fresnel_reflection111.ins.R.Value = 0f; fresnel_reflection111.ins.G.Value = 0f; fresnel_reflection111.ins.B.Value = 0f; var fresnel_reflection_if_reflection_used131 = new MathNode("fresnel_reflection_if_reflection_used"); fresnel_reflection_if_reflection_used131.ins.Value1.Value = part.Reflectivity; fresnel_reflection_if_reflection_used131.ins.Value2.Value = part.FresnelReflectionsAsFloat; fresnel_reflection_if_reflection_used131.Operation = MathNode.Operations.Multiply; fresnel_reflection_if_reflection_used131.UseClamp = false; var select_reflection_or_fresnel_reflection109 = new MixNode("select_reflection_or_fresnel_reflection"); select_reflection_or_fresnel_reflection109.ins.Color1.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); select_reflection_or_fresnel_reflection109.ins.Color2.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); select_reflection_or_fresnel_reflection109.ins.Fac.Value = 1f; select_reflection_or_fresnel_reflection109.BlendType = ccl.ShaderNodes.MixNode.BlendTypes.Mix; select_reflection_or_fresnel_reflection109.UseClamp = false; var shadeless95 = new MixClosureNode("shadeless"); shadeless95.ins.Fac.Value = part.ShadelessAsFloat; var glossy96 = new GlossyBsdfNode("glossy"); glossy96.ins.Color.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); glossy96.ins.Roughness.Value = part.ReflectionRoughnessPow2; glossy96.ins.Normal.Value = new ccl.float4(0f, 0f, 0f, 1f); var reflection_factor112 = new SeparateRgbNode("reflection_factor"); reflection_factor112.ins.Image.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); var attennuated_refraction_color106 = new MixNode("attennuated_refraction_color"); attennuated_refraction_color106.ins.Color1.Value = new ccl.float4(0f, 0f, 0f, 1f); attennuated_refraction_color106.ins.Color2.Value = part.TransparencyColorGamma; attennuated_refraction_color106.ins.Fac.Value = part.Transparency; attennuated_refraction_color106.BlendType = ccl.ShaderNodes.MixNode.BlendTypes.Mix; attennuated_refraction_color106.UseClamp = false; var refraction84 = new RefractionBsdfNode("refraction"); refraction84.ins.Color.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); refraction84.ins.Roughness.Value = part.RefractionRoughnessPow2; refraction84.ins.IOR.Value = part.IOR; refraction84.ins.Normal.Value = new ccl.float4(0f, 0f, 0f, 1f); refraction84.Distribution = RefractionBsdfNode.RefractionDistribution.Beckmann; var diffuse_plus_glossy107 = new MixClosureNode("diffuse_plus_glossy"); diffuse_plus_glossy107.ins.Fac.Value = 0f; var blend_in_transparency83 = new MixClosureNode("blend_in_transparency"); blend_in_transparency83.ins.Fac.Value = part.Transparency; var separate_xyz100 = new SeparateXyzNode("separate_xyz"); separate_xyz100.ins.Vector.Value = new ccl.float4(0f, 0f, 0f, 1f); var multiply101 = new MathNode("multiply"); multiply101.ins.Value1.Value = 0f; multiply101.ins.Value2.Value = -1f; multiply101.Operation = MathNode.Operations.Multiply; multiply101.UseClamp = false; var combine_xyz99 = new CombineXyzNode("combine_xyz"); combine_xyz99.ins.X.Value = 0f; combine_xyz99.ins.Y.Value = 0f; combine_xyz99.ins.Z.Value = 0f; var environment_texture97 = new ImageTextureNode("environment_texture"); environment_texture97.ins.Vector.Value = new ccl.float4(0f, 0f, 0f, 1f); environment_texture97.Projection = TextureNode.TextureProjection.Flat; environment_texture97.ColorSpace = TextureNode.TextureColorSpace.None; environment_texture97.Extension = TextureNode.TextureExtension.Repeat; environment_texture97.Interpolation = InterpolationType.Linear; environment_texture97.UseAlpha = true; environment_texture97.IsLinear = false; var attenuated_environment_color102 = new MixNode("attenuated_environment_color"); attenuated_environment_color102.ins.Color1.Value = new ccl.float4(0f, 0f, 0f, 1f); attenuated_environment_color102.ins.Color2.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); attenuated_environment_color102.ins.Fac.Value = part.EnvironmentTexture.Amount; attenuated_environment_color102.BlendType = ccl.ShaderNodes.MixNode.BlendTypes.Mix; attenuated_environment_color102.UseClamp = false; var diffuse_glossy_and_refraction108 = new MixClosureNode("diffuse_glossy_and_refraction"); diffuse_glossy_and_refraction108.ins.Fac.Value = part.Transparency; var diffuse98 = new DiffuseBsdfNode("diffuse"); diffuse98.ins.Color.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); diffuse98.ins.Roughness.Value = 0f; diffuse98.ins.Normal.Value = new ccl.float4(0f, 0f, 0f, 1f); var invert_roughness88 = new MathNode("invert_roughness"); invert_roughness88.ins.Value1.Value = 1f; invert_roughness88.ins.Value2.Value = part.RefractionRoughnessPow2; invert_roughness88.Operation = MathNode.Operations.Subtract; invert_roughness88.UseClamp = false; var multiply_transparency89 = new MathNode("multiply_transparency"); multiply_transparency89.ins.Value1.Value = 1f; multiply_transparency89.ins.Value2.Value = part.Transparency; multiply_transparency89.Operation = MathNode.Operations.Multiply; multiply_transparency89.UseClamp = false; var light_path86 = new LightPathNode("light_path"); var multiply_with_shadowray90 = new MathNode("multiply_with_shadowray"); multiply_with_shadowray90.ins.Value1.Value = 1f; multiply_with_shadowray90.ins.Value2.Value = 0f; multiply_with_shadowray90.Operation = MathNode.Operations.Multiply; multiply_with_shadowray90.UseClamp = false; var custom_environment_blend103 = new MixClosureNode("custom_environment_blend"); custom_environment_blend103.ins.Fac.Value = part.EnvironmentTexture.Amount; var coloured_shadow_trans_color87 = new TransparentBsdfNode("coloured_shadow_trans_color"); coloured_shadow_trans_color87.ins.Color.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); var weight_for_shadowray_coloured_shadow91 = new MathNode("weight_for_shadowray_coloured_shadow"); weight_for_shadowray_coloured_shadow91.ins.Value1.Value = 0f; weight_for_shadowray_coloured_shadow91.ins.Value2.Value = 1f; weight_for_shadowray_coloured_shadow91.Operation = MathNode.Operations.Multiply; weight_for_shadowray_coloured_shadow91.UseClamp = false; var transparency_texture62 = new ImageTextureNode("transparency_texture"); transparency_texture62.ins.Vector.Value = new ccl.float4(0f, 0f, 0f, 1f); transparency_texture62.Projection = TextureNode.TextureProjection.Flat; transparency_texture62.ColorSpace = TextureNode.TextureColorSpace.None; transparency_texture62.Extension = TextureNode.TextureExtension.Repeat; transparency_texture62.Interpolation = InterpolationType.Linear; transparency_texture62.UseAlpha = true; transparency_texture62.IsLinear = false; var transpluminance63 = new RgbToLuminanceNode("transpluminance"); transpluminance63.ins.Color.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); var invert_luminence64 = new MathNode("invert_luminence"); invert_luminence64.ins.Value1.Value = 1f; invert_luminence64.ins.Value2.Value = 0f; invert_luminence64.Operation = MathNode.Operations.Subtract; invert_luminence64.UseClamp = false; var transparency_texture_amount67 = new MathNode("transparency_texture_amount"); transparency_texture_amount67.ins.Value1.Value = 1f; transparency_texture_amount67.ins.Value2.Value = part.TransparencyTexture.Amount; transparency_texture_amount67.Operation = MathNode.Operations.Multiply; transparency_texture_amount67.UseClamp = false; var toggle_diffuse_texture_alpha_usage117 = new MathNode("toggle_diffuse_texture_alpha_usage"); toggle_diffuse_texture_alpha_usage117.ins.Value1.Value = 1f; toggle_diffuse_texture_alpha_usage117.ins.Value2.Value = part.DiffuseTexture.UseAlphaAsFloat; toggle_diffuse_texture_alpha_usage117.Operation = MathNode.Operations.Multiply; toggle_diffuse_texture_alpha_usage117.UseClamp = false; var toggle_transparency_texture66 = new MathNode("toggle_transparency_texture"); toggle_transparency_texture66.ins.Value1.Value = part.HasTransparencyTextureAsFloat; toggle_transparency_texture66.ins.Value2.Value = 0f; toggle_transparency_texture66.Operation = MathNode.Operations.Multiply; toggle_transparency_texture66.UseClamp = false; var coloured_shadow_mix_custom93 = new MixClosureNode("coloured_shadow_mix_custom"); coloured_shadow_mix_custom93.ins.Fac.Value = 0f; var transparent80 = new TransparentBsdfNode("transparent"); transparent80.ins.Color.Value = new ccl.float4(1f, 1f, 1f, 1f); var add_diffuse_texture_alpha118 = new MathNode("add_diffuse_texture_alpha"); add_diffuse_texture_alpha118.ins.Value1.Value = 0f; add_diffuse_texture_alpha118.ins.Value2.Value = 0f; add_diffuse_texture_alpha118.Operation = MathNode.Operations.Add; add_diffuse_texture_alpha118.UseClamp = false; var custom_alpha_cutter85 = new MixClosureNode("custom_alpha_cutter"); custom_alpha_cutter85.ins.Fac.Value = 0f; var principledbsdf132 = new UberBsdfNode("principledbsdf"); principledbsdf132.ins.BaseColor.Value = part.TransparencyColorGamma; principledbsdf132.ins.SubsurfaceColor.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f); principledbsdf132.ins.Metallic.Value = 0f; principledbsdf132.ins.Subsurface.Value = 0f; principledbsdf132.ins.SubsurfaceRadius.Value = new ccl.float4(0f, 0f, 0f, 1f); principledbsdf132.ins.Specular.Value = 0f; principledbsdf132.ins.Roughness.Value = part.ReflectionRoughnessPow2; principledbsdf132.ins.SpecularTint.Value = 0f; principledbsdf132.ins.Anisotropic.Value = 0f; principledbsdf132.ins.Sheen.Value = 0f; principledbsdf132.ins.SheenTint.Value = 0f; principledbsdf132.ins.Clearcoat.Value = 0f; principledbsdf132.ins.ClearcoatGloss.Value = 0f; principledbsdf132.ins.IOR.Value = part.IOR; principledbsdf132.ins.Transparency.Value = part.Transparency; principledbsdf132.ins.RefractionRoughness.Value = part.RefractionRoughnessPow2; principledbsdf132.ins.AnisotropicRotation.Value = 0f; principledbsdf132.ins.Normal.Value = new ccl.float4(0f, 0f, 0f, 1f); principledbsdf132.ins.ClearcoatNormal.Value = new ccl.float4(0f, 0f, 0f, 1f); principledbsdf132.ins.Tangent.Value = new ccl.float4(0f, 0f, 0f, 1f); var coloured_shadow_mix_glass_principled116 = new MixClosureNode("coloured_shadow_mix_glass_principled"); coloured_shadow_mix_glass_principled116.ins.Fac.Value = 0f; m_shader.AddNode(texcoord60); m_shader.AddNode(invert_transparency79); m_shader.AddNode(diffuse_texture61); m_shader.AddNode(weight_diffuse_amount_by_transparency_inv78); m_shader.AddNode(invert_alpha76); m_shader.AddNode(diffuse_texture_amount65); m_shader.AddNode(honor_texture_repeat77); m_shader.AddNode(repeat_mixer75); m_shader.AddNode(diffuse_behind_texture_through_alpha119); m_shader.AddNode(multiply120); m_shader.AddNode(multiply129); m_shader.AddNode(mix125); m_shader.AddNode(separate_base_color73); m_shader.AddNode(separate_diffuse_texture_color72); m_shader.AddNode(subtract126); m_shader.AddNode(subtract127); m_shader.AddNode(subtract128); m_shader.AddNode(bump_texture69); m_shader.AddNode(bump_texture_to_bw70); m_shader.AddNode(bump_amount71); m_shader.AddNode(final_base_color74); m_shader.AddNode(bump68); m_shader.AddNode(diffuse82); m_shader.AddNode(shadeless_bsdf94); m_shader.AddNode(attenuated_reflection_color104); m_shader.AddNode(fresnel_based_on_constant124); m_shader.AddNode(simple_reflection110); m_shader.AddNode(fresnel_reflection111); m_shader.AddNode(fresnel_reflection_if_reflection_used131); m_shader.AddNode(select_reflection_or_fresnel_reflection109); m_shader.AddNode(shadeless95); m_shader.AddNode(glossy96); m_shader.AddNode(reflection_factor112); m_shader.AddNode(attennuated_refraction_color106); m_shader.AddNode(refraction84); m_shader.AddNode(diffuse_plus_glossy107); m_shader.AddNode(blend_in_transparency83); m_shader.AddNode(separate_xyz100); m_shader.AddNode(multiply101); m_shader.AddNode(combine_xyz99); m_shader.AddNode(environment_texture97); m_shader.AddNode(attenuated_environment_color102); m_shader.AddNode(diffuse_glossy_and_refraction108); m_shader.AddNode(diffuse98); m_shader.AddNode(invert_roughness88); m_shader.AddNode(multiply_transparency89); m_shader.AddNode(light_path86); m_shader.AddNode(multiply_with_shadowray90); m_shader.AddNode(custom_environment_blend103); m_shader.AddNode(coloured_shadow_trans_color87); m_shader.AddNode(weight_for_shadowray_coloured_shadow91); m_shader.AddNode(transparency_texture62); m_shader.AddNode(transpluminance63); m_shader.AddNode(invert_luminence64); m_shader.AddNode(transparency_texture_amount67); m_shader.AddNode(toggle_diffuse_texture_alpha_usage117); m_shader.AddNode(toggle_transparency_texture66); m_shader.AddNode(coloured_shadow_mix_custom93); m_shader.AddNode(transparent80); m_shader.AddNode(add_diffuse_texture_alpha118); m_shader.AddNode(custom_alpha_cutter85); m_shader.AddNode(principledbsdf132); m_shader.AddNode(coloured_shadow_mix_glass_principled116); texcoord60.outs.UV.Connect(diffuse_texture61.ins.Vector); invert_transparency79.outs.Value.Connect(weight_diffuse_amount_by_transparency_inv78.ins.Value2); diffuse_texture61.outs.Alpha.Connect(invert_alpha76.ins.Value2); diffuse_texture61.outs.Color.Connect(diffuse_texture_amount65.ins.Color2); weight_diffuse_amount_by_transparency_inv78.outs.Value.Connect(diffuse_texture_amount65.ins.Fac); invert_alpha76.outs.Value.Connect(honor_texture_repeat77.ins.Value1); diffuse_texture_amount65.outs.Color.Connect(repeat_mixer75.ins.Color1); honor_texture_repeat77.outs.Value.Connect(repeat_mixer75.ins.Fac); repeat_mixer75.outs.Color.Connect(diffuse_behind_texture_through_alpha119.ins.Color1); diffuse_texture61.outs.Alpha.Connect(multiply120.ins.Value1); multiply120.outs.Value.Connect(multiply129.ins.Value1); invert_transparency79.outs.Value.Connect(multiply129.ins.Value2); multiply129.outs.Value.Connect(mix125.ins.Fac); diffuse_behind_texture_through_alpha119.outs.Color.Connect(separate_base_color73.ins.Image); mix125.outs.Color.Connect(separate_diffuse_texture_color72.ins.Image); separate_base_color73.outs.R.Connect(subtract126.ins.Value1); separate_diffuse_texture_color72.outs.R.Connect(subtract126.ins.Value2); separate_base_color73.outs.G.Connect(subtract127.ins.Value1); separate_diffuse_texture_color72.outs.G.Connect(subtract127.ins.Value2); separate_base_color73.outs.B.Connect(subtract128.ins.Value1); separate_diffuse_texture_color72.outs.B.Connect(subtract128.ins.Value2); texcoord60.outs.UV.Connect(bump_texture69.ins.Vector); bump_texture69.outs.Color.Connect(bump_texture_to_bw70.ins.Color); subtract126.outs.Value.Connect(final_base_color74.ins.R); subtract127.outs.Value.Connect(final_base_color74.ins.G); subtract128.outs.Value.Connect(final_base_color74.ins.B); bump_texture_to_bw70.outs.Val.Connect(bump68.ins.Height); bump_amount71.outs.Value.Connect(bump68.ins.Strength); final_base_color74.outs.Image.Connect(diffuse82.ins.Color); bump68.outs.Normal.Connect(diffuse82.ins.Normal); final_base_color74.outs.Image.Connect(shadeless_bsdf94.ins.Color); bump68.outs.Normal.Connect(fresnel_based_on_constant124.ins.Normal); fresnel_based_on_constant124.outs.Fac.Connect(fresnel_reflection111.ins.R); simple_reflection110.outs.Image.Connect(select_reflection_or_fresnel_reflection109.ins.Color1); fresnel_reflection111.outs.Image.Connect(select_reflection_or_fresnel_reflection109.ins.Color2); fresnel_reflection_if_reflection_used131.outs.Value.Connect(select_reflection_or_fresnel_reflection109.ins.Fac); diffuse82.outs.BSDF.Connect(shadeless95.ins.Closure1); shadeless_bsdf94.outs.Emission.Connect(shadeless95.ins.Closure2); attenuated_reflection_color104.outs.Color.Connect(glossy96.ins.Color); bump68.outs.Normal.Connect(glossy96.ins.Normal); select_reflection_or_fresnel_reflection109.outs.Color.Connect(reflection_factor112.ins.Image); attennuated_refraction_color106.outs.Color.Connect(refraction84.ins.Color); bump68.outs.Normal.Connect(refraction84.ins.Normal); shadeless95.outs.Closure.Connect(diffuse_plus_glossy107.ins.Closure1); glossy96.outs.BSDF.Connect(diffuse_plus_glossy107.ins.Closure2); reflection_factor112.outs.R.Connect(diffuse_plus_glossy107.ins.Fac); shadeless95.outs.Closure.Connect(blend_in_transparency83.ins.Closure1); refraction84.outs.BSDF.Connect(blend_in_transparency83.ins.Closure2); texcoord60.outs.EnvEmap.Connect(separate_xyz100.ins.Vector); separate_xyz100.outs.Y.Connect(multiply101.ins.Value1); separate_xyz100.outs.X.Connect(combine_xyz99.ins.X); multiply101.outs.Value.Connect(combine_xyz99.ins.Y); separate_xyz100.outs.Z.Connect(combine_xyz99.ins.Z); combine_xyz99.outs.Vector.Connect(environment_texture97.ins.Vector); environment_texture97.outs.Color.Connect(attenuated_environment_color102.ins.Color2); diffuse_plus_glossy107.outs.Closure.Connect(diffuse_glossy_and_refraction108.ins.Closure1); blend_in_transparency83.outs.Closure.Connect(diffuse_glossy_and_refraction108.ins.Closure2); attenuated_environment_color102.outs.Color.Connect(diffuse98.ins.Color); invert_roughness88.outs.Value.Connect(multiply_transparency89.ins.Value1); multiply_transparency89.outs.Value.Connect(multiply_with_shadowray90.ins.Value1); light_path86.outs.IsShadowRay.Connect(multiply_with_shadowray90.ins.Value2); diffuse_glossy_and_refraction108.outs.Closure.Connect(custom_environment_blend103.ins.Closure1); diffuse98.outs.BSDF.Connect(custom_environment_blend103.ins.Closure2); final_base_color74.outs.Image.Connect(coloured_shadow_trans_color87.ins.Color); multiply_with_shadowray90.outs.Value.Connect(weight_for_shadowray_coloured_shadow91.ins.Value1); texcoord60.outs.UV.Connect(transparency_texture62.ins.Vector); transparency_texture62.outs.Color.Connect(transpluminance63.ins.Color); transpluminance63.outs.Val.Connect(invert_luminence64.ins.Value2); invert_luminence64.outs.Value.Connect(transparency_texture_amount67.ins.Value1); invert_alpha76.outs.Value.Connect(toggle_diffuse_texture_alpha_usage117.ins.Value1); transparency_texture_amount67.outs.Value.Connect(toggle_transparency_texture66.ins.Value2); custom_environment_blend103.outs.Closure.Connect(coloured_shadow_mix_custom93.ins.Closure1); coloured_shadow_trans_color87.outs.BSDF.Connect(coloured_shadow_mix_custom93.ins.Closure2); weight_for_shadowray_coloured_shadow91.outs.Value.Connect(coloured_shadow_mix_custom93.ins.Fac); toggle_diffuse_texture_alpha_usage117.outs.Value.Connect(add_diffuse_texture_alpha118.ins.Value1); toggle_transparency_texture66.outs.Value.Connect(add_diffuse_texture_alpha118.ins.Value2); coloured_shadow_mix_custom93.outs.Closure.Connect(custom_alpha_cutter85.ins.Closure1); transparent80.outs.BSDF.Connect(custom_alpha_cutter85.ins.Closure2); add_diffuse_texture_alpha118.outs.Value.Connect(custom_alpha_cutter85.ins.Fac); bump68.outs.Normal.Connect(principledbsdf132.ins.Normal); bump68.outs.Normal.Connect(principledbsdf132.ins.ClearcoatNormal); principledbsdf132.outs.BSDF.Connect(coloured_shadow_mix_glass_principled116.ins.Closure1); coloured_shadow_trans_color87.outs.BSDF.Connect(coloured_shadow_mix_glass_principled116.ins.Closure2); weight_for_shadowray_coloured_shadow91.outs.Value.Connect(coloured_shadow_mix_glass_principled116.ins.Fac); if (part.HasDiffuseTexture) { RenderEngine.SetTextureImage(diffuse_texture61, part.DiffuseTexture); RenderEngine.SetProjectionMode(m_shader, part.DiffuseTexture, diffuse_texture61, texcoord60); } if (part.HasBumpTexture) { RenderEngine.SetTextureImage(bump_texture69, part.BumpTexture); RenderEngine.SetProjectionMode(m_shader, part.BumpTexture, bump_texture69, texcoord60); } if (part.HasTransparencyTexture) { RenderEngine.SetTextureImage(transparency_texture62, part.TransparencyTexture); RenderEngine.SetProjectionMode(m_shader, part.TransparencyTexture, transparency_texture62, texcoord60); } if (part.HasEnvironmentTexture) { RenderEngine.SetTextureImage(environment_texture97, part.EnvironmentTexture); RenderEngine.SetProjectionMode(m_shader, part.EnvironmentTexture, environment_texture97, texcoord60); } if (part.CyclesMaterialType == ShaderBody.CyclesMaterial.Glass) { return(coloured_shadow_mix_glass_principled116); } return(custom_alpha_cutter85); }
internal SpriteMgr ( RenderEngine engine ) { this.device = engine.Device; alphaSprite = new SpriteBatch( device ); additiveSprite = new SpriteBatch( device ); }
public void launch(RenderEngine renderEngine) { renderer = renderEngine; updateList(); }
/// <summary> /// 从一副包含多个子图的图片中建立动画 /// </summary> /// <param name="engine">渲染组件</param> public AnimatedSpriteSingle( RenderEngine engine ) { this.engine = engine; }
/// <summary> /// Constructor for our changequeue implementation /// </summary> /// <param name="pluginId">Id of the plugin instantiating the render change queue</param> /// <param name="engine">Reference to our render engine</param> /// <param name="doc">Document runtime serial number</param> /// <param name="view">Reference to the RhinoView for which this queue is created.</param> /// <param name="modal">Set to true if rendering modal</param> internal ChangeDatabase(Guid pluginId, RenderEngine engine, uint doc, ViewInfo view, bool modal) : base(pluginId, doc, view, !modal) { _renderEngine = engine; _objectShaderDatabase = new ObjectShaderDatabase(_objectDatabase); _shaderConverter = new ShaderConverter(engine.Settings); _modalRenderer = modal; }