C# Class RhinoCyclesCore.RenderEngine

ファイルを表示 Open project: mcneel/RhinoCycles Class Usage Examples

Public Properties

Property Type Description
DisplayLock object
RenderedSamples int
Session Session
TimeString string

Protected Properties

Property Type Description
PluginId Guid
PreviewEventArgs CreatePreviewEventArgs
m_display_update_callback CSycles.DisplayUpdateCallback
m_doc_serialnumber uint
m_flush bool
m_test_cancel_callback CSycles.TestCancelCallback
m_update_callback CSycles.UpdateCallback
m_update_render_tile_callback CSycles.RenderTileCallback
m_view ViewInfo
m_write_render_tile_callback CSycles.RenderTileCallback

Public Methods

Method Description
CheckFlushQueue ( ) : void

Check if we should change render engine status. If the changequeue has notified us of any changes Flush will be true. If we're rendering then move to State.Halted and cancel our current render progress.

ColorClamp ( int ch ) : int

Clamp color so we get valid values for system bitmap

Continue ( ) : void
CreateFloat4 ( Color color ) : float4
CreateFloat4 ( byte x, byte y, byte z, byte w ) : float4
CreateFloat4 ( double x, double y, double z ) : float4
CreateWorld ( ) : void

Tell our changequeue instance to initialise world.

DegToRad ( float ang ) : float
DisplayBuffer ( uint sessionId, uint tx, uint ty, uint tw, uint th ) : void

Update the RenderWindow or RenderBitmap with the updated tile from Cycles render progress.

FlushIt ( ) : void

Flush

IsPreview ( ) : bool

True if rendering for preview

LoggerCallback ( string msg ) : void

Callback for debug logging facility. Will be called only for Debug builds of ccycles.dll

Pause ( ) : void
RenderEngine ( Guid pluginId, CreatePreviewEventArgs previewEventArgs, bool interactive ) : System
RenderEngine ( Guid pluginId, uint docRuntimeSerialnumber, ViewInfo view, ViewportInfo vp, bool interactive ) : System
RenderEngine ( Guid pluginId, uint docRuntimeSerialNumber, bool interactive ) : System
SaveRenderedBuffer ( int sample ) : void
SetFloatTextureAsByteTexture ( bool floatAsByte ) : void

OpenCL doesn't properly support HDRi textures in the environment, so read them as byte textures instead.

SetProgress ( RenderWindow rw, string msg, float progress ) : void

Set progress to RenderWindow, if it is not null.

SetProjectionMode ( Shader shader, CyclesTextureImage texture, ImageTextureNode image_node, TextureCoordinateNode texture_coordinates ) : void

Set image texture node and link up with correct TextureCoordinateNode output based on texture ProjectionMode. This may add new nodes to the shader!

StopRendering ( ) : void

Called when user presses the stop render button.

TestCancel ( uint sid ) : void
TriggerChangesReady ( ) : void
TriggerSamplesChanged ( int samples ) : void
TriggerStatusTextUpdated ( StatusTextEventArgs e ) : void

Tell engine to fire StatusTextEvent with given arguments

UpdateCallback ( uint sid ) : void

Handle status updates

UpdateRenderTileCallback ( uint sessionId, uint x, uint y, uint w, uint h, uint depth, int startSample, int numSamples, int sample, int resolution ) : void

Handle update render tile callback

WriteRenderTileCallback ( uint sessionId, uint x, uint y, uint w, uint h, uint depth, int startSample, int numSamples, int sample, int resolution ) : void

Handle write render tile callback

Protected Methods

Method Description
CreateScene ( Client client, Device render_device, RenderEngine cycles_engine ) : Scene

create a ccl.Scene

Database_FilmUpdateTagged ( object sender, EventArgs e ) : void
Database_LightShaderChanged ( object sender, LightShaderUpdatedEventArgs e ) : void
Database_LinearWorkflowChanged ( object sender, LinearWorkflowChangedEventArgs e ) : void
Database_MaterialShaderChanged ( object sender, MaterialShaderUpdatedEventArgs e ) : void
SetCallbacks ( ) : void

Register the callbacks to the render engine session

UploadData ( ) : bool

Main entry point for uploading data to Cycles.

Private Methods

Method Description
CreateCyclesShaderFromRhinoV6BasicMat ( CyclesShader shader ) : ccl.Shader
CreateCyclesShaderFromXml ( CyclesShader shader ) : ccl.Shader
CreateMaterialShader ( CyclesShader shader ) : ccl.Shader
CreateSimpleEmissionShader ( CyclesLight light ) : ccl.Shader
HasSceneChanges ( ) : bool

Return true if any change has been received through the changequeue

ReCreateSimpleEmissionShader ( CyclesLight light, ccl.Shader emission_shader ) : ccl.Shader
RecreateBackgroundShader ( CyclesBackground background, RhinoShader &currentShader ) : void
RecreateCyclesShaderFromRhinoV6BasicMat ( CyclesShader shader, ccl.Shader existing ) : ccl.Shader
RecreateCyclesShaderFromXml ( CyclesShader shader, ccl.Shader existing ) : ccl.Shader
RecreateMaterialShader ( CyclesShader shader, ccl.Shader existing ) : ccl.Shader
RegisterEventHandler ( ) : void
SetTextureImage ( EnvironmentTextureNode envnode, CyclesTextureImage texture ) : void
SetTextureImage ( ImageTextureNode imnode, CyclesTextureImage texture ) : void
StopTheRenderer ( ) : void

Method Details

CheckFlushQueue() public method

Check if we should change render engine status. If the changequeue has notified us of any changes Flush will be true. If we're rendering then move to State.Halted and cancel our current render progress.
public CheckFlushQueue ( ) : void
return void

ColorClamp() public static method

Clamp color so we get valid values for system bitmap
public static ColorClamp ( int ch ) : int
ch int
return int

Continue() public method

public Continue ( ) : void
return void

CreateFloat4() public static method

public static CreateFloat4 ( Color color ) : float4
color System.Drawing.Color
return float4

CreateFloat4() public static method

public static CreateFloat4 ( byte x, byte y, byte z, byte w ) : float4
x byte
y byte
z byte
w byte
return float4

CreateFloat4() public static method

public static CreateFloat4 ( double x, double y, double z ) : float4
x double
y double
z double
return float4

CreateScene() protected static method

create a ccl.Scene
protected static CreateScene ( Client client, Device render_device, RenderEngine cycles_engine ) : Scene
client Client Client to create scene for
render_device Device Render device to use
cycles_engine RenderEngine Engine instance to create for
return Scene

CreateWorld() public method

Tell our changequeue instance to initialise world.
public CreateWorld ( ) : void
return void

Database_FilmUpdateTagged() protected method

protected Database_FilmUpdateTagged ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void

Database_LightShaderChanged() protected method

protected Database_LightShaderChanged ( object sender, LightShaderUpdatedEventArgs e ) : void
sender object
e LightShaderUpdatedEventArgs
return void

Database_LinearWorkflowChanged() protected method

protected Database_LinearWorkflowChanged ( object sender, LinearWorkflowChangedEventArgs e ) : void
sender object
e LinearWorkflowChangedEventArgs
return void

Database_MaterialShaderChanged() protected method

protected Database_MaterialShaderChanged ( object sender, MaterialShaderUpdatedEventArgs e ) : void
sender object
e MaterialShaderUpdatedEventArgs
return void

DegToRad() public static method

public static DegToRad ( float ang ) : float
ang float
return float

DisplayBuffer() public method

Update the RenderWindow or RenderBitmap with the updated tile from Cycles render progress.
public DisplayBuffer ( uint sessionId, uint tx, uint ty, uint tw, uint th ) : void
sessionId uint
tx uint
ty uint
tw uint
th uint
return void

FlushIt() public method

Flush
public FlushIt ( ) : void
return void

IsPreview() public method

True if rendering for preview
public IsPreview ( ) : bool
return bool

LoggerCallback() public static method

Callback for debug logging facility. Will be called only for Debug builds of ccycles.dll
public static LoggerCallback ( string msg ) : void
msg string
return void

Pause() public method

public Pause ( ) : void
return void

RenderEngine() public method

public RenderEngine ( Guid pluginId, CreatePreviewEventArgs previewEventArgs, bool interactive ) : System
pluginId Guid
previewEventArgs CreatePreviewEventArgs
interactive bool
return System

RenderEngine() public method

public RenderEngine ( Guid pluginId, uint docRuntimeSerialnumber, ViewInfo view, ViewportInfo vp, bool interactive ) : System
pluginId Guid
docRuntimeSerialnumber uint
view ViewInfo
vp ViewportInfo
interactive bool
return System

RenderEngine() public method

public RenderEngine ( Guid pluginId, uint docRuntimeSerialNumber, bool interactive ) : System
pluginId Guid
docRuntimeSerialNumber uint
interactive bool
return System

SaveRenderedBuffer() public method

public SaveRenderedBuffer ( int sample ) : void
sample int
return void

SetCallbacks() protected method

Register the callbacks to the render engine session
protected SetCallbacks ( ) : void
return void

SetFloatTextureAsByteTexture() public method

OpenCL doesn't properly support HDRi textures in the environment, so read them as byte textures instead.
public SetFloatTextureAsByteTexture ( bool floatAsByte ) : void
floatAsByte bool
return void

SetProgress() public method

Set progress to RenderWindow, if it is not null.
public SetProgress ( RenderWindow rw, string msg, float progress ) : void
rw RenderWindow
msg string
progress float
return void

SetProjectionMode() public static method

Set image texture node and link up with correct TextureCoordinateNode output based on texture ProjectionMode. This may add new nodes to the shader!
public static SetProjectionMode ( Shader shader, CyclesTextureImage texture, ImageTextureNode image_node, TextureCoordinateNode texture_coordinates ) : void
shader Shader
texture CyclesTextureImage
image_node ImageTextureNode
texture_coordinates TextureCoordinateNode
return void

StopRendering() public method

Called when user presses the stop render button.
public StopRendering ( ) : void
return void

TestCancel() public method

public TestCancel ( uint sid ) : void
sid uint
return void

TriggerChangesReady() public method

public TriggerChangesReady ( ) : void
return void

TriggerSamplesChanged() public method

public TriggerSamplesChanged ( int samples ) : void
samples int
return void

TriggerStatusTextUpdated() public method

Tell engine to fire StatusTextEvent with given arguments
public TriggerStatusTextUpdated ( StatusTextEventArgs e ) : void
e StatusTextEventArgs
return void

UpdateCallback() public method

Handle status updates
public UpdateCallback ( uint sid ) : void
sid uint
return void

UpdateRenderTileCallback() public method

Handle update render tile callback
public UpdateRenderTileCallback ( uint sessionId, uint x, uint y, uint w, uint h, uint depth, int startSample, int numSamples, int sample, int resolution ) : void
sessionId uint
x uint
y uint
w uint
h uint
depth uint
startSample int
numSamples int
sample int
resolution int
return void

UploadData() protected method

Main entry point for uploading data to Cycles.
protected UploadData ( ) : bool
return bool

WriteRenderTileCallback() public method

Handle write render tile callback
public WriteRenderTileCallback ( uint sessionId, uint x, uint y, uint w, uint h, uint depth, int startSample, int numSamples, int sample, int resolution ) : void
sessionId uint
x uint
y uint
w uint
h uint
depth uint
startSample int
numSamples int
sample int
resolution int
return void

Property Details

DisplayLock public_oe property

Lock object to protect buffer access.
public object DisplayLock
return object

PluginId protected_oe property

protected Guid PluginId
return Guid

PreviewEventArgs protected_oe property

protected CreatePreviewEventArgs PreviewEventArgs
return CreatePreviewEventArgs

RenderedSamples public_oe property

public int RenderedSamples
return int

Session public_oe property

Reference to the session of this render engine instance.
public Session Session
return Session

TimeString public_oe property

public string TimeString
return string

m_display_update_callback protected_oe property

protected CSycles.DisplayUpdateCallback m_display_update_callback
return CSycles.DisplayUpdateCallback

m_doc_serialnumber protected_oe property

protected uint m_doc_serialnumber
return uint

m_flush protected_oe property

protected bool m_flush
return bool

m_test_cancel_callback protected_oe property

protected CSycles.TestCancelCallback m_test_cancel_callback
return CSycles.TestCancelCallback

m_update_callback protected_oe property

protected CSycles.UpdateCallback m_update_callback
return CSycles.UpdateCallback

m_update_render_tile_callback protected_oe property

protected CSycles.RenderTileCallback m_update_render_tile_callback
return CSycles.RenderTileCallback

m_view protected_oe property

protected ViewInfo m_view
return ViewInfo

m_write_render_tile_callback protected_oe property

protected CSycles.RenderTileCallback m_write_render_tile_callback
return CSycles.RenderTileCallback