Compare commits

..

148 Commits

Author SHA1 Message Date
194998766c Painstakingly merge branch 'master' into temp_viewport_fx_merge
This branch will not make it into blender, however there are a few things that might be useful here for people who work on the viewport project and could be merged to master:

* Matrix stacks
There is working code for matrix stacks in gpu_matrix.c. Basically it works by overriding all draw calls with a special version that loads our custom stack in OpenGL. To refactor this out, coders should do this in three stages:

1) Inspect all calls to GPUBegin/GPUDraw*/GPURect* and only add one call to upload the matrices once to the relevant uniform of the shader, then substitute with the normal GL call.

2) Remove all hardcoded GL matrices from shaders. Shaders should use generic uniforms/uniform blocks for matrices

3) Do not use GL-style stacks. Actually stacks should be generic and local, not global. We do not care about a global projection/modelview etc matrix, rather we want to add matrix stacks locally in places where they are needed and upload those matrices to our shaders. The code can be generalized to do that by substituting the enum in the gpuMatrix* functions with a GPUMatrixStack* though it will be slightly tedious to do - like everything viewport related.

* GLU removal:

This branch also removes glu completely from blender by providing a helper library that handles drawing of some helper shapes. The way this is handled is not ideal, since it uses the GSOC code that is not the way we want to do things here, however it could be improved and made with a proper design.

There are some graphical glitches still here, but should be fixable.
2016-06-19 21:17:17 +02:00
7da189b4e8 Fix broken combine XYZ node after recent refactoring. 2016-06-18 22:37:18 +02:00
2465bd90d5 Cleanup: style, whitespace, doxy filepaths 2016-06-19 06:33:29 +10:00
d67c07ea49 Fix T48671: Cycles crash with OSL nodes and bump after recent refactoring. 2016-06-18 12:32:40 +02:00
7ac126e728 Fix T46492: GGX distribution produces black pixels
The issue was caused by some numerical instability.
2016-06-17 16:30:29 +02:00
bcde045b32 Fix T48667: Bisect-fill crash
BMO iterator would loop over removed faces.

Recent changes to mempool FREEWORD size exposed this bug.
2016-06-17 21:45:56 +10:00
ca01fe58e1 Fix T48662: Blender crash using node groups connected with displacement output in some situations 2016-06-17 12:14:36 +02:00
f0c7a2a25c Fix T48657: Incorrect render with Cycles (CPU) using texture
The sockets of the RGB to BW node were set to the wrong type after the recent node refactor.
2016-06-17 05:20:47 +02:00
d747bfbe29 Fix/cleanup BKE libquery's ID looper.
Some area were still not in sync with readfile.c, now should be better.

Note that readfile.c has been used as référence here re us refcounting,
not sure how accurate it is, time will say :|
2016-06-16 21:12:12 +02:00
503315111e readfile.c: fix some wrong usages of newlibadr_us.
There are most likely some more still, but think this should now be inline with
libquery looper...
2016-06-16 20:31:11 +02:00
d05014f844 Readfile cleanup: add new newlibadr_real_us helper. 2016-06-16 19:23:09 +02:00
42e2398ae3 Vertex paint color operations
D2050 by @metaraptor with edits

Adds levels, brightness/contrast, hsv & invert operations.
2016-06-17 01:56:59 +10:00
3f744a16c4 Correct error in recent commit 2016-06-16 22:18:59 +10:00
046adde64f Fix some rare asserts with new simple/random particle distribution code.
Optimization in binary search could lead to equality instead of expected strictly greater than value.
Harmless but noisy, and better be strict here.

reported by sergey on irc (with koro cycles benchmark file), thanks.
2016-06-16 14:08:44 +02:00
5ea27bec1f BMesh Decimate: use doubles to calculate optimized position
This allows the error threshold for calculating the optimized location to be much lower.

Resolves visible artifacts w/ 1m-tri happy-buddha example.
2016-06-16 19:25:02 +10:00
47a5d7d1bc BLI_math: Add double versions of functions
- mul_v3_m3v3_db
- mul_m3_v3_db
- negate_v3_db
2016-06-16 19:20:08 +10:00
ef515822ce Fix ruler crash using stale snap-context
Since ruler allows other operators to run (such as mode-switching).
Only cache snap-context while dragging.
2016-06-16 18:49:39 +10:00
57cff46cec BMesh Decimate: support ngons 2016-06-16 04:30:59 +10:00
9285bbe484 Fix error splitting convex faces
Created double faces, leaked memory.
2016-06-16 03:43:22 +10:00
3c64696972 Fix T48654: outline text visible while renaming
Both button and rename text would draw while renaming,
caused issues with some themes.
2016-06-15 21:46:32 +10:00
Dalai Felinto
e0db647d35 Fix region_2d_to_origin_3d not working with ortho view
In some cases when:
* the viewport was in the camera mode
* the camera was ortho
* the view was not fitting (as oppose to use HOME)

region_2d_to_origin_3d would misbehave (and consequently region_2d_to_location_3d).

Sample addon to test it:
```
import bpy

from bpy_extras.view3d_utils import (
    region_2d_to_location_3d,
    )

from mathutils import (
    Vector,
    )

class MoveXYOperator(bpy.types.Operator):
    """Translate the view using mouse events"""
    bl_idname = "view3d.move_xy"
    bl_label = "Move XY"

    @classmethod
    def poll(cls, context):
        return context.object

    def modal(self, context, event):
        if event.type == 'MOUSEMOVE':
            self.move(context, event)

        elif event.type in {'LEFTMOUSE', 'RIGHTMOUSE', 'ESC'}:
            return {'FINISHED'}

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        if context.space_data.type == 'VIEW_3D':
            self.ob = context.object
            context.window_manager.modal_handler_add(self)
            return {'RUNNING_MODAL'}
        else:
            self.report({'WARNING'}, "Active space must be a View3d")
            return {'CANCELLED'}

    def move(self, context, event):
        xy = region_2d_to_location_3d(
                context.region,
                context.space_data.region_3d,
                (event.mouse_region_x, event.mouse_region_y),
                Vector(),
                ).xy

        self.ob.location.xy = xy

def register():
    bpy.utils.register_class(MoveXYOperator)

def unregister():
    bpy.utils.unregister_class(MoveXYOperator)

if __name__ == "__main__":
    register()
```
2016-06-14 18:03:07 -03:00
09da51e603 Text Editor: auto-complete removed entire word on undo 2016-06-15 04:28:13 +10:00
81f435202a VSE: minor drawing glitch with meta's
Meta contents could obscure meta selection outline, draw after.
2016-06-15 04:08:03 +10:00
28398f654d Correct update issue caused by recent commit
VSE effects within a meta-strip could fail to update on cancel.
2016-06-15 04:08:03 +10:00
eaf894db6d Fix VSE updating effects within metas
Missing update caused internal lengths to be wrong.
2016-06-15 02:44:34 +10:00
a3a7e46318 Cleanup: Remove outdated comment, visibility layers in kernel have been removed. 2016-06-14 16:46:44 +02:00
9182e07c0e FileSpace cleanup: make ED_path_extension_type public.
Maybe we should move it to BLI, but not sure how, and where (and its defines
are SpaceFile's ones, meh :| ).
2016-06-14 16:30:16 +02:00
c7e7c1b241 Write .blend file: refactor & fixes re ID block itself.
Factorized writing of ID block's data (so far, only IDProps) into own helper func.
This also fixes missing IDProp (aka custom data) saving from GreasePencil and Library
datablocks (and add comment about why we do not save WM IDProps).

Finaly, it ensures all ID-related data are written immediately after the ID itself
(was not the case for all data types previously, some were writting their own data
before IDProps). This is not a fix (.blend file format does not enforce any order
on sub-data of datablocks, they only have to be after datablock struct itself in file),
but makes things more consistent.
2016-06-14 15:03:49 +02:00
424f41ad1c Fix T48649: VSE meta-strip overlap shuffles recursively 2016-06-14 21:57:55 +10:00
180aad5e0b Correct sequencer transform check
Check to avoid operating on same strip multiple times wasn't working.

Harmless but better make it functional.
2016-06-14 21:57:55 +10:00
a47937454c fix T48602: Changed The Collada validator to treat faces with < 3 verts as Warning and let the Mesh Validator take care of the cleanup 2016-06-14 13:09:10 +02:00
6d111a233c Fix T48613: Bump mapping in cycles is not shown on the viewport when the material use node groups 2016-06-14 11:31:00 +02:00
51cb4ea2cf Fix T48154: Decimate topology changes with scale
This can't be avoided completely, however the threshold used can be much lower.
2016-06-14 17:12:29 +10:00
049f715d1c Usual UI/i18n message fixes. 2016-06-14 00:16:39 +02:00
Phil Gosch
9c600435fa Made incremental snapping intervalls smaller for UV editor
Before the intervall was set to 0.125 which effectively resulted in 8 positions across the UV space (per axis).
I halved that value, holding shift enables an even finer movement.

This change was ported over from my soc-2016-uv_tools branch after talking with howardt, ideasman42 and hackerman-
2016-06-13 18:35:32 +02:00
abb9d0b0ad Curve Fitting: add high-quality flag
When this flag is set - even when the curve error is under the threshold,
keep attempting a better fit.

Enable this for freehand drawing, since it gives nicer results and isn't noticeably slower.
2016-06-14 02:27:32 +10:00
b0985b393c Fix T48595: UI glitch with driver menu re-opening
Holding Ctrl-D would keep opening driver menus.
2016-06-14 01:52:35 +10:00
520691e591 Bevel segments also changeable with mouse (S toggle).
Also, can use numeric input to set segments and profile when
in those respective value-adjusting modes (as per S or P toggle).
Finally, fixed problem with previous bevel commit: when changing
value-adjusting mode, would like to start off resumed value adjustment
where it was before.
2016-06-13 09:14:13 -04:00
08baf3ea79 Keymap: include 'Dopesheet Generic' 2016-06-13 23:03:00 +10:00
5be4d0b328 Fix misleading indentation in ImBuf 2016-06-13 14:46:04 +02:00
f87611622d Fix typo in variable name as well. 2016-06-13 14:08:06 +02:00
f2c5ea2516 Fix own error w/ undefined behavior
This happened to work for me but caused issues on OSX.
2016-06-13 21:57:22 +10:00
2566652ae6 Cycles: fixed a typo that would crash shaders that use the "Is Diffuse Ray" output of the LightPath node 2016-06-13 13:33:56 +02:00
617c4d6adb Fix glShadeModel being left flat in edit-mode draw 2016-06-13 19:21:46 +10:00
8d8c5a542c Cycles: Fix unhandled enumerator in OSL switch
Unsigned int is not supported by OSL as far as i concerned, so should not
really matter here. However, might be wrong and perhaps more proper idea
would be so set it as regular int?
2016-06-13 10:15:39 +02:00
1883dbd8c3 Fix T48616: Auto-merge selects extra edges
Auto-merge caused all edges between selected vertices to be selected.
This only makes sense in vertex-select-mode.

Correct edge-flag merging code, which now merges flags from multiple edges.
2016-06-13 18:07:59 +10:00
cefbe8fe54 Fix build error with GCC 6.1. 2016-06-12 21:29:19 +02:00
24d53f79b2 Fix Cycles debug build assert on some platforms, tighten checks to avoid this in the future. 2016-06-12 17:35:15 +02:00
055001111e Fix T48604: Crash on undo due to bad drawing code.
Short story: draw_lamp would add itself to delayed transp drawing list from 'xray' drawing step.
This was broken, since delayed transp drawing list is always handled **before** delayed xray one.

After undo it lead to segfault crash, v3d->afterdraw_transp still having reference to old freed scene's base.

Also added asserts that those afterdraw list are empty at end of drawing step, should help
avoiding that kind of issue in future.
2016-06-12 17:06:50 +02:00
2033f47e55 Curve Fitting: offset based fallback to calculate cubics
Add a new fallback method that uses offset distance from the curve to the line between both points,
for freehand drawing it typically only fives minor improvements (1-3% fewer points),
for curve dissolve the improvements are more noticeable.
2016-06-12 22:25:43 +10:00
66b12ef4ab BLI_math: cleanup arg names
project functions arg naming made it hard to tell which vector was projected onto.
2016-06-12 15:39:04 +10:00
65df2fd997 bmesh py api: expose BM_face_calc_tangent_*
D1988 by @wisaac, with own edits and improvements.

This improves on existing tangent calculation functions too.

- BM_face_calc_tangent_auto: Chooses method based on number of sides, used by manipulator (not exposed to Python).
- BM_face_calc_tangent_edge: from longest edge.
- BM_face_calc_tangent_edge_pair: from longest edge-pair (most useful with quads).
- BM_face_calc_tangent_edge_diagonal: edge farthest from any vertex.
- BM_face_calc_tangent_vert_diagonal: vert farthest from any vertex.

Also optimize BM_vert_tri_calc_tangent_edge* functions to avoid sqrt.
2016-06-12 15:12:34 +10:00
421ec97276 Docs: Support out-of-source reference-API builds
This was originally supported, however relative links to examples & templates made it fail.
Now files in the source tree are copied to the build-dir, with ".." replaced with "__"
to avoid having to mirror Blender's source-layout in the Sphinx build-dir.

Also skip uploading the built docs when an SSH user-name isn't passed to sphinx_doc_gen.sh
instead of aborting (so people w/o SSH access to our servers can use the shell-script).
2016-06-12 11:31:28 +10:00
2b15a588a1 Cleanup: API docs (whitespace/line length) 2016-06-12 10:05:35 +10:00
1cd3676d4d Cleanup, remove unneeded variable. 2016-06-12 00:01:57 +02:00
324bed3843 Fix compiler warning for unused variables. 2016-06-11 23:58:12 +02:00
ebdd2e0b6d Cycles: make shader node enums consistently lower case, update OSL shaders accordingly. 2016-06-11 23:50:11 +02:00
b8112a8960 Fix OS X build after Decklink changes, it is not supported yet so don't enable it. 2016-06-11 23:50:06 +02:00
eea89417f4 BGE: DeckLink card support for video capture and streaming.
You can capture and stream video in the BGE using the DeckLink video
   cards from Black Magic Design. You need a card and Desktop Video software
   version 10.4 or above to use these features in the BGE.
   Many thanks to Nuno Estanquiero who tested the patch extensively
   on a variety of Decklink products, it wouldn't have been possible without
   his help.
   You can find a brief summary of the decklink features here: https://wiki.blender.org/index.php/Dev:Source/GameEngine/Decklink
   The full API details and samples are in the Python API documentation.

bge.texture.VideoDeckLink(format, capture=0):

   Use this object to capture a video stream. the format argument describes
   the video and pixel formats and the capture argument the card number.
   This object can be used as a source for bge.texture.Texture so that the frame
   is sent to the GPU, or by itself using the new refresh method to get the video
   frame in a buffer.
   The frames are usually not in RGB but in YUV format (8bit or 10bit); they
   require a shader to extract the RGB components in the GPU. Details and sample
   shaders in the documentation.
   3D video capture is supported: the frames are double height with left and right
   eyes in top-bottom order. The 'eye' uniform (see setUniformEyef) can be used to
   sample the 3D frame when the BGE is also in stereo mode. This allows to composite
   a 3D video stream with a 3D scene and render it in stereo.
   In Windows, and if you have a nVidia Quadro GPU, you can benefit of an additional
   performance boost by using 'GPUDirect': a method to send a video frame to the GPU
   without going through the OGL driver. The 'pinned memory' OGL extension is also
   supported (only on high-end AMD GPU) with the same effect.

bge.texture.DeckLink(cardIdx=0, format=""):

   Use this object to send video frame to a DeckLink card. Only the immediate mode
   is supported, the scheduled mode is not implemented.
   This object is similar to bge.texture.Texture: you need to attach a image source
   and call refresh() to compute and send the frame to the card.
   This object is best suited for video keying: a video stream (not captured) flows
   through the card and the frame you send to the card are displayed above it (the
   card does the compositing automatically based on the alpha channel).
   At the time of this commit, 3D video keying is supported in the BGE but not in the
   DeckLink card due to a color space issue.
2016-06-11 22:26:05 +02:00
c0bf881ebf BL_Shader.setUniformEyef(name)
defines a uniform that reflects the eye being rendered in stereo mode:
    0.0 for the left eye, 0.5 for the right eye.
    In non stereo mode, the value of the uniform is fixed to 0.0.
    The typical use of this uniform is in stereo mode to sample stereo textures
    containing the left and right eye images in a top-bottom order.

    python:
      shader = obj.meshes[0].materials[mat].getShader()
      shader.setUniformEyef("eye")

    shader:
      uniform float eye;
      uniform sampler2D tex;
      void main(void)
      {
         vec4 color;
         float ty, tx;
         tx = gl_TexCoord[0].x;
         ty = eye+gl_TexCoord[0].y*0.5;
         // ty will be between 0 and 0.5 for the left eye render
         // and 0.5 and 1.0 for the right eye render.
         color = texture(tex, vec2(tx, ty));
         ...
      }
2016-06-11 22:24:18 +02:00
fa9bb2ffe9 Atomic ops: Fix atomic_add_uint32 and atomic_sub_uint32 in Windows
The assembler version in Windows used to return the previous value
    of the variable while all the other versions return the new value.
    This is now fixed for consistency.
    Note: this bug had no effect on blender because no part of the code
    use the return value of these functions, but the future BGE DeckLink
    module makes use of it to implement reference counter.
2016-06-11 22:15:25 +02:00
40f1c4f343 BGE: Various render improvements.
bge.logic.setRender(flag) to enable/disable render.
    The render pass is enabled by default but it can be disabled with
    bge.logic.setRender(False).
    Once disabled, the render pass is skipped and a new logic frame starts
    immediately. Note that VSync no longer limits the fps when render is off
    but the 'Use Frame Rate' option in the Render Properties still does.
    To run as many frames as possible, untick the option
    This function is useful when you don't need the default render, e.g.
    when doing offscreen render to an alternate device than the monitor.
    Note that without VSync, you must limit the frame rate by other means.

fbo = bge.render.offScreenCreate(width,height,[,samples=0][,target=bge.render.RAS_OFS_RENDER_BUFFER])
    Use this method to create an offscreen buffer of given size, with given MSAA
    samples and targetting either a render buffer (bge.render.RAS_OFS_RENDER_BUFFER)
    or a texture (bge.render.RAS_OFS_RENDER_TEXTURE). Use the former if you want to
    retrieve the frame buffer on the host and the latter if you want to pass the render
    to another context (texture are proper OGL object, render buffers aren't)
    The object created by this function can only be used as a parameter of the
    bge.texture.ImageRender() constructor to send the the render to the FBO rather
    than to the frame buffer. This is best suited when you want to create a render
    of specific size, or if you need an image with an alpha channel.

bge.texture.<imagetype>.refresh(buffer=None, format="RGBA", ts=-1.0)
    Without arg, the refresh method of the image objects is pretty much a no-op, it
    simply invalidates the image so that on next texture refresh, the image will
    be recalculated.
    It is now possible to pass an optional buffer object to transfer the image (and
    recalculate it if it was invalid) to an external object. The object must implement
    the 'buffer protocol'. The image will be transfered as "RGBA" or "BGRA" pixels
    depending on format argument (only those 2 formats are supported) and ts is an
    optional timestamp in the image depends on it (e.g. VideoFFmpeg playing a video file).
    With this function you don't need anymore to link the image object to a Texture
    object to use: the image object is self-sufficient.

bge.texture.ImageRender(scene, camera, fbo=None)
    Render to buffer is possible by passing a FBO object (see offScreenCreate).

bge.texture.ImageRender.render()
    Allows asynchronous render: call this method to render the scene but without
    extracting the pixels yet. The function returns as soon as the render commands
    have been send to the GPU. The render will proceed asynchronously in the GPU
    while the host can perform other tasks.
    To complete the render, you can either call refresh() directly of refresh the texture
    to which this object is the source. Asynchronous render is useful to achieve optimal
    performance: call render() on frame N and refresh() on frame N+1 to give as much as
    time as possible to the GPU to render the frame while the game engine can perform other tasks.

Support negative scale on camera.
    Camera scale was previously ignored in the BGE.
    It is now injected in the modelview matrix as a vertical or horizontal flip
    of the scene (respectively if scaleY<0 and scaleX<0).
    Note that the actual value of the scale is not used, only the sign.
    This allows to flip the image produced by ImageRender() without any performance
    degradation: the flip is integrated in the render itself.

Optimized image transfer from ImageRender to buffer.
    Previously, images that were transferred to the host were always going through
    buffers in VideoTexture. It is now possible to transfer ImageRender
    images to external buffer without intermediate copy (i.e. directly from OGL to buffer)
    if the attributes of the ImageRender objects are set as follow:
       flip=False, alpha=True, scale=False, depth=False, zbuff=False.
       (if you need to flip the image, use camera negative scale)
2016-06-11 22:05:20 +02:00
5b061ddf1e Fix Gradient Texture and OSL after refactor. 2016-06-11 21:40:00 +02:00
0b415700f4 Attempted fix for T48625: tablet button configured to right click not working on OS X. 2016-06-11 20:32:24 +02:00
42aec3b355 Cycles: nodify shader nodes
Differential Revision: https://developer.blender.org/D2038
2016-06-11 20:32:24 +02:00
4df6474f01 Fix T48617: VSE: Do not draw backdrop in Seq + Preview mode, only makes sense when no preview is available... 2016-06-11 17:28:32 +02:00
dccf5afbef BLI_rand: add BLI_rng_get_char_n
Use to fill an array of bytes to random values.
2016-06-12 00:41:02 +10:00
4ec1c76afc Fix T48634: Interpolation and distribution of Children Particles breaks.
Own stupid off-by-one regression in rB019ce363b01bba0afe1 and later...
2016-06-11 14:37:47 +02:00
07925b6316 UI Font: Fix bad kerning of Thai font.
Thai font is a complex script that assumes full featured unicode layout engine,
while Blender only knows about basic kerning (offset of a char based on the previous one).

So this commit edits Thai part of our i18n font to fix the very bad spacing of thai chars
we had in Blender so far.

Work done by Hồ Châu, many thanks!
2016-06-11 10:47:53 +02:00
a99c03a0ad VSE: select by group: add option to select by group on same channel only. 2016-06-10 18:40:31 +02:00
25f3c0a395 Install_deps: add '--no-build' option to prevent compiling anything. 2016-06-10 18:09:34 +02:00
54343b821d GPU: use basic-shader for line-stipple 2016-06-10 07:50:49 +10:00
af077706fb Remove redundant GL attribute push/pop
Stipple isnt left on during object drawing
2016-06-10 07:50:49 +10:00
b07508a362 Fix GPU logical error changing stipple 2016-06-10 07:50:49 +10:00
a5788a9c47 Cleanup: brace-placement 2016-06-10 07:50:45 +10:00
8529b2f925 BGE: alpha on frame buffer and precedence of MSAA over swap.
A new option '-a' can be passed to the blenderplayer. It forces the
framebuffer to have an alpha channel.
This can be used in VideoTexture to return a image with alpha channel
with ImageViewport (provided alpha is set to True on the ImageViewport
object and that the background color alpha channel is 0, which is the
default).
Without the -a option, the frame buffer has no alpha channel and
ImageViewport always returns an opaque image, no matter what.
In Linux, the player window will be rendered transparently over
the desktop.
In Windows, the player window is still rendered opaque because
transparency of the window is only possible using the 'compositing'
functions of Windows. The code is there but not enabled  (look for
WIN32_COMPOSITING) because 1) it doesn't work so well 2) it requires
a DLL that is only available on Vista and up.

give precedence to AA over Swap copy:

Certain GPU (intel) will not allow MSAA together with swap copy.
Previously, swap copy had priority over MSAA: fewer AA samples would be
chosen if it was the condition to get swap copy. This patch reverse the
logic: swap copy will be abandonned if another swap method (undefined or
exchange) will provide the number of AA samples requested. If no AA
samples is requested, swap copy still has the priority of course.
2016-06-09 22:15:13 +02:00
5da02ab9e2 GPU: only call glShadeModel when needed 2016-06-10 06:11:14 +10:00
efd547f3da GPU: avoid multiple bind calls in GPU_draw_pbvh_buffers
Also add utility functions: GPU_basic_shader_bind_enable/disable
so we don't have to get the previous state every time and manipulate it
2016-06-10 06:09:11 +10:00
6798809c7e Flat shading for basic shader
The purpose of the patch is to replace deprecated  glShadeModel.

To decrease glShadeModel calls I've set GL_SMOOTH by default

Reviewers: merwin, brecht

Reviewed By: brecht

Subscribers: blueprintrandom, Evgeny_Rodygin, AlexKowel, yurikovelenov

Differential Revision: https://developer.blender.org/D1958
2016-06-10 05:38:17 +10:00
d733826708 Fix T48614: Blender from buildbot crash when Separate selection in this particular scene.
Regression from recent rB2c5dc66d5effd4072f438afb, if last item of last chunk of a mempool was valid,
it would not be returned by mempool iterator step, which would always return NULL in that case.
2016-06-09 17:53:51 +02:00
20f0e2f342 Compilation error fix after recent cleanup
Please do not do cleanups in minimal configuration, doing that has been
proven to only cause issues without solving anything meaningful ;)
2016-06-09 09:53:35 +02:00
88ac2d390b Cleanup: GPU arg wrapping 2016-06-09 05:44:25 +10:00
5065343074 Cleanup: GPU headers 2016-06-09 05:38:43 +10:00
d01499a45c GPU: avoid disabling basic-shader for lasso
Replace glDrawPixels w/ glaDrawPixelsTex
2016-06-09 05:17:43 +10:00
69bf7a44aa Fix armature stick draw, unpack-alignment was set but never restored
Drawing a single stick bone set the alignment to 1, applying this setting to the rest of Blender.
2016-06-09 05:17:43 +10:00
b41cfb590c glutil: add glaGetOneInt helper 2016-06-09 05:17:43 +10:00
b32fd196a0 Depsgraph: Avoid redundant connection from IK solver to chain
Could give barely measurable speedup on a complex rigs.
2016-06-08 17:33:04 +02:00
c683c3805e Depsgraph: Remove unused code
Became obsolete after recent changes.
2016-06-08 17:33:04 +02:00
bdd855ac1a Depsgraph: Optimize flush update when there's few objects and fewzillions of bones
Avoid annoying checks form inside operations loop, gives few percent speedup in
files like army_of_blenrigs.
2016-06-08 17:33:04 +02:00
b9de44f458 GPU: fix texface image w/ basic-shader 2016-06-09 00:44:20 +10:00
Julian Eisel
fc96110bb5 Make uiLists placed in popups usable
It's still not completely working - there are still some glitches - but far better than before.
To make buttons of the uiList work, you have to add a 'check' callback to the operator that invokes the menu. Only if it returns True, the uiList gets refreshed. To avoid this we have to make the region refresh tagging in the entire button handling a bit smarter.

Changes I had to do:
* Call uiList handling from menu/popup handling if needed.
* Make uiList handling use special popup refresh tag if placed in menu.
* Allow popups invoked from py operator to tag for refresh by using operator 'check' callback.
* Tag popup for refresh when resizing uiList.

Mostly fixes T48612.
2016-06-08 16:05:23 +02:00
37fc4b575f Fix FPE exception happening when converting linear<->srgb using SIMD 2016-06-08 16:00:34 +02:00
6ca6d3c4fd Cleanup: typo 2016-06-08 22:31:35 +10:00
e02679f71e Cleanup: typos 2016-06-08 22:25:23 +10:00
5e063ce6c9 Fix edit-mesh draw not disabling stipple
Caused problem w/ basic-shader
2016-06-08 21:37:34 +10:00
6307e823ca Cycles: Fix crash after recent zero scale instance optimization 2016-06-08 12:25:35 +02:00
438bdccff3 Buildobt: Update master config 2016-06-08 12:17:18 +02:00
b7a0340414 Buildbot: Give 2015 builds different name 2016-06-08 12:01:26 +02:00
4845736e41 3D Text: Use BLI_array_store for undo storage 2016-06-08 19:26:49 +10:00
94057b15d1 3D Text: Store separate arrays for undo data
Don't store maximum length of text per undo step,
or attempt to pack all data in a single array.

Was storing 32766 characters per undo step, irrespective of actual text length.
2016-06-08 19:21:18 +10:00
c6864c408b 3D Text: move undo into its own file 2016-06-08 19:12:23 +10:00
0a029e3dd1 BLI_array_store: move helper functions into their own API 2016-06-08 19:12:23 +10:00
e623d6b223 Fix cloth stability when in perfect rest shape.
The way cloth is coded, structural springs are only effective when stretched, while bending springs act only when shrunk. However, when cloth is exactly in its rest shape, neither have any effect, and effectively don't exist for the implicit solver.

This creates a stability problem in the initial frames of the simulation, especially considering that gravity seems to act so precisely that it doesn't disturb the strict equality of lengths, so in parts of the cloth this springless state can continue for quite a while.

Here is an example of things going haywire because of this and some suspicious logic in collision code acting together: {F314558}

Changing the condition so that structural springs are active even at exactly rest length fixes this test case. The use of >= is also supported by the original paper that the cloth implementation in blender is based on.

Reviewers: lukastoenne

Reviewed By: lukastoenne

Projects: #bf_blender

Differential Revision: https://developer.blender.org/D2028
2016-06-08 10:32:11 +02:00
1345865dcd Buildbot: Trickery for MSVC2015 and NVCC 2016-06-08 10:31:04 +02:00
fc60689a25 Correct assert 2016-06-08 16:31:40 +10:00
eaa19177e7 GPU: fix/workaround basic shader font-color
All text was displaying black.

BLF uses alpha-only textures which aren't supported by the basic-shader,
Workaround this by using texture swizzle so the RGB components of the texture are set to 1.
2016-06-08 15:20:57 +10:00
654019fa01 Cycles: Fix two numerical issues in the volume code
This hopefully fixes T48383 by avoiding two numerical problems that I found in the volume code.

Reviewers: sergey, dingto, brecht

Reviewed By: sergey, dingto, brecht

Maniphest Tasks: T48383

Differential Revision: https://developer.blender.org/D2051
2016-06-08 03:17:19 +02:00
942b98e55c Use stubs for glrecti/glrectf to make sure the matrix stacks have been
committed.
2015-05-11 18:02:15 +02:00
7e0a3c2c9e Merge branch 'master' into temp_viewport_fx_merge 2015-05-11 17:44:03 +02:00
333e58919c Merge branch 'master' into temp_viewport_fx_merge
Conflicts:
	source/blender/editors/gpencil/drawgpencil.c
	source/blender/editors/space_sequencer/sequencer_draw.c
	source/blender/editors/space_view3d/drawobject.c
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/editors/transform/transform.c
2015-05-11 11:33:03 +02:00
36f5dffc6a Merge branch 'master' into temp_viewport_fx_merge
Conflicts:
	source/blender/editors/gpencil/drawgpencil.c
2015-04-20 11:01:12 +02:00
fc0e24b05c Blender displays fine again without errors, using the custom matrix
stacks.

Still need to replace glRect calls to completely fix it probably.

This still does not use the soc API properly.
2015-04-14 22:15:17 +02:00
2fd4fc1f2d Hello non crashy world! Still not 100% correct but at least now it fires
up.

Issue was getting matrices from GL instead of own matrix stack
2015-04-14 20:03:23 +02:00
707ee19146 Trying to solve text crash issues 2015-04-14 18:08:16 +02:00
394b815261 Substitute draw calls with a wrapper to make sure current matrix stack
works.
2015-04-14 15:23:13 +02:00
7cea6ecddb Merge branch 'master' into temp_viewport_fx_merge
Conflicts:
	source/blender/editors/interface/interface_widgets.c
	source/blender/editors/space_graph/graph_draw.c
2015-04-14 14:13:02 +02:00
87cb1cc2e6 Merge branch 'master' into temp_viewport_fx_merge
Also tried to use gpuMatrix calls where possible in new code
- might have missed a few places.

Conflicts:
	source/blender/editors/space_view3d/view3d_edit.c
	source/blender/editors/transform/transform.c
2015-04-10 11:29:19 +02:00
0d4db6e9e8 Matrix API: explicitly set the matrix we tweak - much clearer this way and
we may even use explicit stacks in the future.
2015-04-03 18:04:28 +02:00
32b481f873 No declarations in for-loops and warning fixes for matrix pointers 2015-04-03 15:51:09 +02:00
53cfd4761c fix another Mac crasher
According to LLDB everything we pass to glVertexPointer and
glDrawElements seems perfectly OK, but for some reason it crashes in
the driver.

With this change I was finally able to run this branch! Until sync-ing
with today’s matrix module.
2015-04-01 20:28:23 -04:00
4491627bfa move glColor outside loop
instead of repeatedly setting the same color
2015-04-01 20:18:13 -04:00
c3f3b958dc cleanup
no functional change
2015-04-01 20:15:32 -04:00
49e0eff55d fix VAOs on Mac legacy context
Was causing crash on launch.

GLEW gives us glBindVertexArray and friends but sets them to NULL,
since Apple uses GL_APPLE_vertex_array_object instead of
GL_ARB_vertex_array_object. The ARB version evolved from the APPLE
version and they’re used in exactly the same way, so I aliased them to
keep our VAO code simple.
2015-04-01 20:13:45 -04:00
2d82d98669 Matrix module: substitution WIP.
Warning - don't open blender up or it will hang your computer
2015-04-01 20:54:07 +02:00
38125d3547 Small cleanup 2015-04-01 20:54:07 +02:00
bf696c65fd more minor cleanup 2015-04-01 14:25:06 -04:00
c9f3339aa3 fix array range check
Allowed writing past the buffer’s end.

Thanks, clang!
2015-04-01 14:25:05 -04:00
7f1e982da1 use reciprocals for vertex data conversion
* is faster than / even on modern CPUs. If we care to inline, speed is
a concern here.
2015-04-01 14:25:05 -04:00
8e49d815d1 minor cleanup 2015-04-01 14:25:05 -04:00
d323c4904e More cleanup and interface resurrected 2015-04-01 14:59:26 +02:00
6cc93dcc5e Fix an invalid operation 2015-04-01 14:40:13 +02:00
3fd766ba38 Exit without leaks and crashes. 2015-04-01 14:30:57 +02:00
b350e51f53 More API changes, get rid of indexBufferDataGLSL (we can reuse vertex
streams effectively here)
2015-04-01 14:24:07 +02:00
14aca96652 Blender now runs without crashing, but still garbage on screen. 2015-04-01 14:12:11 +02:00
559a21d467 Changes to the gpu immediate API to reuse the new vertexstream
abstractions (still does not work)
2015-04-01 13:35:57 +02:00
9e1aec6c63 Some compilation fixes after merge 2015-04-01 11:49:50 +02:00
9d854700d6 Merge branch 'master' into temp_viewport_fx_merge
Conflicts:
	source/blender/editors/space_view3d/drawobject.c
	source/blender/editors/space_view3d/view3d_edit.c
	source/blender/gpu/GPU_extensions.h
	source/blender/gpu/intern/gpu_draw.c
	source/blender/gpu/intern/gpu_extensions.c
2015-04-01 11:34:30 +02:00
dd95926c6e Fix compilation with scons 2015-03-24 17:41:57 +01:00
3af88c69aa cleanup: code style
Mostly I wanted to go through the new GPU library code and learn it
thoroughly.
2015-03-23 01:07:39 -04:00
96b01755af delete redundant C++ file
gpu_lighting.c has all of this code.
2015-03-22 20:24:26 -04:00
85d5c78901 Blender compiles again and has most of the mising files now. 2015-03-18 22:37:44 +01:00
f707ffdd3a Even more missing stuffs 2015-03-18 22:08:02 +01:00
36ae264727 Still more files from branch that were left over uncommitted. 2015-03-18 22:00:34 +01:00
b6e99a672b Blender now compiles (whee) but don't try to run it :p 2015-03-18 20:29:35 +01:00
17569847e8 Basic shaders 2015-03-18 20:27:54 +01:00
2f61341bfc Move element indices to vertex stream code. 2015-03-18 20:16:06 +01:00
86f21ba177 Refactoring to make stub for vertex interface redundant. 2015-03-18 20:00:43 +01:00
dd958cb5b6 GSOC viewport project by
Jason Wilkins. Master rebase work in progress.

Branch here still does not compile and there may be some changes to the
naming and API, but it should serve to keep things visible.
2015-03-18 14:44:16 +01:00
403 changed files with 22990 additions and 8179 deletions

View File

@@ -229,8 +229,12 @@ option(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" )
mark_as_advanced(WITH_SYSTEM_BULLET)
option(WITH_GAMEENGINE "Enable Game Engine" ${_init_GAMEENGINE})
if(APPLE)
set(WITH_GAMEENGINE_DECKLINK OFF)
else()
option(WITH_GAMEENGINE_DECKLINK "Support BlackMagicDesign DeckLink cards in the Game Engine" ON)
endif()
option(WITH_PLAYER "Build Player" OFF)
option(WITH_DECKLINK "Support BlackMagicDesign DeckLink cards in the BGE" ON)
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
# Compositor
@@ -457,12 +461,6 @@ mark_as_advanced(
WITH_GL_PROFILE_ES20
)
if(WITH_GL_PROFILE_COMPAT)
set(WITH_GLU ON)
else()
set(WITH_GLU OFF)
endif()
if(WIN32)
option(WITH_GL_ANGLE "Link with the ANGLE library, an OpenGL ES 2.0 implementation based on Direct3D, instead of the system OpenGL library." OFF)
mark_as_advanced(WITH_GL_ANGLE)
@@ -2527,11 +2525,6 @@ endif()
find_package(OpenGL)
blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}")
if(WITH_GLU)
list(APPEND BLENDER_GL_LIBRARIES "${OPENGL_glu_LIBRARY}")
list(APPEND GL_DEFINITIONS -DWITH_GLU)
endif()
if(WITH_SYSTEM_GLES)
find_package_wrapper(OpenGLES)
endif()
@@ -2759,9 +2752,7 @@ else()
endif()
if(NOT WITH_GLU)
list(APPEND GL_DEFINITIONS -DGLEW_NO_GLU)
endif()
list(APPEND GL_DEFINITIONS -DGLEW_NO_GLU)
#-----------------------------------------------------------------------------
# Configure Bullet
@@ -3260,7 +3251,6 @@ if(FIRST_RUN)
info_cfg_text("OpenGL:")
info_cfg_option(WITH_GLEW_ES)
info_cfg_option(WITH_GLU)
info_cfg_option(WITH_GL_EGL)
info_cfg_option(WITH_GL_PROFILE_COMPAT)
info_cfg_option(WITH_GL_PROFILE_CORE)

1386
SConstruct Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,7 @@
ARGS=$( \
getopt \
-o s:i:t:h \
--long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-confirm,with-all,with-opencollada,\
--long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,with-all,with-opencollada,\
ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,\
force-all,force-python,force-numpy,force-boost,\
force-ocio,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
@@ -97,6 +97,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--no-sudo
Disable use of sudo (this script won't be able to do much though, will just print needed packages...).
--no-build
Do not build (compile) anything, dependencies not installable with the package manager will remain missing.
--no-confirm
Disable any interaction with user (suitable for automated run).
@@ -267,6 +270,7 @@ DO_SHOW_DEPS=false
SUDO="sudo"
NO_BUILD=false
NO_CONFIRM=false
PYTHON_VERSION="3.5.1"
@@ -463,6 +467,12 @@ while true; do
PRINT ""
SUDO=""; shift; continue
;;
--no-build)
PRINT ""
WARNING "--no-build enabled, this script will not be able to install all dependencies..."
PRINT ""
NO_BUILD=true; shift; continue
;;
--no-confirm)
NO_CONFIRM=true; shift; continue
;;
@@ -967,6 +977,11 @@ clean_Python() {
}
compile_Python() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, Python will not be compiled!"
return
fi
# To be changed each time we make edits that would modify the compiled result!
py_magic=1
_init_python
@@ -1032,6 +1047,11 @@ clean_Numpy() {
}
compile_Numpy() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, Numpy will not be compiled!"
return
fi
# To be changed each time we make edits that would modify the compiled result!
numpy_magic=0
_init_numpy
@@ -1092,6 +1112,11 @@ clean_Boost() {
}
compile_Boost() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, Boost will not be compiled!"
return
fi
# To be changed each time we make edits that would modify the compiled result!
boost_magic=10
@@ -1165,6 +1190,11 @@ clean_OCIO() {
}
compile_OCIO() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, OpenColorIO will not be compiled!"
return
fi
# To be changed each time we make edits that would modify the compiled result!
ocio_magic=1
_init_ocio
@@ -1256,6 +1286,11 @@ clean_ILMBASE() {
}
compile_ILMBASE() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, ILMBase will not be compiled!"
return
fi
# To be changed each time we make edits that would modify the compiled result!
ilmbase_magic=10
_init_ilmbase
@@ -1343,6 +1378,11 @@ clean_OPENEXR() {
}
compile_OPENEXR() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, OpenEXR will not be compiled!"
return
fi
# To be changed each time we make edits that would modify the compiled result!
openexr_magic=14
@@ -1458,6 +1498,11 @@ clean_OIIO() {
}
compile_OIIO() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, OpenImageIO will not be compiled!"
return
fi
# To be changed each time we make edits that would modify the compiled result!
oiio_magic=16
_init_oiio
@@ -1589,6 +1634,11 @@ clean_LLVM() {
}
compile_LLVM() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, LLVM will not be compiled!"
return
fi
# To be changed each time we make edits that would modify the compiled result!
llvm_magic=3
_init_llvm
@@ -1686,6 +1736,11 @@ clean_OSL() {
}
compile_OSL() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, OpenShadingLanguage will not be compiled!"
return
fi
# To be changed each time we make edits that would modify the compiled result!
osl_magic=20
_init_osl
@@ -1812,6 +1867,11 @@ clean_OSD() {
}
compile_OSD() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, OpenSubdiv will not be compiled!"
return
fi
# To be changed each time we make edits that would modify the compiled result!
osd_magic=1
_init_osd
@@ -1904,6 +1964,11 @@ clean_BLOSC() {
}
compile_BLOSC() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, Blosc will not be compiled!"
return
fi
# To be changed each time we make edits that would modify the compiled result!
blosc_magic=0
_init_blosc
@@ -1986,6 +2051,11 @@ clean_OPENVDB() {
}
compile_OPENVDB() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, OpenVDB will not be compiled!"
return
fi
compile_BLOSC
PRINT ""
@@ -2082,6 +2152,11 @@ clean_OpenCOLLADA() {
}
compile_OpenCOLLADA() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, OpenCOLLADA will not be compiled!"
return
fi
# To be changed each time we make edits that would modify the compiled results!
opencollada_magic=9
_init_opencollada
@@ -2161,6 +2236,11 @@ clean_FFmpeg() {
}
compile_FFmpeg() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, ffmpeg will not be compiled!"
return
fi
# To be changed each time we make edits that would modify the compiled result!
ffmpeg_magic=5
_init_ffmpeg

View File

@@ -285,7 +285,7 @@ def generic_builder(id, libdir='', branch='', rsync=False):
maxsize=150 * 1024 * 1024,
workdir='install'))
f.addStep(MasterShellCommand(name='unpack',
command=['python', unpack_script, filename],
command=['python2.7', unpack_script, filename],
description='unpacking',
descriptionDone='unpacked'))
return f

View File

@@ -77,10 +77,12 @@ if 'cmake' in builder:
elif builder.startswith('win'):
if builder.endswith('_vc2015'):
if builder.startswith('win64'):
cmake_options.extend(['-G', 'Visual Studio 14 2015 Win64', '-DWITH_CYCLES_CUDA_BINARIES=0'])
cmake_options.extend(['-G', 'Visual Studio 14 2015 Win64'])
elif builder.startswith('win32'):
bits = 32
cmake_options.extend(['-G', 'Visual Studio 14 2015', '-DWITH_CYCLES_CUDA_BINARIES=0'])
cmake_options.extend(['-G', 'Visual Studio 14 2015'])
cmake_extra_options.append('-DCUDA_NVCC_FLAGS=--cl-version;2013;' +
'--compiler-bindir;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\bin')
else:
if builder.startswith('win64'):
cmake_options.extend(['-G', 'Visual Studio 12 2013 Win64'])

View File

@@ -108,6 +108,8 @@ if builder.find('cmake') != -1:
platform += 'i386'
elif builder.endswith('ppc_10_6_cmake'):
platform += 'ppc'
if builder.endswith('vc2015'):
platform += "-vc14"
builderified_name = 'blender-{}-{}-{}'.format(blender_full_version, git_hash, platform)
if branch != '':
builderified_name = branch + "-" + builderified_name

View File

@@ -685,7 +685,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
list_insert_after(BLENDER_SORTED_LIBS "ge_logic_ngnetwork" "extern_bullet")
endif()
if(WITH_DECKLINK)
if(WITH_GAMEENGINE_DECKLINK)
list(APPEND BLENDER_SORTED_LIBS bf_intern_decklink)
endif()

View File

@@ -0,0 +1,263 @@
import commands
#############################################################################
################### Compiler & architecture settings ##################
#############################################################################
MACOSX_ARCHITECTURE = 'x86_64' # valid archs: ppc, i386, ppc64, x86_64
MACOSX_SDK='' # set an sdk name like '10.7' or leave empty for automatic choosing highest available
MACOSX_DEPLOYMENT_TARGET = '10.6'
# gcc always defaults to the system standard compiler linked by a shim or symlink
CC = 'gcc'
CXX = 'g++'
LCGDIR = '#../lib/darwin-9.x.universal'
LIBDIR = '${LCGDIR}'
#############################################################################
################### Dependency settings ##################
#############################################################################
# enable ffmpeg support
WITH_BF_FFMPEG = True
BF_FFMPEG = LIBDIR + '/ffmpeg'
BF_FFMPEG_INC = "${BF_FFMPEG}/include"
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg bz2'
#bz2 is a standard osx dynlib
BF_PYTHON_VERSION = '3.4'
WITH_OSX_STATICPYTHON = True
# python 3.4 uses precompiled libraries in bf svn /lib by default
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}m'
# BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}m'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
# BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
WITH_BF_OPENAL = True
BF_OPENAL = LIBDIR + '/openal'
WITH_BF_STATICOPENAL = False
BF_OPENAL_INC = '${BF_OPENAL}/include' # only headers from libdir needed for proper use of framework !!!!
#BF_OPENAL_LIB = 'openal'
#BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
# Warning, this static lib configuration is untested! users of this OS please confirm.
#BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_CXX = '/usr'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
# we use simply jack framework
WITH_BF_JACK = True
BF_JACK = '/Library/Frameworks/Jackmp.framework'
BF_JACK_INC = '${BF_JACK}/headers'
#BF_JACK_LIB = 'jack' # not used due framework
BF_JACK_LIBPATH = '${BF_JACK}'
WITH_BF_SNDFILE = True
BF_SNDFILE = LIBDIR + '/sndfile'
BF_SNDFILE_INC = '${BF_SNDFILE}/include'
BF_SNDFILE_LIB = 'sndfile FLAC ogg vorbis vorbisenc'
BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib ${BF_FFMPEG}/lib' #ogg libs are stored in ffmpeg dir
WITH_BF_SDL = True
BF_SDL = LIBDIR + '/sdl' #$(shell sdl-config --prefix)
BF_SDL_INC = '${BF_SDL}/include' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
BF_SDL_LIB = 'SDL2' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
BF_SDL_LIBPATH = '${BF_SDL}/lib'
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = '${LCGDIR}/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread'
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = True
WITH_BF_JPEG = True
BF_JPEG = LIBDIR + '/jpeg'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'jpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_OPENJPEG = True
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_PNG = True
BF_PNG = LIBDIR + '/png'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
BF_PNG_LIBPATH = '${BF_PNG}/lib'
WITH_BF_TIFF = True
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
BF_TIFF_LIB = 'tiff'
BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
WITH_BF_ZLIB = True
BF_ZLIB = '/usr'
#BF_ZLIB_INC = '${BF_ZLIB}/include' # don't use this, it breaks -isysroot ${MACOSX_SDK}
BF_ZLIB_LIB = 'z'
WITH_BF_INTERNATIONAL = True
WITH_BF_GAMEENGINE = True
WITH_BF_PLAYER = True
WITH_BF_OCEANSIM = True
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
WITH_BF_FFTW3 = True
BF_FFTW3 = LIBDIR + '/fftw3'
BF_FFTW3_INC = '${BF_FFTW3}/include'
BF_FFTW3_LIB = 'libfftw3'
BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
BF_FREETYPE = LIBDIR + '/freetype'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = True
WITH_BF_ICONV = True
BF_ICONV = '/usr'
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
#BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = True
BF_OPENGL_LIB = 'GL'
BF_OPENGL_LIBPATH = '/System/Library/Frameworks/OpenGL.framework/Libraries'
BF_OPENGL_LINKFLAGS = ['-framework', 'OpenGL']
#OpenCollada flags
WITH_BF_COLLADA = True
BF_COLLADA = '#source/blender/collada'
BF_COLLADA_INC = '${BF_COLLADA}'
BF_COLLADA_LIB = 'bf_collada'
BF_OPENCOLLADA = LIBDIR + '/opencollada'
BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
BF_OPENCOLLADA_LIB = 'OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils OpenCOLLADAStreamWriter MathMLSolver GeneratedSaxParser xml2 buffer ftoa'
BF_OPENCOLLADA_LIBPATH = LIBDIR + '/opencollada'
BF_PCRE = LIBDIR + '/opencollada'
BF_PCRE_LIB = 'pcre'
BF_PCRE_LIBPATH = '${BF_PCRE}/lib'
#BF_EXPAT = '/usr'
#BF_EXPAT_LIB = 'expat'
#BF_EXPAT_LIBPATH = '/usr/lib'
# Cycles
WITH_BF_CYCLES = True
#OSL
WITH_BF_CYCLES_OSL = True
BF_OSL = LIBDIR + '/osl'
BF_OSL_INC = '${BF_OSL}/include'
# note oslexec would passed via program linkflags, which is needed to
# make llvm happy with osl_allocate_closure_component
#BF_OSL_LIB = 'oslcomp oslquery'
BF_OSL_LIBPATH = '${BF_OSL}/lib'
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
WITH_BF_LLVM = True
BF_LLVM = LIBDIR + '/llvm'
BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
'LLVMTarget LLVMMC LLVMCore LLVMSupport LLVMObject'
BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
WITH_BF_OIIO = True
BF_OIIO = LIBDIR + '/openimageio'
BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
WITH_BF_OCIO = True
BF_OCIO = LIBDIR + '/opencolorio'
BF_OCIO_INC = '${BF_OCIO}/include'
BF_OCIO_LIB = 'OpenColorIO tinyxml yaml-cpp'
BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
WITH_BF_BOOST = True
BF_BOOST = LIBDIR + '/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB = 'boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt boost_wave-mt'
BF_BOOST_LIB_INTERNATIONAL = 'boost_locale-mt'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_CYCLES_CUDA_BINARIES = False
BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
#Freestyle
WITH_BF_FREESTYLE = True
#OpenMP ( will be checked for compiler support and turned off eventually )
WITH_BF_OPENMP = True
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = []
# SpaceNavigator and related 3D mice, driver must be 3DxWare 10 Beta 4 (Mac OS X) or later !
WITH_BF_3DMOUSE = True
#############################################################################
################### various compile settings and flags ##################
#############################################################################
BF_QUIET = '1' # suppress verbose output
CFLAGS = []
CXXFLAGS = []
CCFLAGS = ['-pipe','-funsigned-char']
CPPFLAGS = []
PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Cocoa','-framework','Carbon','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']
LLIBS = ['stdc++']
REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-O2']
CC_WARN = ['-Wall']
C_WARN = ['-Wno-char-subscripts', '-Wpointer-arith', '-Wcast-align', '-Wdeclaration-after-statement', '-Wno-unknown-pragmas', '-Wstrict-prototypes']
CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
##FIX_STUBS_WARNINGS = -Wno-unused
##LOPTS = --dynamic
##DYNLDFLAGS = -shared $(LDFLAGS)
BF_PROFILE_CCFLAGS = ['-pg', '-g ']
BF_PROFILE_LINKFLAGS = ['-pg']
BF_PROFILE = False
BF_DEBUG = False
BF_DEBUG_CCFLAGS = ['-g']
#############################################################################
################### Output directories ##################
#############################################################################
BF_BUILDDIR='../build/darwin'
BF_INSTALLDIR='../install/darwin'

View File

@@ -0,0 +1,268 @@
from FindPython import FindPython
py = FindPython()
BF_PYTHON_ABI_FLAGS = py['ABI_FLAGS']
BF_PYTHON = py['PYTHON']
BF_PYTHON_LIBPATH = py['LIBPATH']
BF_PYTHON_LIBPATH_ARCH = py['LIBPATH_ARCH']
BF_PYTHON_CONFIG = py['CONFIG']
BF_PYTHON_VERSION = py['VERSION']
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS} ' + BF_PYTHON_CONFIG
BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}' # BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/config/libpython'+BF_PYTHON_VERSION+'.a'
BF_PYTHON_LINKFLAGS = ['-Xlinker', '-export-dynamic']
BF_PYTHON_LIB_STATIC = '${BF_PYTHON_LIBPATH_ARCH}/libpython${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}.a'
WITH_BF_OPENAL = True
WITH_BF_STATICOPENAL = False
BF_OPENAL = '/usr'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'openal'
BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
BF_CXX = '/usr'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_JACK = False
BF_JACK = '/usr'
BF_JACK_INC = '${BF_JACK}/include/jack'
BF_JACK_LIB = 'jack'
BF_JACK_LIBPATH = '${BF_JACK}/lib'
WITH_BF_SNDFILE = False
WITH_BF_STATICSNDFILE = False
BF_SNDFILE = '/usr'
BF_SNDFILE_INC = '${BF_SNDFILE}/include/sndfile'
BF_SNDFILE_LIB = 'sndfile'
BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
BF_SNDFILE_LIB_STATIC = '${BF_SNDFILE}/lib/libsndfile.a ${BF_OGG}/lib/libvorbis.a ${BF_OGG}/lib/libFLAC.a ${BF_OGG}/lib/libvorbisenc.a ${BF_OGG}/lib/libogg.a'
WITH_BF_SDL = True
BF_SDL = '/usr' #$(shell sdl-config --prefix)
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = '/usr'
# when compiling with your own openexr lib you might need to set...
# BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR ${BF_OPENEXR}/include'
BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
# BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
WITH_BF_DDS = True
WITH_BF_JPEG = True
BF_JPEG = '/usr'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'jpeg'
WITH_BF_PNG = True
BF_PNG = '/usr'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
WITH_BF_TIFF = True
BF_TIFF = '/usr'
BF_TIFF_INC = '${BF_TIFF}/include'
BF_TIFF_LIB = 'tiff'
WITH_BF_ZLIB = True
BF_ZLIB = '/usr'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIB = 'z'
WITH_BF_INTERNATIONAL = True
WITH_BF_GAMEENGINE = True
WITH_BF_PLAYER = True
WITH_BF_OCEANSIM = True
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
WITH_BF_ELTOPO = False
BF_LAPACK = '/usr'
BF_LAPACK_LIB = 'lapack3gf blas clapack'
BF_LAPACK_LIBPATH = '${BF_LAPACK}/lib'
BF_FREETYPE = '/usr'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
#BF_FREETYPE_LIB_STATIC = '${BF_FREETYPE}/lib/libfreetype.a'
WITH_BF_ICONV = False
BF_ICONV = "/usr"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
WITH_BF_BINRELOC = True
# enable ffmpeg support
WITH_BF_FFMPEG = True
BF_FFMPEG = '/usr'
BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
#WITH_BF_STATICFFMPEG = True
#BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH/libavcodec.a ${BF_FFMPEG_LIBPATH}/libswscale.a ${BF_FFMPEG_LIBPATH}/libavutil.a ${BF_FFMPEG_LIBPATH}/libavdevice.a'
# enable ogg, vorbis and theora in ffmpeg
WITH_BF_OGG = False
BF_OGG = '/usr'
BF_OGG_INC = '${BF_OGG}/include'
BF_OGG_LIB = 'ogg vorbis vorbisenc theoraenc theoradec'
WITH_BF_OPENJPEG = True
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_FFTW3 = False
WITH_BF_STATICFFTW3 = False
BF_FFTW3 = '/usr'
BF_FFTW3_INC = '${BF_FFTW3}/include'
BF_FFTW3_LIB = 'fftw3'
BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
BF_FFTW3_LIB_STATIC = '${BF_FFTW3_LIBPATH}/libfftw3.a'
WITH_BF_REDCODE = False
BF_REDCODE = '#extern/libredcode'
BF_REDCODE_LIB = ''
# BF_REDCODE_INC = '${BF_REDCODE}/include'
BF_REDCODE_INC = '${BF_REDCODE}/../' #C files request "libredcode/format.h" which is in "#extern/libredcode/format.h", stupid but compiles for now.
BF_REDCODE_LIBPATH='${BF_REDCODE}/lib'
# Mesa Libs should go here if you're using them as well....
WITH_BF_STATICOPENGL = False
BF_OPENGL = '/usr'
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIB = 'GL X11 Xi Xxf86vm'
BF_OPENGL_LIBPATH = '/usr/X11R6/lib'
BF_OPENGL_LIB_STATIC = '${BF_OPENGL_LIBPATH}/libGL.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a ${BF_OPENGL_LIBPATH}/libX11.a ${BF_OPENGL_LIBPATH}/libXi.a ${BF_OPENGL_LIBPATH}/libXext.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a'
WITH_BF_COLLADA = False
BF_COLLADA = '#source/blender/collada'
BF_COLLADA_INC = '${BF_COLLADA}'
BF_COLLADA_LIB = 'bf_collada'
BF_OPENCOLLADA = '/usr'
BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include/opencollada'
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre buffer ftoa'
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
BF_PCRE = ''
BF_PCRE_LIB = 'pcre'
BF_PCRE_LIBPATH = '/usr/lib'
BF_EXPAT = '/usr'
BF_EXPAT_LIB = 'expat'
BF_EXPAT_LIBPATH = '/usr/lib'
WITH_BF_JEMALLOC = False
WITH_BF_STATICJEMALLOC = False
BF_JEMALLOC = '/usr'
BF_JEMALLOC_INC = '${BF_JEMALLOC}/include'
BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib'
BF_JEMALLOC_LIB = 'jemalloc'
BF_JEMALLOC_LIB_STATIC = '${BF_JEMALLOC_LIBPATH}/libjemalloc.a'
WITH_BF_OIIO = False
WITH_BF_STATICOIIO = False
BF_OIIO = '/usr'
BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_JPEG}/lib/libjpeg.a'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
WITH_BF_OCIO = False
WITH_BF_STATICOCIO = False
BF_OCIO = '/usr'
BF_OCIO_INC = '${BF_OCIO}/include'
BF_OCIO_LIB = 'OpenColorIO yaml-cpp tinyxml'
BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/libOpenColorIO.a ${BF_OCIO_LIBPATH}/libtinyxml.a ${BF_OCIO_LIBPATH}/libyaml-cpp.a'
BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
WITH_BF_BOOST = True
WITH_BF_STATICBOOST = False
BF_BOOST = '/usr'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB = 'boost_filesystem boost_regex boost_system boost_thread boost_date_time'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a ' + \
'${BF_BOOST_LIBPATH}/libboost_thread.a'
BF_BOOST_LIB_INTERNATIONAL = 'boost_locale'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_CYCLES = WITH_BF_OIIO and WITH_BF_BOOST
WITH_BF_CYCLES_CUDA_BINARIES = False
BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50']
WITH_BF_OPENMP = True
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-pthread']
#SpaceNavigator and friends
WITH_BF_3DMOUSE = True
WITH_BF_STATIC3DMOUSE = False
BF_3DMOUSE = '/usr'
BF_3DMOUSE_INC = '${BF_3DMOUSE}/include'
BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib'
BF_3DMOUSE_LIB = 'spnav'
BF_3DMOUSE_LIB_STATIC = '${BF_3DMOUSE_LIBPATH}/libspnav.a'
#Freestyle
WITH_BF_FREESTYLE = True
##
CC = 'gcc'
CXX = 'g++'
CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE']
CFLAGS = ['-std=gnu89']
CXXFLAGS = []
CPPFLAGS = []
# g++ 4.6, only needed for bullet
CXXFLAGS += ['-fpermissive']
if WITH_BF_FFMPEG:
# libavutil needs UINT64_C()
CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-O2']
C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wunused-parameter', '-Wstrict-prototypes', '-Werror=declaration-after-statement', '-Werror=implicit-function-declaration', '-Werror=return-type']
CC_WARN = ['-Wall']
CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
LLIBS = ['util', 'c', 'm', 'dl', 'pthread']
BF_PROFILE = False
BF_PROFILE_CCFLAGS = ['-pg','-g']
BF_PROFILE_LINKFLAGS = ['-pg']
BF_DEBUG = False
BF_DEBUG_CCFLAGS = ['-g']
BF_BUILDDIR = '../build/linux'
BF_INSTALLDIR='../install/linux'
#Link against pthread
PLATFORM_LINKFLAGS = ['-pthread']
#Fix for LLVM conflict with Mesa llvmpipe, SDL dynload also requires symbols to be hidden.
# TODO(sergey): Move this to SConstruct, so we can have this line depended on user config.
PLATFORM_LINKFLAGS += ['-Wl,--version-script=source/creator/blender.map']

View File

@@ -0,0 +1,221 @@
LCGDIR = '#../lib/mingw32'
LIBDIR = "${LCGDIR}"
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '3.4'
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}mw'
BF_PYTHON_DLL = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/libpython${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}.a'
WITH_BF_OPENAL = True
BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'wrap_oal'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
WITH_BF_FFMPEG = True
BF_FFMPEG_LIB = 'avformat-55 avcodec-55 avdevice-55 avutil-52 swscale-2'
BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib'
BF_FFMPEG_INC = LIBDIR + '/ffmpeg/include'
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-55.dll ${BF_FFMPEG_LIBPATH}/avcodec-55.dll ${BF_FFMPEG_LIBPATH}/avdevice-55.dll ${BF_FFMPEG_LIBPATH}/avutil-52.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
WITH_BF_JACK = False
BF_JACK = LIBDIR + '/jack'
BF_JACK_INC = '${BF_JACK}/include'
BF_JACK_LIB = 'libjack'
BF_JACK_LIBPATH = '${BF_JACK}/lib'
WITH_BF_SNDFILE = False
BF_SNDFILE = LIBDIR + '/sndfile'
BF_SNDFILE_INC = '${BF_SNDFILE}/include'
BF_SNDFILE_LIB = 'libsndfile-1'
BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
WITH_BF_SDL = True
BF_SDL = LIBDIR + '/sdl'
BF_SDL_INC = '${BF_SDL}/include'
BF_SDL_LIB = 'SDL'
BF_SDL_LIBPATH = '${BF_SDL}/lib'
BF_PTHREADS = LIBDIR + '/pthreads'
BF_PTHREADS_INC = '${BF_PTHREADS}/include'
BF_PTHREADS_LIB = 'pthreadGC2'
BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = LIBDIR + '/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = 'Half IlmImf Imath IlmThread Iex'
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = True
WITH_BF_JPEG = True
BF_JPEG = LIBDIR + '/jpeg'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'liblibjpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = True
BF_PNG = LIBDIR + '/png'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
BF_PNG_LIBPATH = '${BF_PNG}/lib'
WITH_BF_TIFF = True
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
BF_TIFF_LIB = 'tiff'
BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
WITH_BF_ZLIB = True
BF_ZLIB = LIBDIR + '/zlib'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIB = 'z'
BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = True
WITH_BF_OPENJPEG = True
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_FFTW3 = True
BF_FFTW3 = LIBDIR + '/fftw3'
BF_FFTW3_INC = '${BF_FFTW3}/include'
BF_FFTW3_LIB = 'fftw3'
BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
WITH_BF_GAMEENGINE = True
WITH_BF_PLAYER = True
WITH_BF_OCEANSIM = True
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
BF_WINTAB = LIBDIR + '/wintab'
BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
BF_FREETYPE = LIBDIR + '/freetype'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_ICONV = False
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
WITH_BF_REDCODE = False
BF_REDCODE_INC = '#extern'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = False
BF_OPENGL = 'C:\\MingW'
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
BF_OPENGL_LIB = 'opengl32'
BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a',
'${BF_OPENGL}/lib/libXmu.a', '${BF_OPENGL}/lib/libXext.a',
'${BF_OPENGL}/lib/libX11.a', '${BF_OPENGL}/lib/libXi.a' ]
WITH_BF_COLLADA = True
BF_COLLADA = '#source/blender/collada'
BF_COLLADA_INC = '${BF_COLLADA}'
BF_COLLADA_LIB = 'bf_collada'
BF_OPENCOLLADA = LIBDIR + '/opencollada'
BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include/opencollada'
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre buffer ftoa xml'
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
#Cycles
WITH_BF_CYCLES = True
WITH_BF_CYCLES_CUDA_BINARIES = False
BF_CYCLES_CUDA_NVCC = "" # Path to the NVIDIA CUDA compiler
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50']
WITH_BF_OIIO = True
BF_OIIO = LIBDIR + '/openimageio'
BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
WITH_BF_OCIO = True
BF_OCIO = LIBDIR + '/opencolorio'
BF_OCIO_INC = '${BF_OCIO}/include'
BF_OCIO_LIB = 'OpenColorIO'
BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
WITH_BF_BOOST = True
BF_BOOST = LIBDIR + '/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB = 'boost_date_time-mgw46-mt-s-1_49 boost_filesystem-mgw46-mt-s-1_49 boost_regex-mgw46-mt-s-1_49 boost_system-mgw46-mt-s-1_49 boost_thread-mgw46-mt-s-1_49'
BF_BOOST_LIB_INTERNATIONAL = 'boost_locale-mgw46-mt-s-1_49'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
WITH_BF_IME = True
WITH_BF_OPENMP = True
#CUDA
WITH_BF_CYCLES_CUDA_BINARIES = False
#BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50']
#Freestyle
WITH_BF_FREESTYLE = True
##
CC = 'gcc'
CXX = 'g++'
CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ]
CXXFLAGS = []
CPPFLAGS = ['-DWIN32', '-DFREE_WINDOWS', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC', '-DOPJ_STATIC']
REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-O2']
C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-prototypes']
CC_WARN = [ '-Wall' ]
LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-ldbghelp']
if WITH_BF_IME:
LLIBS.append('-limm32')
PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']
## DISABLED, causes linking errors!
## for re-distribution, so users dont need mingw installed
# PLATFORM_LINKFLAGS += ["-static-libgcc", "-static-libstdc++"]
BF_DEBUG = False
BF_DEBUG_CCFLAGS= ['-g']
BF_PROFILE_CCFLAGS = ['-pg', '-g']
BF_PROFILE_LINKFLAGS = ['-pg']
BF_PROFILE_FLAGS = BF_PROFILE_CCFLAGS
BF_PROFILE = False
BF_BUILDDIR = '..\\build\\win32-mingw'
BF_INSTALLDIR='..\\install\\win32-mingw'

View File

@@ -0,0 +1,256 @@
import subprocess
CL_OUT = subprocess.Popen(["cl.exe"],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
CL_STDOUT, CL_STDERR = CL_OUT.communicate()
if "18.00." in CL_STDERR:
VC_VERSION = '12.0'
LCGDIR = '#../lib/windows_vc12'
else:
import sys
print("Visual C version not supported {}\n".format(CL_STDERR))
sys.exit(1)
LIBDIR = '${LCGDIR}'
WITH_BF_FFMPEG = True
BF_FFMPEG = LIBDIR +'/ffmpeg'
BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}/include/msvc'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
BF_FFMPEG_LIB = 'avformat-55.lib avcodec-55.lib avdevice-55.lib avutil-52.lib swscale-2.lib'
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-55.dll ${BF_FFMPEG_LIBPATH}/avcodec-55.dll ${BF_FFMPEG_LIBPATH}/avdevice-55.dll ${BF_FFMPEG_LIBPATH}/avutil-52.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '3.4'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}'
BF_PYTHON_DLL = '${BF_PYTHON_LIB}'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
WITH_BF_PYTHON_INSTALL_NUMPY = True
WITH_BF_OPENAL = True
BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include '
BF_OPENAL_LIB = 'OpenAL32'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
WITH_BF_ICONV = True
BF_ICONV = LIBDIR + '/iconv'
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
WITH_BF_JACK = False
BF_JACK = LIBDIR + '/jack'
BF_JACK_INC = '${BF_JACK}/include ${BF_FFMPEG}/include/msvc'
BF_JACK_LIB = 'libjack'
BF_JACK_LIBPATH = '${BF_JACK}/lib'
WITH_BF_SNDFILE = True
BF_SNDFILE = LIBDIR + '/sndfile'
BF_SNDFILE_INC = '${BF_SNDFILE}/include'
BF_SNDFILE_LIB = 'libsndfile-1'
BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
WITH_BF_SDL = True
BF_SDL = LIBDIR + '/sdl'
BF_SDL_INC = '${BF_SDL}/include'
BF_SDL_LIB = 'SDL2.lib'
BF_SDL_LIBPATH = '${BF_SDL}/lib'
BF_PTHREADS = LIBDIR + '/pthreads'
BF_PTHREADS_INC = '${BF_PTHREADS}/include'
BF_PTHREADS_LIB = 'pthreadVC2'
BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = LIBDIR + '/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR '
BF_OPENEXR_LIB = ' Iex-2_2 Half IlmImf-2_2 Imath-2_2 IlmThread-2_2 '
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = True
WITH_BF_JPEG = True
BF_JPEG = LIBDIR + '/jpeg'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'libjpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = True
BF_PNG = LIBDIR + '/png'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'libpng'
BF_PNG_LIBPATH = '${BF_PNG}/lib'
WITH_BF_TIFF = True
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
BF_TIFF_LIB = 'libtiff'
BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
WITH_BF_ZLIB = True
BF_ZLIB = LIBDIR + '/zlib'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIB = 'libz_st'
BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = True
WITH_BF_GAMEENGINE = True
WITH_BF_PLAYER = True
WITH_BF_OCEANSIM = True
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
WITH_BF_ELTOPO = False
BF_LAPACK = LIBDIR + '/lapack'
BF_LAPACK_LIB = 'libf2c clapack_nowrap BLAS_nowrap'
BF_LAPACK_LIBPATH = '${BF_LAPACK}/lib'
BF_WINTAB = LIBDIR + '/wintab'
BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
WITH_BF_BINRELOC = False
BF_WITH_FREETYPE = True
BF_FREETYPE = LIBDIR + '/freetype'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype2ST'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_OPENJPEG = True
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_FFTW3 = True
BF_FFTW3 = LIBDIR + '/fftw3'
BF_FFTW3_INC = '${BF_FFTW3}/include'
BF_FFTW3_LIB = 'libfftw'
BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
WITH_BF_REDCODE = False
BF_REDCODE_INC = '#extern'
WITH_BF_COLLADA = True
BF_COLLADA = '#source/blender/collada'
BF_COLLADA_INC = '${BF_COLLADA}'
BF_COLLADA_LIB = 'bf_collada'
BF_OPENCOLLADA = LIBDIR + '/opencollada'
BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include/opencollada'
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml pcre buffer ftoa'
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
WITH_BF_IME = True
WITH_BF_3DMOUSE = True
WITH_BF_OPENMP = True
#Cycles
WITH_BF_CYCLES = True
WITH_BF_CYCLES_OSL = True
WITH_BF_STATICOSL = True
BF_OSL = '${LIBDIR}/osl'
BF_OSL_INC = '${BF_OSL}/include'
BF_OSL_LIBPATH = '${BF_OSL}/lib'
BF_OSL_LIB_STATIC = '${BF_OSL_LIBPATH}/oslcomp.lib ${BF_OSL_LIBPATH}/oslexec.lib ${BF_OSL_LIBPATH}/oslquery.lib '
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
WITH_BF_LLVM = True
BF_LLVM = LIBDIR + '/llvm'
BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
'LLVMTarget LLVMMC LLVMCore LLVMObject LLVMRuntimeDyld LLVMSupport'
BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
WITH_BF_OIIO = True
BF_OIIO = '${LIBDIR}/openimageio'
BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/OpenImageIO.lib'
WITH_BF_STATICOIIO = True
WITH_BF_OCIO = True
BF_OCIO = '${LIBDIR}/opencolorio'
BF_OCIO_INC = '${BF_OCIO}/include'
BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/OpenColorIO.lib'
WITH_BF_STATICOCIO = True
WITH_BF_BOOST = True
BF_BOOST = '${LIBDIR}/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB = 'libboost_date_time-vc120-mt-s-1_55 libboost_filesystem-vc120-mt-s-1_55 libboost_regex-vc120-mt-s-1_55 libboost_system-vc120-mt-s-1_55 libboost_thread-vc120-mt-s-1_55 libboost_wave-vc120-mt-s-1_55'
BF_BOOST_LIB_INTERNATIONAL = ' libboost_locale-vc120-mt-s-1_55'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
#CUDA
WITH_BF_CYCLES_CUDA_BINARIES = False
#BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE']
#Freestyle
WITH_BF_FREESTYLE = True
WITH_BF_STATICOPENGL = False
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
BF_OPENGL_LIB = 'opengl32'
BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a',
'${BF_OPENGL}/lib/libXmu.a', '${BF_OPENGL}/lib/libXext.a',
'${BF_OPENGL}/lib/libX11.a', '${BF_OPENGL}/lib/libXi.a' ]
CC = 'cl.exe'
CXX = 'cl.exe'
CCFLAGS = ['/nologo', '/J', '/W3', '/Gd', '/w34062', '/wd4018', '/wd4065', '/wd4127', '/wd4181', '/wd4200', '/wd4244', '/wd4267', '/wd4305', '/wd4800', '/we4013', '/we4431']
CXXFLAGS = ['/EHsc']
BGE_CXXFLAGS = ['/O2', '/Ob2', '/EHsc', '/GR', '/fp:fast', '/arch:SSE']
if VC_VERSION == '12.0':
CCFLAGS.append('/DOIIO_STATIC_BUILD') # OIIO api changed with 1.4 making this needed
BF_DEBUG_CCFLAGS = ['/Zi', '/Ob0', '/Od', '/FR${TARGET}.sbr']
CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE', '-DOPJ_STATIC']
REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-O2', '/Ob2']
C_WARN = []
CC_WARN = []
CXX_WARN = []
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi', 'Dbghelp']
if WITH_BF_IME:
LLIBS.append('imm32')
PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
# # Todo
# BF_PROFILE_CCFLAGS = ['-pg', '-g ']
# BF_PROFILE_LINKFLAGS = ['-pg']
# BF_PROFILE = False
BF_BSC=False
BF_CYCLES_CUDA_ENV="C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd"
BF_BUILDDIR = '..\\build\\win32-vc'
BF_INSTALLDIR='..\\install\\win32-vc'

View File

@@ -0,0 +1,216 @@
LCGDIR = '#../lib/mingw64'
LIBDIR = "${LCGDIR}"
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '3.4'
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}mw'
BF_PYTHON_DLL = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
WITH_BF_OPENAL = True
BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'wrap_oal'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
WITH_BF_FFMPEG = True
BF_FFMPEG_LIB = 'avformat.dll avcodec.dll avdevice.dll avutil.dll swscale.dll swresample.dll'
BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib'
BF_FFMPEG_INC = LIBDIR + '/ffmpeg/include'
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll ${BF_FFMPEG_LIBPATH}/swresample-0.dll ${BF_FFMPEG_LIBPATH}/xvidcore.dll'
WITH_BF_JACK = False
BF_JACK = LIBDIR + '/jack'
BF_JACK_INC = '${BF_JACK}/include'
BF_JACK_LIB = 'libjack'
BF_JACK_LIBPATH = '${BF_JACK}/lib'
WITH_BF_SNDFILE = False
BF_SNDFILE = LIBDIR + '/sndfile'
BF_SNDFILE_INC = '${BF_SNDFILE}/include'
BF_SNDFILE_LIB = 'libsndfile-1'
BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
WITH_BF_SDL = True
BF_SDL = LIBDIR + '/sdl'
BF_SDL_INC = '${BF_SDL}/include'
BF_SDL_LIB = 'SDL'
BF_SDL_LIBPATH = '${BF_SDL}/lib'
BF_PTHREADS = '' # Part of MinGW-w64
BF_PTHREADS_INC = ''
BF_PTHREADS_LIB = ''
BF_PTHREADS_LIBPATH = ''
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = LIBDIR + '/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = 'Half IlmImf Imath IlmThread Iex'
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
WITH_BF_DDS = True
WITH_BF_JPEG = True
BF_JPEG = LIBDIR + '/jpeg'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'jpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = True
BF_PNG = LIBDIR + '/png'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
BF_PNG_LIBPATH = '${BF_PNG}/lib'
WITH_BF_TIFF = True
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
BF_TIFF_LIB = 'tiff'
BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
WITH_BF_ZLIB = True
BF_ZLIB = LIBDIR + '/zlib'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIB = 'z'
BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = True
WITH_BF_OPENJPEG = True
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_FFTW3 = True
BF_FFTW3 = LIBDIR + '/fftw3'
BF_FFTW3_INC = '${BF_FFTW3}/include'
BF_FFTW3_LIB = 'fftw3'
BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
WITH_BF_GAMEENGINE = True
WITH_BF_OCEANSIM = True
WITH_BF_PLAYER = True
WITH_BF_LIBMV = True
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
BF_WINTAB = LIBDIR + '/wintab'
BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
# enable freetype2 support for text objects
BF_FREETYPE = LIBDIR + '/freetype'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2/'
BF_FREETYPE_LIB = 'freetype'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_ICONV = False
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
WITH_BF_REDCODE = False
BF_REDCODE_INC = '#extern'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = False
BF_OPENGL = 'C:\\MingW'
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
BF_OPENGL_LIB = 'opengl32'
BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a',
'${BF_OPENGL}/lib/libXmu.a', '${BF_OPENGL}/lib/libXext.a',
'${BF_OPENGL}/lib/libX11.a', '${BF_OPENGL}/lib/libXi.a' ]
WITH_BF_COLLADA = True
BF_COLLADA = '#source/blender/collada'
BF_COLLADA_INC = '${BF_COLLADA}'
BF_COLLADA_LIB = 'bf_collada'
BF_OPENCOLLADA = LIBDIR + '/opencollada'
BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include/opencollada'
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre buffer ftoa xml'
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
#Cycles
WITH_BF_CYCLES = True
WITH_BF_CYCLES_CUDA_BINARIES = False
BF_CYCLES_CUDA_NVCC = "" # Path to the NVIDIA CUDA compiler
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50']
WITH_BF_OIIO = True
BF_OIIO = LIBDIR + '/openimageio'
BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
WITH_BF_OCIO = True
BF_OCIO = LIBDIR + '/opencolorio'
BF_OCIO_INC = '${BF_OCIO}/include'
BF_OCIO_LIB = 'OpenColorIO'
BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
WITH_BF_BOOST = True
BF_BOOST = LIBDIR + '/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB = 'boost_date_time-mgw47-mt-s-1_49 boost_date_time-mgw47-mt-sd-1_49 boost_filesystem-mgw47-mt-s-1_49 boost_filesystem-mgw47-mt-sd-1_49 boost_regex-mgw47-mt-s-1_49 boost_regex-mgw47-mt-sd-1_49 boost_system-mgw47-mt-s-1_49 boost_system-mgw47-mt-sd-1_49 boost_thread-mgw47-mt-s-1_49 boost_thread-mgw47-mt-sd-1_49'
BF_BOOST_LIB_INTERNATIONAL = ' boost_locale-mgw47-mt-s-1_49 boost_locale-mgw47-mt-sd-1_49'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-mmmx', '-msse', '-msse2']
WITH_BF_IME = True
WITH_BF_OPENMP = True
#Freestyle
WITH_BF_FREESTYLE = True
##
CC = 'gcc'
CXX = 'g++'
CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ]
CXXFLAGS = [ '-fpermissive' ]
CPPFLAGS = ['-DWIN32', '-DMS_WIN64', '-DFREE_WINDOWS', '-DFREE_WINDOWS64', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC', '-DOPJ_STATIC']
REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-O2', '-ftree-vectorize']
# NOTE: C_WARN seems to get ignored - at least -Wno-char-subscripts doesn't work!
C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-prototypes']
CC_WARN = [ '-Wall', '-Wno-char-subscripts' ]
LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-lpthread', '-ldbghelp']
if WITH_BF_IME:
LLIBS.append('-limm32')
PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']
## DISABLED, causes linking errors!
## for re-distribution, so users dont need mingw installed
# PLATFORM_LINKFLAGS += ["-static-libgcc", "-static-libstdc++"]
BF_DEBUG = False
BF_DEBUG_CCFLAGS= ['-g']
BF_PROFILE_CCFLAGS = ['-pg', '-g']
BF_PROFILE_LINKFLAGS = ['-pg']
BF_PROFILE_FLAGS = BF_PROFILE_CCFLAGS
BF_PROFILE = False
BF_BUILDDIR = '..\\build\\win64-mingw'
BF_INSTALLDIR='..\\install\\win64-mingw'

View File

@@ -0,0 +1,256 @@
import subprocess
CL_OUT = subprocess.Popen(["cl.exe"],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
CL_STDOUT, CL_STDERR = CL_OUT.communicate()
if "18.00." in CL_STDERR:
VC_VERSION = '12.0'
LCGDIR = '#../lib/win64_vc12'
else:
import sys
print("Visual C version not supported {}\n".format(CL_STDERR))
sys.exit(1)
LIBDIR = '${LCGDIR}'
WITH_BF_FFMPEG = True
BF_FFMPEG = LIBDIR +'/ffmpeg'
BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}/include/msvc '
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
BF_FFMPEG_LIB = 'avformat-55.lib avcodec-55.lib avdevice-55.lib avutil-52.lib swscale-2.lib'
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-55.dll ${BF_FFMPEG_LIBPATH}/avcodec-55.dll ${BF_FFMPEG_LIBPATH}/avdevice-55.dll ${BF_FFMPEG_LIBPATH}/avutil-52.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '3.4'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}'
BF_PYTHON_DLL = '${BF_PYTHON_LIB}'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
WITH_BF_PYTHON_INSTALL_NUMPY = True
WITH_BF_OPENAL = True
BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include '
BF_OPENAL_LIB = 'OpenAL32'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
WITH_BF_SNDFILE = True
BF_SNDFILE = LIBDIR + '/sndfile'
BF_SNDFILE_INC = '${BF_SNDFILE}/include'
BF_SNDFILE_LIB = 'libsndfile-1'
BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
WITH_BF_ICONV = True
BF_ICONV = LIBDIR + '/iconv'
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
WITH_BF_SDL = True
BF_SDL = LIBDIR + '/sdl'
BF_SDL_INC = '${BF_SDL}/include'
BF_SDL_LIB = 'SDL2.lib'
BF_SDL_LIBPATH = '${BF_SDL}/lib'
WITH_BF_JACK = False
BF_PTHREADS = LIBDIR + '/pthreads'
BF_PTHREADS_INC = '${BF_PTHREADS}/include'
BF_PTHREADS_LIB = 'pthreadVC2'
BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = LIBDIR + '/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR '
BF_OPENEXR_LIB = ' Iex-2_2 Half IlmImf-2_2 Imath-2_2 IlmThread-2_2 '
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = True
WITH_BF_JPEG = True
BF_JPEG = LIBDIR + '/jpeg'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'libjpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = True
BF_PNG = LIBDIR + '/png'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'libpng'
BF_PNG_LIBPATH = '${BF_PNG}/lib'
WITH_BF_TIFF = True
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
BF_TIFF_LIB = 'libtiff'
BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
WITH_BF_ZLIB = True
BF_ZLIB = LIBDIR + '/zlib'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIB = 'libz_st'
BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = True
WITH_BF_GAMEENGINE = True
WITH_BF_PLAYER = True
WITH_BF_OCEANSIM = True
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
WITH_BF_ELTOPO = False
BF_LAPACK = LIBDIR + '/lapack'
BF_LAPACK_LIB = 'libf2c clapack_nowrap BLAS_nowrap'
BF_LAPACK_LIBPATH = '${BF_LAPACK}/lib'
BF_WINTAB = LIBDIR + '/wintab'
BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
WITH_BF_BINRELOC = False
BF_WITH_FREETYPE = True
BF_FREETYPE = LIBDIR + '/freetype'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype2ST'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = False
BF_QUICKTIME = LIBDIR + '/QTDevWin'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/CIncludes'
BF_QUICKTIME_LIB = 'qtmlClient'
BF_QUICKTIME_LIBPATH = '${BF_QUICKTIME}/Libraries'
WITH_BF_OPENJPEG = True
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_FFTW3 = True
BF_FFTW3 = LIBDIR + '/fftw3'
BF_FFTW3_INC = '${BF_FFTW3}/include'
BF_FFTW3_LIB = 'libfftw'
BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
WITH_BF_REDCODE = False
BF_REDCODE_INC = '#extern'
WITH_BF_COLLADA = True
BF_COLLADA = '#source/blender/collada'
BF_COLLADA_INC = '${BF_COLLADA}'
BF_COLLADA_LIB = 'bf_collada'
BF_OPENCOLLADA = LIBDIR + '/opencollada'
BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include/opencollada'
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml pcre buffer ftoa'
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
WITH_BF_IME = True
WITH_BF_3DMOUSE = True
WITH_BF_OPENMP = True
#Cycles
WITH_BF_CYCLES = True
WITH_BF_CYCLES_OSL = True
WITH_BF_STATICOSL = True
BF_OSL = '${LIBDIR}/osl'
BF_OSL_INC = '${BF_OSL}/include'
BF_OSL_LIBPATH = '${BF_OSL}/lib'
BF_OSL_LIB_STATIC = '${BF_OSL_LIBPATH}/oslcomp.lib ${BF_OSL_LIBPATH}/oslexec.lib ${BF_OSL_LIBPATH}/oslquery.lib '
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
WITH_BF_LLVM = True
BF_LLVM = LIBDIR + '/llvm'
BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
'LLVMTarget LLVMMC LLVMCore LLVMObject LLVMRuntimeDyld LLVMSupport'
BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
WITH_BF_OIIO = True
BF_OIIO = '${LIBDIR}/openimageio'
BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/OpenImageIO.lib ${BF_OIIO_LIBPATH}/OpenImageIO_Util.lib'
WITH_BF_STATICOIIO = True
WITH_BF_OCIO = True
BF_OCIO = '${LIBDIR}/opencolorio'
BF_OCIO_INC = '${BF_OCIO}/include'
BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/OpenColorIO.lib'
WITH_BF_STATICOCIO = True
WITH_BF_BOOST = True
BF_BOOST = '${LIBDIR}/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB = 'libboost_date_time-vc120-mt-s-1_55 libboost_filesystem-vc120-mt-s-1_55 libboost_regex-vc120-mt-s-1_55 libboost_system-vc120-mt-s-1_55 libboost_thread-vc120-mt-s-1_55 libboost_wave-vc120-mt-s-1_55'
BF_BOOST_LIB_INTERNATIONAL = ' libboost_locale-vc120-mt-s-1_55'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
#CUDA
WITH_BF_CYCLES_CUDA_BINARIES = False
#BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
# No need to manually specify SSE/SSE2 on x64 systems.
BF_RAYOPTIMIZATION_SSE_FLAGS = ['']
#Freestyle
WITH_BF_FREESTYLE = True
WITH_BF_STATICOPENGL = False
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
BF_OPENGL_LIB = 'opengl32'
BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a',
'${BF_OPENGL}/lib/libXmu.a', '${BF_OPENGL}/lib/libXext.a',
'${BF_OPENGL}/lib/libX11.a', '${BF_OPENGL}/lib/libXi.a' ]
CC = 'cl.exe'
CXX = 'cl.exe'
CFLAGS = []
CCFLAGS = ['/nologo', '/J', '/W3', '/Gd', '/w34062', '/wd4018', '/wd4065', '/wd4127', '/wd4181', '/wd4200', '/wd4244', '/wd4267', '/wd4305', '/wd4800', '/we4013', '/we4431']
# We want to support Vista level ABI for x64
if VC_VERSION == '12.0':
CCFLAGS.append('/D_WIN32_WINNT=0x600')
CCFLAGS.append('/DOIIO_STATIC_BUILD') # OIIO api changed with 1.4 making this needed
CXXFLAGS = ['/EHsc']
BGE_CXXFLAGS = ['/O2', '/Ob2', '/EHsc', '/GR', '/fp:fast']
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr', '/Od', '/Ob0']
CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE', '-DOPJ_STATIC']
REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-O2', '/Ob2']
C_WARN = []
CC_WARN = []
CXX_WARN = []
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi', 'Dbghelp']
if WITH_BF_IME:
LLIBS.append('imm32')
PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
BF_CYCLES_CUDA_ENV="C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd"
BF_BUILDDIR = '..\\build\\win64-vc'
BF_INSTALLDIR='..\\install\\win64-vc'

View File

@@ -197,17 +197,15 @@ fg_shaders = {
}
#
# Helper function to attach a pixel shader to the material that receives the video frame.
#
def config_video(obj, format, pixel, is3D=False, mat=0, card=0):
if not pixel in fg_shaders:
if pixel not in fg_shaders:
raise('Unsuported shader')
shader = obj.meshes[0].materials[mat].getShader()
if shader != None and not shader.isValid():
if shader is not None and not shader.isValid():
shader.setSource(VertexShader, fg_shaders[pixel], True)
shader.setSampler('tex', 0)
shader.setUniformEyef("eye")
@@ -223,9 +221,9 @@ def config_video(obj, format, pixel, is3D=False, mat=0, card=0):
# and call it once to initialize the object
#
def init(cont):
#config_video(cont.owner, 'HD720p5994', '8BitBGRA')
#config_video(cont.owner, 'HD720p5994', '8BitYUV')
#config_video(cont.owner, 'pal ', '10BitYUV')
# config_video(cont.owner, 'HD720p5994', '8BitBGRA')
# config_video(cont.owner, 'HD720p5994', '8BitYUV')
# config_video(cont.owner, 'pal ', '10BitYUV')
config_video(cont.owner, 'pal ', '8BitYUV')
@@ -234,6 +232,6 @@ def init(cont):
#
def play(cont):
obj = cont.owner
if hasattr(obj, "video"):
obj["video"].refresh(True)
video = obj.get("video")
if video is not None:
video.refresh(True)

View File

@@ -8,11 +8,11 @@ Physics Constraints (bge.constraints)
Examples
--------
.. include:: ../examples/bge.constraints.py
.. include:: __/examples/bge.constraints.py
:start-line: 1
:end-line: 4
.. literalinclude:: ../examples/bge.constraints.py
.. literalinclude:: __/examples/bge.constraints.py
:lines: 6-

View File

@@ -20,7 +20,7 @@ This module holds key constants for the SCA_KeyboardSensor.
sensor = co.sensors["Keyboard"]
sensor.key = bge.events.F1KEY
.. code-block:: python
code-block:: python
# Do the all keys thing
import bge
@@ -41,7 +41,7 @@ This module holds key constants for the SCA_KeyboardSensor.
if key == bge.events.DKEY:
# Activate Right!
.. code-block:: python
code-block:: python
# The all keys thing without a keyboard sensor (but you will
# need an always sensor with pulse mode on)

View File

@@ -385,9 +385,10 @@ General functions
If False, the render is skipped and another logic frame starts immediately.
.. note::
GPU VSync no longer limits the number of frame per second when render is off,
but the 'Use Frame Rate' option still regulates the fps. To run as many frames
as possible, untick this option (Render Properties, System panel)
but the *Use Frame Rate* option still regulates the fps. To run as many frames
as possible, untick this option (Render Properties, System panel).
:arg render: the render flag
:type render: bool

View File

@@ -98,6 +98,7 @@ Constants
The pixel buffer for offscreen render is a Texture. Argument to :func:`offScreenCreate`
*****
Types
*****
@@ -107,8 +108,8 @@ Types
An off-screen render buffer object.
Use :func:`offScreenCreate` to create it.
Currently it can only be used in the :class:`bge.texture.ImageRender` constructor to render on a FBO rather than the
default viewport.
Currently it can only be used in the :class:`bge.texture.ImageRender`
constructor to render on a FBO rather than the default viewport.
.. attribute:: width
@@ -124,10 +125,14 @@ Types
.. attribute:: color
The underlying OpenGL bind code of the texture object that holds the rendered image, 0 if the FBO is using RenderBuffer. The choice between RenderBuffer and Texture is determined by the target argument of :func:`offScreenCreate`.
The underlying OpenGL bind code of the texture object that holds
the rendered image, 0 if the FBO is using RenderBuffer.
The choice between RenderBuffer and Texture is determined
by the target argument of :func:`offScreenCreate`.
:type: integer
*********
Functions
*********
@@ -410,7 +415,11 @@ Functions
:type height: integer
:arg samples: the number of multisample for anti-aliasing (MSAA), 0 to disable MSAA
:type samples: integer
:arg target: the pixel storage: :data:`RAS_OFS_RENDER_BUFFER` to render on RenderBuffers (the default), :data:`RAS_OFS_RENDER_TEXTURE` to render on texture. The later is interesting if you want to access the texture directly (see :attr:`RASOffScreen.color`). Otherwise the default is preferable as it's more widely supported by GPUs and more efficient. If the GPU does not support MSAA+Texture (e.g. Intel HD GPU), MSAA will be disabled.
:arg target: the pixel storage: :data:`RAS_OFS_RENDER_BUFFER` to render on RenderBuffers (the default),
:data:`RAS_OFS_RENDER_TEXTURE` to render on texture.
The later is interesting if you want to access the texture directly (see :attr:`RASOffScreen.color`).
Otherwise the default is preferable as it's more widely supported by GPUs and more efficient.
If the GPU does not support MSAA+Texture (e.g. Intel HD GPU), MSAA will be disabled.
:type target: integer
:rtype: :class:`RASOffScreen`

View File

@@ -8,13 +8,16 @@ Introduction
The bge.texture module allows you to manipulate textures during the game.
Several sources for texture are possible: video files, image files, video capture, memory buffer, camera render or a mix of that.
Several sources for texture are possible: video files, image files, video capture, memory buffer,
camera render or a mix of that.
The video and image files can be loaded from the internet using an URL instead of a file name.
In addition, you can apply filters on the images before sending them to the GPU, allowing video effect: blue screen, color band, gray, normal map.
In addition, you can apply filters on the images before sending them to the GPU, allowing video effect:
blue screen, color band, gray, normal map.
bge.texture uses FFmpeg to load images and videos. All the formats and codecs that FFmpeg supports are supported by this module, including but not limited to:
bge.texture uses FFmpeg to load images and videos.
All the formats and codecs that FFmpeg supports are supported by this module, including but not limited to:
* AVI
* Ogg
@@ -36,28 +39,29 @@ When the texture object is deleted, the new texture is deleted and the old textu
.. module:: bge.texture
.. include:: ../examples/bge.texture.py
.. include:: __/examples/bge.texture.py
:start-line: 1
:end-line: 5
.. literalinclude:: ../examples/bge.texture.py
.. literalinclude:: __/examples/bge.texture.py
:lines: 7-
.. include:: ../examples/bge.texture.1.py
.. include:: __/examples/bge.texture.1.py
:start-line: 1
:end-line: 6
.. literalinclude:: ../examples/bge.texture.1.py
.. literalinclude:: __/examples/bge.texture.1.py
:lines: 8-
.. include:: ../examples/bge.texture.2.py
.. include:: __/examples/bge.texture.2.py
:start-line: 1
:end-line: 6
.. literalinclude:: ../examples/bge.texture.2.py
.. literalinclude:: __/examples/bge.texture.2.py
:lines: 8-
*************
Video classes
*************
@@ -180,19 +184,23 @@ Video classes
:return: Whether the video was playing.
:rtype: bool
.. method:: refresh(buffer=None, format="RGBA", ts=-1.0)
.. method:: refresh(buffer=None, format="RGBA", timestamp=-1.0)
Refresh video - get its status and optionally copy the frame to an external buffer.
:arg buffer: An optional object that implements the buffer protocol. If specified, the image is copied to the buffer, which must be big enough or an exception is thrown.
:arg buffer: An optional object that implements the buffer protocol.
If specified, the image is copied to the buffer, which must be big enough or an exception is thrown.
:type buffer: any buffer type
:arg format: An optional image format specifier for the image that will be copied to the buffer. Only valid values are "RGBA" or "BGRA"
:arg format: An optional image format specifier for the image that will be copied to the buffer.
Only valid values are "RGBA" or "BGRA"
:type format: str
:arg ts: An optional timestamp (in seconds from the start of the movie) of the frame to be copied to the buffer.
:type ts: float
:arg timestamp: An optional timestamp (in seconds from the start of the movie)
of the frame to be copied to the buffer.
:type timestamp: float
:return: see `FFmpeg Video and Image Status`_.
:rtype: int
*************
Image classes
*************
@@ -260,9 +268,11 @@ Image classes
Refresh image, get its status and optionally copy the frame to an external buffer.
:arg buffer: An optional object that implements the buffer protocol. If specified, the image is copied to the buffer, which must be big enough or an exception is thrown.
:arg buffer: An optional object that implements the buffer protocol.
If specified, the image is copied to the buffer, which must be big enough or an exception is thrown.
:type buffer: any buffer type
:arg format: An optional image format specifier for the image that will be copied to the buffer. Only valid values are "RGBA" or "BGRA"
:arg format: An optional image format specifier for the image that will be copied to the buffer.
Only valid values are "RGBA" or "BGRA"
:type format: str
:return: see `FFmpeg Video and Image Status`_.
:rtype: int
@@ -331,7 +341,8 @@ Image classes
Update image buffer.
:arg imageBuffer: Buffer to load the new data from.
:type imageBuffer: :class:`~bgl.Buffer`, :class:`ImageBuff` or Python object implementing the buffer protocol (f.ex. bytes)
:type imageBuffer: :class:`~bgl.Buffer`, :class:`ImageBuff`
or Python object implementing the buffer protocol (f.ex. bytes)
:arg width: Width of the data to load.
:type width: int
:arg height: Height of the data to load.
@@ -368,7 +379,8 @@ Image classes
:arg scene: Scene in which the image has to be taken.
:type scene: :class:`~bge.types.KX_Scene`
:arg observer: Reference object for the mirror (the object from which the mirror has to be looked at, for example a camera).
:arg observer: Reference object for the mirror
(the object from which the mirror has to be looked at, for example a camera).
:type observer: :class:`~bge.types.KX_GameObject`
:arg mirror: Object holding the mirror.
:type mirror: :class:`~bge.types.KX_GameObject`
@@ -428,11 +440,15 @@ Image classes
.. method:: refresh(buffer=None, format="RGBA")
Refresh image - render and copy the image to an external buffer (optional) then invalidate its current content.
Refresh image - render and copy the image to an external buffer (optional)
then invalidate its current content.
:arg buffer: An optional object that implements the buffer protocol. If specified, the image is rendered and copied to the buffer, which must be big enough or an exception is thrown.
:arg buffer: An optional object that implements the buffer protocol.
If specified, the image is rendered and copied to the buffer,
which must be big enough or an exception is thrown.
:type buffer: any buffer type
:arg format: An optional image format specifier for the image that will be copied to the buffer. Only valid values are "RGBA" or "BGRA"
:arg format: An optional image format specifier for the image that will be copied to the buffer.
Only valid values are "RGBA" or "BGRA"
:type format: str
.. attribute:: scale
@@ -520,11 +536,15 @@ Image classes
.. method:: refresh(buffer=None, format="RGBA")
Refresh image - calculate and copy the image to an external buffer (optional) then invalidate its current content.
Refresh image - calculate and copy the image to an external buffer (optional)
then invalidate its current content.
:arg buffer: An optional object that implements the buffer protocol. If specified, the image is calculated and copied to the buffer, which must be big enough or an exception is thrown.
:arg buffer: An optional object that implements the buffer protocol.
If specified, the image is calculated and copied to the buffer,
which must be big enough or an exception is thrown.
:type buffer: any buffer type
:arg format: An optional image format specifier for the image that will be copied to the buffer. Only valid values are "RGBA" or "BGRA"
:arg format: An optional image format specifier for the image that will be copied to the buffer.
Only valid values are "RGBA" or "BGRA"
:type format: str
.. attribute:: scale
@@ -570,10 +590,11 @@ Image classes
:type: bool
.. class:: ImageRender(scene, camera, fbo=None)
.. class:: ImageRender(scene, camera)
Image source from render. The render is done on a custom framebuffer object if fbo is specified, otherwise on
the default framebuffer.
Image source from render.
The render is done on a custom framebuffer object if fbo is specified,
otherwise on the default framebuffer.
:arg scene: Scene in which the image has to be taken.
:type scene: :class:`~bge.types.KX_Scene`
@@ -666,7 +687,14 @@ Image classes
.. method:: render()
Render the scene but do not extract the pixels yet. The function returns as soon as the render commands have been send to the GPU. The render will proceed asynchronously in the GPU while the host can perform other tasks. To complete the render, you can either call :func:`refresh` directly of refresh the texture of which this object is the source. This method is useful to implement asynchronous render for optimal performance: call render() on frame n and refresh() on frame n+1 to give as much as time as possible to the GPU to render the frame while the game engine can perform other tasks.
Render the scene but do not extract the pixels yet.
The function returns as soon as the render commands have been send to the GPU.
The render will proceed asynchronously in the GPU while the host can perform other tasks.
To complete the render, you can either call :func:`refresh`
directly of refresh the texture of which this object is the source.
This method is useful to implement asynchronous render for optimal performance: call render()
on frame n and refresh() on frame n+1 to give as much as time as possible to the GPU
to render the frame while the game engine can perform other tasks.
:return: True if the render was initiated, False if the render cannot be performed (e.g. the camera is active)
:rtype: bool
@@ -674,11 +702,21 @@ Image classes
.. method:: refresh()
.. method:: refresh(buffer, format="RGBA")
Refresh video - render and optionally copy the image to an external buffer then invalidate its current content. The render may have been started earlier with the :func:`render` method, in which case this function simply waits for the render operations to complete. When called without argument, the pixels are not extracted but the render is guaranteed to be completed when the function returns. This only makes sense with offscreen render on texture target (see :func:`~bge.render.offScreenCreate`).
Refresh video - render and optionally copy the image to an external buffer then invalidate its current content.
The render may have been started earlier with the :func:`render` method,
in which case this function simply waits for the render operations to complete.
When called without argument, the pixels are not extracted but the render is guaranteed
to be completed when the function returns.
This only makes sense with offscreen render on texture target (see :func:`~bge.render.offScreenCreate`).
:arg buffer: An object that implements the buffer protocol. If specified, the image is copied to the buffer, which must be big enough or an exception is thrown. The transfer to the buffer is optimal if no processing of the image is needed. This is the case if flip=False, alpha=True, scale=False, whole=True, depth=False, zbuff=False and no filter is set.
:arg buffer: An object that implements the buffer protocol.
If specified, the image is copied to the buffer, which must be big enough or an exception is thrown.
The transfer to the buffer is optimal if no processing of the image is needed.
This is the case if ``flip=False, alpha=True, scale=False, whole=True, depth=False, zbuff=False``
and no filter is set.
:type buffer: any buffer type of sufficient size
:arg format: An optional image format specifier for the image that will be copied to the buffer. Only valid values are "RGBA" or "BGRA"
:arg format: An optional image format specifier for the image that will be copied to the buffer.
Only valid values are "RGBA" or "BGRA"
:type format: str
:return: True if the render is complete, False if the render cannot be performed (e.g. the camera is active)
:rtype: bool
@@ -736,9 +774,14 @@ Image classes
Refresh video - copy the viewport to an external buffer (optional) then invalidate its current content.
:arg buffer: An optional object that implements the buffer protocol. If specified, the image is copied to the buffer, which must be big enough or an exception is thrown. The transfer to the buffer is optimal if no processing of the image is needed. This is the case if flip=False, alpha=True, scale=False, whole=True, depth=False, zbuff=False and no filter is set.
:arg buffer: An optional object that implements the buffer protocol.
If specified, the image is copied to the buffer, which must be big enough or an exception is thrown.
The transfer to the buffer is optimal if no processing of the image is needed.
This is the case if ``flip=False, alpha=True, scale=False, whole=True, depth=False, zbuff=False``
and no filter is set.
:type buffer: any buffer type
:arg format: An optional image format specifier for the image that will be copied to the buffer. Only valid values are "RGBA" or "BGRA"
:arg format: An optional image format specifier for the image that will be copied to the buffer.
Only valid values are "RGBA" or "BGRA"
:type format: str
.. attribute:: scale
@@ -768,7 +811,7 @@ Image classes
.. attribute:: depth
Use depth component of viewport as array of float - not suitable for texture source,
should only be used with bge.texture.imageToArray(mode='F').
should only be used with ``bge.texture.imageToArray(mode='F')``.
:type: bool
@@ -795,78 +838,88 @@ Image classes
:arg capture: Card number from which the input video must be captured.
:type capture: int
The format argument must be written as <displayMode>/<pixelFormat>[/3D][:<cacheSize>]” where <displayMode>
The format argument must be written as ``<displayMode>/<pixelFormat>[/3D][:<cacheSize>]`` where ``<displayMode>``
describes the frame size and rate and <pixelFormat> the encoding of the pixels.
The optional /3D suffix is to be used if the video stream is stereo with a left and right eye feed.
The optional :<cacheSize> suffix determines the number of the video frames kept in cache, by default 8.
Some DeckLink cards won't work below a certain cache size. The default value 8 should be sufficient for all cards.
The optional ``/3D`` suffix is to be used if the video stream is stereo with a left and right eye feed.
The optional ``:<cacheSize>`` suffix determines the number of the video frames kept in cache, by default 8.
Some DeckLink cards won't work below a certain cache size.
The default value 8 should be sufficient for all cards.
You may try to reduce the cache size to reduce the memory footprint. For example the The 4K Extreme is known
to work with 3 frames only, the Extreme 2 needs 4 frames and the Intensity Shuttle needs 6 frames, etc.
Reducing the cache size may be useful when Decklink is used in conjunction with GPUDirect: all frames must be locked
in memory in that case and that puts a lot of pressure on memory. If you reduce the cache size too much,
Reducing the cache size may be useful when Decklink is used in conjunction with GPUDirect:
all frames must be locked in memory in that case and that puts a lot of pressure on memory.
If you reduce the cache size too much,
you'll get no error but no video feed either.
The valid <displayMode> values are copied from the 'BMDDisplayMode' enum in the DeckLink API
The valid ``<displayMode>`` values are copied from the ``BMDDisplayMode`` enum in the DeckLink API
without the 'bmdMode' prefix. In case a mode that is not in this list is added in a later version
of the SDK, it is also possible to specify the 4 letters of the internal code for that mode.
You will find the internal code in the DeckLinkAPIModes.h file that is part of the SDK.
You will find the internal code in the ``DeckLinkAPIModes.h`` file that is part of the SDK.
Here is for reference the full list of supported display modes with their equivalent internal code:
* NTSC 'ntsc'
* NTSC2398 'nt23'
* PAL 'pal '
* NTSCp 'ntsp'
* PALp 'palp'
HD 1080 Modes:
* HD1080p2398 '23ps'
* HD1080p24 '24ps'
* HD1080p25 'Hp25'
* HD1080p2997 'Hp29'
* HD1080p30 'Hp30'
* HD1080i50 'Hi50'
* HD1080i5994 'Hi59'
* HD1080i6000 'Hi60'
* HD1080p50 'Hp50'
* HD1080p5994 'Hp59'
* HD1080p6000 'Hp60'
HD 720 Modes:
* HD720p50 'hp50'
* HD720p5994 'hp59'
* HD720p60 'hp60'
Internal Codes
- NTSC 'ntsc'
- NTSC2398 'nt23'
- PAL 'pal '
- NTSCp 'ntsp'
- PALp 'palp'
HD 1080 Modes
- HD1080p2398 '23ps'
- HD1080p24 '24ps'
- HD1080p25 'Hp25'
- HD1080p2997 'Hp29'
- HD1080p30 'Hp30'
- HD1080i50 'Hi50'
- HD1080i5994 'Hi59'
- HD1080i6000 'Hi60'
- HD1080p50 'Hp50'
- HD1080p5994 'Hp59'
- HD1080p6000 'Hp60'
HD 720 Modes
- HD720p50 'hp50'
- HD720p5994 'hp59'
- HD720p60 'hp60'
2k Modes
* 2k2398 '2k23'
* 2k24 '2k24'
* 2k25 '2k25'
- 2k2398 '2k23'
- 2k24 '2k24'
- 2k25 '2k25'
4k Modes
* 4K2160p2398 '4k23'
* 4K2160p24 '4k24'
* 4K2160p25 '4k25'
* 4K2160p2997 '4k29'
* 4K2160p30 '4k30'
* 4K2160p50 '4k50'
* 4K2160p5994 '4k59'
* 4K2160p60 '4k60'
- 4K2160p2398 '4k23'
- 4K2160p24 '4k24'
- 4K2160p25 '4k25'
- 4K2160p2997 '4k29'
- 4K2160p30 '4k30'
- 4K2160p50 '4k50'
- 4K2160p5994 '4k59'
- 4K2160p60 '4k60'
Most of names are self explanatory. If necessary refer to the DeckLink API documentation for more information.
Similarly, <pixelFormat> is copied from the BMDPixelFormat enum.
Here is for reference the full list of supported pixel format and their equivalent internal code:
* 8BitYUV '2vuy'
* 10BitYUV 'v210'
* 8BitARGB * no equivalent code *
* 8BitBGRA 'BGRA'
* 10BitRGB 'r210'
* 12BitRGB 'R12B'
* 12BitRGBLE 'R12L'
* 10BitRGBXLE 'R10l'
* 10BitRGBX 'R10b'
Pixel Formats
- 8BitYUV '2vuy'
- 10BitYUV 'v210'
- 8BitARGB * no equivalent code *
- 8BitBGRA 'BGRA'
- 10BitRGB 'r210'
- 12BitRGB 'R12B'
- 12BitRGBLE 'R12L'
- 10BitRGBXLE 'R10l'
- 10BitRGBX 'R10b'
Refer to the DeckLink SDK documentation for a full description of these pixel format.
It is important to understand them as the decoding of the pixels is NOT done in VideoTexture
for performance reason. Instead a specific shader must be used to decode the pixel in the GPU.
Only the '8BitARGB', '8BitBGRA' and '10BitRGBXLE' pixel formats are mapped directly to OpenGL RGB float textures.
The '8BitYUV' and '10BitYUV' pixel formats are mapped to openGL RGB float texture but require a shader to decode.
The other pixel formats are sent as a 'GL_RED_INTEGER' texture (i.e. a texture with only the
The other pixel formats are sent as a ``GL_RED_INTEGER`` texture (i.e. a texture with only the
red channel coded as an unsigned 32 bit integer) and are not recommended for use.
Example: HD1080p24/10BitYUV/3D:4 is equivalent to 24ps/v210/3D:4” and represents a full HD stereo feed at 24 frame per second and 4 frames cache size.
Example: ``HD1080p24/10BitYUV/3D:4`` is equivalent to ``24ps/v210/3D:4``
and represents a full HD stereo feed at 24 frame per second and 4 frames cache size.
Although video format auto detection is possible with certain DeckLink devices, the corresponding
API is NOT implemented in the BGE. Therefore it is important to specify the format string that
@@ -946,6 +999,7 @@ Image classes
:return: True if the capture could be stopped, False otherwise.
:rtype: bool
***************
Texture classes
***************
@@ -979,16 +1033,16 @@ Texture classes
:type: bool
.. method:: refresh(refresh_source=True, ts=-1.0)
.. method:: refresh(refresh_source=True, timestamp=-1.0)
Refresh texture from source.
:arg refresh_source: Whether to also refresh the image source of the texture.
:type refresh_source: bool
:arg ts: If the texture controls a VideoFFmpeg object:
:arg timestamp: If the texture controls a VideoFFmpeg object:
timestamp (in seconds from the start of the movie) of the frame to be loaded; this can be
used for video-sound synchonization by passing :attr:`~bge.types.KX_SoundActuator.time` to it. (optional)
:type ts: float
:type timestamp: float
.. attribute:: source
@@ -1015,7 +1069,9 @@ Texture classes
on the output interfaces. Keying is supported: it allows to composite the frame with an
input video feed that transits through the DeckLink card.
:arg cardIdx: Number of the card to be used for output (0=first card). It should be noted that DeckLink devices are usually half duplex: they can either be used for capture or playback but not both at the same time.
:arg cardIdx: Number of the card to be used for output (0=first card).
It should be noted that DeckLink devices are usually half duplex:
they can either be used for capture or playback but not both at the same time.
:type cardIdx: int
:arg format: String representing the display mode of the output feed.
:type format: str
@@ -1025,11 +1081,11 @@ Texture classes
specified. If keying is the goal (see keying attributes), the format must match exactly the
input video feed, otherwise it can be any format supported by the device (there will be a
runtime error if not).
The format of the string is <displayMode>[/3D]”.
The format of the string is ``<displayMode>[/3D]``.
Refer to :class:`VideoDeckLink` to get the list of acceptable <displayMode>.
The optional “/3D” suffix is used to create a stereo 3D feed. In that case the 'right' attribute
must also be set to specify the image source for the right eye.
Refer to :class:`VideoDeckLink` to get the list of acceptable ``<displayMode>``.
The optional ``/3D`` suffix is used to create a stereo 3D feed.
In that case the 'right' attribute must also be set to specify the image source for the right eye.
Note: The pixel format is not specified here because it is always BGRA. The alpha channel is
used in keying to mix the source with the input video feed, otherwise it is not used.
@@ -1048,14 +1104,14 @@ Texture classes
copy inside VideoTexture).
:type: one of...
* :class:`VideoFFmpeg`
* :class:`VideoDeckLink`
* :class:`ImageFFmpeg`
* :class:`ImageBuff`
* :class:`ImageMirror`
* :class:`ImageMix`
* :class:`ImageRender`
* :class:`ImageViewport`
- :class:`VideoFFmpeg`
- :class:`VideoDeckLink`
- :class:`ImageFFmpeg`
- :class:`ImageBuff`
- :class:`ImageMirror`
- :class:`ImageMix`
- :class:`ImageRender`
- :class:`ImageViewport`
.. attribute:: right
@@ -1065,14 +1121,14 @@ Texture classes
render buffer that is just the size of the video frame.
:type: one of...
* :class:`VideoFFmpeg`
* :class:`VideoDeckLink`
* :class:`ImageFFmpeg`
* :class:`ImageBuff`
* :class:`ImageMirror`
* :class:`ImageMix`
* :class:`ImageRender`
* :class:`ImageViewport`
- :class:`VideoFFmpeg`
- :class:`VideoDeckLink`
- :class:`ImageFFmpeg`
- :class:`ImageBuff`
- :class:`ImageMirror`
- :class:`ImageMix`
- :class:`ImageRender`
- :class:`ImageViewport`
.. attribute:: keying
@@ -1121,28 +1177,29 @@ Texture classes
new frame is sent from the host. Thus, it is not necessary to refresh the
DeckLink object if it is known that the image source has not changed.
:type refresh_source: bool
:arg ts: The timestamp value passed to the image source object to compute the image. If unspecified, the BGE clock is used.
:arg ts: The timestamp value passed to the image source object to compute the image.
If unspecified, the BGE clock is used.
:type ts: float
**************
Filter classes
**************
.. class:: FilterBGR24
Source filter BGR24.
.. class:: FilterBlueScreen
Filter for Blue Screen. The RGB channels of the color are left unchanged, while the output alpha is obtained as follows:
Filter for Blue Screen.
The RGB channels of the color are left unchanged, while the output alpha is obtained as follows:
* if the square of the euclidian distance between the RGB color and the filter's reference color is smaller than the filter's lower limit,
- if the square of the euclidian distance between the RGB color
and the filter's reference color is smaller than the filter's lower limit,
the output alpha is set to 0;
* if that square is bigger than the filter's upper limit, the output alpha is set to 255;
* otherwise the output alpha is linarly extrapoled between 0 and 255 in the interval of the limits.
- if that square is bigger than the filter's upper limit, the output alpha is set to 255;
- otherwise the output alpha is linarly extrapoled between 0 and 255 in the interval of the limits.
.. attribute:: color
@@ -1175,7 +1232,8 @@ Filter classes
.. class:: FilterColor
Filter for color calculations. The output color is obtained by multiplying the reduced 4x4 matrix with the input color
Filter for color calculations.
The output color is obtained by multiplying the reduced 4x4 matrix with the input color
and adding the remaining column to the result.
.. attribute:: matrix
@@ -1202,7 +1260,8 @@ Filter classes
.. class:: FilterGray
Filter for gray scale effect. Proportions of R, G and B contributions in the output gray scale are 28:151:77.
Filter for gray scale effect.
Proportions of R, G and B contributions in the output gray scale are 28:151:77.
.. attribute:: previous
@@ -1321,15 +1380,19 @@ Functions
:arg mode: Optional argument representing the pixel format.
* You can use the characters R, G, B for the 3 color channels, A for the alpha channel,
- You can use the characters R, G, B for the 3 color channels, A for the alpha channel,
0 to force a fixed 0 color channel and 1 to force a fixed 255 color channel.
Examples:
* "BGR" will return 3 bytes per pixel with the Blue, Green and Red channels in that order.
* "RGB1" will return 4 bytes per pixel with the Red, Green, Blue channels in that order and the alpha channel forced to 255.
* A special mode "F" allows to return the image as an array of float. This mode should only be used to retrieve
the depth buffer of the class:`ImageViewport` and :class:`ImageRender` objects.
- "BGR" will return 3 bytes per pixel with the
Blue, Green and Red channels in that order.
- "RGB1" will return 4 bytes per pixel with the
Red, Green, Blue channels in that order and the alpha channel forced to 255.
- A special mode "F" allows to return the image as an array of float.
This mode should only be used to retrieve the depth buffer of the
class:`ImageViewport` and :class:`ImageRender` objects.
The default mode is "RGBA".
:type mode: str
@@ -1351,7 +1414,8 @@ Functions
the texture by material. In that case the material must have a texture channel in first
position.
If the object has no material that matches name, it generates a runtime error. Use try/except to catch the exception.
If the object has no material that matches name, it generates a runtime error.
Use try/except to catch the exception.
Ex: ``bge.texture.materialID(obj, 'IMvideo.png')``

View File

@@ -27,8 +27,10 @@ base class --- :class:`PyObjectPlus`
:type: list of ints.
Each specifying the value of an axis between -1.0 and 1.0 depending on how far the axis is pushed, 0 for nothing.
The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls.
Each specifying the value of an axis between -1.0 and 1.0
depending on how far the axis is pushed, 0 for nothing.
The first 2 values are used by most joysticks and gamepads for directional control.
3rd and 4th values are only on some joysticks and can be used for arbitary controls.
* left:[-1.0, 0.0, ...]
* right:[1.0, 0.0, ...]

View File

@@ -1,7 +1,8 @@
..
This document is appended to the auto generated bmesh api doc to avoid clogging up the C files with details.
to test this run:
./blender.bin -b -noaudio -P doc/python_api/sphinx_doc_gen.py -- --partial bmesh* ; cd doc/python_api ; sphinx-build sphinx-in sphinx-out ; cd ../../
./blender.bin -b -noaudio -P doc/python_api/sphinx_doc_gen.py -- \
--partial bmesh* ; cd doc/python_api ; sphinx-build sphinx-in sphinx-out ; cd ../../
Submodules:
@@ -40,7 +41,7 @@ For an overview of BMesh data types and how they reference each other see:
Example Script
--------------
.. literalinclude:: ../../../release/scripts/templates_py/bmesh_simple.py
.. literalinclude:: __/__/__/release/scripts/templates_py/bmesh_simple.py
Stand-Alone Module
@@ -59,9 +60,9 @@ There are 2 ways to access BMesh data, you can create a new BMesh by converting
:class:`bpy.types.BlendData.meshes` or by accessing the current edit mode mesh.
see: :class:`bmesh.types.BMesh.from_mesh` and :mod:`bmesh.from_edit_mesh` respectively.
When explicitly converting from mesh data python **owns** the data, that is to say - that the mesh only exists while
python holds a reference to it, and the script is responsible for putting it back into a mesh data-block when the edits
are done.
When explicitly converting from mesh data python **owns** the data, that is to say -
that the mesh only exists while python holds a reference to it,
and the script is responsible for putting it back into a mesh data-block when the edits are done.
Note that unlike :mod:`bpy`, a BMesh does not necessarily correspond to data in the currently open blend file,
a BMesh can be created, edited and freed without the user ever seeing or having access to it.

View File

@@ -151,7 +151,7 @@ Data Creation/Removal
^^^^^^^^^^^^^^^^^^^^^
Those of you familiar with other Python API's may be surprised that
new datablocks in the bpy API can't be created by calling the class:
new data-blocks in the bpy API can't be created by calling the class:
>>> bpy.types.Mesh()
Traceback (most recent call last):
@@ -305,7 +305,7 @@ In Python, this is done by defining a class, which is a subclass of an existing
Example Operator
----------------
.. literalinclude:: ../../../release/scripts/templates_py/operator_simple.py
.. literalinclude:: __/__/__/release/scripts/templates_py/operator_simple.py
Once this script runs, ``SimpleOperator`` is registered with Blender
and can be called from the operator search popup or added to the toolbar.
@@ -336,7 +336,7 @@ Example Panel
Panels register themselves as a class, like an operator.
Notice the extra ``bl_`` variables used to set the context they display in.
.. literalinclude:: ../../../release/scripts/templates_py/ui_panel_simple.py
.. literalinclude:: __/__/__/release/scripts/templates_py/ui_panel_simple.py
To run the script:
@@ -393,11 +393,11 @@ so these are accessed as normal Python types.
Internal Types
--------------
Used for Blender datablocks and collections: :class:`bpy.types.bpy_struct`
Used for Blender data-blocks and collections: :class:`bpy.types.bpy_struct`
For data that contains its own attributes groups/meshes/bones/scenes... etc.
There are 2 main types that wrap Blenders data, one for datablocks
There are 2 main types that wrap Blenders data, one for data-blocks
(known internally as ``bpy_struct``), another for properties.
>>> bpy.context.object

View File

@@ -57,7 +57,7 @@ Operator Example
++++++++++++++++
This script shows how operators can be used to model a link of a chain.
.. literalinclude:: ../examples/bmesh.ops.1.py
.. literalinclude:: __/examples/bmesh.ops.1.py
"""

View File

@@ -325,6 +325,24 @@ except ImportError:
"freestyle.types",
"freestyle.utils"]
# Source files we use, and need to copy to the OUTPUT_DIR
# to have working out-of-source builds.
# Note that ".." is replaced by "__" in the RST files,
# to avoid having to match Blender's source tree.
EXTRA_SOURCE_FILES = (
"../../../release/scripts/templates_py/bmesh_simple.py",
"../../../release/scripts/templates_py/operator_simple.py",
"../../../release/scripts/templates_py/ui_panel_simple.py",
"../../../release/scripts/templates_py/ui_previews_custom_icon.py",
"../examples/bge.constraints.py",
"../examples/bge.texture.1.py",
"../examples/bge.texture.2.py",
"../examples/bge.texture.py",
"../examples/bmesh.ops.1.py",
"../examples/bpy.app.translations.py",
)
# examples
EXAMPLES_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "examples"))
EXAMPLE_SET = set()
@@ -1890,6 +1908,21 @@ def copy_handwritten_rsts(basepath):
shutil.copy2(os.path.join(RST_DIR, f), basepath)
def copy_handwritten_extra(basepath):
for f_src in EXTRA_SOURCE_FILES:
if os.sep != "/":
f_src = os.sep.join(f_src.split("/"))
f_dst = f_src.replace("..", "__")
f_src = os.path.join(RST_DIR, f_src)
f_dst = os.path.join(basepath, f_dst)
os.makedirs(os.path.dirname(f_dst), exist_ok=True)
shutil.copy2(f_src, f_dst)
def rna2sphinx(basepath):
try:
@@ -1921,35 +1954,48 @@ def rna2sphinx(basepath):
# copy the other rsts
copy_handwritten_rsts(basepath)
# copy source files referenced
copy_handwritten_extra(basepath)
def align_sphinx_in_to_sphinx_in_tmp():
def align_sphinx_in_to_sphinx_in_tmp(dir_src, dir_dst):
'''
Move changed files from SPHINX_IN_TMP to SPHINX_IN
'''
import filecmp
sphinx_in_files = set(os.listdir(SPHINX_IN))
sphinx_in_tmp_files = set(os.listdir(SPHINX_IN_TMP))
# possible the dir doesn't exist when running recursively
os.makedirs(dir_dst, exist_ok=True)
sphinx_dst_files = set(os.listdir(dir_dst))
sphinx_src_files = set(os.listdir(dir_src))
# remove deprecated files that have been removed
for f in sorted(sphinx_in_files):
if f not in sphinx_in_tmp_files:
for f in sorted(sphinx_dst_files):
if f not in sphinx_src_files:
BPY_LOGGER.debug("\tdeprecated: %s" % f)
os.remove(os.path.join(SPHINX_IN, f))
f_dst = os.path.join(dir_dst, f)
if os.path.isdir(f_dst):
shutil.rmtree(f_dst, True)
else:
os.remove(f_dst)
# freshen with new files.
for f in sorted(sphinx_in_tmp_files):
f_from = os.path.join(SPHINX_IN_TMP, f)
f_to = os.path.join(SPHINX_IN, f)
for f in sorted(sphinx_src_files):
f_src = os.path.join(dir_src, f)
f_dst = os.path.join(dir_dst, f)
if os.path.isdir(f_src):
align_sphinx_in_to_sphinx_in_tmp(f_src, f_dst)
else:
do_copy = True
if f in sphinx_in_files:
if filecmp.cmp(f_from, f_to):
if f in sphinx_dst_files:
if filecmp.cmp(f_src, f_dst):
do_copy = False
if do_copy:
BPY_LOGGER.debug("\tupdating: %s" % f)
shutil.copy(f_from, f_to)
shutil.copy(f_src, f_dst)
def refactor_sphinx_log(sphinx_logfile):
@@ -2036,7 +2082,7 @@ def main():
shutil.rmtree(SPHINX_OUT_PDF, True)
else:
# move changed files in SPHINX_IN
align_sphinx_in_to_sphinx_in_tmp()
align_sphinx_in_to_sphinx_in_tmp(SPHINX_IN_TMP, SPHINX_IN)
# report which example files weren't used
EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED

View File

@@ -3,11 +3,6 @@
# bash doc/python_api/sphinx_doc_gen.sh
# ssh upload means you need an account on the server
if [ "$1" == "" ] ; then
echo "Expected a single argument for the username on blender.org, aborting"
exit 1
fi
# ----------------------------------------------------------------------------
# Upload vars
@@ -22,9 +17,15 @@ if [ -z $BLENDER_BIN ] ; then
BLENDER_BIN="./blender.bin"
fi
SSH_USER=$1
SSH_HOST=$SSH_USER"@blender.org"
SSH_UPLOAD="/data/www/vhosts/www.blender.org/api" # blender_python_api_VERSION, added after
if [ "$1" == "" ] ; then
echo "Expected a single argument for the username on blender.org, skipping upload step!"
DO_UPLOAD=false
else
SSH_USER=$1
SSH_HOST=$SSH_USER"@blender.org"
SSH_UPLOAD="/data/www/vhosts/www.blender.org/api" # blender_python_api_VERSION, added after
fi
# ----------------------------------------------------------------------------
# Blender Version & Info
@@ -33,10 +34,12 @@ SSH_UPLOAD="/data/www/vhosts/www.blender.org/api" # blender_python_api_VERSION,
# "_".join(str(v) for v in bpy.app.version)
# custom blender vars
blender_srcdir=$(dirname -- $0)/../..
blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_header="$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h"
blender_version=$(grep "BLENDER_VERSION\s" "$blender_version_header" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_version_header" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_version_header" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_version_header" | awk '{print $3}')
unset blender_version_header
if [ "$blender_version_cycle" = "release" ] ; then
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)$blender_version_char"_release"
@@ -48,6 +51,8 @@ SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION
SPHINXBASE=doc/python_api
SPHINX_WORKDIR="$(mktemp --directory --suffix=.sphinx)"
# ----------------------------------------------------------------------------
# Generate reStructuredText (blender/python only)
@@ -59,7 +64,10 @@ if $DO_EXE_BLENDER ; then
-noaudio \
--factory-startup \
--python-exit-code 1 \
--python $SPHINXBASE/sphinx_doc_gen.py
--python $SPHINXBASE/sphinx_doc_gen.py \
-- \
--output=$SPHINX_WORKDIR
if (($? != 0)) ; then
echo "Generating documentation failed, aborting"
@@ -67,15 +75,14 @@ if $DO_EXE_BLENDER ; then
fi
fi
# ----------------------------------------------------------------------------
# Generate HTML (sphinx)
if $DO_OUT_HTML ; then
# sphinx-build -n -b html $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out
# sphinx-build -n -b html $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out
# annoying bug in sphinx makes it very slow unless we do this. should report.
cd $SPHINXBASE
cd $SPHINX_WORKDIR
sphinx-build -b html sphinx-in sphinx-out
# XXX, saves space on upload and zip, should move HTML outside
@@ -103,20 +110,21 @@ fi
# Generate PDF (sphinx/laytex)
if $DO_OUT_PDF ; then
sphinx-build -n -b latex $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out
make -C $SPHINXBASE/sphinx-out
mv $SPHINXBASE/sphinx-out/contents.pdf $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf
cd $SPHINX_WORKDIR
sphinx-build -n -b latex $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out
make -C $SPHINX_WORKDIR/sphinx-out
mv $SPHINX_WORKDIR/sphinx-out/contents.pdf \
$SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf
fi
# ----------------------------------------------------------------------------
# Upload to blender servers, comment this section for testing
if $DO_UPLOAD ; then
cp $SPHINXBASE/sphinx-out/contents.html $SPHINXBASE/sphinx-out/index.html
cp $SPHINX_WORKDIR/sphinx-out/contents.html $SPHINX_WORKDIR/sphinx-out/index.html
ssh $SSH_USER@blender.org 'rm -rf '$SSH_UPLOAD_FULL'/*'
rsync --progress -ave "ssh -p 22" $SPHINXBASE/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/
rsync --progress -ave "ssh -p 22" $SPHINX_WORKDIR/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/
## symlink the dir to a static URL
#ssh $SSH_USER@blender.org 'rm '$SSH_UPLOAD'/250PythonDoc && ln -s '$SSH_UPLOAD_FULL' '$SSH_UPLOAD'/250PythonDoc'
@@ -134,11 +142,15 @@ if $DO_UPLOAD ; then
if $DO_OUT_PDF ; then
# rename so local PDF has matching name.
rsync --progress -ave "ssh -p 22" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf
rsync --progress -ave "ssh -p 22" \
$SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf \
$SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf
fi
if $DO_OUT_HTML_ZIP ; then
rsync --progress -ave "ssh -p 22" $SPHINXBASE/blender_python_reference_$BLENDER_VERSION.zip $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.zip
rsync --progress -ave "ssh -p 22" \
$SPHINX_WORKDIR/blender_python_reference_$BLENDER_VERSION.zip \
$SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.zip
fi
fi
@@ -149,5 +161,5 @@ fi
echo ""
echo "Finished! view the docs from: "
if $DO_OUT_HTML ; then echo " html:" $SPHINXBASE/sphinx-out/contents.html ; fi
if $DO_OUT_PDF ; then echo " pdf:" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf ; fi
if $DO_OUT_HTML ; then echo " html:" $SPHINX_WORKDIR/sphinx-out/contents.html ; fi
if $DO_OUT_PDF ; then echo " pdf:" $SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf ; fi

View File

@@ -60,6 +60,7 @@ int curve_fit_cubic_to_points_db(
const unsigned int points_len,
const unsigned int dims,
const double error_threshold,
const unsigned int calc_flag,
const unsigned int *corners,
unsigned int corners_len,
@@ -72,6 +73,7 @@ int curve_fit_cubic_to_points_fl(
const unsigned int points_len,
const unsigned int dims,
const float error_threshold,
const unsigned int calc_flag,
const unsigned int *corners,
const unsigned int corners_len,
@@ -117,6 +119,10 @@ int curve_fit_cubic_to_points_single_fl(
float r_handle_r[],
float *r_error_sq);
enum {
CURVE_FIT_CALC_HIGH_QUALIY = (1 << 0),
};
/* curve_fit_corners_detect.c */
/**

View File

@@ -46,6 +46,12 @@
/* Take curvature into account when calculating the least square solution isn't usable. */
#define USE_CIRCULAR_FALLBACK
/* Use the maximum distance of any points from the direct line between 2 points
* to calculate how long the handles need to be.
* Can do a 'perfect' reversal of subdivision when for curve has symmetrical handles and doesn't change direction
* (as with an 'S' shape). */
#define USE_OFFSET_FALLBACK
/* avoid re-calculating lengths multiple times */
#define USE_LENGTH_CACHE
@@ -339,6 +345,44 @@ static double cubic_calc_error(
return error_max_sq;
}
#ifdef USE_OFFSET_FALLBACK
/**
* A version #cubic_calc_error where we don't need the split-index and can exit early when over the limit.
*/
static double cubic_calc_error_simple(
const Cubic *cubic,
const double *points_offset,
const uint points_offset_len,
const double *u,
const double error_threshold_sq,
const uint dims)
{
double error_max_sq = 0.0;
const double *pt_real = points_offset + dims;
#ifdef USE_VLA
double pt_eval[dims];
#else
double *pt_eval = alloca(sizeof(double) * dims);
#endif
for (uint i = 1; i < points_offset_len - 1; i++, pt_real += dims) {
cubic_evaluate(cubic, u[i], dims, pt_eval);
const double err_sq = len_squared_vnvn(pt_real, pt_eval, dims);
if (err_sq >= error_threshold_sq) {
return error_threshold_sq;
}
else if (err_sq >= error_max_sq) {
error_max_sq = err_sq;
}
}
return error_max_sq;
}
#endif
/**
* Bezier multipliers
*/
@@ -530,6 +574,85 @@ static void cubic_from_points_fallback(
}
#endif /* USE_CIRCULAR_FALLBACK */
#ifdef USE_OFFSET_FALLBACK
static void cubic_from_points_offset_fallback(
const double *points_offset,
const uint points_offset_len,
const double tan_l[],
const double tan_r[],
const uint dims,
Cubic *r_cubic)
{
const double *p0 = &points_offset[0];
const double *p3 = &points_offset[(points_offset_len - 1) * dims];
#ifdef USE_VLA
double dir_unit[dims];
double a[2][dims];
double tmp[dims];
#else
double *dir_unit = alloca(sizeof(double) * dims);
double *a[2] = {
alloca(sizeof(double) * dims),
alloca(sizeof(double) * dims),
};
double *tmp = alloca(sizeof(double) * dims);
#endif
const double dir_dist = normalize_vn_vnvn(dir_unit, p3, p0, dims);
project_plane_vn_vnvn_normalized(a[0], tan_l, dir_unit, dims);
project_plane_vn_vnvn_normalized(a[1], tan_r, dir_unit, dims);
/* only for better accuracy, not essential */
normalize_vn(a[0], dims);
normalize_vn(a[1], dims);
mul_vnvn_fl(a[1], a[1], -1, dims);
double dists[2] = {0, 0};
const double *pt = points_offset;
for (uint i = 1; i < points_offset_len - 1; i++, pt += dims) {
for (uint k = 0; k < 2; k++) {
sub_vn_vnvn(tmp, p0, pt, dims);
project_vn_vnvn_normalized(tmp, tmp, a[k], dims);
dists[k] = max(dists[k], dot_vnvn(tmp, a[k], dims));
}
}
float alpha_l = (dists[0] / 0.75) / dot_vnvn(tan_l, a[0], dims);
float alpha_r = (dists[1] / 0.75) / -dot_vnvn(tan_r, a[1], dims);
if (!(alpha_l > 0.0f)) {
alpha_l = dir_dist / 3.0;
}
if (!(alpha_r > 0.0f)) {
alpha_r = dir_dist / 3.0;
}
double *p1 = CUBIC_PT(r_cubic, 1, dims);
double *p2 = CUBIC_PT(r_cubic, 2, dims);
copy_vnvn(CUBIC_PT(r_cubic, 0, dims), p0, dims);
copy_vnvn(CUBIC_PT(r_cubic, 3, dims), p3, dims);
#ifdef USE_ORIG_INDEX_DATA
r_cubic->orig_span = (points_offset_len - 1);
#endif
/* p1 = p0 - (tan_l * alpha_l);
* p2 = p3 + (tan_r * alpha_r);
*/
msub_vn_vnvn_fl(p1, p0, tan_l, alpha_l, dims);
madd_vn_vnvn_fl(p2, p3, tan_r, alpha_r, dims);
}
#endif /* USE_OFFSET_FALLBACK */
/**
* Use least-squares method to find Bezier control points for region.
*/
@@ -918,6 +1041,8 @@ static bool fit_cubic_to_points(
Cubic *cubic_test = alloca(cubic_alloc_size(dims));
/* Run this so we use the non-circular calculation when the circular-fallback
* in 'cubic_from_points' failed to give a close enough result. */
#ifdef USE_CIRCULAR_FALLBACK
if (!(error_max_sq < error_threshold_sq)) {
/* Don't use the cubic calculated above, instead calculate a new fallback cubic,
@@ -940,14 +1065,28 @@ static bool fit_cubic_to_points(
}
#endif
/* Test the offset fallback */
#ifdef USE_OFFSET_FALLBACK
if (!(error_max_sq < error_threshold_sq)) {
/* Using the offset from the curve to calculate cubic handle length may give better results
* try this as a second fallback. */
cubic_from_points_offset_fallback(
points_offset, points_offset_len,
tan_l, tan_r, dims, cubic_test);
const double error_max_sq_test = cubic_calc_error_simple(
cubic_test, points_offset, points_offset_len, u, error_max_sq, dims);
if (error_max_sq > error_max_sq_test) {
error_max_sq = error_max_sq_test;
cubic_copy(r_cubic, cubic_test, dims);
}
}
#endif
*r_error_max_sq = error_max_sq;
*r_split_index = split_index;
if (error_max_sq < error_threshold_sq) {
free(u);
return true;
}
else {
if (!(error_max_sq < error_threshold_sq)) {
cubic_copy(cubic_test, r_cubic, dims);
/* If error not too large, try some reparameterization and iteration */
@@ -965,24 +1104,27 @@ static bool fit_cubic_to_points(
points_offset_coords_length,
#endif
u_prime, tan_l, tan_r, dims, cubic_test);
error_max_sq = cubic_calc_error(
const double error_max_sq_test = cubic_calc_error(
cubic_test, points_offset, points_offset_len, u_prime, dims,
&split_index);
if (error_max_sq < error_threshold_sq) {
if (error_max_sq > error_max_sq_test) {
error_max_sq = error_max_sq_test;
cubic_copy(r_cubic, cubic_test, dims);
*r_error_max_sq = error_max_sq;
*r_split_index = split_index;
}
if (!(error_max_sq < error_threshold_sq)) {
/* continue */
}
else {
assert((error_max_sq < error_threshold_sq));
free(u_prime);
free(u);
cubic_copy(r_cubic, cubic_test, dims);
*r_error_max_sq = error_max_sq;
*r_split_index = split_index;
return true;
}
else if (error_max_sq < *r_error_max_sq) {
cubic_copy(r_cubic, cubic_test, dims);
*r_error_max_sq = error_max_sq;
*r_split_index = split_index;
}
SWAP(double *, u, u_prime);
}
@@ -991,6 +1133,10 @@ static bool fit_cubic_to_points(
return false;
}
else {
free(u);
return true;
}
}
static void fit_cubic_to_points_recursive(
@@ -1002,6 +1148,7 @@ static void fit_cubic_to_points_recursive(
const double tan_l[],
const double tan_r[],
const double error_threshold_sq,
const uint calc_flag,
const uint dims,
/* fill in the list */
CubicList *clist)
@@ -1015,8 +1162,11 @@ static void fit_cubic_to_points_recursive(
#ifdef USE_LENGTH_CACHE
points_length_cache,
#endif
tan_l, tan_r, error_threshold_sq, dims,
cubic, &error_max_sq, &split_index))
tan_l, tan_r,
(calc_flag & CURVE_FIT_CALC_HIGH_QUALIY) ? DBL_EPSILON : error_threshold_sq,
dims,
cubic, &error_max_sq, &split_index) ||
(error_max_sq < error_threshold_sq))
{
cubic_list_prepend(clist, cubic);
return;
@@ -1068,13 +1218,13 @@ static void fit_cubic_to_points_recursive(
#ifdef USE_LENGTH_CACHE
points_length_cache,
#endif
tan_l, tan_center, error_threshold_sq, dims, clist);
tan_l, tan_center, error_threshold_sq, calc_flag, dims, clist);
fit_cubic_to_points_recursive(
&points_offset[split_index * dims], points_offset_len - split_index,
#ifdef USE_LENGTH_CACHE
points_length_cache + split_index,
#endif
tan_center, tan_r, error_threshold_sq, dims, clist);
tan_center, tan_r, error_threshold_sq, calc_flag, dims, clist);
}
@@ -1097,6 +1247,7 @@ int curve_fit_cubic_to_points_db(
const uint points_len,
const uint dims,
const double error_threshold,
const uint calc_flag,
const uint *corners,
uint corners_len,
@@ -1172,7 +1323,7 @@ int curve_fit_cubic_to_points_db(
#ifdef USE_LENGTH_CACHE
points_length_cache,
#endif
tan_l, tan_r, error_threshold_sq, dims, &clist);
tan_l, tan_r, error_threshold_sq, calc_flag, dims, &clist);
}
else if (points_len == 1) {
assert(points_offset_len == 1);
@@ -1239,6 +1390,7 @@ int curve_fit_cubic_to_points_fl(
const uint points_len,
const uint dims,
const float error_threshold,
const uint calc_flag,
const uint *corners,
const uint corners_len,
@@ -1256,7 +1408,7 @@ int curve_fit_cubic_to_points_fl(
uint cubic_array_len = 0;
int result = curve_fit_cubic_to_points_db(
points_db, points_len, dims, error_threshold, corners, corners_len,
points_db, points_len, dims, error_threshold, calc_flag, corners, corners_len,
&cubic_array_db, &cubic_array_len,
r_cubic_orig_index,
r_corner_index_array, r_corner_index_len);

View File

@@ -290,4 +290,28 @@ MINLINE bool equals_vnvn(
return true;
}
#if 0
MINLINE void project_vn_vnvn(
double v_out[], const double p[], const double v_proj[], const uint dims)
{
const double mul = dot_vnvn(p, v_proj, dims) / dot_vnvn(v_proj, v_proj, dims);
mul_vnvn_fl(v_out, v_proj, mul, dims);
}
#endif
MINLINE void project_vn_vnvn_normalized(
double v_out[], const double p[], const double v_proj[], const uint dims)
{
const double mul = dot_vnvn(p, v_proj, dims);
mul_vnvn_fl(v_out, v_proj, mul, dims);
}
MINLINE void project_plane_vn_vnvn_normalized(
double v_out[], const double v[], const double v_plane[], const uint dims)
{
assert(v != v_out);
project_vn_vnvn_normalized(v_out, v, v_plane, dims);
sub_vn_vnvn(v_out, v, v_out, dims);
}
/** \} */

View File

@@ -34,7 +34,7 @@ add_subdirectory(mikktspace)
add_subdirectory(glew-mx)
add_subdirectory(eigen)
if (WITH_DECKLINK)
if (WITH_GAMEENGINE_DECKLINK)
add_subdirectory(decklink)
endif()

View File

@@ -73,18 +73,6 @@ struct XMLReadState : public XMLReader {
/* Attribute Reading */
static bool xml_read_bool(bool *value, pugi::xml_node node, const char *name)
{
pugi::xml_attribute attr = node.attribute(name);
if(attr) {
*value = (string_iequals(attr.value(), "true")) || (atoi(attr.value()) != 0);
return true;
}
return false;
}
static bool xml_read_int(int *value, pugi::xml_node node, const char *name)
{
pugi::xml_attribute attr = node.attribute(name);
@@ -193,18 +181,6 @@ static bool xml_read_string(string *str, pugi::xml_node node, const char *name)
return false;
}
static bool xml_read_ustring(ustring *str, pugi::xml_node node, const char *name)
{
pugi::xml_attribute attr = node.attribute(name);
if(attr) {
*str = ustring(attr.value());
return true;
}
return false;
}
static bool xml_equal_string(pugi::xml_node node, const char *name, const char *value)
{
pugi::xml_attribute attr = node.attribute(name);
@@ -215,24 +191,6 @@ static bool xml_equal_string(pugi::xml_node node, const char *name, const char *
return false;
}
static bool xml_read_enum_value(int *value, NodeEnum& enm, pugi::xml_node node, const char *name)
{
pugi::xml_attribute attr = node.attribute(name);
if(attr) {
ustring ustr(attr.value());
if(enm.exists(ustr)) {
*value = enm[ustr];
return true;
}
else
fprintf(stderr, "Unknown value \"%s\" for attribute \"%s\".\n", ustr.c_str(), name);
}
return false;
}
/* Camera */
static void xml_read_camera(XMLReadState& state, pugi::xml_node node)
@@ -267,47 +225,74 @@ static void xml_read_shader_graph(XMLReadState& state, Shader *shader, pugi::xml
{
xml_read_node(state, shader, graph_node);
ShaderManager *manager = state.scene->shader_manager;
ShaderGraph *graph = new ShaderGraph();
map<string, ShaderNode*> nodemap;
nodemap["output"] = graph->output();
/* local state, shader nodes can't link to nodes outside the shader graph */
XMLReader graph_reader;
graph_reader.node_map[ustring("output")] = graph->output();
for(pugi::xml_node node = graph_node.first_child(); node; node = node.next_sibling()) {
ustring node_name(node.name());
if(node_name == "connect") {
/* connect nodes */
vector<string> from_tokens, to_tokens;
string_split(from_tokens, node.attribute("from").value());
string_split(to_tokens, node.attribute("to").value());
if(from_tokens.size() == 2 && to_tokens.size() == 2) {
ustring from_node_name(from_tokens[0]);
ustring from_socket_name(from_tokens[1]);
ustring to_node_name(to_tokens[0]);
ustring to_socket_name(to_tokens[1]);
/* find nodes and sockets */
ShaderOutput *output = NULL;
ShaderInput *input = NULL;
if(graph_reader.node_map.find(from_node_name) != graph_reader.node_map.end()) {
ShaderNode *fromnode = (ShaderNode*)graph_reader.node_map[from_node_name];
foreach(ShaderOutput *out, fromnode->outputs)
if(string_iequals(xml_socket_name(out->name().c_str()), from_socket_name.c_str()))
output = out;
if(!output)
fprintf(stderr, "Unknown output socket name \"%s\" on \"%s\".\n", from_node_name.c_str(), from_socket_name.c_str());
}
else
fprintf(stderr, "Unknown shader node name \"%s\".\n", from_node_name.c_str());
if(graph_reader.node_map.find(to_node_name) != graph_reader.node_map.end()) {
ShaderNode *tonode = (ShaderNode*)graph_reader.node_map[to_node_name];
foreach(ShaderInput *in, tonode->inputs)
if(string_iequals(xml_socket_name(in->name().c_str()), to_socket_name.c_str()))
input = in;
if(!input)
fprintf(stderr, "Unknown input socket name \"%s\" on \"%s\".\n", to_socket_name.c_str(), to_node_name.c_str());
}
else
fprintf(stderr, "Unknown shader node name \"%s\".\n", to_node_name.c_str());
/* connect */
if(output && input)
graph->connect(output, input);
}
else
fprintf(stderr, "Invalid from or to value for connect node.\n");
continue;
}
ShaderNode *snode = NULL;
/* ToDo: Add missing nodes
* RGBCurvesNode, VectorCurvesNode, RGBRampNode and ConvertNode (RGB -> BW).
*/
if(string_iequals(node.name(), "image_texture")) {
ImageTextureNode *img = new ImageTextureNode();
xml_read_string(&img->filename, node, "src");
img->filename = path_join(state.base, img->filename);
xml_read_enum_value((int*)&img->color_space, ImageTextureNode::color_space_enum, node, "color_space");
xml_read_enum_value((int*)&img->projection, ImageTextureNode::projection_enum, node, "projection");
xml_read_float(&img->projection_blend, node, "projection_blend");
/* ToDo: Interpolation */
snode = img;
}
else if(string_iequals(node.name(), "environment_texture")) {
EnvironmentTextureNode *env = new EnvironmentTextureNode();
xml_read_string(&env->filename, node, "src");
env->filename = path_join(state.base, env->filename);
xml_read_enum_value((int*)&env->color_space, EnvironmentTextureNode::color_space_enum, node, "color_space");
xml_read_enum_value((int*)&env->projection, EnvironmentTextureNode::projection_enum, node, "projection");
snode = env;
}
#ifdef WITH_OSL
else if(string_iequals(node.name(), "osl_shader")) {
if(node_name == "osl_shader") {
ShaderManager *manager = state.scene->shader_manager;
if(manager->use_osl()) {
std::string filepath;
@@ -320,390 +305,54 @@ static void xml_read_shader_graph(XMLReadState& state, Shader *shader, pugi::xml
if(!snode) {
fprintf(stderr, "Failed to create OSL node from \"%s\".\n", filepath.c_str());
continue;
}
}
else {
fprintf(stderr, "OSL node missing \"src\" attribute.\n");
continue;
}
}
else {
fprintf(stderr, "OSL node without using --shadingsys osl.\n");
continue;
}
}
else
#endif
else if(string_iequals(node.name(), "sky_texture")) {
SkyTextureNode *sky = new SkyTextureNode();
{
/* exception for name collision */
if(node_name == "background")
node_name = "background_shader";
xml_read_enum_value((int*)&sky->type, SkyTextureNode::type_enum, node, "type");
xml_read_float3(&sky->sun_direction, node, "sun_direction");
xml_read_float(&sky->turbidity, node, "turbidity");
xml_read_float(&sky->ground_albedo, node, "ground_albedo");
const NodeType *node_type = NodeType::find(node_name);
snode = sky;
}
else if(string_iequals(node.name(), "noise_texture")) {
snode = new NoiseTextureNode();
}
else if(string_iequals(node.name(), "checker_texture")) {
snode = new CheckerTextureNode();
}
else if(string_iequals(node.name(), "brick_texture")) {
BrickTextureNode *brick = new BrickTextureNode();
xml_read_float(&brick->offset, node, "offset");
xml_read_int(&brick->offset_frequency, node, "offset_frequency");
xml_read_float(&brick->squash, node, "squash");
xml_read_int(&brick->squash_frequency, node, "squash_frequency");
snode = brick;
}
else if(string_iequals(node.name(), "gradient_texture")) {
GradientTextureNode *blend = new GradientTextureNode();
xml_read_enum_value((int*)&blend->type, GradientTextureNode::type_enum, node, "type");
snode = blend;
}
else if(string_iequals(node.name(), "voronoi_texture")) {
VoronoiTextureNode *voronoi = new VoronoiTextureNode();
xml_read_enum_value((int*)&voronoi->coloring, VoronoiTextureNode::coloring_enum, node, "coloring");
snode = voronoi;
}
else if(string_iequals(node.name(), "musgrave_texture")) {
MusgraveTextureNode *musgrave = new MusgraveTextureNode();
xml_read_enum_value((int*)&musgrave->type, MusgraveTextureNode::type_enum, node, "type");
snode = musgrave;
}
else if(string_iequals(node.name(), "magic_texture")) {
MagicTextureNode *magic = new MagicTextureNode();
xml_read_int(&magic->depth, node, "depth");
snode = magic;
}
else if(string_iequals(node.name(), "wave_texture")) {
WaveTextureNode *wave = new WaveTextureNode();
xml_read_enum_value((int*)&wave->type, WaveTextureNode::type_enum, node, "type");
xml_read_enum_value((int*)&wave->profile, WaveTextureNode::profile_enum, node, "profile");
snode = wave;
}
else if(string_iequals(node.name(), "normal")) {
NormalNode *normal = new NormalNode();
xml_read_float3(&normal->direction, node, "direction");
snode = normal;
}
else if(string_iequals(node.name(), "bump")) {
BumpNode *bump = new BumpNode();
xml_read_bool(&bump->invert, node, "invert");
snode = bump;
}
else if(string_iequals(node.name(), "mapping")) {
MappingNode *map = new MappingNode();
TextureMapping *texmap = &map->tex_mapping;
xml_read_enum_value((int*) &texmap->type, TextureMapping::type_enum, node, "type");
xml_read_enum_value((int*) &texmap->projection, TextureMapping::projection_enum, node, "projection");
xml_read_enum_value((int*) &texmap->x_mapping, TextureMapping::mapping_enum, node, "x_mapping");
xml_read_enum_value((int*) &texmap->y_mapping, TextureMapping::mapping_enum, node, "y_mapping");
xml_read_enum_value((int*) &texmap->z_mapping, TextureMapping::mapping_enum, node, "z_mapping");
xml_read_bool(&texmap->use_minmax, node, "use_minmax");
if(texmap->use_minmax) {
xml_read_float3(&texmap->min, node, "min");
xml_read_float3(&texmap->max, node, "max");
}
xml_read_float3(&texmap->translation, node, "translation");
xml_read_float3(&texmap->rotation, node, "rotation");
xml_read_float3(&texmap->scale, node, "scale");
snode = map;
}
else if(string_iequals(node.name(), "anisotropic_bsdf")) {
AnisotropicBsdfNode *aniso = new AnisotropicBsdfNode();
xml_read_enum_value((int*)&aniso->distribution, AnisotropicBsdfNode::distribution_enum, node, "distribution");
snode = aniso;
}
else if(string_iequals(node.name(), "diffuse_bsdf")) {
snode = new DiffuseBsdfNode();
}
else if(string_iequals(node.name(), "translucent_bsdf")) {
snode = new TranslucentBsdfNode();
}
else if(string_iequals(node.name(), "transparent_bsdf")) {
snode = new TransparentBsdfNode();
}
else if(string_iequals(node.name(), "velvet_bsdf")) {
snode = new VelvetBsdfNode();
}
else if(string_iequals(node.name(), "toon_bsdf")) {
ToonBsdfNode *toon = new ToonBsdfNode();
xml_read_enum_value((int*)&toon->component, ToonBsdfNode::component_enum, node, "component");
snode = toon;
}
else if(string_iequals(node.name(), "glossy_bsdf")) {
GlossyBsdfNode *glossy = new GlossyBsdfNode();
xml_read_enum_value((int*)&glossy->distribution, GlossyBsdfNode::distribution_enum, node, "distribution");
snode = glossy;
}
else if(string_iequals(node.name(), "glass_bsdf")) {
GlassBsdfNode *diel = new GlassBsdfNode();
xml_read_enum_value((int*)&diel->distribution, GlassBsdfNode::distribution_enum, node, "distribution");
snode = diel;
}
else if(string_iequals(node.name(), "refraction_bsdf")) {
RefractionBsdfNode *diel = new RefractionBsdfNode();
xml_read_enum_value((int*)&diel->distribution, RefractionBsdfNode::distribution_enum, node, "distribution");
snode = diel;
}
else if(string_iequals(node.name(), "hair_bsdf")) {
HairBsdfNode *hair = new HairBsdfNode();
xml_read_enum_value((int*)&hair->component, HairBsdfNode::component_enum, node, "component");
snode = hair;
}
else if(string_iequals(node.name(), "emission")) {
snode = new EmissionNode();
}
else if(string_iequals(node.name(), "ambient_occlusion")) {
snode = new AmbientOcclusionNode();
}
else if(string_iequals(node.name(), "background")) {
snode = new BackgroundNode();
}
else if(string_iequals(node.name(), "holdout")) {
snode = new HoldoutNode();
}
else if(string_iequals(node.name(), "absorption_volume")) {
snode = new AbsorptionVolumeNode();
}
else if(string_iequals(node.name(), "scatter_volume")) {
snode = new ScatterVolumeNode();
}
else if(string_iequals(node.name(), "subsurface_scattering")) {
SubsurfaceScatteringNode *sss = new SubsurfaceScatteringNode();
string falloff;
xml_read_string(&falloff, node, "falloff");
if(falloff == "cubic")
sss->closure = CLOSURE_BSSRDF_CUBIC_ID;
else if(falloff == "gaussian")
sss->closure = CLOSURE_BSSRDF_GAUSSIAN_ID;
else /*if(falloff == "burley")*/
sss->closure = CLOSURE_BSSRDF_BURLEY_ID;
snode = sss;
}
else if(string_iequals(node.name(), "geometry")) {
snode = new GeometryNode();
}
else if(string_iequals(node.name(), "texture_coordinate")) {
snode = new TextureCoordinateNode();
}
else if(string_iequals(node.name(), "light_path")) {
snode = new LightPathNode();
}
else if(string_iequals(node.name(), "light_falloff")) {
snode = new LightFalloffNode();
}
else if(string_iequals(node.name(), "object_info")) {
snode = new ObjectInfoNode();
}
else if(string_iequals(node.name(), "particle_info")) {
snode = new ParticleInfoNode();
}
else if(string_iequals(node.name(), "hair_info")) {
snode = new HairInfoNode();
}
else if(string_iequals(node.name(), "value")) {
ValueNode *value = new ValueNode();
xml_read_float(&value->value, node, "value");
snode = value;
}
else if(string_iequals(node.name(), "color")) {
ColorNode *color = new ColorNode();
xml_read_float3(&color->value, node, "value");
snode = color;
}
else if(string_iequals(node.name(), "mix_closure")) {
snode = new MixClosureNode();
}
else if(string_iequals(node.name(), "add_closure")) {
snode = new AddClosureNode();
}
else if(string_iequals(node.name(), "invert")) {
snode = new InvertNode();
}
else if(string_iequals(node.name(), "mix")) {
/* ToDo: Tag Mix case for optimization */
MixNode *mix = new MixNode();
xml_read_enum_value((int*)&mix->type, MixNode::type_enum, node, "type");
xml_read_bool(&mix->use_clamp, node, "use_clamp");
snode = mix;
}
else if(string_iequals(node.name(), "gamma")) {
snode = new GammaNode();
}
else if(string_iequals(node.name(), "brightness")) {
snode = new BrightContrastNode();
}
else if(string_iequals(node.name(), "combine_rgb")) {
snode = new CombineRGBNode();
}
else if(string_iequals(node.name(), "separate_rgb")) {
snode = new SeparateRGBNode();
}
else if(string_iequals(node.name(), "combine_hsv")) {
snode = new CombineHSVNode();
}
else if(string_iequals(node.name(), "separate_hsv")) {
snode = new SeparateHSVNode();
}
else if(string_iequals(node.name(), "combine_xyz")) {
snode = new CombineXYZNode();
}
else if(string_iequals(node.name(), "separate_xyz")) {
snode = new SeparateXYZNode();
}
else if(string_iequals(node.name(), "hsv")) {
snode = new HSVNode();
}
else if(string_iequals(node.name(), "wavelength")) {
snode = new WavelengthNode();
}
else if(string_iequals(node.name(), "blackbody")) {
snode = new BlackbodyNode();
}
else if(string_iequals(node.name(), "attribute")) {
AttributeNode *attr = new AttributeNode();
xml_read_ustring(&attr->attribute, node, "attribute");
snode = attr;
}
else if(string_iequals(node.name(), "uv_map")) {
UVMapNode *uvm = new UVMapNode();
xml_read_ustring(&uvm->attribute, node, "uv_map");
snode = uvm;
}
else if(string_iequals(node.name(), "camera")) {
snode = new CameraNode();
}
else if(string_iequals(node.name(), "fresnel")) {
snode = new FresnelNode();
}
else if(string_iequals(node.name(), "layer_weight")) {
snode = new LayerWeightNode();
}
else if(string_iequals(node.name(), "wireframe")) {
WireframeNode *wire = new WireframeNode;
xml_read_bool(&wire->use_pixel_size, node, "use_pixel_size");
snode = wire;
}
else if(string_iequals(node.name(), "normal_map")) {
NormalMapNode *nmap = new NormalMapNode;
xml_read_ustring(&nmap->attribute, node, "attribute");
xml_read_enum_value((int*)&nmap->space, NormalMapNode::space_enum, node, "space");
snode = nmap;
}
else if(string_iequals(node.name(), "tangent")) {
TangentNode *tangent = new TangentNode;
xml_read_ustring(&tangent->attribute, node, "attribute");
xml_read_enum_value((int*)&tangent->direction_type, TangentNode::direction_type_enum, node, "direction_type");
xml_read_enum_value((int*)&tangent->axis, TangentNode::axis_enum, node, "axis");
snode = tangent;
}
else if(string_iequals(node.name(), "math")) {
MathNode *math = new MathNode();
xml_read_enum_value((int*)&math->type, MathNode::type_enum, node, "type");
xml_read_bool(&math->use_clamp, node, "use_clamp");
snode = math;
}
else if(string_iequals(node.name(), "vector_math")) {
VectorMathNode *vmath = new VectorMathNode();
xml_read_enum_value((int*)&vmath->type, VectorMathNode::type_enum, node, "type");
snode = vmath;
}
else if(string_iequals(node.name(), "vector_transform")) {
VectorTransformNode *vtransform = new VectorTransformNode();
xml_read_enum_value((int*)&vtransform->type, VectorTransformNode::type_enum, node, "type");
xml_read_enum_value((int*)&vtransform->convert_from, VectorTransformNode::convert_space_enum, node, "convert_from");
xml_read_enum_value((int*)&vtransform->convert_to, VectorTransformNode::convert_space_enum, node, "convert_to");
snode = vtransform;
}
else if(string_iequals(node.name(), "connect")) {
/* connect nodes */
vector<string> from_tokens, to_tokens;
string_split(from_tokens, node.attribute("from").value());
string_split(to_tokens, node.attribute("to").value());
if(from_tokens.size() == 2 && to_tokens.size() == 2) {
/* find nodes and sockets */
ShaderOutput *output = NULL;
ShaderInput *input = NULL;
if(nodemap.find(from_tokens[0]) != nodemap.end()) {
ShaderNode *fromnode = nodemap[from_tokens[0]];
foreach(ShaderOutput *out, fromnode->outputs)
if(string_iequals(xml_socket_name(out->name().c_str()), from_tokens[1]))
output = out;
if(!output)
fprintf(stderr, "Unknown output socket name \"%s\" on \"%s\".\n", from_tokens[1].c_str(), from_tokens[0].c_str());
}
else
fprintf(stderr, "Unknown shader node name \"%s\".\n", from_tokens[0].c_str());
if(nodemap.find(to_tokens[0]) != nodemap.end()) {
ShaderNode *tonode = nodemap[to_tokens[0]];
foreach(ShaderInput *in, tonode->inputs)
if(string_iequals(xml_socket_name(in->name().c_str()), to_tokens[1]))
input = in;
if(!input)
fprintf(stderr, "Unknown input socket name \"%s\" on \"%s\".\n", to_tokens[1].c_str(), to_tokens[0].c_str());
}
else
fprintf(stderr, "Unknown shader node name \"%s\".\n", to_tokens[0].c_str());
/* connect */
if(output && input)
graph->connect(output, input);
}
else
fprintf(stderr, "Invalid from or to value for connect node.\n");
}
else
if(!node_type) {
fprintf(stderr, "Unknown shader node \"%s\".\n", node.name());
continue;
}
else if(node_type->type != NodeType::SHADER) {
fprintf(stderr, "Node type \"%s\" is not a shader node.\n", node_type->name.c_str());
continue;
}
snode = (ShaderNode*) node_type->create(node_type);
}
xml_read_node(graph_reader, snode, node);
if(node_name == "image_texture") {
ImageTextureNode *img = (ImageTextureNode*) snode;
img->filename = path_join(state.base, img->filename.string());
}
else if(node_name == "environment_texture") {
EnvironmentTextureNode *env = (EnvironmentTextureNode*) snode;
env->filename = path_join(state.base, env->filename.string());
}
if(snode) {
/* add to graph */
graph->add(snode);
/* add to map for name lookups */
string name = "";
xml_read_string(&name, node, "name");
nodemap[name] = snode;
/* read input values */
for(pugi::xml_attribute attr = node.first_attribute(); attr; attr = attr.next_attribute()) {
foreach(ShaderInput *in, snode->inputs) {
if(string_iequals(in->name().c_str(), attr.name())) {
switch(in->type()) {
case SocketType::FLOAT:
case SocketType::INT:
xml_read_float(&in->value_float(), node, attr.name());
break;
case SocketType::COLOR:
case SocketType::VECTOR:
case SocketType::POINT:
case SocketType::NORMAL:
xml_read_float3(&in->value(), node, attr.name());
break;
case SocketType::STRING:
xml_read_ustring( &in->value_string(), node, attr.name() );
break;
default:
break;
}
}
}
}
}
}

View File

@@ -153,28 +153,31 @@ static void set_default_value(ShaderInput *input,
BL::BlendData& b_data,
BL::ID& b_id)
{
Node *node = input->parent;
const SocketType& socket = input->socket_type;
/* copy values for non linked inputs */
switch(input->type()) {
case SocketType::FLOAT: {
input->set(get_float(b_sock.ptr, "default_value"));
node->set(socket, get_float(b_sock.ptr, "default_value"));
break;
}
case SocketType::INT: {
input->set(get_int(b_sock.ptr, "default_value"));
node->set(socket, get_int(b_sock.ptr, "default_value"));
break;
}
case SocketType::COLOR: {
input->set(float4_to_float3(get_float4(b_sock.ptr, "default_value")));
node->set(socket, float4_to_float3(get_float4(b_sock.ptr, "default_value")));
break;
}
case SocketType::NORMAL:
case SocketType::POINT:
case SocketType::VECTOR: {
input->set(get_float3(b_sock.ptr, "default_value"));
node->set(socket, get_float3(b_sock.ptr, "default_value"));
break;
}
case SocketType::STRING: {
input->set((ustring)blender_absolute_path(b_data, b_id, get_string(b_sock.ptr, "default_value")));
node->set(socket, (ustring)blender_absolute_path(b_data, b_id, get_string(b_sock.ptr, "default_value")));
break;
}
default:
@@ -616,7 +619,7 @@ static ShaderNode *add_node(Scene *scene,
/* TODO(sergey): Does not work properly when we change builtin type. */
if(b_image.is_updated()) {
scene->image_manager->tag_reload_image(
image->filename,
image->filename.string(),
image->builtin_data,
get_image_interpolation(b_image_node),
get_image_extension(b_image_node));
@@ -662,7 +665,7 @@ static ShaderNode *add_node(Scene *scene,
/* TODO(sergey): Does not work properly when we change builtin type. */
if(b_image.is_updated()) {
scene->image_manager->tag_reload_image(
env->filename,
env->filename.string(),
env->builtin_data,
get_image_interpolation(b_env_node),
EXTENSION_REPEAT);
@@ -799,7 +802,7 @@ static ShaderNode *add_node(Scene *scene,
if(true) {
b_point_density_node.cache_point_density(b_scene, settings);
scene->image_manager->tag_reload_image(
point_density->filename,
point_density->filename.string(),
point_density->builtin_data,
point_density->interpolation,
EXTENSION_CLIP);
@@ -1153,13 +1156,12 @@ void BlenderSync::sync_materials(bool update_all)
add_nodes(scene, b_engine, b_data, b_scene, !preview, graph, b_ntree);
}
else {
ShaderNode *closure, *out;
DiffuseBsdfNode *diffuse = new DiffuseBsdfNode();
diffuse->color = get_float3(b_mat->diffuse_color());
graph->add(diffuse);
closure = graph->add(new DiffuseBsdfNode());
closure->input("Color")->set(get_float3(b_mat->diffuse_color()));
out = graph->output();
graph->connect(closure->output("BSDF"), out->input("Surface"));
ShaderNode *out = graph->output();
graph->connect(diffuse->output("BSDF"), out->input("Surface"));
}
/* settings */
@@ -1202,13 +1204,12 @@ void BlenderSync::sync_world(bool update_all)
shader->volume_interpolation_method = get_volume_interpolation(cworld);
}
else if(b_world) {
ShaderNode *closure, *out;
BackgroundNode *background = new BackgroundNode();
background->color = get_float3(b_world.horizon_color());
graph->add(background);
closure = graph->add(new BackgroundNode());
closure->input("Color")->set(get_float3(b_world.horizon_color()));
out = graph->output();
graph->connect(closure->output("Background"), out->input("Surface"));
ShaderNode *out = graph->output();
graph->connect(background->output("Background"), out->input("Surface"));
}
if(b_world) {
@@ -1287,7 +1288,6 @@ void BlenderSync::sync_lamps(bool update_all)
add_nodes(scene, b_engine, b_data, b_scene, !preview, graph, b_ntree);
}
else {
ShaderNode *closure, *out;
float strength = 1.0f;
if(b_lamp->type() == BL::Lamp::type_POINT ||
@@ -1297,12 +1297,13 @@ void BlenderSync::sync_lamps(bool update_all)
strength = 100.0f;
}
closure = graph->add(new EmissionNode());
closure->input("Color")->set(get_float3(b_lamp->color()));
closure->input("Strength")->set(strength);
out = graph->output();
EmissionNode *emission = new EmissionNode();
emission->color = get_float3(b_lamp->color());
emission->strength = strength;
graph->add(emission);
graph->connect(closure->output("Emission"), out->input("Surface"));
ShaderNode *out = graph->output();
graph->connect(emission->output("Emission"), out->input("Surface"));
}
shader->set_graph(graph);

View File

@@ -230,6 +230,7 @@ void BVHBuild::add_references(BVHRange& root)
foreach(Object *ob, objects) {
if(params.top_level) {
if(!ob->is_traceable()) {
++i;
continue;
}
if(!ob->mesh->is_instanced())

View File

@@ -82,6 +82,12 @@ void Node::set(const SocketType& input, int value)
get_socket_value<int>(this, input) = value;
}
void Node::set(const SocketType& input, uint value)
{
assert(input.type == SocketType::UINT);
get_socket_value<uint>(this, input) = value;
}
void Node::set(const SocketType& input, float value)
{
assert(input.type == SocketType::FLOAT);
@@ -198,6 +204,12 @@ int Node::get_int(const SocketType& input) const
return get_socket_value<int>(this, input);
}
uint Node::get_uint(const SocketType& input) const
{
assert(input.type == SocketType::UINT);
return get_socket_value<uint>(this, input);
}
float Node::get_float(const SocketType& input) const
{
assert(input.type == SocketType::FLOAT);

View File

@@ -38,6 +38,7 @@ struct Node
/* set values */
void set(const SocketType& input, bool value);
void set(const SocketType& input, int value);
void set(const SocketType& input, uint value);
void set(const SocketType& input, float value);
void set(const SocketType& input, float2 value);
void set(const SocketType& input, float3 value);
@@ -60,6 +61,7 @@ struct Node
/* get values */
bool get_bool(const SocketType& input) const;
int get_int(const SocketType& input) const;
uint get_uint(const SocketType& input) const;
float get_float(const SocketType& input) const;
float2 get_float2(const SocketType& input) const;
float3 get_float3(const SocketType& input) const;

View File

@@ -41,6 +41,7 @@ size_t SocketType::size(Type type)
case BOOLEAN: return sizeof(bool);
case FLOAT: return sizeof(float);
case INT: return sizeof(int);
case UINT: return sizeof(uint);
case COLOR: return sizeof(float3);
case VECTOR: return sizeof(float3);
case POINT: return sizeof(float3);

View File

@@ -39,6 +39,7 @@ struct SocketType
BOOLEAN,
FLOAT,
INT,
UINT,
COLOR,
VECTOR,
POINT,
@@ -154,7 +155,7 @@ const NodeType *structname::register_type()
#define SOCKET_DEFINE(name, ui_name, default_value, datatype, TYPE, flags, ...) \
{ \
static datatype defval = default_value; \
assert(SOCKET_SIZEOF(T, name) == sizeof(datatype)); \
CHECK_TYPE(((T *)1)->name, datatype); \
type->register_input(ustring(#name), ustring(ui_name), TYPE, SOCKET_OFFSETOF(T, name), &defval, NULL, NULL, flags, ##__VA_ARGS__); \
}
@@ -162,6 +163,8 @@ const NodeType *structname::register_type()
SOCKET_DEFINE(name, ui_name, default_value, bool, SocketType::BOOLEAN, 0, ##__VA_ARGS__)
#define SOCKET_INT(name, ui_name, default_value, ...) \
SOCKET_DEFINE(name, ui_name, default_value, int, SocketType::INT, 0, ##__VA_ARGS__)
#define SOCKET_UINT(name, ui_name, default_value, ...) \
SOCKET_DEFINE(name, ui_name, default_value, uint, SocketType::UINT, 0, ##__VA_ARGS__)
#define SOCKET_FLOAT(name, ui_name, default_value, ...) \
SOCKET_DEFINE(name, ui_name, default_value, float, SocketType::FLOAT, 0, ##__VA_ARGS__)
#define SOCKET_COLOR(name, ui_name, default_value, ...) \

View File

@@ -108,6 +108,11 @@ void xml_read_node(XMLReader& reader, Node *node, pugi::xml_node xml_node)
node->set(socket, (int)atoi(attr.value()));
break;
}
case SocketType::UINT:
{
node->set(socket, (uint)atoi(attr.value()));
break;
}
case SocketType::INT_ARRAY:
{
vector<string> tokens;
@@ -310,6 +315,11 @@ pugi::xml_node xml_write_node(Node *node, pugi::xml_node xml_root)
attr = node->get_int(socket);
break;
}
case SocketType::UINT:
{
attr = node->get_uint(socket);
break;
}
case SocketType::INT_ARRAY:
{
std::stringstream ss;

View File

@@ -276,7 +276,7 @@ ccl_device float3 bsdf_microfacet_ggx_eval_reflect(const ShaderClosure *sc, cons
bool m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
float3 N = sc->N;
if(m_refractive || fmaxf(alpha_x, alpha_y) <= 1e-4f)
if(m_refractive || alpha_x*alpha_y <= 1e-7f)
return make_float3(0.0f, 0.0f, 0.0f);
float cosNO = dot(N, I);
@@ -367,7 +367,7 @@ ccl_device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderClosure *sc, con
bool m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
float3 N = sc->N;
if(!m_refractive || fmaxf(alpha_x, alpha_y) <= 1e-4f)
if(!m_refractive || alpha_x*alpha_y <= 1e-7f)
return make_float3(0.0f, 0.0f, 0.0f);
float cosNO = dot(N, I);
@@ -450,7 +450,7 @@ ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals *kg, const ShaderClosure
*omega_in = 2 * cosMO * m - I;
if(dot(Ng, *omega_in) > 0) {
if(fmaxf(alpha_x, alpha_y) <= 1e-4f) {
if(alpha_x*alpha_y <= 1e-7f) {
/* some high number for MIS */
*pdf = 1e6f;
*eval = make_float3(1e6f, 1e6f, 1e6f);
@@ -539,7 +539,7 @@ ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals *kg, const ShaderClosure
*domega_in_dy = dTdy;
#endif
if(fmaxf(alpha_x, alpha_y) <= 1e-4f || fabsf(m_eta - 1.0f) < 1e-4f) {
if(alpha_x*alpha_y <= 1e-7f || fabsf(m_eta - 1.0f) < 1e-4f) {
/* some high number for MIS */
*pdf = 1e6f;
*eval = make_float3(1e6f, 1e6f, 1e6f);
@@ -622,7 +622,7 @@ ccl_device float3 bsdf_microfacet_beckmann_eval_reflect(const ShaderClosure *sc,
bool m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
float3 N = sc->N;
if(m_refractive || fmaxf(alpha_x, alpha_y) <= 1e-4f)
if(m_refractive || alpha_x*alpha_y <= 1e-7f)
return make_float3(0.0f, 0.0f, 0.0f);
float cosNO = dot(N, I);
@@ -716,7 +716,7 @@ ccl_device float3 bsdf_microfacet_beckmann_eval_transmit(const ShaderClosure *sc
bool m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
float3 N = sc->N;
if(!m_refractive || fmaxf(alpha_x, alpha_y) <= 1e-4f)
if(!m_refractive || alpha_x*alpha_y <= 1e-7f)
return make_float3(0.0f, 0.0f, 0.0f);
float cosNO = dot(N, I);
@@ -798,7 +798,7 @@ ccl_device int bsdf_microfacet_beckmann_sample(KernelGlobals *kg, const ShaderCl
*omega_in = 2 * cosMO * m - I;
if(dot(Ng, *omega_in) > 0) {
if(fmaxf(alpha_x, alpha_y) <= 1e-4f) {
if(alpha_x*alpha_y <= 1e-7f) {
/* some high number for MIS */
*pdf = 1e6f;
*eval = make_float3(1e6f, 1e6f, 1e6f);
@@ -889,7 +889,7 @@ ccl_device int bsdf_microfacet_beckmann_sample(KernelGlobals *kg, const ShaderCl
*domega_in_dy = dTdy;
#endif
if(fmaxf(alpha_x, alpha_y) <= 1e-4f || fabsf(m_eta - 1.0f) < 1e-4f) {
if(alpha_x*alpha_y <= 1e-7f || fabsf(m_eta - 1.0f) < 1e-4f) {
/* some high number for MIS */
*pdf = 1e6f;
*eval = make_float3(1e6f, 1e6f, 1e6f);

View File

@@ -292,7 +292,6 @@ enum PathRayFlag {
PATH_RAY_CURVE = 512, /* visibility flag to define curve segments */
PATH_RAY_VOLUME_SCATTER = 1024, /* volume scattering */
/* note that these can use maximum 12 bits, the other are for layers */
PATH_RAY_ALL_VISIBILITY = (1|2|4|8|16|32|64|128|256|512|1024),
PATH_RAY_MIS_SKIP = 2048,

View File

@@ -276,7 +276,7 @@ ccl_device float kernel_volume_distance_sample(float max_t, float3 sigma_t, int
float sample_t = min(max_t, -logf(1.0f - xi*(1.0f - sample_transmittance))/sample_sigma_t);
*transmittance = volume_color_transmittance(sigma_t, sample_t);
*pdf = (sigma_t * *transmittance)/(make_float3(1.0f, 1.0f, 1.0f) - full_transmittance);
*pdf = safe_divide_color(sigma_t * *transmittance, make_float3(1.0f, 1.0f, 1.0f) - full_transmittance);
/* todo: optimization: when taken together with hit/miss decision,
* the full_transmittance cancels out drops out and xi does not
@@ -290,7 +290,7 @@ ccl_device float3 kernel_volume_distance_pdf(float max_t, float3 sigma_t, float
float3 full_transmittance = volume_color_transmittance(sigma_t, max_t);
float3 transmittance = volume_color_transmittance(sigma_t, sample_t);
return (sigma_t * transmittance)/(make_float3(1.0f, 1.0f, 1.0f) - full_transmittance);
return safe_divide_color(sigma_t * transmittance, make_float3(1.0f, 1.0f, 1.0f) - full_transmittance);
}
/* Emission */
@@ -625,11 +625,13 @@ ccl_device void kernel_volume_decoupled_record(KernelGlobals *kg, PathState *sta
const int global_max_steps = kernel_data.integrator.volume_max_steps;
step_size = kernel_data.integrator.volume_step_size;
/* compute exact steps in advance for malloc */
max_steps = max((int)ceilf(ray->t/step_size), 1);
if(max_steps > global_max_steps) {
if(ray->t > global_max_steps*step_size) {
max_steps = global_max_steps;
step_size = ray->t / (float)max_steps;
}
else {
max_steps = max((int)ceilf(ray->t/step_size), 1);
}
#ifdef __KERNEL_CPU__
/* NOTE: For the branched path tracing it's possible to have direct
* and indirect light integration both having volume segments allocated.

View File

@@ -45,9 +45,9 @@ shader node_anisotropic_bsdf(
RoughnessV = Roughness / (1.0 - aniso);
}
if (distribution == "Sharp")
if (distribution == "sharp")
BSDF = Color * reflection(Normal);
else if (distribution == "Beckmann")
else if (distribution == "beckmann")
BSDF = Color * microfacet_beckmann_aniso(Normal, T, RoughnessU, RoughnessV);
else if (distribution == "GGX")
BSDF = Color * microfacet_ggx_aniso(Normal, T, RoughnessU, RoughnessV);

View File

@@ -44,7 +44,7 @@ shader node_environment_texture(
matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
vector Vector = P,
string filename = "",
string projection = "Equirectangular",
string projection = "equirectangular",
string interpolation = "linear",
string color_space = "sRGB",
int is_float = 1,
@@ -59,7 +59,7 @@ shader node_environment_texture(
p = normalize(p);
if (projection == "Equirectangular")
if (projection == "equirectangular")
p = environment_texture_direction_to_equirectangular(p);
else
p = environment_texture_direction_to_mirrorball(p);

View File

@@ -19,7 +19,7 @@
shader node_glass_bsdf(
color Color = 0.8,
string distribution = "Sharp",
string distribution = "sharp",
float Roughness = 0.2,
float IOR = 1.45,
normal Normal = N,
@@ -30,9 +30,9 @@ shader node_glass_bsdf(
float cosi = dot(I, Normal);
float Fr = fresnel_dielectric_cos(cosi, eta);
if (distribution == "Sharp")
if (distribution == "sharp")
BSDF = Color * (Fr * reflection(Normal) + (1.0 - Fr) * refraction(Normal, eta));
else if (distribution == "Beckmann")
else if (distribution == "beckmann")
BSDF = Color * (Fr * microfacet_beckmann(Normal, Roughness) +
(1.0 - Fr) * microfacet_beckmann_refraction(Normal, Roughness, eta));
else if (distribution == "GGX")

View File

@@ -24,9 +24,9 @@ shader node_glossy_bsdf(
normal Normal = N,
output closure color BSDF = 0)
{
if (distribution == "Sharp")
if (distribution == "sharp")
BSDF = Color * reflection(Normal);
else if (distribution == "Beckmann")
else if (distribution == "beckmann")
BSDF = Color * microfacet_beckmann(Normal, Roughness);
else if (distribution == "GGX")
BSDF = Color * microfacet_ggx(Normal, Roughness);

View File

@@ -29,31 +29,31 @@ float gradient(point p, string type)
float result = 0.0;
if (type == "Linear") {
if (type == "linear") {
result = x;
}
else if (type == "Quadratic") {
else if (type == "quadratic") {
float r = max(x, 0.0);
result = r * r;
}
else if (type == "Easing") {
else if (type == "easing") {
float r = min(max(x, 0.0), 1.0);
float t = r * r;
result = (3.0 * t - 2.0 * t * r);
}
else if (type == "Diagonal") {
else if (type == "diagonal") {
result = (x + y) * 0.5;
}
else if (type == "Radial") {
else if (type == "radial") {
result = atan2(y, x) / M_2PI + 0.5;
}
else {
float r = max(1.0 - sqrt(x * x + y * y + z * z), 0.0);
if (type == "Quadratic Sphere")
if (type == "quadratic_sphere")
result = r * r;
else if (type == "Spherical")
else if (type == "spherical")
result = r;
}
@@ -63,7 +63,7 @@ float gradient(point p, string type)
shader node_gradient_texture(
int use_mapping = 0,
matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
string type = "Linear",
string type = "linear",
point Vector = P,
output float Fac = 0.0,
output color Color = 0.0)

View File

@@ -20,7 +20,7 @@
shader node_hair_bsdf(
color Color = 0.8,
string component = "Reflection",
string component = "reflection",
float Offset = 0.0,
float RoughnessU = 0.1,
float RoughnessV = 1.0,
@@ -37,7 +37,7 @@ shader node_hair_bsdf(
BSDF = transparent();
}
else {
if (component == "Reflection")
if (component == "reflection")
BSDF = Color * hair_reflection(Normal, roughnessh, roughnessv, normalize(dPdv), 0.0);
else
BSDF = Color * hair_transmission(Normal, roughnessh, roughnessv, normalize(dPdv), 0.0);
@@ -48,7 +48,7 @@ shader node_hair_bsdf(
BSDF = transparent();
}
else {
if (component == "Reflection")
if (component == "reflection")
BSDF = Color * hair_reflection(Normal, roughnessh, roughnessv, dPdu, -Offset);
else
BSDF = Color * hair_transmission(Normal, roughnessh, roughnessv, dPdu, -Offset);

View File

@@ -86,7 +86,7 @@ shader node_image_texture(
point Vector = P,
string filename = "",
string color_space = "sRGB",
string projection = "Flat",
string projection = "flat",
string interpolation = "smartcubic",
string wrap = "periodic",
float projection_blend = 0.0,
@@ -100,7 +100,7 @@ shader node_image_texture(
if (use_mapping)
p = transform(mapping, p);
if (projection == "Flat") {
if (projection == "flat") {
Color = image_texture_lookup(filename,
color_space,
p[0], p[1],
@@ -110,7 +110,7 @@ shader node_image_texture(
interpolation,
wrap);
}
else if (projection == "Box") {
else if (projection == "box") {
/* object space normal */
vector Nob = transform("world", "object", N);
@@ -210,7 +210,7 @@ shader node_image_texture(
Alpha += weight[2] * tmp_alpha;
}
}
else if (projection == "Sphere") {
else if (projection == "sphere") {
point projected = map_to_sphere(texco_remap_square(p));
Color = image_texture_lookup(filename,
color_space,
@@ -221,7 +221,7 @@ shader node_image_texture(
interpolation,
wrap);
}
else if (projection == "Tube") {
else if (projection == "tube") {
point projected = map_to_tube(texco_remap_square(p));
Color = image_texture_lookup(filename,
color_space,

View File

@@ -49,7 +49,7 @@ float safe_log(float a, float b)
}
shader node_math(
string type = "Add",
string type = "add",
int use_clamp = 0,
float Value1 = 0.0,
float Value2 = 0.0,
@@ -57,43 +57,43 @@ shader node_math(
{
/* OSL asin, acos, pow check for values that could give rise to nan */
if (type == "Add")
if (type == "add")
Value = Value1 + Value2;
else if (type == "Subtract")
else if (type == "subtract")
Value = Value1 - Value2;
else if (type == "Multiply")
else if (type == "multiply")
Value = Value1 * Value2;
else if (type == "Divide")
else if (type == "divide")
Value = safe_divide(Value1, Value2);
else if (type == "Sine")
else if (type == "sine")
Value = sin(Value1);
else if (type == "Cosine")
else if (type == "cosine")
Value = cos(Value1);
else if (type == "Tangent")
else if (type == "tangent")
Value = tan(Value1);
else if (type == "Arcsine")
else if (type == "arcsine")
Value = asin(Value1);
else if (type == "Arccosine")
else if (type == "arccosine")
Value = acos(Value1);
else if (type == "Arctangent")
else if (type == "arctangent")
Value = atan(Value1);
else if (type == "Power")
else if (type == "power")
Value = pow(Value1, Value2);
else if (type == "Logarithm")
else if (type == "logarithm")
Value = safe_log(Value1, Value2);
else if (type == "Minimum")
else if (type == "minimum")
Value = min(Value1, Value2);
else if (type == "Maximum")
else if (type == "maximum")
Value = max(Value1, Value2);
else if (type == "Round")
else if (type == "round")
Value = floor(Value1 + 0.5);
else if (type == "Less Than")
else if (type == "less_than")
Value = Value1 < Value2;
else if (type == "Greater Than")
else if (type == "greater_than")
Value = Value1 > Value2;
else if (type == "Modulo")
else if (type == "modulo")
Value = safe_modulo(Value1, Value2);
else if (type == "Absolute")
else if (type == "absolute")
Value = fabs(Value1);
if (use_clamp)

View File

@@ -277,7 +277,7 @@ color node_mix_clamp(color col)
}
shader node_mix(
string type = "Mix",
string type = "mix",
int use_clamp = 0,
float Fac = 0.5,
color Color1 = 0.0,
@@ -286,41 +286,41 @@ shader node_mix(
{
float t = clamp(Fac, 0.0, 1.0);
if (type == "Mix")
if (type == "mix")
Color = node_mix_blend(t, Color1, Color2);
if (type == "Add")
if (type == "add")
Color = node_mix_add(t, Color1, Color2);
if (type == "Multiply")
if (type == "multiply")
Color = node_mix_mul(t, Color1, Color2);
if (type == "Screen")
if (type == "screen")
Color = node_mix_screen(t, Color1, Color2);
if (type == "Overlay")
if (type == "overlay")
Color = node_mix_overlay(t, Color1, Color2);
if (type == "Subtract")
if (type == "subtract")
Color = node_mix_sub(t, Color1, Color2);
if (type == "Divide")
if (type == "divide")
Color = node_mix_div(t, Color1, Color2);
if (type == "Difference")
if (type == "difference")
Color = node_mix_diff(t, Color1, Color2);
if (type == "Darken")
if (type == "darken")
Color = node_mix_dark(t, Color1, Color2);
if (type == "Lighten")
if (type == "lighten")
Color = node_mix_light(t, Color1, Color2);
if (type == "Dodge")
if (type == "dodge")
Color = node_mix_dodge(t, Color1, Color2);
if (type == "Burn")
if (type == "burn")
Color = node_mix_burn(t, Color1, Color2);
if (type == "Hue")
if (type == "hue")
Color = node_mix_hue(t, Color1, Color2);
if (type == "Saturation")
if (type == "saturation")
Color = node_mix_sat(t, Color1, Color2);
if (type == "Value")
if (type == "value")
Color = node_mix_val (t, Color1, Color2);
if (type == "Color")
if (type == "color")
Color = node_mix_color(t, Color1, Color2);
if (type == "Soft Light")
if (type == "soft_light")
Color = node_mix_soft(t, Color1, Color2);
if (type == "Linear Light")
if (type == "linear_light")
Color = node_mix_linear(t, Color1, Color2);
if (use_clamp)

View File

@@ -210,15 +210,15 @@ shader node_musgrave_texture(
p = p * Scale;
if (type == "Multifractal")
if (type == "multifractal")
Fac = intensity * noise_musgrave_multi_fractal(p, dimension, lacunarity, octaves);
else if (type == "fBM")
Fac = intensity * noise_musgrave_fBm(p, dimension, lacunarity, octaves);
else if (type == "Hybrid Multifractal")
else if (type == "hybrid_multifractal")
Fac = intensity * noise_musgrave_hybrid_multi_fractal(p, dimension, lacunarity, octaves, Offset, Gain);
else if (type == "Ridged Multifractal")
else if (type == "ridged_multifractal")
Fac = intensity * noise_musgrave_ridged_multi_fractal(p, dimension, lacunarity, octaves, Offset, Gain);
else if (type == "Hetero Terrain")
else if (type == "hetero_terrain")
Fac = intensity * noise_musgrave_hetero_terrain(p, dimension, lacunarity, octaves, Offset);
Color = color(Fac, Fac, Fac);

View File

@@ -20,14 +20,14 @@ shader node_normal_map(
normal NormalIn = N,
float Strength = 1.0,
color Color = color(0.5, 0.5, 1.0),
string space = "Tangent",
string space = "tangent",
string attr_name = "geom:tangent",
string attr_sign_name = "geom:tangent_sign",
output normal Normal = NormalIn)
{
color mcolor = 2.0 * color(Color[0] - 0.5, Color[1] - 0.5, Color[2] - 0.5);
if (space == "Tangent") {
if (space == "tangent") {
vector tangent;
vector ninterp;
float tangent_sign;
@@ -53,20 +53,20 @@ shader node_normal_map(
Normal = normal(0, 0, 0);
}
}
else if (space == "Object") {
else if (space == "object") {
Normal = normalize(transform("object", "world", vector(mcolor)));
}
else if (space == "World") {
else if (space == "world") {
Normal = normalize(vector(mcolor));
}
else if (space == "Blender Object") {
else if (space == "blender_object") {
/* strange blender convention */
mcolor[1] = -mcolor[1];
mcolor[2] = -mcolor[2];
Normal = normalize(transform("object", "world", vector(mcolor)));
}
else if (space == "Blender World") {
else if (space == "blender_world") {
/* strange blender convention */
mcolor[1] = -mcolor[1];
mcolor[2] = -mcolor[2];

View File

@@ -18,7 +18,7 @@
shader node_refraction_bsdf(
color Color = 0.8,
string distribution = "Sharp",
string distribution = "sharp",
float Roughness = 0.2,
float IOR = 1.45,
normal Normal = N,
@@ -27,9 +27,9 @@ shader node_refraction_bsdf(
float f = max(IOR, 1e-5);
float eta = backfacing() ? 1.0 / f : f;
if (distribution == "Sharp")
if (distribution == "sharp")
BSDF = Color * refraction(Normal, eta);
else if (distribution == "Beckmann")
else if (distribution == "beckmann")
BSDF = Color * microfacet_beckmann_refraction(Normal, Roughness, eta);
else if (distribution == "GGX")
BSDF = Color * microfacet_ggx_refraction(Normal, Roughness, eta);

View File

@@ -111,7 +111,7 @@ shader node_sky_texture(
int use_mapping = 0,
matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
vector Vector = P,
string sky_model = "Hosek / Wilkie",
string type = "hosek_wilkie",
float theta = 0.0,
float phi = 0.0,
color radiance = color(0.0, 0.0, 0.0),
@@ -125,7 +125,7 @@ shader node_sky_texture(
if (use_mapping)
p = transform(mapping, p);
if (sky_model == "Hosek / Wilkie")
if (type == "hosek_wilkie")
Color = sky_radiance_new(p, phi, theta, radiance, config_x, config_y, config_z);
else
Color = sky_radiance_old(p, phi, theta, radiance, config_x, config_y, config_z);

View File

@@ -22,13 +22,13 @@ shader node_subsurface_scattering(
vector Radius = vector(0.1, 0.1, 0.1),
float TextureBlur = 0.0,
float Sharpness = 0.0,
string falloff = "Cubic",
string falloff = "cubic",
normal Normal = N,
output closure color BSSRDF = 0)
{
if (falloff == "Gaussian")
if (falloff == "gaussian")
BSSRDF = Color * bssrdf_gaussian(Normal, Scale * Radius, TextureBlur);
else if (falloff == "Cubic")
else if (falloff == "cubic")
BSSRDF = Color * bssrdf_cubic(Normal, Scale * Radius, TextureBlur, Sharpness);
else
BSSRDF = Color * bssrdf_burley(Normal, Scale * Radius, TextureBlur, Color);

View File

@@ -19,24 +19,24 @@
shader node_tangent(
normal NormalIn = N,
string attr_name = "geom:tangent",
string direction_type = "Radial",
string axis = "Z",
string direction_type = "radial",
string axis = "z",
output normal Tangent = normalize(dPdu))
{
vector T;
if (direction_type == "UV Map") {
if (direction_type == "uv_map") {
getattribute(attr_name, T);
}
else if (direction_type == "Radial") {
else if (direction_type == "radial") {
point generated;
if (!getattribute("geom:generated", generated))
generated = P;
if (axis == "X")
if (axis == "x")
T = vector(0.0, -(generated[2] - 0.5), (generated[1] - 0.5));
else if (axis == "Y")
else if (axis == "y")
T = vector(-(generated[2] - 0.5), 0.0, (generated[0] - 0.5));
else
T = vector(-(generated[1] - 0.5), (generated[0] - 0.5), 0.0);

View File

@@ -18,15 +18,15 @@
shader node_toon_bsdf(
color Color = 0.8,
string component = "Diffuse",
string component = "diffuse",
float Size = 0.5,
float Smooth = 0.0,
normal Normal = N,
output closure color BSDF = 0)
{
if (component == "Diffuse")
if (component == "diffuse")
BSDF = Color * diffuse_toon(Normal, Size, Smooth);
else if (component == "Glossy")
else if (component == "glossy")
BSDF = Color * glossy_toon(Normal, Size, Smooth);
}

View File

@@ -18,7 +18,7 @@
shader node_uv_map(
int from_dupli = 0,
string name = "",
string attribute = "",
string bump_offset = "center",
output point UV = point(0.0, 0.0, 0.0))
{
@@ -26,10 +26,10 @@ shader node_uv_map(
getattribute("geom:dupli_uv", UV);
}
else {
if (name == "")
if (attribute == "")
getattribute("geom:uv", UV);
else
getattribute(name, UV);
getattribute(attribute, UV);
}
if (bump_offset == "dx") {

View File

@@ -17,33 +17,33 @@
#include "stdosl.h"
shader node_vector_math(
string type = "Add",
string type = "add",
vector Vector1 = vector(0.0, 0.0, 0.0),
vector Vector2 = vector(0.0, 0.0, 0.0),
output float Value = 0.0,
output vector Vector = vector(0.0, 0.0, 0.0))
{
if (type == "Add") {
if (type == "add") {
Vector = Vector1 + Vector2;
Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2])) / 3.0;
}
else if (type == "Subtract") {
else if (type == "subtract") {
Vector = Vector1 - Vector2;
Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2])) / 3.0;
}
else if (type == "Average") {
else if (type == "average") {
Value = length(Vector1 + Vector2);
Vector = normalize(Vector1 + Vector2);
}
else if (type == "Dot Product") {
else if (type == "dot_product") {
Value = dot(Vector1, Vector2);
}
else if (type == "Cross Product") {
else if (type == "cross_product") {
vector c = cross(Vector1, Vector2);
Value = length(c);
Vector = normalize(c);
}
else if (type == "Normalize") {
else if (type == "normalize") {
Value = length(Vector1);
Vector = normalize(Vector1);
}

View File

@@ -17,18 +17,18 @@
#include "stdosl.h"
shader node_vector_transform(
string type = "Vector",
string type = "vector",
string convert_from = "world",
string convert_to = "object",
vector VectorIn = vector(0.0, 0.0, 0.0),
output vector VectorOut = vector(0.0, 0.0, 0.0))
{
if (type == "Vector" || type == "Normal") {
if (type == "vector" || type == "normal") {
VectorOut = transform(convert_from, convert_to, VectorIn);
if (type == "Normal")
if (type == "normal")
VectorOut = normalize(VectorOut);
}
else if (type == "Point") {
else if (type == "point") {
point Point = (point)VectorIn;
VectorOut = transform(convert_from, convert_to, Point);
}

View File

@@ -22,7 +22,7 @@
shader node_voronoi_texture(
int use_mapping = 0,
matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
string coloring = "Intensity",
string coloring = "intensity",
float Scale = 5.0,
point Vector = P,
output float Fac = 0.0,
@@ -40,7 +40,7 @@ shader node_voronoi_texture(
voronoi(p * Scale, 1.0, da, pa);
/* Colored output */
if (coloring == "Intensity") {
if (coloring == "intensity") {
Fac = fabs(da[0]);
Color = color(Fac);
}

View File

@@ -23,10 +23,10 @@ float wave(point p, string type, string profile, float detail, float distortion,
{
float n = 0.0;
if (type == "Bands") {
if (type == "bands") {
n = (p[0] + p[1] + p[2]) * 10.0;
}
else if (type == "Rings") {
else if (type == "rings") {
n = length(p) * 20.0;
}
@@ -34,7 +34,7 @@ float wave(point p, string type, string profile, float detail, float distortion,
n = n + (distortion * noise_turbulence(p * dscale, detail, 0));
}
if (profile == "Sine") {
if (profile == "sine") {
return 0.5 + 0.5 * sin(n);
}
else {
@@ -48,8 +48,8 @@ float wave(point p, string type, string profile, float detail, float distortion,
shader node_wave_texture(
int use_mapping = 0,
matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
string type = "Bands",
string profile = "Sine",
string type = "bands",
string profile = "sine",
float Scale = 5.0,
float Distortion = 0.0,
float Detail = 2.0,

View File

@@ -32,12 +32,12 @@ NODE_DEFINE(Background)
{
NodeType* type = NodeType::add("background", create);
SOCKET_INT(ao_factor, "AO Factor", 0.0f);
SOCKET_FLOAT(ao_factor, "AO Factor", 0.0f);
SOCKET_FLOAT(ao_distance, "AO Distance", FLT_MAX);
SOCKET_BOOLEAN(use_shader, "Use Shader", true);
SOCKET_BOOLEAN(use_ao, "Use AO", false);
SOCKET_INT(visibility, "Visibility", PATH_RAY_ALL_VISIBILITY);
SOCKET_UINT(visibility, "Visibility", PATH_RAY_ALL_VISIBILITY);
SOCKET_BOOLEAN(transparent, "Transparent", false);
SOCKET_NODE(shader, "Shader", &Shader::node_type);

View File

@@ -68,7 +68,7 @@ NODE_DEFINE(Camera)
SOCKET_FLOAT(aperturesize, "Aperture Size", 0.0f);
SOCKET_FLOAT(focaldistance, "Focal Distance", 10.0f);
SOCKET_INT(blades, "Blades", 0);
SOCKET_UINT(blades, "Blades", 0);
SOCKET_FLOAT(bladesrotation, "Blades Rotation", 0.0f);
SOCKET_TRANSFORM(matrix, "Matrix", transform_identity());

View File

@@ -51,72 +51,19 @@ bool check_node_inputs_traversed(const ShaderNode *node,
return true;
}
bool check_node_inputs_equals(const ShaderNode *node_a,
const ShaderNode *node_b)
{
if(node_a->inputs.size() != node_b->inputs.size()) {
/* Happens with BSDF closure nodes which are currently sharing the same
* name for all the BSDF types, making it impossible to filter out
* incompatible nodes.
*/
return false;
}
for(int i = 0; i < node_a->inputs.size(); ++i) {
ShaderInput *input_a = node_a->inputs[i],
*input_b = node_b->inputs[i];
if(input_a->link == NULL && input_b->link == NULL) {
/* Unconnected inputs are expected to have the same value. */
if(input_a->value() != input_b->value()) {
return false;
}
}
else if(input_a->link != NULL && input_b->link != NULL) {
/* Expect links are to come from the same exact socket. */
if(input_a->link != input_b->link) {
return false;
}
}
else {
/* One socket has a link and another has not, inputs can't be
* considered equal.
*/
return false;
}
}
return true;
}
} /* namespace */
/* Input and Output */
ShaderInput::ShaderInput(ShaderNode *parent_, const char *name, SocketType::Type type)
{
parent = parent_;
name_ = name;
type_ = type;
link = NULL;
value_ = make_float3(0.0f, 0.0f, 0.0f);
stack_offset = SVM_STACK_INVALID;
flags_ = 0;
}
ShaderOutput::ShaderOutput(ShaderNode *parent_, const char *name, SocketType::Type type)
{
parent = parent_;
name_ = name;
type_ = type;
stack_offset = SVM_STACK_INVALID;
}
/* Node */
ShaderNode::ShaderNode(const char *name_)
ShaderNode::ShaderNode(const NodeType *type)
: Node(type)
{
name = name_;
name = type->name;
id = -1;
bump = SHADER_BUMP_NONE;
special_type = SHADER_SPECIAL_TYPE_NONE;
create_inputs_outputs(type);
}
ShaderNode::~ShaderNode()
@@ -128,6 +75,19 @@ ShaderNode::~ShaderNode()
delete socket;
}
void ShaderNode::create_inputs_outputs(const NodeType *type)
{
foreach(const SocketType& socket, type->inputs) {
if(socket.flags & SocketType::LINKABLE) {
inputs.push_back(new ShaderInput(socket, this));
}
}
foreach(const SocketType& socket, type->outputs) {
outputs.push_back(new ShaderOutput(socket, this));
}
}
ShaderInput *ShaderNode::input(const char *name)
{
foreach(ShaderInput *socket, inputs) {
@@ -166,31 +126,6 @@ ShaderOutput *ShaderNode::output(ustring name)
return NULL;
}
ShaderInput *ShaderNode::add_input(const char *name, SocketType::Type type, float value, int flags)
{
ShaderInput *input = new ShaderInput(this, name, type);
input->value_.x = value;
input->flags_ = flags;
inputs.push_back(input);
return input;
}
ShaderInput *ShaderNode::add_input(const char *name, SocketType::Type type, float3 value, int flags)
{
ShaderInput *input = new ShaderInput(this, name, type);
input->value_ = value;
input->flags_ = flags;
inputs.push_back(input);
return input;
}
ShaderOutput *ShaderNode::add_output(const char *name, SocketType::Type type)
{
ShaderOutput *output = new ShaderOutput(this, name, type);
outputs.push_back(output);
return output;
}
void ShaderNode::attributes(Shader *shader, AttributeRequestSet *attributes)
{
foreach(ShaderInput *input, inputs) {
@@ -209,6 +144,49 @@ void ShaderNode::attributes(Shader *shader, AttributeRequestSet *attributes)
}
}
bool ShaderNode::equals(const ShaderNode& other)
{
if (type != other.type || bump != other.bump)
return false;
assert(inputs.size() == other.inputs.size());
/* Compare unlinkable sockets */
foreach(const SocketType& socket, type->inputs) {
if(!(socket.flags & SocketType::LINKABLE)) {
if(!Node::equals_value(other, socket)) {
return false;
}
}
}
/* Compare linkable input sockets */
for(int i = 0; i < inputs.size(); ++i) {
ShaderInput *input_a = inputs[i],
*input_b = other.inputs[i];
if(input_a->link == NULL && input_b->link == NULL) {
/* Unconnected inputs are expected to have the same value. */
if(!Node::equals_value(other, input_a->socket_type)) {
return false;
}
}
else if(input_a->link != NULL && input_b->link != NULL) {
/* Expect links are to come from the same exact socket. */
if(input_a->link != input_b->link) {
return false;
}
}
else {
/* One socket has a link and another has not, inputs can't be
* considered equal.
*/
return false;
}
}
return true;
}
/* Graph */
ShaderGraph::ShaderGraph()
@@ -470,8 +448,7 @@ void ShaderGraph::remove_proxy_nodes()
disconnect(to);
/* transfer the default input value to the target socket */
to->set(input->value());
to->set(input->value_string());
tonode->copy_value(to->socket_type, *proxy, input->socket_type);
}
}
@@ -542,7 +519,7 @@ void ShaderGraph::constant_fold()
vector<ShaderInput*> links(output->links);
for(size_t i = 0; i < links.size(); i++) {
if(i > 0)
links[i]->set(links[0]->value());
links[i]->parent->copy_value(links[i]->socket_type, *links[0]->parent, links[0]->socket_type);
disconnect(links[i]);
}
}
@@ -604,26 +581,12 @@ void ShaderGraph::deduplicate_nodes()
}
/* Try to merge this node with another one. */
foreach(ShaderNode *other_node, done[node->name]) {
if(node == other_node) {
/* Don't merge with self. */
continue;
}
if(node->name != other_node->name) {
/* Can only de-duplicate nodes of the same type. */
continue;
}
if(!check_node_inputs_equals(node, other_node)) {
/* Node inputs are different, can't merge them, */
continue;
}
if(!node->equals(other_node)) {
/* Node settings are different. */
continue;
}
if (node != other_node && node->equals(*other_node)) {
/* TODO(sergey): Consider making it an utility function. */
for(int i = 0; i < node->outputs.size(); ++i) {
relink(node, node->outputs[i], other_node->outputs[i]);
}
}
break;
}
}
@@ -927,14 +890,15 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight
if(fin) {
/* mix closure: add node to mix closure weights */
ShaderNode *mix_node = add(new MixClosureWeightNode());
MixClosureWeightNode *mix_node = new MixClosureWeightNode();
add(mix_node);
ShaderInput *fac_in = mix_node->input("Fac");
ShaderInput *weight_in = mix_node->input("Weight");
if(fin->link)
connect(fin->link, fac_in);
else
fac_in->set(fin->value_float());
mix_node->fac = node->get_float(fin->socket_type);
if(weight_out)
connect(weight_out, weight_in);
@@ -961,20 +925,20 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight
return;
/* already has a weight connected to it? add weights */
if(weight_in->link || weight_in->value_float() != 0.0f) {
ShaderNode *math_node = add(new MathNode());
ShaderInput *value1_in = math_node->input("Value1");
ShaderInput *value2_in = math_node->input("Value2");
float weight_value = node->get_float(weight_in->socket_type);
if(weight_in->link || weight_value != 0.0f) {
MathNode *math_node = new MathNode();
add(math_node);
if(weight_in->link)
connect(weight_in->link, value1_in);
connect(weight_in->link, math_node->input("Value1"));
else
value1_in->set(weight_in->value_float());
math_node->value1 = weight_value;
if(weight_out)
connect(weight_out, value2_in);
connect(weight_out, math_node->input("Value2"));
else
value2_in->set(1.0f);
math_node->value2 = 1.0f;
weight_out = math_node->output("Value");
if(weight_in->link)
@@ -985,7 +949,7 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight
if(weight_out)
connect(weight_out, weight_in);
else
weight_in->set(weight_in->value_float() + 1.0f);
node->set(weight_in->socket_type, weight_value + 1.0f);
}
}

View File

@@ -18,6 +18,7 @@
#define __GRAPH_H__
#include "node.h"
#include "node_type.h"
#include "kernel_types.h"
@@ -79,32 +80,21 @@ enum ShaderNodeSpecialType {
class ShaderInput {
public:
ShaderInput(ShaderNode *parent, const char *name, SocketType::Type type);
ShaderInput(const SocketType& socket_type_, ShaderNode* parent_)
: socket_type(socket_type_), parent(parent_), link(NULL), stack_offset(SVM_STACK_INVALID)
{}
ustring name() { return name_; }
int flags() { return flags_; }
SocketType::Type type() { return type_; }
ustring name() { return socket_type.ui_name; }
int flags() { return socket_type.flags; }
SocketType::Type type() { return socket_type.type; }
void set(float f) { value_.x = f; }
void set(float3 f) { value_ = f; }
void set(int i) { value_.x = (float)i; }
void set(ustring s) { value_string_ = s; }
float3& value() { return value_; }
float& value_float() { return value_.x; }
ustring& value_string() { return value_string_; }
ustring name_;
SocketType::Type type_;
void set(float f) { ((Node*)parent)->set(socket_type, f); }
void set(float3 f) { ((Node*)parent)->set(socket_type, f); }
const SocketType& socket_type;
ShaderNode *parent;
ShaderOutput *link;
float3 value_;
ustring value_string_;
int stack_offset; /* for SVM compiler */
int flags_;
};
/* Output
@@ -113,17 +103,16 @@ public:
class ShaderOutput {
public:
ShaderOutput(ShaderNode *parent, const char *name, SocketType::Type type);
ShaderOutput(const SocketType& socket_type_, ShaderNode* parent_)
: socket_type(socket_type_), parent(parent_), stack_offset(SVM_STACK_INVALID)
{}
ustring name() { return name_; }
SocketType::Type type() { return type_; }
ustring name_;
SocketType::Type type_;
ustring name() { return socket_type.ui_name; }
SocketType::Type type() { return socket_type.type; }
const SocketType& socket_type;
ShaderNode *parent;
vector<ShaderInput*> links;
int stack_offset; /* for SVM compiler */
};
@@ -132,20 +121,18 @@ public:
* Shader node in graph, with input and output sockets. This is the virtual
* base class for all node types. */
class ShaderNode {
class ShaderNode : public Node {
public:
explicit ShaderNode(const char *name);
explicit ShaderNode(const NodeType *type);
virtual ~ShaderNode();
void create_inputs_outputs(const NodeType *type);
ShaderInput *input(const char *name);
ShaderOutput *output(const char *name);
ShaderInput *input(ustring name);
ShaderOutput *output(ustring name);
ShaderInput *add_input(const char *name, SocketType::Type type, float value=0.0f, int flags=0);
ShaderInput *add_input(const char *name, SocketType::Type type, float3 value, int flags=0);
ShaderOutput *add_output(const char *name, SocketType::Type type);
virtual ShaderNode *clone() const = 0;
virtual void attributes(Shader *shader, AttributeRequestSet *attributes);
virtual void compile(SVMCompiler& compiler) = 0;
@@ -171,7 +158,6 @@ public:
vector<ShaderInput*> inputs;
vector<ShaderOutput*> outputs;
ustring name; /* name, not required to be unique */
int id; /* index in graph node array */
ShaderBump bump; /* for bump mapping utility */
@@ -207,23 +193,21 @@ public:
* NOTE: If some node can't be de-duplicated for whatever reason it
* is to be handled in the subclass.
*/
virtual bool equals(const ShaderNode *other)
{
return name == other->name &&
bump == other->bump;
}
virtual bool equals(const ShaderNode& other);
};
/* Node definition utility macros */
#define SHADER_NODE_CLASS(type) \
NODE_DECLARE; \
type(); \
virtual ShaderNode *clone() const { return new type(*this); } \
virtual void compile(SVMCompiler& compiler); \
virtual void compile(OSLCompiler& compiler); \
#define SHADER_NODE_NO_CLONE_CLASS(type) \
NODE_DECLARE; \
type(); \
virtual void compile(SVMCompiler& compiler); \
virtual void compile(OSLCompiler& compiler); \

View File

@@ -85,7 +85,7 @@ NODE_DEFINE(Mesh)
displacement_method_enum.insert("both", DISPLACE_BOTH);
SOCKET_ENUM(displacement_method, "Displacement Method", displacement_method_enum, DISPLACE_BUMP);
SOCKET_INT(motion_steps, "Motion Steps", 3);
SOCKET_UINT(motion_steps, "Motion Steps", 3);
SOCKET_BOOLEAN(use_motion_blur, "Use Motion Blur", false);
SOCKET_INT_ARRAY(triangles, "Triangles", array<int>());

File diff suppressed because it is too large Load Diff

View File

@@ -18,6 +18,7 @@
#define __NODES_H__
#include "graph.h"
#include "node.h"
#include "util_string.h"
@@ -35,6 +36,7 @@ public:
Transform compute_transform();
bool skip();
void compile(SVMCompiler& compiler, int offset_in, int offset_out);
int compile(SVMCompiler& compiler, ShaderInput *vector_in);
void compile(OSLCompiler &compiler);
int compile_begin(SVMCompiler& compiler, ShaderInput *vector_in);
@@ -49,48 +51,26 @@ public:
enum Type { POINT = 0, TEXTURE = 1, VECTOR = 2, NORMAL = 3 };
Type type;
static NodeEnum type_enum;
enum Mapping { NONE = 0, X = 1, Y = 2, Z = 3 };
Mapping x_mapping, y_mapping, z_mapping;
static NodeEnum mapping_enum;
enum Projection { FLAT, CUBE, TUBE, SPHERE };
Projection projection;
static NodeEnum projection_enum;
bool equals(const TextureMapping& other) {
return translation == other.translation &&
rotation == other.rotation &&
scale == other.scale &&
use_minmax == other.use_minmax &&
min == other.min &&
max == other.max &&
type == other.type &&
x_mapping == other.x_mapping &&
y_mapping == other.y_mapping &&
z_mapping == other.z_mapping &&
projection == other.projection;
}
};
/* Nodes */
class TextureNode : public ShaderNode {
public:
explicit TextureNode(const char *name_) : ShaderNode(name_) {}
explicit TextureNode(const NodeType *node_type) : ShaderNode(node_type) {}
TextureMapping tex_mapping;
virtual bool equals(const ShaderNode *other) {
return ShaderNode::equals(other) &&
tex_mapping.equals(((const TextureNode*)other)->tex_mapping);
}
};
/* Any node which uses image manager's slot should be a subclass of this one. */
class ImageSlotTextureNode : public TextureNode {
public:
explicit ImageSlotTextureNode(const char *name_) : TextureNode(name_) {
explicit ImageSlotTextureNode(const NodeType *node_type) : TextureNode(node_type) {
special_type = SHADER_SPECIAL_TYPE_IMAGE_SLOT;
}
int slot;
@@ -107,7 +87,7 @@ public:
int is_float;
bool is_linear;
bool use_alpha;
string filename;
ustring filename;
void *builtin_data;
NodeImageColorSpace color_space;
NodeImageProjection projection;
@@ -115,22 +95,14 @@ public:
ExtensionType extension;
float projection_blend;
bool animated;
float3 vector;
static NodeEnum color_space_enum;
static NodeEnum projection_enum;
virtual bool equals(const ShaderNode *other) {
const ImageTextureNode *image_node = (const ImageTextureNode*)other;
virtual bool equals(const ShaderNode& other)
{
const ImageTextureNode& image_node = (const ImageTextureNode&)other;
return ImageSlotTextureNode::equals(other) &&
use_alpha == image_node->use_alpha &&
filename == image_node->filename &&
builtin_data == image_node->builtin_data &&
color_space == image_node->color_space &&
projection == image_node->projection &&
interpolation == image_node->interpolation &&
extension == image_node->extension &&
projection_blend == image_node->projection_blend &&
animated == image_node->animated;
builtin_data == image_node.builtin_data &&
animated == image_node.animated;
}
};
@@ -146,26 +118,20 @@ public:
int is_float;
bool is_linear;
bool use_alpha;
string filename;
ustring filename;
void *builtin_data;
NodeImageColorSpace color_space;
NodeEnvironmentProjection projection;
InterpolationType interpolation;
bool animated;
float3 vector;
static NodeEnum color_space_enum;
static NodeEnum projection_enum;
virtual bool equals(const ShaderNode *other) {
const EnvironmentTextureNode *env_node = (const EnvironmentTextureNode*)other;
virtual bool equals(const ShaderNode& other)
{
const EnvironmentTextureNode& env_node = (const EnvironmentTextureNode&)other;
return ImageSlotTextureNode::equals(other) &&
use_alpha == env_node->use_alpha &&
filename == env_node->filename &&
builtin_data == env_node->builtin_data &&
color_space == env_node->color_space &&
projection == env_node->projection &&
interpolation == env_node->interpolation &&
animated == env_node->animated;
builtin_data == env_node.builtin_data &&
animated == env_node.animated;
}
};
@@ -179,25 +145,20 @@ public:
float3 sun_direction;
float turbidity;
float ground_albedo;
static NodeEnum type_enum;
virtual bool equals(const ShaderNode *other) {
const SkyTextureNode *sky_node = (const SkyTextureNode*)other;
return TextureNode::equals(other) &&
sun_direction == sky_node->sun_direction &&
turbidity == sky_node->turbidity &&
ground_albedo == sky_node->ground_albedo &&
type == sky_node->type;
}
float3 vector;
};
class OutputNode : public ShaderNode {
public:
SHADER_NODE_CLASS(OutputNode)
void* surface;
void* volume;
float displacement;
float3 normal;
/* Don't allow output node de-duplication. */
virtual bool equals(const ShaderNode * /*other*/) { return false; }
virtual bool equals(const ShaderNode& /*other*/) { return false; }
};
class GradientTextureNode : public TextureNode {
@@ -207,18 +168,15 @@ public:
virtual int get_group() { return NODE_GROUP_LEVEL_2; }
NodeGradientType type;
static NodeEnum type_enum;
virtual bool equals(const ShaderNode *other) {
const GradientTextureNode *gradient_node = (const GradientTextureNode*)other;
return TextureNode::equals(other) &&
type == gradient_node->type;
}
float3 vector;
};
class NoiseTextureNode : public TextureNode {
public:
SHADER_NODE_CLASS(NoiseTextureNode)
float scale, detail, distortion;
float3 vector;
};
class VoronoiTextureNode : public TextureNode {
@@ -228,13 +186,8 @@ public:
virtual int get_group() { return NODE_GROUP_LEVEL_2; }
NodeVoronoiColoring coloring;
static NodeEnum coloring_enum;
virtual bool equals(const ShaderNode *other) {
const VoronoiTextureNode *voronoi_node = (const VoronoiTextureNode*)other;
return TextureNode::equals(other) &&
coloring == voronoi_node->coloring;
}
float scale;
float3 vector;
};
class MusgraveTextureNode : public TextureNode {
@@ -244,13 +197,8 @@ public:
virtual int get_group() { return NODE_GROUP_LEVEL_2; }
NodeMusgraveType type;
static NodeEnum type_enum;
virtual bool equals(const ShaderNode *other) {
const MusgraveTextureNode *musgrave_node = (const MusgraveTextureNode*)other;
return TextureNode::equals(other) &&
type == musgrave_node->type;
}
float scale, detail, dimension, lacunarity, offset, gain;
float3 vector;
};
class WaveTextureNode : public TextureNode {
@@ -261,15 +209,9 @@ public:
NodeWaveType type;
NodeWaveProfile profile;
static NodeEnum type_enum;
static NodeEnum profile_enum;
virtual bool equals(const ShaderNode *other) {
const WaveTextureNode *wave_node = (const WaveTextureNode*)other;
return TextureNode::equals(other) &&
type == wave_node->type &&
profile == wave_node->profile;
}
float scale, distortion, detail, detail_scale;
float3 vector;
};
class MagicTextureNode : public TextureNode {
@@ -279,18 +221,17 @@ public:
virtual int get_group() { return NODE_GROUP_LEVEL_2; }
int depth;
virtual bool equals(const ShaderNode *other) {
const MagicTextureNode *magic_node = (const MagicTextureNode*)other;
return TextureNode::equals(other) &&
depth == magic_node->depth;
}
float3 vector;
float scale, distortion;
};
class CheckerTextureNode : public TextureNode {
public:
SHADER_NODE_CLASS(CheckerTextureNode)
float3 vector, color1, color2;
float scale;
virtual int get_group() { return NODE_GROUP_LEVEL_2; }
};
@@ -301,16 +242,11 @@ public:
float offset, squash;
int offset_frequency, squash_frequency;
virtual int get_group() { return NODE_GROUP_LEVEL_2; }
float3 color1, color2, mortar;
float scale, mortar_size, bias, brick_width, row_height;
float3 vector;
virtual bool equals(const ShaderNode *other) {
const BrickTextureNode *brick_node = (const BrickTextureNode*)other;
return TextureNode::equals(other) &&
offset == brick_node->offset &&
squash == brick_node->squash &&
offset_frequency == brick_node->offset_frequency &&
squash_frequency == brick_node->squash_frequency;
}
virtual int get_group() { return NODE_GROUP_LEVEL_2; }
};
class PointDensityTextureNode : public ShaderNode {
@@ -324,25 +260,20 @@ public:
bool has_spatial_varying() { return true; }
bool has_object_dependency() { return true; }
ustring filename;
NodeTexVoxelSpace space;
InterpolationType interpolation;
Transform tfm;
float3 vector;
ImageManager *image_manager;
int slot;
string filename;
NodeTexVoxelSpace space;
void *builtin_data;
InterpolationType interpolation;
Transform tfm;
static NodeEnum space_enum;
virtual bool equals(const ShaderNode *other) {
const PointDensityTextureNode *point_dendity_node = (const PointDensityTextureNode*)other;
virtual bool equals(const ShaderNode& other) {
const PointDensityTextureNode& point_dendity_node = (const PointDensityTextureNode&)other;
return ShaderNode::equals(other) &&
filename == point_dendity_node->filename &&
space == point_dendity_node->space &&
builtin_data == point_dendity_node->builtin_data &&
interpolation == point_dendity_node->interpolation &&
tfm == point_dendity_node->tfm;
builtin_data == point_dendity_node.builtin_data;
}
};
@@ -351,20 +282,16 @@ public:
SHADER_NODE_CLASS(MappingNode)
virtual int get_group() { return NODE_GROUP_LEVEL_2; }
float3 vector;
TextureMapping tex_mapping;
virtual bool equals(const ShaderNode *other) {
const MappingNode *mapping_node = (const MappingNode*)other;
return ShaderNode::equals(other) &&
tex_mapping.equals(mapping_node->tex_mapping);
}
};
class RGBToBWNode : public ShaderNode {
public:
SHADER_NODE_CLASS(RGBToBWNode)
bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized);
float3 color;
};
class ConvertNode : public ShaderNode {
@@ -376,28 +303,39 @@ public:
SocketType::Type from, to;
virtual bool equals(const ShaderNode *other)
{
const ConvertNode *convert_node = (const ConvertNode*)other;
return ShaderNode::equals(other) &&
from == convert_node->from &&
to == convert_node->to;
}
union {
float value_float;
int value_int;
float3 value_color;
float3 value_vector;
float3 value_point;
float3 value_normal;
};
ustring value_string;
private:
static const int MAX_TYPE = 12;
static bool register_types();
static Node* create(const NodeType *type);
static const NodeType *node_types[MAX_TYPE][MAX_TYPE];
static bool initialized;
};
class BsdfNode : public ShaderNode {
public:
explicit BsdfNode(bool scattering = false);
explicit BsdfNode(const NodeType *node_type);
SHADER_NODE_BASE_CLASS(BsdfNode);
bool has_spatial_varying() { return true; }
void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2, ShaderInput *param3 = NULL, ShaderInput *param4 = NULL);
virtual ClosureType get_closure_type() { return closure; }
float3 color;
float3 normal;
float surface_mix_weight;
ClosureType closure;
bool scattering;
virtual bool equals(const ShaderNode * /*other*/)
virtual bool equals(const ShaderNode& /*other*/)
{
/* TODO(sergey): With some care BSDF nodes can be de-duplicated. */
return false;
@@ -408,8 +346,9 @@ class AnisotropicBsdfNode : public BsdfNode {
public:
SHADER_NODE_CLASS(AnisotropicBsdfNode)
float3 tangent;
float roughness, anisotropy, rotation;
ClosureType distribution;
static NodeEnum distribution_enum;
void attributes(Shader *shader, AttributeRequestSet *attributes);
};
@@ -417,6 +356,8 @@ public:
class DiffuseBsdfNode : public BsdfNode {
public:
SHADER_NODE_CLASS(DiffuseBsdfNode)
float roughness;
};
class TranslucentBsdfNode : public BsdfNode {
@@ -434,6 +375,8 @@ public:
class VelvetBsdfNode : public BsdfNode {
public:
SHADER_NODE_CLASS(VelvetBsdfNode)
float sigma;
};
class GlossyBsdfNode : public BsdfNode {
@@ -443,8 +386,8 @@ public:
void simplify_settings(Scene *scene);
bool has_integrator_dependency();
float roughness;
ClosureType distribution, distribution_orig;
static NodeEnum distribution_enum;
};
class GlassBsdfNode : public BsdfNode {
@@ -454,8 +397,8 @@ public:
void simplify_settings(Scene *scene);
bool has_integrator_dependency();
float roughness, IOR;
ClosureType distribution, distribution_orig;
static NodeEnum distribution_enum;
};
class RefractionBsdfNode : public BsdfNode {
@@ -465,16 +408,16 @@ public:
void simplify_settings(Scene *scene);
bool has_integrator_dependency();
float roughness, IOR;
ClosureType distribution, distribution_orig;
static NodeEnum distribution_enum;
};
class ToonBsdfNode : public BsdfNode {
public:
SHADER_NODE_CLASS(ToonBsdfNode)
float smooth, size;
ClosureType component;
static NodeEnum component_enum;
};
class SubsurfaceScatteringNode : public BsdfNode {
@@ -483,8 +426,11 @@ public:
bool has_surface_bssrdf() { return true; }
bool has_bssrdf_bump();
float scale;
float3 radius;
float sharpness;
float texture_blur;
ClosureType falloff;
static NodeEnum falloff_enum;
};
class EmissionNode : public ShaderNode {
@@ -494,6 +440,10 @@ public:
virtual ClosureType get_closure_type() { return CLOSURE_EMISSION_ID; }
bool has_surface_emission() { return true; }
float3 color;
float strength;
float surface_mix_weight;
};
class BackgroundNode : public ShaderNode {
@@ -501,6 +451,10 @@ public:
SHADER_NODE_CLASS(BackgroundNode)
bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized);
virtual ClosureType get_closure_type() { return CLOSURE_BACKGROUND_ID; }
float3 color;
float strength;
float surface_mix_weight;
};
class HoldoutNode : public ShaderNode {
@@ -508,6 +462,9 @@ public:
SHADER_NODE_CLASS(HoldoutNode)
virtual int get_group() { return NODE_GROUP_LEVEL_1; }
virtual ClosureType get_closure_type() { return CLOSURE_HOLDOUT_ID; }
float surface_mix_weight;
float volume_mix_weight;
};
class AmbientOcclusionNode : public ShaderNode {
@@ -517,11 +474,16 @@ public:
bool has_spatial_varying() { return true; }
virtual int get_group() { return NODE_GROUP_LEVEL_1; }
virtual ClosureType get_closure_type() { return CLOSURE_AMBIENT_OCCLUSION_ID; }
float3 normal_osl;
float3 color;
float surface_mix_weight;
};
class VolumeNode : public ShaderNode {
public:
SHADER_NODE_CLASS(VolumeNode)
VolumeNode(const NodeType *node_type);
SHADER_NODE_BASE_CLASS(VolumeNode)
void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2);
virtual int get_group() { return NODE_GROUP_LEVEL_1; }
@@ -530,9 +492,12 @@ public:
}
virtual ClosureType get_closure_type() { return closure; }
float3 color;
float density;
float volume_mix_weight;
ClosureType closure;
virtual bool equals(const ShaderNode * /*other*/)
virtual bool equals(const ShaderNode& /*other*/)
{
/* TODO(sergey): With some care Volume nodes can be de-duplicated. */
return false;
@@ -547,6 +512,8 @@ public:
class ScatterVolumeNode : public VolumeNode {
public:
SHADER_NODE_CLASS(ScatterVolumeNode)
float anisotropy;
};
class HairBsdfNode : public BsdfNode {
@@ -554,8 +521,10 @@ public:
SHADER_NODE_CLASS(HairBsdfNode)
ClosureType component;
static NodeEnum component_enum;
float offset;
float roughness_u;
float roughness_v;
float3 tangent;
};
class GeometryNode : public ShaderNode {
@@ -563,6 +532,8 @@ public:
SHADER_NODE_CLASS(GeometryNode)
void attributes(Shader *shader, AttributeRequestSet *attributes);
bool has_spatial_varying() { return true; }
float3 normal_osl;
};
class TextureCoordinateNode : public ShaderNode {
@@ -572,17 +543,10 @@ public:
bool has_spatial_varying() { return true; }
bool has_object_dependency() { return use_transform; }
float3 normal_osl;
bool from_dupli;
bool use_transform;
Transform ob_tfm;
virtual bool equals(const ShaderNode *other) {
const TextureCoordinateNode *texco_node = (const TextureCoordinateNode*)other;
return ShaderNode::equals(other) &&
from_dupli == texco_node->from_dupli &&
use_transform == texco_node->use_transform &&
ob_tfm == texco_node->ob_tfm;
}
};
class UVMapNode : public ShaderNode {
@@ -594,13 +558,6 @@ public:
ustring attribute;
bool from_dupli;
virtual bool equals(const ShaderNode *other) {
const UVMapNode *uv_map_node = (const UVMapNode*)other;
return ShaderNode::equals(other) &&
attribute == uv_map_node->attribute &&
from_dupli == uv_map_node->from_dupli;
}
};
class LightPathNode : public ShaderNode {
@@ -614,6 +571,9 @@ public:
SHADER_NODE_CLASS(LightFalloffNode)
bool has_spatial_varying() { return true; }
virtual int get_group() { return NODE_GROUP_LEVEL_2; }
float strength;
float smooth;
};
class ObjectInfoNode : public ShaderNode {
@@ -648,12 +608,6 @@ public:
bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized);
float value;
virtual bool equals(const ShaderNode *other) {
const ValueNode *value_node = (const ValueNode*)other;
return ShaderNode::equals(other) &&
value == value_node->value;
}
};
class ColorNode : public ShaderNode {
@@ -663,12 +617,6 @@ public:
bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized);
float3 value;
virtual bool equals(const ShaderNode *other) {
const ColorNode *color_node = (const ColorNode*)other;
return ShaderNode::equals(other) &&
value == color_node->value;
}
};
class AddClosureNode : public ShaderNode {
@@ -680,11 +628,16 @@ class MixClosureNode : public ShaderNode {
public:
SHADER_NODE_CLASS(MixClosureNode)
bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized);
float fac;
};
class MixClosureWeightNode : public ShaderNode {
public:
SHADER_NODE_CLASS(MixClosureWeightNode);
float weight;
float fac;
};
class InvertNode : public ShaderNode {
@@ -692,6 +645,9 @@ public:
SHADER_NODE_CLASS(InvertNode)
virtual int get_group() { return NODE_GROUP_LEVEL_3; }
float fac;
float3 color;
};
class MixNode : public ShaderNode {
@@ -701,80 +657,90 @@ public:
virtual int get_group() { return NODE_GROUP_LEVEL_3; }
bool use_clamp;
NodeMix type;
static NodeEnum type_enum;
virtual bool equals(const ShaderNode *other)
{
const MixNode *mix_node = (const MixNode*)other;
return ShaderNode::equals(other) &&
use_clamp == mix_node->use_clamp &&
type == mix_node->type;
}
bool use_clamp;
float3 color1;
float3 color2;
float fac;
};
class CombineRGBNode : public ShaderNode {
public:
SHADER_NODE_CLASS(CombineRGBNode)
virtual int get_group() { return NODE_GROUP_LEVEL_3; }
float r, g, b;
};
class CombineHSVNode : public ShaderNode {
public:
SHADER_NODE_CLASS(CombineHSVNode)
virtual int get_group() { return NODE_GROUP_LEVEL_3; }
float h, s, v;
};
class CombineXYZNode : public ShaderNode {
public:
SHADER_NODE_CLASS(CombineXYZNode)
virtual int get_group() { return NODE_GROUP_LEVEL_3; }
float x, y, z;
};
class GammaNode : public ShaderNode {
public:
SHADER_NODE_CLASS(GammaNode)
bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized);
virtual int get_group() { return NODE_GROUP_LEVEL_1; }
float3 color;
float gamma;
};
class BrightContrastNode : public ShaderNode {
public:
SHADER_NODE_CLASS(BrightContrastNode)
virtual int get_group() { return NODE_GROUP_LEVEL_1; }
float3 color;
float bright;
float contrast;
};
class SeparateRGBNode : public ShaderNode {
public:
SHADER_NODE_CLASS(SeparateRGBNode)
virtual int get_group() { return NODE_GROUP_LEVEL_3; }
float3 color;
};
class SeparateHSVNode : public ShaderNode {
public:
SHADER_NODE_CLASS(SeparateHSVNode)
virtual int get_group() { return NODE_GROUP_LEVEL_3; }
float3 color;
};
class SeparateXYZNode : public ShaderNode {
public:
SHADER_NODE_CLASS(SeparateXYZNode)
virtual int get_group() { return NODE_GROUP_LEVEL_3; }
float3 vector;
};
class HSVNode : public ShaderNode {
public:
SHADER_NODE_CLASS(HSVNode)
float hue;
float saturation;
float value;
float fac;
float3 color;
};
class AttributeNode : public ShaderNode {
@@ -784,12 +750,6 @@ public:
bool has_spatial_varying() { return true; }
ustring attribute;
virtual bool equals(const ShaderNode *other) {
const AttributeNode *color_node = (const AttributeNode*)other;
return ShaderNode::equals(other) &&
attribute == color_node->attribute;
}
};
class CameraNode : public ShaderNode {
@@ -803,6 +763,9 @@ public:
SHADER_NODE_CLASS(FresnelNode)
bool has_spatial_varying() { return true; }
virtual int get_group() { return NODE_GROUP_LEVEL_1; }
float3 normal;
float IOR;
};
class LayerWeightNode : public ShaderNode {
@@ -810,6 +773,9 @@ public:
SHADER_NODE_CLASS(LayerWeightNode)
bool has_spatial_varying() { return true; }
virtual int get_group() { return NODE_GROUP_LEVEL_1; }
float3 normal;
float blend;
};
class WireframeNode : public ShaderNode {
@@ -818,22 +784,25 @@ public:
bool has_spatial_varying() { return true; }
virtual int get_group() { return NODE_GROUP_LEVEL_3; }
float size;
bool use_pixel_size;
};
class WavelengthNode : public ShaderNode {
public:
SHADER_NODE_CLASS(WavelengthNode)
virtual int get_group() { return NODE_GROUP_LEVEL_3; }
float wavelength;
};
class BlackbodyNode : public ShaderNode {
public:
SHADER_NODE_CLASS(BlackbodyNode)
bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized);
virtual int get_group() { return NODE_GROUP_LEVEL_3; }
float temperature;
};
class MathNode : public ShaderNode {
@@ -842,18 +811,10 @@ public:
virtual int get_group() { return NODE_GROUP_LEVEL_1; }
bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized);
bool use_clamp;
float value1;
float value2;
NodeMath type;
static NodeEnum type_enum;
virtual bool equals(const ShaderNode *other)
{
const MathNode *math_node = (const MathNode*)other;
return ShaderNode::equals(other) &&
use_clamp == math_node->use_clamp &&
type == math_node->type;
}
bool use_clamp;
};
class NormalNode : public ShaderNode {
@@ -862,13 +823,7 @@ public:
virtual int get_group() { return NODE_GROUP_LEVEL_2; }
float3 direction;
virtual bool equals(const ShaderNode *other)
{
const NormalNode *normal_node = (const NormalNode*)other;
return ShaderNode::equals(other) &&
direction == normal_node->direction;
}
float3 normal;
};
class VectorMathNode : public ShaderNode {
@@ -877,15 +832,9 @@ public:
virtual int get_group() { return NODE_GROUP_LEVEL_1; }
bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized);
float3 vector1;
float3 vector2;
NodeVectorMath type;
static NodeEnum type_enum;
virtual bool equals(const ShaderNode *other)
{
const VectorMathNode *math_node = (const VectorMathNode*)other;
return ShaderNode::equals(other) &&
type == math_node->type;
}
};
class VectorTransformNode : public ShaderNode {
@@ -897,17 +846,7 @@ public:
NodeVectorTransformType type;
NodeVectorTransformConvertSpace convert_from;
NodeVectorTransformConvertSpace convert_to;
static NodeEnum type_enum;
static NodeEnum convert_space_enum;
virtual bool equals(const ShaderNode *other) {
const VectorTransformNode *vector_transform_node = (const VectorTransformNode*)other;
return ShaderNode::equals(other) &&
type == vector_transform_node->type &&
convert_from == vector_transform_node->convert_from &&
convert_to == vector_transform_node->convert_to;
}
float3 vector;
};
class BumpNode : public ShaderNode {
@@ -920,12 +859,13 @@ public:
}
bool invert;
virtual bool equals(const ShaderNode *other) {
const BumpNode *bump_node = (const BumpNode*)other;
return ShaderNode::equals(other) &&
invert == bump_node->invert;
}
float height;
float sample_center;
float sample_x;
float sample_y;
float3 normal;
float strength;
float distance;
};
class RGBCurvesNode : public ShaderNode {
@@ -933,10 +873,10 @@ public:
SHADER_NODE_CLASS(RGBCurvesNode)
virtual int get_group() { return NODE_GROUP_LEVEL_3; }
virtual bool equals(const ShaderNode * /*other*/) { return false; }
array<float3> curves;
float min_x, max_x;
float min_x, max_x, fac;
float3 color;
};
class VectorCurvesNode : public ShaderNode {
@@ -944,25 +884,27 @@ public:
SHADER_NODE_CLASS(VectorCurvesNode)
virtual int get_group() { return NODE_GROUP_LEVEL_3; }
virtual bool equals(const ShaderNode * /*other*/) { return false; }
array<float3> curves;
float min_x, max_x;
float min_x, max_x, fac;
float3 vector;
};
class RGBRampNode : public ShaderNode {
public:
SHADER_NODE_CLASS(RGBRampNode)
virtual int get_group() { return NODE_GROUP_LEVEL_1; }
array<float3> ramp;
array<float> ramp_alpha;
float fac;
bool interpolate;
virtual int get_group() { return NODE_GROUP_LEVEL_1; }
virtual bool equals(const ShaderNode * /*other*/) { return false; }
};
class SetNormalNode : public ShaderNode {
public:
SHADER_NODE_CLASS(SetNormalNode)
float3 direction;
};
class OSLNode : public ShaderNode {
@@ -970,17 +912,20 @@ public:
static OSLNode *create(size_t num_inputs);
~OSLNode();
SHADER_NODE_BASE_CLASS(OSLNode)
ShaderNode *clone() const;
char* input_default_value();
void add_input(ustring name, SocketType::Type type);
void add_output(ustring name, SocketType::Type type);
SHADER_NODE_NO_CLONE_CLASS(OSLNode)
/* ideally we could beter detect this, but we can't query this now */
bool has_spatial_varying() { return true; }
virtual bool equals(const ShaderNode * /*other*/) { return false; }
virtual bool equals(const ShaderNode& /*other*/) { return false; }
string filepath;
string bytecode_hash;
private:
OSLNode();
};
class NormalMapNode : public ShaderNode {
@@ -991,17 +936,10 @@ public:
virtual int get_group() { return NODE_GROUP_LEVEL_3; }
NodeNormalMapSpace space;
static NodeEnum space_enum;
ustring attribute;
virtual bool equals(const ShaderNode *other)
{
const NormalMapNode *normal_map_node = (const NormalMapNode*)other;
return ShaderNode::equals(other) &&
space == normal_map_node->space &&
attribute == normal_map_node->attribute;
}
float strength;
float3 color;
float3 normal_osl;
};
class TangentNode : public ShaderNode {
@@ -1013,19 +951,8 @@ public:
NodeTangentDirectionType direction_type;
NodeTangentAxis axis;
static NodeEnum direction_type_enum;
static NodeEnum axis_enum;
ustring attribute;
virtual bool equals(const ShaderNode *other)
{
const TangentNode *tangent_node = (const TangentNode*)other;
return ShaderNode::equals(other) &&
direction_type == tangent_node->direction_type &&
axis == tangent_node->axis &&
attribute == tangent_node->attribute;
}
float3 normal_osl;
};
CCL_NAMESPACE_END

View File

@@ -39,8 +39,8 @@ NODE_DEFINE(Object)
SOCKET_NODE(mesh, "Mesh", &Mesh::node_type);
SOCKET_TRANSFORM(tfm, "Transform", transform_identity());
SOCKET_INT(visibility, "Visibility", ~0);
SOCKET_INT(random_id, "Random ID", 0);
SOCKET_UINT(visibility, "Visibility", ~0);
SOCKET_UINT(random_id, "Random ID", 0);
SOCKET_INT(pass_id, "Pass ID", 0);
SOCKET_BOOLEAN(use_holdout, "Use Holdout", false);
SOCKET_POINT(dupli_generated, "Dupli Generated", make_float3(0.0f, 0.0f, 0.0f));

View File

@@ -477,8 +477,10 @@ OSLNode *OSLShaderManager::osl_node(const std::string& filepath,
continue;
if(!param->isoutput && param->validdefault) {
node->add_input(param->name.c_str(), socket_type, make_float3(param->fdefault[0], param->fdefault[1], param->fdefault[2]));
continue;
float3 *default_value = (float3*)node->input_default_value();
default_value->x = param->fdefault[0];
default_value->y = param->fdefault[1];
default_value->z = param->fdefault[2];
}
}
else if(param->type.aggregate == TypeDesc::SCALAR) {
@@ -486,24 +488,21 @@ OSLNode *OSLShaderManager::osl_node(const std::string& filepath,
socket_type = SocketType::INT;
if(!param->isoutput && param->validdefault) {
node->add_input(param->name.c_str(), socket_type, (float)param->idefault[0]);
continue;
*(int*)node->input_default_value() = param->idefault[0];
}
}
else if(param->type.basetype == TypeDesc::FLOAT) {
socket_type = SocketType::FLOAT;
if(!param->isoutput && param->validdefault) {
node->add_input(param->name.c_str(), socket_type, param->fdefault[0]);
continue;
*(float*)node->input_default_value() = param->fdefault[0];
}
}
else if(param->type.basetype == TypeDesc::STRING) {
socket_type = SocketType::STRING;
if(!param->isoutput && param->validdefault) {
node->add_input(param->name.c_str(), socket_type);
continue;
*(ustring*)node->input_default_value() = param->sdefault[0];
}
}
else
@@ -513,10 +512,10 @@ OSLNode *OSLShaderManager::osl_node(const std::string& filepath,
continue;
if(param->isoutput) {
node->add_output(param->name.c_str(), socket_type);
node->add_output(param->name, socket_type);
}
else {
node->add_input(param->name.c_str(), socket_type);
node->add_input(param->name, socket_type);
}
}
@@ -528,6 +527,9 @@ OSLNode *OSLShaderManager::osl_node(const std::string& filepath,
node->filepath = filepath;
}
/* Generate inputs and outputs */
node->create_inputs_outputs(node->type);
return node;
}
@@ -643,27 +645,28 @@ void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath)
continue;
string param_name = compatible_name(node, input);
const SocketType& socket = input->socket_type;
switch(input->type()) {
case SocketType::COLOR:
parameter_color(param_name.c_str(), input->value());
parameter_color(param_name.c_str(), node->get_float3(socket));
break;
case SocketType::POINT:
parameter_point(param_name.c_str(), input->value());
parameter_point(param_name.c_str(), node->get_float3(socket));
break;
case SocketType::VECTOR:
parameter_vector(param_name.c_str(), input->value());
parameter_vector(param_name.c_str(), node->get_float3(socket));
break;
case SocketType::NORMAL:
parameter_normal(param_name.c_str(), input->value());
parameter_normal(param_name.c_str(), node->get_float3(socket));
break;
case SocketType::FLOAT:
parameter(param_name.c_str(), input->value_float());
parameter(param_name.c_str(), node->get_float(socket));
break;
case SocketType::INT:
parameter(param_name.c_str(), (int)input->value_float());
parameter(param_name.c_str(), node->get_int(socket));
break;
case SocketType::STRING:
parameter(param_name.c_str(), input->value_string());
parameter(param_name.c_str(), node->get_string(socket));
break;
case SocketType::CLOSURE:
case SocketType::UNDEFINED:
@@ -733,6 +736,169 @@ void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath)
}
}
static TypeDesc array_typedesc(TypeDesc typedesc, int arraylength)
{
return TypeDesc((TypeDesc::BASETYPE)typedesc.basetype,
(TypeDesc::AGGREGATE)typedesc.aggregate,
(TypeDesc::VECSEMANTICS)typedesc.vecsemantics,
arraylength);
}
void OSLCompiler::parameter(ShaderNode* node, const char *name)
{
OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
ustring uname = ustring(name);
const SocketType& socket = *(node->type->find_input(uname));
switch(socket.type)
{
case SocketType::BOOLEAN:
{
int value = node->get_bool(socket);
ss->Parameter(name, TypeDesc::TypeInt, &value);
break;
}
case SocketType::FLOAT:
{
float value = node->get_float(socket);
ss->Parameter(uname, TypeDesc::TypeFloat, &value);
break;
}
case SocketType::INT:
{
int value = node->get_int(socket);
ss->Parameter(uname, TypeDesc::TypeInt, &value);
break;
}
case SocketType::COLOR:
{
float3 value = node->get_float3(socket);
ss->Parameter(uname, TypeDesc::TypeColor, &value);
break;
}
case SocketType::VECTOR:
{
float3 value = node->get_float3(socket);
ss->Parameter(uname, TypeDesc::TypeVector, &value);
break;
}
case SocketType::POINT:
{
float3 value = node->get_float3(socket);
ss->Parameter(uname, TypeDesc::TypePoint, &value);
break;
}
case SocketType::NORMAL:
{
float3 value = node->get_float3(socket);
ss->Parameter(uname, TypeDesc::TypeNormal, &value);
break;
}
case SocketType::POINT2:
{
float2 value = node->get_float2(socket);
ss->Parameter(uname, TypeDesc(TypeDesc::FLOAT, TypeDesc::VEC2, TypeDesc::POINT), &value);
break;
}
case SocketType::STRING:
{
ustring value = node->get_string(socket);
ss->Parameter(uname, TypeDesc::TypeString, &value);
break;
}
case SocketType::ENUM:
{
ustring value = node->get_string(socket);
ss->Parameter(uname, TypeDesc::TypeString, &value);
break;
}
case SocketType::TRANSFORM:
{
Transform value = node->get_transform(socket);
ss->Parameter(uname, TypeDesc::TypeMatrix, &value);
break;
}
case SocketType::BOOLEAN_ARRAY:
{
// OSL does not support booleans, so convert to int
const array<bool>& value = node->get_bool_array(socket);
array<int> intvalue(value.size());
for (size_t i = 0; i < value.size(); i++)
intvalue[i] = value[i];
ss->Parameter(uname, array_typedesc(TypeDesc::TypeInt, value.size()), intvalue.data());
break;
}
case SocketType::FLOAT_ARRAY:
{
const array<float>& value = node->get_float_array(socket);
ss->Parameter(uname, array_typedesc(TypeDesc::TypeFloat, value.size()), value.data());
break;
}
case SocketType::INT_ARRAY:
{
const array<int>& value = node->get_int_array(socket);
ss->Parameter(uname, array_typedesc(TypeDesc::TypeInt, value.size()), value.data());
break;
}
case SocketType::COLOR_ARRAY:
case SocketType::VECTOR_ARRAY:
case SocketType::POINT_ARRAY:
case SocketType::NORMAL_ARRAY:
{
TypeDesc typedesc;
switch(socket.type)
{
case SocketType::COLOR_ARRAY: typedesc = TypeDesc::TypeColor; break;
case SocketType::VECTOR_ARRAY: typedesc = TypeDesc::TypeVector; break;
case SocketType::POINT_ARRAY: typedesc = TypeDesc::TypePoint; break;
case SocketType::NORMAL_ARRAY: typedesc = TypeDesc::TypeNormal; break;
default: assert(0); break;
}
// convert to tightly packed array since float3 has padding
const array<float3>& value = node->get_float3_array(socket);
array<float> fvalue(value.size() * 3);
for (size_t i = 0, j = 0; i < value.size(); i++)
{
fvalue[j++] = value[i].x;
fvalue[j++] = value[i].y;
fvalue[j++] = value[i].z;
}
ss->Parameter(uname, array_typedesc(typedesc, value.size()), fvalue.data());
break;
}
case SocketType::POINT2_ARRAY:
{
const array<float2>& value = node->get_float2_array(socket);
ss->Parameter(uname, array_typedesc(TypeDesc(TypeDesc::FLOAT, TypeDesc::VEC2, TypeDesc::POINT), value.size()), value.data());
break;
}
case SocketType::STRING_ARRAY:
{
const array<ustring>& value = node->get_string_array(socket);
ss->Parameter(uname, array_typedesc(TypeDesc::TypeString, value.size()), value.data());
break;
}
case SocketType::TRANSFORM_ARRAY:
{
const array<Transform>& value = node->get_transform_array(socket);
ss->Parameter(uname, array_typedesc(TypeDesc::TypeMatrix, value.size()), value.data());
break;
}
case SocketType::CLOSURE:
case SocketType::NODE:
case SocketType::NODE_ARRAY:
case SocketType::UNDEFINED:
case SocketType::UINT:
{
assert(0);
break;
}
}
}
void OSLCompiler::parameter(const char *name, float f)
{
OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
@@ -996,6 +1162,10 @@ void OSLCompiler::add(ShaderNode * /*node*/, const char * /*name*/, bool /*isfil
{
}
void OSLCompiler::parameter(ShaderNode * /*node*/, const char * /*name*/)
{
}
void OSLCompiler::parameter(const char * /*name*/, float /*f*/)
{
}

View File

@@ -125,6 +125,8 @@ public:
void add(ShaderNode *node, const char *name, bool isfilepath = false);
void parameter(ShaderNode *node, const char *name);
void parameter(const char *name, float f);
void parameter_color(const char *name, float3 f);
void parameter_vector(const char *name, float3 f);

View File

@@ -449,17 +449,15 @@ void ShaderManager::device_free_common(Device *device, DeviceScene *dscene, Scen
void ShaderManager::add_default(Scene *scene)
{
ShaderNode *closure, *out;
/* default surface */
{
ShaderGraph *graph = new ShaderGraph();
closure = graph->add(new DiffuseBsdfNode());
closure->input("Color")->set(make_float3(0.8f, 0.8f, 0.8f));
out = graph->output();
DiffuseBsdfNode *diffuse = new DiffuseBsdfNode();
diffuse->color = make_float3(0.8f, 0.8f, 0.8f);
graph->add(diffuse);
graph->connect(closure->output("BSDF"), out->input("Surface"));
graph->connect(diffuse->output("BSDF"), graph->output()->input("Surface"));
Shader *shader = new Shader();
shader->name = "default_surface";
@@ -472,12 +470,12 @@ void ShaderManager::add_default(Scene *scene)
{
ShaderGraph *graph = new ShaderGraph();
closure = graph->add(new EmissionNode());
closure->input("Color")->set(make_float3(0.8f, 0.8f, 0.8f));
closure->input("Strength")->set(0.0f);
out = graph->output();
EmissionNode *emission = new EmissionNode();
emission->color = make_float3(0.8f, 0.8f, 0.8f);
emission->strength = 0.0f;
graph->add(emission);
graph->connect(closure->output("Emission"), out->input("Surface"));
graph->connect(emission->output("Emission"), graph->output()->input("Surface"));
Shader *shader = new Shader();
shader->name = "default_light";

View File

@@ -192,14 +192,16 @@ int SVMCompiler::stack_assign(ShaderInput *input)
input->stack_offset = input->link->stack_offset;
}
else {
Node *node = input->parent;
/* not linked to output -> add nodes to load default value */
input->stack_offset = stack_find_offset(input->type());
if(input->type() == SocketType::FLOAT) {
add_node(NODE_VALUE_F, __float_as_int(input->value_float()), input->stack_offset);
add_node(NODE_VALUE_F, __float_as_int(node->get_float(input->socket_type)), input->stack_offset);
}
else if(input->type() == SocketType::INT) {
add_node(NODE_VALUE_F, (int)input->value_float(), input->stack_offset);
add_node(NODE_VALUE_F, node->get_int(input->socket_type), input->stack_offset);
}
else if(input->type() == SocketType::VECTOR ||
input->type() == SocketType::NORMAL ||
@@ -208,7 +210,7 @@ int SVMCompiler::stack_assign(ShaderInput *input)
{
add_node(NODE_VALUE_V, input->stack_offset);
add_node(NODE_VALUE_V, input->value());
add_node(NODE_VALUE_V, node->get_float3(input->socket_type));
}
else /* should not get called for closure */
assert(0);
@@ -446,7 +448,7 @@ void SVMCompiler::generate_closure_node(ShaderNode *node,
const char *weight_name = (current_type == SHADER_TYPE_VOLUME)? "VolumeMixWeight": "SurfaceMixWeight";
ShaderInput *weight_in = node->input(weight_name);
if(weight_in && (weight_in->link || weight_in->value_float() != 1.0f))
if(weight_in && (weight_in->link || node->get_float(weight_in->socket_type) != 1.0f))
mix_weight_offset = stack_assign(weight_in);
else
mix_weight_offset = SVM_STACK_INVALID;

View File

@@ -19,16 +19,14 @@
#
# The Original Code is: all of this file.
#
# Contributor(s): Blender Foundation
# Contributor(s): Blender Foundation.
#
# ***** END GPL LICENSE BLOCK *****
set(INC
)
set(INC_SYS
)
set(SRC
@@ -57,5 +55,4 @@ if (UNIX AND NOT APPLE)
)
endif()
blender_add_lib(bf_intern_decklink "${SRC}" "${INC}" "${INC_SYS}")

View File

@@ -35,24 +35,22 @@
/* Include the OS specific Declink headers */
#ifdef WIN32
#include <windows.h>
#include <objbase.h>
#include <comutil.h>
#include "win/DeckLinkAPI_h.h"
# include <windows.h>
# include <objbase.h>
# include <comutil.h>
# include "win/DeckLinkAPI_h.h"
typedef unsigned int dl_size_t;
#elif defined(__APPLE__)
#error "Decklink not supported in OSX"
# error "Decklink not supported in OSX"
#else
#include "linux/DeckLinkAPI.h"
# include "linux/DeckLinkAPI.h"
/* Windows COM API uses BOOL, linux uses bool */
#define BOOL bool
# define BOOL bool
typedef uint32_t dl_size_t;
#endif
/* OS independent function to get the device iterator */
IDeckLinkIterator* BMD_CreateDeckLinkIterator(void);
#endif
#endif /* __DECKLINKAPI_H__ */

View File

@@ -1,60 +0,0 @@
/* -LICENSE-START-
** Copyright (c) 2014 Blackmagic Design
**
** Permission is hereby granted, free of charge, to any person or organization
** obtaining a copy of the software and accompanying documentation covered by
** this license (the "Software") to use, reproduce, display, distribute,
** execute, and transmit the Software, and to prepare derivative works of the
** Software, and to permit third-parties to whom the Software is furnished to
** do so, all subject to the following:
**
** The copyright notices in the Software and this entire statement, including
** the above license grant, this restriction and the following disclaimer,
** must be included in all copies of the Software, in whole or in part, and
** all derivative works of the Software, unless such copies or derivative
** works are solely in the form of machine-executable object code generated by
** a source language processor.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
** -LICENSE-END-
*/
#ifndef BMD_DECKLINKAPICONFIGURATION_v10_2_H
#define BMD_DECKLINKAPICONFIGURATION_v10_2_H
#include "DeckLinkAPIConfiguration.h"
// Interface ID Declarations
BMD_CONST REFIID IID_IDeckLinkConfiguration_v10_2 = /* C679A35B-610C-4D09-B748-1D0478100FC0 */ {0xC6,0x79,0xA3,0x5B,0x61,0x0C,0x4D,0x09,0xB7,0x48,0x1D,0x04,0x78,0x10,0x0F,0xC0};
// Forward Declarations
class IDeckLinkConfiguration_v10_2;
/* Interface IDeckLinkConfiguration_v10_2 - DeckLink Configuration interface */
class IDeckLinkConfiguration_v10_2 : public IUnknown
{
public:
virtual HRESULT SetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ bool value) = 0;
virtual HRESULT GetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ bool *value) = 0;
virtual HRESULT SetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ int64_t value) = 0;
virtual HRESULT GetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ int64_t *value) = 0;
virtual HRESULT SetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ double value) = 0;
virtual HRESULT GetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ double *value) = 0;
virtual HRESULT SetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ const char *value) = 0;
virtual HRESULT GetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ const char **value) = 0;
virtual HRESULT WriteConfigurationToPreferences (void) = 0;
protected:
virtual ~IDeckLinkConfiguration_v10_2 () {} // call Release method to drop reference count
};
#endif /* defined(BMD_DECKLINKAPICONFIGURATION_v10_2_H) */

View File

@@ -1,109 +0,0 @@
/* -LICENSE-START-
** Copyright (c) 2009 Blackmagic Design
**
** Permission is hereby granted, free of charge, to any person or organization
** obtaining a copy of the software and accompanying documentation covered by
** this license (the "Software") to use, reproduce, display, distribute,
** execute, and transmit the Software, and to prepare derivative works of the
** Software, and to permit third-parties to whom the Software is furnished to
** do so, all subject to the following:
**
** The copyright notices in the Software and this entire statement, including
** the above license grant, this restriction and the following disclaimer,
** must be included in all copies of the Software, in whole or in part, and
** all derivative works of the Software, unless such copies or derivative
** works are solely in the form of machine-executable object code generated by
** a source language processor.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
** -LICENSE-END-
**/
#include <stdio.h>
#include <pthread.h>
#include <dlfcn.h>
#include "DeckLinkAPI_v7_6.h"
#define kDeckLinkAPI_Name "libDeckLinkAPI.so"
#define KDeckLinkPreviewAPI_Name "libDeckLinkPreviewAPI.so"
typedef IDeckLinkIterator* (*CreateIteratorFunc_v7_6)(void);
typedef IDeckLinkGLScreenPreviewHelper_v7_6* (*CreateOpenGLScreenPreviewHelperFunc_v7_6)(void);
typedef IDeckLinkVideoConversion_v7_6* (*CreateVideoConversionInstanceFunc_v7_6)(void);
static pthread_once_t gDeckLinkOnceControl = PTHREAD_ONCE_INIT;
static pthread_once_t gPreviewOnceControl = PTHREAD_ONCE_INIT;
static CreateIteratorFunc_v7_6 gCreateIteratorFunc = NULL;
static CreateOpenGLScreenPreviewHelperFunc_v7_6 gCreateOpenGLPreviewFunc = NULL;
static CreateVideoConversionInstanceFunc_v7_6 gCreateVideoConversionFunc = NULL;
void InitDeckLinkAPI_v7_6 (void)
{
void *libraryHandle;
libraryHandle = dlopen(kDeckLinkAPI_Name, RTLD_NOW|RTLD_GLOBAL);
if (!libraryHandle)
{
fprintf(stderr, "%s\n", dlerror());
return;
}
gCreateIteratorFunc = (CreateIteratorFunc_v7_6)dlsym(libraryHandle, "CreateDeckLinkIteratorInstance");
if (!gCreateIteratorFunc)
fprintf(stderr, "%s\n", dlerror());
gCreateVideoConversionFunc = (CreateVideoConversionInstanceFunc_v7_6)dlsym(libraryHandle, "CreateVideoConversionInstance");
if (!gCreateVideoConversionFunc)
fprintf(stderr, "%s\n", dlerror());
}
void InitDeckLinkPreviewAPI_v7_6 (void)
{
void *libraryHandle;
libraryHandle = dlopen(KDeckLinkPreviewAPI_Name, RTLD_NOW|RTLD_GLOBAL);
if (!libraryHandle)
{
fprintf(stderr, "%s\n", dlerror());
return;
}
gCreateOpenGLPreviewFunc = (CreateOpenGLScreenPreviewHelperFunc_v7_6)dlsym(libraryHandle, "CreateOpenGLScreenPreviewHelper");
if (!gCreateOpenGLPreviewFunc)
fprintf(stderr, "%s\n", dlerror());
}
IDeckLinkIterator* CreateDeckLinkIteratorInstance_v7_6 (void)
{
pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI_v7_6);
if (gCreateIteratorFunc == NULL)
return NULL;
return gCreateIteratorFunc();
}
IDeckLinkGLScreenPreviewHelper_v7_6* CreateOpenGLScreenPreviewHelper_v7_6 (void)
{
pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI_v7_6);
pthread_once(&gPreviewOnceControl, InitDeckLinkPreviewAPI_v7_6);
if (gCreateOpenGLPreviewFunc == NULL)
return NULL;
return gCreateOpenGLPreviewFunc();
}
IDeckLinkVideoConversion_v7_6* CreateVideoConversionInstance_v7_6 (void)
{
pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI_v7_6);
if (gCreateVideoConversionFunc == NULL)
return NULL;
return gCreateVideoConversionFunc();
}

View File

@@ -1,133 +0,0 @@
/* -LICENSE-START-
** Copyright (c) 2011 Blackmagic Design
**
** Permission is hereby granted, free of charge, to any person or organization
** obtaining a copy of the software and accompanying documentation covered by
** this license (the "Software") to use, reproduce, display, distribute,
** execute, and transmit the Software, and to prepare derivative works of the
** Software, and to permit third-parties to whom the Software is furnished to
** do so, all subject to the following:
**
** The copyright notices in the Software and this entire statement, including
** the above license grant, this restriction and the following disclaimer,
** must be included in all copies of the Software, in whole or in part, and
** all derivative works of the Software, unless such copies or derivative
** works are solely in the form of machine-executable object code generated by
** a source language processor.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
** -LICENSE-END-
**/
#include <stdio.h>
#include <pthread.h>
#include <dlfcn.h>
#include "DeckLinkAPI_v8_0.h"
#define kDeckLinkAPI_Name "libDeckLinkAPI.so"
#define KDeckLinkPreviewAPI_Name "libDeckLinkPreviewAPI.so"
typedef IDeckLinkIterator_v8_0* (*CreateIteratorFunc)(void);
typedef IDeckLinkAPIInformation* (*CreateAPIInformationFunc)(void);
typedef IDeckLinkGLScreenPreviewHelper* (*CreateOpenGLScreenPreviewHelperFunc)(void);
typedef IDeckLinkVideoConversion* (*CreateVideoConversionInstanceFunc)(void);
static pthread_once_t gDeckLinkOnceControl = PTHREAD_ONCE_INIT;
static pthread_once_t gPreviewOnceControl = PTHREAD_ONCE_INIT;
static bool gLoadedDeckLinkAPI = false;
static CreateIteratorFunc gCreateIteratorFunc = NULL;
static CreateAPIInformationFunc gCreateAPIInformationFunc = NULL;
static CreateOpenGLScreenPreviewHelperFunc gCreateOpenGLPreviewFunc = NULL;
static CreateVideoConversionInstanceFunc gCreateVideoConversionFunc = NULL;
void InitDeckLinkAPI (void)
{
void *libraryHandle;
libraryHandle = dlopen(kDeckLinkAPI_Name, RTLD_NOW|RTLD_GLOBAL);
if (!libraryHandle)
{
fprintf(stderr, "%s\n", dlerror());
return;
}
gLoadedDeckLinkAPI = true;
gCreateIteratorFunc = (CreateIteratorFunc)dlsym(libraryHandle, "CreateDeckLinkIteratorInstance_0001");
if (!gCreateIteratorFunc)
fprintf(stderr, "%s\n", dlerror());
gCreateAPIInformationFunc = (CreateAPIInformationFunc)dlsym(libraryHandle, "CreateDeckLinkAPIInformationInstance_0001");
if (!gCreateAPIInformationFunc)
fprintf(stderr, "%s\n", dlerror());
gCreateVideoConversionFunc = (CreateVideoConversionInstanceFunc)dlsym(libraryHandle, "CreateVideoConversionInstance_0001");
if (!gCreateVideoConversionFunc)
fprintf(stderr, "%s\n", dlerror());
}
void InitDeckLinkPreviewAPI (void)
{
void *libraryHandle;
libraryHandle = dlopen(KDeckLinkPreviewAPI_Name, RTLD_NOW|RTLD_GLOBAL);
if (!libraryHandle)
{
fprintf(stderr, "%s\n", dlerror());
return;
}
gCreateOpenGLPreviewFunc = (CreateOpenGLScreenPreviewHelperFunc)dlsym(libraryHandle, "CreateOpenGLScreenPreviewHelper_0001");
if (!gCreateOpenGLPreviewFunc)
fprintf(stderr, "%s\n", dlerror());
}
bool IsDeckLinkAPIPresent (void)
{
// If the DeckLink API dynamic library was successfully loaded, return this knowledge to the caller
return gLoadedDeckLinkAPI;
}
IDeckLinkIterator_v8_0* CreateDeckLinkIteratorInstance (void)
{
pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);
if (gCreateIteratorFunc == NULL)
return NULL;
return gCreateIteratorFunc();
}
IDeckLinkAPIInformation* CreateDeckLinkAPIInformationInstance (void)
{
pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);
if (gCreateAPIInformationFunc == NULL)
return NULL;
return gCreateAPIInformationFunc();
}
IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper (void)
{
pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);
pthread_once(&gPreviewOnceControl, InitDeckLinkPreviewAPI);
if (gCreateOpenGLPreviewFunc == NULL)
return NULL;
return gCreateOpenGLPreviewFunc();
}
IDeckLinkVideoConversion* CreateVideoConversionInstance (void)
{
pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);
if (gCreateVideoConversionFunc == NULL)
return NULL;
return gCreateVideoConversionFunc();
}

View File

@@ -1,55 +0,0 @@
/* -LICENSE-START-
** Copyright (c) 2014 Blackmagic Design
**
** Permission is hereby granted, free of charge, to any person or organization
** obtaining a copy of the software and accompanying documentation covered by
** this license (the "Software") to use, reproduce, display, distribute,
** execute, and transmit the Software, and to prepare derivative works of the
** Software, and to permit third-parties to whom the Software is furnished to
** do so, all subject to the following:
**
** The copyright notices in the Software and this entire statement, including
** the above license grant, this restriction and the following disclaimer,
** must be included in all copies of the Software, in whole or in part, and
** all derivative works of the Software, unless such copies or derivative
** works are solely in the form of machine-executable object code generated by
** a source language processor.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
** -LICENSE-END-
*/
#ifndef BMD_DECKLINKAPI_v10_2_H
#define BMD_DECKLINKAPI_v10_2_H
#include "DeckLinkAPI.h"
// Type Declarations
/* Enum BMDDeckLinkConfigurationID - DeckLink Configuration ID */
typedef uint32_t BMDDeckLinkConfigurationID_v10_2;
enum _BMDDeckLinkConfigurationID_v10_2 {
/* Video output flags */
bmdDeckLinkConfig3GBpsVideoOutput_v10_2 = '3gbs',
};
/* Enum BMDAudioConnection_v10_2 - Audio connection types */
typedef uint32_t BMDAudioConnection_v10_2;
enum _BMDAudioConnection_v10_2 {
bmdAudioConnectionEmbedded_v10_2 = /* 'embd' */ 0x656D6264,
bmdAudioConnectionAESEBU_v10_2 = /* 'aes ' */ 0x61657320,
bmdAudioConnectionAnalog_v10_2 = /* 'anlg' */ 0x616E6C67,
bmdAudioConnectionAnalogXLR_v10_2 = /* 'axlr' */ 0x61786C72,
bmdAudioConnectionAnalogRCA_v10_2 = /* 'arca' */ 0x61726361
};
#endif /* defined(BMD_DECKLINKAPI_v10_2_H) */

View File

@@ -1,198 +0,0 @@
/* -LICENSE-START-
** Copyright (c) 2009 Blackmagic Design
**
** Permission is hereby granted, free of charge, to any person or organization
** obtaining a copy of the software and accompanying documentation covered by
** this license (the "Software") to use, reproduce, display, distribute,
** execute, and transmit the Software, and to prepare derivative works of the
** Software, and to permit third-parties to whom the Software is furnished to
** do so, all subject to the following:
**
** The copyright notices in the Software and this entire statement, including
** the above license grant, this restriction and the following disclaimer,
** must be included in all copies of the Software, in whole or in part, and
** all derivative works of the Software, unless such copies or derivative
** works are solely in the form of machine-executable object code generated by
** a source language processor.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
** -LICENSE-END-
*/
/* DeckLinkAPI_v7_1.h */
#ifndef __DeckLink_API_v7_1_h__
#define __DeckLink_API_v7_1_h__
#include "DeckLinkAPI.h"
// "B28131B6-59AC-4857-B5AC-CD75D5883E2F"
#define IID_IDeckLinkDisplayModeIterator_v7_1 (REFIID){0xB2,0x81,0x31,0xB6,0x59,0xAC,0x48,0x57,0xB5,0xAC,0xCD,0x75,0xD5,0x88,0x3E,0x2F}
// "AF0CD6D5-8376-435E-8433-54F9DD530AC3"
#define IID_IDeckLinkDisplayMode_v7_1 (REFIID){0xAF,0x0C,0xD6,0xD5,0x83,0x76,0x43,0x5E,0x84,0x33,0x54,0xF9,0xDD,0x53,0x0A,0xC3}
// "EBD01AFA-E4B0-49C6-A01D-EDB9D1B55FD9"
#define IID_IDeckLinkVideoOutputCallback_v7_1 (REFIID){0xEB,0xD0,0x1A,0xFA,0xE4,0xB0,0x49,0xC6,0xA0,0x1D,0xED,0xB9,0xD1,0xB5,0x5F,0xD9}
// "7F94F328-5ED4-4E9F-9729-76A86BDC99CC"
#define IID_IDeckLinkInputCallback_v7_1 (REFIID){0x7F,0x94,0xF3,0x28,0x5E,0xD4,0x4E,0x9F,0x97,0x29,0x76,0xA8,0x6B,0xDC,0x99,0xCC}
// "AE5B3E9B-4E1E-4535-B6E8-480FF52F6CE5"
#define IID_IDeckLinkOutput_v7_1 (REFIID){0xAE,0x5B,0x3E,0x9B,0x4E,0x1E,0x45,0x35,0xB6,0xE8,0x48,0x0F,0xF5,0x2F,0x6C,0xE5}
// "2B54EDEF-5B32-429F-BA11-BB990596EACD"
#define IID_IDeckLinkInput_v7_1 (REFIID){0x2B,0x54,0xED,0xEF,0x5B,0x32,0x42,0x9F,0xBA,0x11,0xBB,0x99,0x05,0x96,0xEA,0xCD}
// "333F3A10-8C2D-43CF-B79D-46560FEEA1CE"
#define IID_IDeckLinkVideoFrame_v7_1 (REFIID){0x33,0x3F,0x3A,0x10,0x8C,0x2D,0x43,0xCF,0xB7,0x9D,0x46,0x56,0x0F,0xEE,0xA1,0xCE}
// "C8B41D95-8848-40EE-9B37-6E3417FB114B"
#define IID_IDeckLinkVideoInputFrame_v7_1 (REFIID){0xC8,0xB4,0x1D,0x95,0x88,0x48,0x40,0xEE,0x9B,0x37,0x6E,0x34,0x17,0xFB,0x11,0x4B}
// "C86DE4F6-A29F-42E3-AB3A-1363E29F0788"
#define IID_IDeckLinkAudioInputPacket_v7_1 (REFIID){0xC8,0x6D,0xE4,0xF6,0xA2,0x9F,0x42,0xE3,0xAB,0x3A,0x13,0x63,0xE2,0x9F,0x07,0x88}
#if defined(__cplusplus)
class IDeckLinkDisplayModeIterator_v7_1;
class IDeckLinkDisplayMode_v7_1;
class IDeckLinkVideoFrame_v7_1;
class IDeckLinkVideoInputFrame_v7_1;
class IDeckLinkAudioInputPacket_v7_1;
class IDeckLinkDisplayModeIterator_v7_1 : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE Next (IDeckLinkDisplayMode_v7_1* *deckLinkDisplayMode) = 0;
};
class IDeckLinkDisplayMode_v7_1 : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE GetName (const char **name) = 0;
virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode () = 0;
virtual long STDMETHODCALLTYPE GetWidth () = 0;
virtual long STDMETHODCALLTYPE GetHeight () = 0;
virtual HRESULT STDMETHODCALLTYPE GetFrameRate (BMDTimeValue *frameDuration, BMDTimeScale *timeScale) = 0;
};
class IDeckLinkVideoOutputCallback_v7_1 : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted (IDeckLinkVideoFrame_v7_1* completedFrame, BMDOutputFrameCompletionResult result) = 0;
};
class IDeckLinkInputCallback_v7_1 : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived (IDeckLinkVideoInputFrame_v7_1* videoFrame, IDeckLinkAudioInputPacket_v7_1* audioPacket) = 0;
};
// IDeckLinkOutput_v7_1. Created by QueryInterface from IDeckLink.
class IDeckLinkOutput_v7_1 : public IUnknown
{
public:
// Display mode predicates
virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDDisplayModeSupport *result) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator (IDeckLinkDisplayModeIterator_v7_1* *iterator) = 0;
// Video output
virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput (BMDDisplayMode displayMode) = 0;
virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput () = 0;
virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator (IDeckLinkMemoryAllocator* theAllocator) = 0;
virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame (int32_t width, int32_t height, int32_t rowBytes, BMDPixelFormat pixelFormat, BMDFrameFlags flags, IDeckLinkVideoFrame_v7_1* *outFrame) = 0;
virtual HRESULT STDMETHODCALLTYPE CreateVideoFrameFromBuffer (void* buffer, int32_t width, int32_t height, int32_t rowBytes, BMDPixelFormat pixelFormat, BMDFrameFlags flags, IDeckLinkVideoFrame_v7_1* *outFrame) = 0;
virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync (IDeckLinkVideoFrame_v7_1* theFrame) = 0;
virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame (IDeckLinkVideoFrame_v7_1* theFrame, BMDTimeValue displayTime, BMDTimeValue displayDuration, BMDTimeScale timeScale) = 0;
virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback (IDeckLinkVideoOutputCallback_v7_1* theCallback) = 0;
// Audio output
virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput (BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, uint32_t channelCount) = 0;
virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput () = 0;
virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync (void* buffer, uint32_t sampleFrameCount, uint32_t *sampleFramesWritten) = 0;
virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll () = 0;
virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll () = 0;
virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples (void* buffer, uint32_t sampleFrameCount, BMDTimeValue streamTime, BMDTimeScale timeScale, uint32_t *sampleFramesWritten) = 0;
virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount (uint32_t *bufferedSampleCount) = 0;
virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples () = 0;
virtual HRESULT STDMETHODCALLTYPE SetAudioCallback (IDeckLinkAudioOutputCallback* theCallback) = 0;
// Output control
virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback (BMDTimeValue playbackStartTime, BMDTimeScale timeScale, double playbackSpeed) = 0;
virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback (BMDTimeValue stopPlaybackAtTime, BMDTimeValue *actualStopTime, BMDTimeScale timeScale) = 0;
virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock (BMDTimeScale desiredTimeScale, BMDTimeValue *elapsedTimeSinceSchedulerBegan) = 0;
};
// IDeckLinkInput_v7_1. Created by QueryInterface from IDeckLink.
class IDeckLinkInput_v7_1 : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDDisplayModeSupport *result) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator (IDeckLinkDisplayModeIterator_v7_1 **iterator) = 0;
// Video input
virtual HRESULT STDMETHODCALLTYPE EnableVideoInput (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDVideoInputFlags flags) = 0;
virtual HRESULT STDMETHODCALLTYPE DisableVideoInput () = 0;
// Audio input
virtual HRESULT STDMETHODCALLTYPE EnableAudioInput (BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, uint32_t channelCount) = 0;
virtual HRESULT STDMETHODCALLTYPE DisableAudioInput () = 0;
virtual HRESULT STDMETHODCALLTYPE ReadAudioSamples (void* buffer, uint32_t sampleFrameCount, uint32_t *sampleFramesRead, BMDTimeValue *audioPacketTime, BMDTimeScale timeScale) = 0;
virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount (uint32_t *bufferedSampleCount) = 0;
// Input control
virtual HRESULT STDMETHODCALLTYPE StartStreams () = 0;
virtual HRESULT STDMETHODCALLTYPE StopStreams () = 0;
virtual HRESULT STDMETHODCALLTYPE PauseStreams () = 0;
virtual HRESULT STDMETHODCALLTYPE SetCallback (IDeckLinkInputCallback_v7_1* theCallback) = 0;
};
// IDeckLinkVideoFrame_v7_1. Created by IDeckLinkOutput::CreateVideoFrame.
class IDeckLinkVideoFrame_v7_1 : public IUnknown
{
public:
virtual long STDMETHODCALLTYPE GetWidth () = 0;
virtual long STDMETHODCALLTYPE GetHeight () = 0;
virtual long STDMETHODCALLTYPE GetRowBytes () = 0;
virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat () = 0;
virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags () = 0;
virtual HRESULT STDMETHODCALLTYPE GetBytes (void* *buffer) = 0;
};
// IDeckLinkVideoInputFrame_v7_1. Provided by the IDeckLinkInput_v7_1 frame arrival callback.
class IDeckLinkVideoInputFrame_v7_1 : public IDeckLinkVideoFrame_v7_1
{
public:
virtual HRESULT STDMETHODCALLTYPE GetFrameTime (BMDTimeValue *frameTime, BMDTimeValue *frameDuration, BMDTimeScale timeScale) = 0;
};
// IDeckLinkAudioInputPacket_v7_1. Provided by the IDeckLinkInput_v7_1 callback.
class IDeckLinkAudioInputPacket_v7_1 : public IUnknown
{
public:
virtual long STDMETHODCALLTYPE GetSampleCount () = 0;
virtual HRESULT STDMETHODCALLTYPE GetBytes (void* *buffer) = 0;
virtual HRESULT STDMETHODCALLTYPE GetAudioPacketTime (BMDTimeValue *packetTime, BMDTimeScale timeScale) = 0;
};
#endif // defined(__cplusplus)
#endif // __DeckLink_API_v7_1_h__

View File

@@ -1,173 +0,0 @@
/* -LICENSE-START-
** Copyright (c) 2009 Blackmagic Design
**
** Permission is hereby granted, free of charge, to any person or organization
** obtaining a copy of the software and accompanying documentation covered by
** this license (the "Software") to use, reproduce, display, distribute,
** execute, and transmit the Software, and to prepare derivative works of the
** Software, and to permit third-parties to whom the Software is furnished to
** do so, all subject to the following:
**
** The copyright notices in the Software and this entire statement, including
** the above license grant, this restriction and the following disclaimer,
** must be included in all copies of the Software, in whole or in part, and
** all derivative works of the Software, unless such copies or derivative
** works are solely in the form of machine-executable object code generated by
** a source language processor.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
** -LICENSE-END-
*/
/* DeckLinkAPI_v7_3.h */
#ifndef __DeckLink_API_v7_3_h__
#define __DeckLink_API_v7_3_h__
#include "DeckLinkAPI.h"
#include "DeckLinkAPI_v7_6.h"
/* Interface ID Declarations */
#define IID_IDeckLinkInputCallback_v7_3 /* FD6F311D-4D00-444B-9ED4-1F25B5730AD0 */ (REFIID){0xFD,0x6F,0x31,0x1D,0x4D,0x00,0x44,0x4B,0x9E,0xD4,0x1F,0x25,0xB5,0x73,0x0A,0xD0}
#define IID_IDeckLinkOutput_v7_3 /* 271C65E3-C323-4344-A30F-D908BCB20AA3 */ (REFIID){0x27,0x1C,0x65,0xE3,0xC3,0x23,0x43,0x44,0xA3,0x0F,0xD9,0x08,0xBC,0xB2,0x0A,0xA3}
#define IID_IDeckLinkInput_v7_3 /* 4973F012-9925-458C-871C-18774CDBBECB */ (REFIID){0x49,0x73,0xF0,0x12,0x99,0x25,0x45,0x8C,0x87,0x1C,0x18,0x77,0x4C,0xDB,0xBE,0xCB}
#define IID_IDeckLinkVideoInputFrame_v7_3 /* CF317790-2894-11DE-8C30-0800200C9A66 */ (REFIID){0xCF,0x31,0x77,0x90,0x28,0x94,0x11,0xDE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66}
/* End Interface ID Declarations */
#if defined(__cplusplus)
/* Forward Declarations */
class IDeckLinkVideoInputFrame_v7_3;
/* End Forward Declarations */
/* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */
class IDeckLinkOutput_v7_3 : public IUnknown
{
public:
virtual HRESULT DoesSupportVideoMode (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, /* out */ BMDDisplayModeSupport *result) = 0;
virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0;
virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;
/* Video Output */
virtual HRESULT EnableVideoOutput (BMDDisplayMode displayMode, BMDVideoOutputFlags flags) = 0;
virtual HRESULT DisableVideoOutput (void) = 0;
virtual HRESULT SetVideoOutputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0;
virtual HRESULT CreateVideoFrame (int32_t width, int32_t height, int32_t rowBytes, BMDPixelFormat pixelFormat, BMDFrameFlags flags, /* out */ IDeckLinkMutableVideoFrame_v7_6 **outFrame) = 0;
virtual HRESULT CreateAncillaryData (BMDPixelFormat pixelFormat, /* out */ IDeckLinkVideoFrameAncillary **outBuffer) = 0;
virtual HRESULT DisplayVideoFrameSync (/* in */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0;
virtual HRESULT ScheduleVideoFrame (/* in */ IDeckLinkVideoFrame_v7_6 *theFrame, BMDTimeValue displayTime, BMDTimeValue displayDuration, BMDTimeScale timeScale) = 0;
virtual HRESULT SetScheduledFrameCompletionCallback (/* in */ IDeckLinkVideoOutputCallback *theCallback) = 0;
virtual HRESULT GetBufferedVideoFrameCount (/* out */ uint32_t *bufferedFrameCount) = 0;
/* Audio Output */
virtual HRESULT EnableAudioOutput (BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, uint32_t channelCount, BMDAudioOutputStreamType streamType) = 0;
virtual HRESULT DisableAudioOutput (void) = 0;
virtual HRESULT WriteAudioSamplesSync (/* in */ void *buffer, uint32_t sampleFrameCount, /* out */ uint32_t *sampleFramesWritten) = 0;
virtual HRESULT BeginAudioPreroll (void) = 0;
virtual HRESULT EndAudioPreroll (void) = 0;
virtual HRESULT ScheduleAudioSamples (/* in */ void *buffer, uint32_t sampleFrameCount, BMDTimeValue streamTime, BMDTimeScale timeScale, /* out */ uint32_t *sampleFramesWritten) = 0;
virtual HRESULT GetBufferedAudioSampleFrameCount (/* out */ uint32_t *bufferedSampleFrameCount) = 0;
virtual HRESULT FlushBufferedAudioSamples (void) = 0;
virtual HRESULT SetAudioCallback (/* in */ IDeckLinkAudioOutputCallback *theCallback) = 0;
/* Output Control */
virtual HRESULT StartScheduledPlayback (BMDTimeValue playbackStartTime, BMDTimeScale timeScale, double playbackSpeed) = 0;
virtual HRESULT StopScheduledPlayback (BMDTimeValue stopPlaybackAtTime, /* out */ BMDTimeValue *actualStopTime, BMDTimeScale timeScale) = 0;
virtual HRESULT IsScheduledPlaybackRunning (/* out */ bool *active) = 0;
virtual HRESULT GetHardwareReferenceClock (BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *elapsedTimeSinceSchedulerBegan) = 0;
protected:
virtual ~IDeckLinkOutput_v7_3 () {}; // call Release method to drop reference count
};
/* End Interface IDeckLinkOutput */
/* Interface IDeckLinkInputCallback - Frame arrival callback. */
class IDeckLinkInputCallback_v7_3 : public IUnknown
{
public:
virtual HRESULT VideoInputFormatChanged (/* in */ BMDVideoInputFormatChangedEvents notificationEvents, /* in */ IDeckLinkDisplayMode_v7_6 *newDisplayMode, /* in */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0;
virtual HRESULT VideoInputFrameArrived (/* in */ IDeckLinkVideoInputFrame_v7_3 *videoFrame, /* in */ IDeckLinkAudioInputPacket *audioPacket) = 0;
protected:
virtual ~IDeckLinkInputCallback_v7_3 () {}; // call Release method to drop reference count
};
/* End Interface IDeckLinkInputCallback */
/* Interface IDeckLinkInput - Created by QueryInterface from IDeckLink. */
class IDeckLinkInput_v7_3 : public IUnknown
{
public:
virtual HRESULT DoesSupportVideoMode (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, /* out */ BMDDisplayModeSupport *result) = 0;
virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0;
virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;
/* Video Input */
virtual HRESULT EnableVideoInput (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDVideoInputFlags flags) = 0;
virtual HRESULT DisableVideoInput (void) = 0;
virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t *availableFrameCount) = 0;
/* Audio Input */
virtual HRESULT EnableAudioInput (BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, uint32_t channelCount) = 0;
virtual HRESULT DisableAudioInput (void) = 0;
virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t *availableSampleFrameCount) = 0;
/* Input Control */
virtual HRESULT StartStreams (void) = 0;
virtual HRESULT StopStreams (void) = 0;
virtual HRESULT PauseStreams (void) = 0;
virtual HRESULT FlushStreams (void) = 0;
virtual HRESULT SetCallback (/* in */ IDeckLinkInputCallback_v7_3 *theCallback) = 0;
protected:
virtual ~IDeckLinkInput_v7_3 () {}; // call Release method to drop reference count
};
/* End Interface IDeckLinkInput */
/* Interface IDeckLinkVideoInputFrame - Provided by the IDeckLinkVideoInput frame arrival callback. */
class IDeckLinkVideoInputFrame_v7_3 : public IDeckLinkVideoFrame_v7_6
{
public:
virtual HRESULT GetStreamTime (/* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration, BMDTimeScale timeScale) = 0;
protected:
virtual ~IDeckLinkVideoInputFrame_v7_3 () {}; // call Release method to drop reference count
};
/* End Interface IDeckLinkVideoInputFrame */
#endif // defined(__cplusplus)
#endif // __DeckLink_API_v7_3_h__

View File

@@ -1,404 +0,0 @@
/* -LICENSE-START-
** Copyright (c) 2009 Blackmagic Design
**
** Permission is hereby granted, free of charge, to any person or organization
** obtaining a copy of the software and accompanying documentation covered by
** this license (the "Software") to use, reproduce, display, distribute,
** execute, and transmit the Software, and to prepare derivative works of the
** Software, and to permit third-parties to whom the Software is furnished to
** do so, all subject to the following:
**
** The copyright notices in the Software and this entire statement, including
** the above license grant, this restriction and the following disclaimer,
** must be included in all copies of the Software, in whole or in part, and
** all derivative works of the Software, unless such copies or derivative
** works are solely in the form of machine-executable object code generated by
** a source language processor.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
** -LICENSE-END-
*/
/* DeckLinkAPI_v7_6.h */
#ifndef __DeckLink_API_v7_6_h__
#define __DeckLink_API_v7_6_h__
#include "DeckLinkAPI.h"
// Interface ID Declarations
#define IID_IDeckLinkVideoOutputCallback_v7_6 /* E763A626-4A3C-49D1-BF13-E7AD3692AE52 */ (REFIID){0xE7,0x63,0xA6,0x26,0x4A,0x3C,0x49,0xD1,0xBF,0x13,0xE7,0xAD,0x36,0x92,0xAE,0x52}
#define IID_IDeckLinkInputCallback_v7_6 /* 31D28EE7-88B6-4CB1-897A-CDBF79A26414 */ (REFIID){0x31,0xD2,0x8E,0xE7,0x88,0xB6,0x4C,0xB1,0x89,0x7A,0xCD,0xBF,0x79,0xA2,0x64,0x14}
#define IID_IDeckLinkDisplayModeIterator_v7_6 /* 455D741F-1779-4800-86F5-0B5D13D79751 */ (REFIID){0x45,0x5D,0x74,0x1F,0x17,0x79,0x48,0x00,0x86,0xF5,0x0B,0x5D,0x13,0xD7,0x97,0x51}
#define IID_IDeckLinkDisplayMode_v7_6 /* 87451E84-2B7E-439E-A629-4393EA4A8550 */ (REFIID){0x87,0x45,0x1E,0x84,0x2B,0x7E,0x43,0x9E,0xA6,0x29,0x43,0x93,0xEA,0x4A,0x85,0x50}
#define IID_IDeckLinkOutput_v7_6 /* 29228142-EB8C-4141-A621-F74026450955 */ (REFIID){0x29,0x22,0x81,0x42,0xEB,0x8C,0x41,0x41,0xA6,0x21,0xF7,0x40,0x26,0x45,0x09,0x55}
#define IID_IDeckLinkInput_v7_6 /* 300C135A-9F43-48E2-9906-6D7911D93CF1 */ (REFIID){0x30,0x0C,0x13,0x5A,0x9F,0x43,0x48,0xE2,0x99,0x06,0x6D,0x79,0x11,0xD9,0x3C,0xF1}
#define IID_IDeckLinkTimecode_v7_6 /* EFB9BCA6-A521-44F7-BD69-2332F24D9EE6 */ (REFIID){0xEF,0xB9,0xBC,0xA6,0xA5,0x21,0x44,0xF7,0xBD,0x69,0x23,0x32,0xF2,0x4D,0x9E,0xE6}
#define IID_IDeckLinkVideoFrame_v7_6 /* A8D8238E-6B18-4196-99E1-5AF717B83D32 */ (REFIID){0xA8,0xD8,0x23,0x8E,0x6B,0x18,0x41,0x96,0x99,0xE1,0x5A,0xF7,0x17,0xB8,0x3D,0x32}
#define IID_IDeckLinkMutableVideoFrame_v7_6 /* 46FCEE00-B4E6-43D0-91C0-023A7FCEB34F */ (REFIID){0x46,0xFC,0xEE,0x00,0xB4,0xE6,0x43,0xD0,0x91,0xC0,0x02,0x3A,0x7F,0xCE,0xB3,0x4F}
#define IID_IDeckLinkVideoInputFrame_v7_6 /* 9A74FA41-AE9F-47AC-8CF4-01F42DD59965 */ (REFIID){0x9A,0x74,0xFA,0x41,0xAE,0x9F,0x47,0xAC,0x8C,0xF4,0x01,0xF4,0x2D,0xD5,0x99,0x65}
#define IID_IDeckLinkScreenPreviewCallback_v7_6 /* 373F499D-4B4D-4518-AD22-6354E5A5825E */ (REFIID){0x37,0x3F,0x49,0x9D,0x4B,0x4D,0x45,0x18,0xAD,0x22,0x63,0x54,0xE5,0xA5,0x82,0x5E}
#define IID_IDeckLinkGLScreenPreviewHelper_v7_6 /* BA575CD9-A15E-497B-B2C2-F9AFE7BE4EBA */ (REFIID){0xBA,0x57,0x5C,0xD9,0xA1,0x5E,0x49,0x7B,0xB2,0xC2,0xF9,0xAF,0xE7,0xBE,0x4E,0xBA}
#define IID_IDeckLinkVideoConversion_v7_6 /* 3EB504C9-F97D-40FE-A158-D407D48CB53B */ (REFIID){0x3E,0xB5,0x04,0xC9,0xF9,0x7D,0x40,0xFE,0xA1,0x58,0xD4,0x07,0xD4,0x8C,0xB5,0x3B}
#define IID_IDeckLinkConfiguration_v7_6 /* B8EAD569-B764-47F0-A73F-AE40DF6CBF10 */ (REFIID){0xB8,0xEA,0xD5,0x69,0xB7,0x64,0x47,0xF0,0xA7,0x3F,0xAE,0x40,0xDF,0x6C,0xBF,0x10}
#if defined(__cplusplus)
/* Enum BMDVideoConnection - Video connection types */
typedef uint32_t BMDVideoConnection_v7_6;
enum _BMDVideoConnection_v7_6 {
bmdVideoConnectionSDI_v7_6 = 'sdi ',
bmdVideoConnectionHDMI_v7_6 = 'hdmi',
bmdVideoConnectionOpticalSDI_v7_6 = 'opti',
bmdVideoConnectionComponent_v7_6 = 'cpnt',
bmdVideoConnectionComposite_v7_6 = 'cmst',
bmdVideoConnectionSVideo_v7_6 = 'svid'
};
// Forward Declarations
class IDeckLinkVideoOutputCallback_v7_6;
class IDeckLinkInputCallback_v7_6;
class IDeckLinkDisplayModeIterator_v7_6;
class IDeckLinkDisplayMode_v7_6;
class IDeckLinkOutput_v7_6;
class IDeckLinkInput_v7_6;
class IDeckLinkTimecode_v7_6;
class IDeckLinkVideoFrame_v7_6;
class IDeckLinkMutableVideoFrame_v7_6;
class IDeckLinkVideoInputFrame_v7_6;
class IDeckLinkScreenPreviewCallback_v7_6;
class IDeckLinkGLScreenPreviewHelper_v7_6;
class IDeckLinkVideoConversion_v7_6;
/* Interface IDeckLinkVideoOutputCallback - Frame completion callback. */
class IDeckLinkVideoOutputCallback_v7_6 : public IUnknown
{
public:
virtual HRESULT ScheduledFrameCompleted (/* in */ IDeckLinkVideoFrame_v7_6 *completedFrame, /* in */ BMDOutputFrameCompletionResult result) = 0;
virtual HRESULT ScheduledPlaybackHasStopped (void) = 0;
protected:
virtual ~IDeckLinkVideoOutputCallback_v7_6 () {}; // call Release method to drop reference count
};
/* Interface IDeckLinkInputCallback - Frame arrival callback. */
class IDeckLinkInputCallback_v7_6 : public IUnknown
{
public:
virtual HRESULT VideoInputFormatChanged (/* in */ BMDVideoInputFormatChangedEvents notificationEvents, /* in */ IDeckLinkDisplayMode_v7_6 *newDisplayMode, /* in */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0;
virtual HRESULT VideoInputFrameArrived (/* in */ IDeckLinkVideoInputFrame_v7_6* videoFrame, /* in */ IDeckLinkAudioInputPacket* audioPacket) = 0;
protected:
virtual ~IDeckLinkInputCallback_v7_6 () {}; // call Release method to drop reference count
};
/* Interface IDeckLinkDisplayModeIterator - enumerates over supported input/output display modes. */
class IDeckLinkDisplayModeIterator_v7_6 : public IUnknown
{
public:
virtual HRESULT Next (/* out */ IDeckLinkDisplayMode_v7_6 **deckLinkDisplayMode) = 0;
protected:
virtual ~IDeckLinkDisplayModeIterator_v7_6 () {}; // call Release method to drop reference count
};
/* Interface IDeckLinkDisplayMode - represents a display mode */
class IDeckLinkDisplayMode_v7_6 : public IUnknown
{
public:
virtual HRESULT GetName (/* out */ const char **name) = 0;
virtual BMDDisplayMode GetDisplayMode (void) = 0;
virtual long GetWidth (void) = 0;
virtual long GetHeight (void) = 0;
virtual HRESULT GetFrameRate (/* out */ BMDTimeValue *frameDuration, /* out */ BMDTimeScale *timeScale) = 0;
virtual BMDFieldDominance GetFieldDominance (void) = 0;
protected:
virtual ~IDeckLinkDisplayMode_v7_6 () {}; // call Release method to drop reference count
};
/* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */
class IDeckLinkOutput_v7_6 : public IUnknown
{
public:
virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* out */ BMDDisplayModeSupport *result) = 0;
virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0;
virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback) = 0;
/* Video Output */
virtual HRESULT EnableVideoOutput (/* in */ BMDDisplayMode displayMode, /* in */ BMDVideoOutputFlags flags) = 0;
virtual HRESULT DisableVideoOutput (void) = 0;
virtual HRESULT SetVideoOutputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0;
virtual HRESULT CreateVideoFrame (/* in */ int32_t width, /* in */ int32_t height, /* in */ int32_t rowBytes, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDFrameFlags flags, /* out */ IDeckLinkMutableVideoFrame_v7_6 **outFrame) = 0;
virtual HRESULT CreateAncillaryData (/* in */ BMDPixelFormat pixelFormat, /* out */ IDeckLinkVideoFrameAncillary **outBuffer) = 0;
virtual HRESULT DisplayVideoFrameSync (/* in */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0;
virtual HRESULT ScheduleVideoFrame (/* in */ IDeckLinkVideoFrame_v7_6 *theFrame, /* in */ BMDTimeValue displayTime, /* in */ BMDTimeValue displayDuration, /* in */ BMDTimeScale timeScale) = 0;
virtual HRESULT SetScheduledFrameCompletionCallback (/* in */ IDeckLinkVideoOutputCallback_v7_6 *theCallback) = 0;
virtual HRESULT GetBufferedVideoFrameCount (/* out */ uint32_t *bufferedFrameCount) = 0;
/* Audio Output */
virtual HRESULT EnableAudioOutput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount, /* in */ BMDAudioOutputStreamType streamType) = 0;
virtual HRESULT DisableAudioOutput (void) = 0;
virtual HRESULT WriteAudioSamplesSync (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* out */ uint32_t *sampleFramesWritten) = 0;
virtual HRESULT BeginAudioPreroll (void) = 0;
virtual HRESULT EndAudioPreroll (void) = 0;
virtual HRESULT ScheduleAudioSamples (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* in */ BMDTimeValue streamTime, /* in */ BMDTimeScale timeScale, /* out */ uint32_t *sampleFramesWritten) = 0;
virtual HRESULT GetBufferedAudioSampleFrameCount (/* out */ uint32_t *bufferedSampleFrameCount) = 0;
virtual HRESULT FlushBufferedAudioSamples (void) = 0;
virtual HRESULT SetAudioCallback (/* in */ IDeckLinkAudioOutputCallback *theCallback) = 0;
/* Output Control */
virtual HRESULT StartScheduledPlayback (/* in */ BMDTimeValue playbackStartTime, /* in */ BMDTimeScale timeScale, /* in */ double playbackSpeed) = 0;
virtual HRESULT StopScheduledPlayback (/* in */ BMDTimeValue stopPlaybackAtTime, /* out */ BMDTimeValue *actualStopTime, /* in */ BMDTimeScale timeScale) = 0;
virtual HRESULT IsScheduledPlaybackRunning (/* out */ bool *active) = 0;
virtual HRESULT GetScheduledStreamTime (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *streamTime, /* out */ double *playbackSpeed) = 0;
/* Hardware Timing */
virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0;
protected:
virtual ~IDeckLinkOutput_v7_6 () {}; // call Release method to drop reference count
};
/* Interface IDeckLinkInput_v7_6 - Created by QueryInterface from IDeckLink. */
class IDeckLinkInput_v7_6 : public IUnknown
{
public:
virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* out */ BMDDisplayModeSupport *result) = 0;
virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0;
virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback) = 0;
/* Video Input */
virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0;
virtual HRESULT DisableVideoInput (void) = 0;
virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t *availableFrameCount) = 0;
/* Audio Input */
virtual HRESULT EnableAudioInput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount) = 0;
virtual HRESULT DisableAudioInput (void) = 0;
virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t *availableSampleFrameCount) = 0;
/* Input Control */
virtual HRESULT StartStreams (void) = 0;
virtual HRESULT StopStreams (void) = 0;
virtual HRESULT PauseStreams (void) = 0;
virtual HRESULT FlushStreams (void) = 0;
virtual HRESULT SetCallback (/* in */ IDeckLinkInputCallback_v7_6 *theCallback) = 0;
/* Hardware Timing */
virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0;
protected:
virtual ~IDeckLinkInput_v7_6 () {}; // call Release method to drop reference count
};
/* Interface IDeckLinkTimecode - Used for video frame timecode representation. */
class IDeckLinkTimecode_v7_6 : public IUnknown
{
public:
virtual BMDTimecodeBCD GetBCD (void) = 0;
virtual HRESULT GetComponents (/* out */ uint8_t *hours, /* out */ uint8_t *minutes, /* out */ uint8_t *seconds, /* out */ uint8_t *frames) = 0;
virtual HRESULT GetString (/* out */ const char **timecode) = 0;
virtual BMDTimecodeFlags GetFlags (void) = 0;
protected:
virtual ~IDeckLinkTimecode_v7_6 () {}; // call Release method to drop reference count
};
/* Interface IDeckLinkVideoFrame - Interface to encapsulate a video frame; can be caller-implemented. */
class IDeckLinkVideoFrame_v7_6 : public IUnknown
{
public:
virtual long GetWidth (void) = 0;
virtual long GetHeight (void) = 0;
virtual long GetRowBytes (void) = 0;
virtual BMDPixelFormat GetPixelFormat (void) = 0;
virtual BMDFrameFlags GetFlags (void) = 0;
virtual HRESULT GetBytes (/* out */ void **buffer) = 0;
virtual HRESULT GetTimecode (BMDTimecodeFormat format, /* out */ IDeckLinkTimecode_v7_6 **timecode) = 0;
virtual HRESULT GetAncillaryData (/* out */ IDeckLinkVideoFrameAncillary **ancillary) = 0;
protected:
virtual ~IDeckLinkVideoFrame_v7_6 () {}; // call Release method to drop reference count
};
/* Interface IDeckLinkMutableVideoFrame - Created by IDeckLinkOutput::CreateVideoFrame. */
class IDeckLinkMutableVideoFrame_v7_6 : public IDeckLinkVideoFrame_v7_6
{
public:
virtual HRESULT SetFlags (BMDFrameFlags newFlags) = 0;
virtual HRESULT SetTimecode (BMDTimecodeFormat format, /* in */ IDeckLinkTimecode_v7_6 *timecode) = 0;
virtual HRESULT SetTimecodeFromComponents (BMDTimecodeFormat format, uint8_t hours, uint8_t minutes, uint8_t seconds, uint8_t frames, BMDTimecodeFlags flags) = 0;
virtual HRESULT SetAncillaryData (/* in */ IDeckLinkVideoFrameAncillary *ancillary) = 0;
protected:
virtual ~IDeckLinkMutableVideoFrame_v7_6 () {}; // call Release method to drop reference count
};
/* Interface IDeckLinkVideoInputFrame - Provided by the IDeckLinkVideoInput frame arrival callback. */
class IDeckLinkVideoInputFrame_v7_6 : public IDeckLinkVideoFrame_v7_6
{
public:
virtual HRESULT GetStreamTime (/* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration, BMDTimeScale timeScale) = 0;
virtual HRESULT GetHardwareReferenceTimestamp (BMDTimeScale timeScale, /* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration) = 0;
protected:
virtual ~IDeckLinkVideoInputFrame_v7_6 () {}; // call Release method to drop reference count
};
/* Interface IDeckLinkScreenPreviewCallback - Screen preview callback */
class IDeckLinkScreenPreviewCallback_v7_6 : public IUnknown
{
public:
virtual HRESULT DrawFrame (/* in */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0;
protected:
virtual ~IDeckLinkScreenPreviewCallback_v7_6 () {}; // call Release method to drop reference count
};
/* Interface IDeckLinkGLScreenPreviewHelper - Created with CoCreateInstance(). */
class IDeckLinkGLScreenPreviewHelper_v7_6 : public IUnknown
{
public:
/* Methods must be called with OpenGL context set */
virtual HRESULT InitializeGL (void) = 0;
virtual HRESULT PaintGL (void) = 0;
virtual HRESULT SetFrame (/* in */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0;
protected:
virtual ~IDeckLinkGLScreenPreviewHelper_v7_6 () {}; // call Release method to drop reference count
};
/* Interface IDeckLinkVideoConversion - Created with CoCreateInstance(). */
class IDeckLinkVideoConversion_v7_6 : public IUnknown
{
public:
virtual HRESULT ConvertFrame (/* in */ IDeckLinkVideoFrame_v7_6* srcFrame, /* in */ IDeckLinkVideoFrame_v7_6* dstFrame) = 0;
protected:
virtual ~IDeckLinkVideoConversion_v7_6 () {}; // call Release method to drop reference count
};
/* Interface IDeckLinkConfiguration - Created by QueryInterface from IDeckLink. */
class IDeckLinkConfiguration_v7_6 : public IUnknown
{
public:
virtual HRESULT GetConfigurationValidator (/* out */ IDeckLinkConfiguration_v7_6 **configObject) = 0;
virtual HRESULT WriteConfigurationToPreferences (void) = 0;
/* Video Output Configuration */
virtual HRESULT SetVideoOutputFormat (/* in */ BMDVideoConnection_v7_6 videoOutputConnection) = 0;
virtual HRESULT IsVideoOutputActive (/* in */ BMDVideoConnection_v7_6 videoOutputConnection, /* out */ bool *active) = 0;
virtual HRESULT SetAnalogVideoOutputFlags (/* in */ BMDAnalogVideoFlags analogVideoFlags) = 0;
virtual HRESULT GetAnalogVideoOutputFlags (/* out */ BMDAnalogVideoFlags *analogVideoFlags) = 0;
virtual HRESULT EnableFieldFlickerRemovalWhenPaused (/* in */ bool enable) = 0;
virtual HRESULT IsEnabledFieldFlickerRemovalWhenPaused (/* out */ bool *enabled) = 0;
virtual HRESULT Set444And3GBpsVideoOutput (/* in */ bool enable444VideoOutput, /* in */ bool enable3GbsOutput) = 0;
virtual HRESULT Get444And3GBpsVideoOutput (/* out */ bool *is444VideoOutputEnabled, /* out */ bool *threeGbsOutputEnabled) = 0;
virtual HRESULT SetVideoOutputConversionMode (/* in */ BMDVideoOutputConversionMode conversionMode) = 0;
virtual HRESULT GetVideoOutputConversionMode (/* out */ BMDVideoOutputConversionMode *conversionMode) = 0;
virtual HRESULT Set_HD1080p24_to_HD1080i5994_Conversion (/* in */ bool enable) = 0;
virtual HRESULT Get_HD1080p24_to_HD1080i5994_Conversion (/* out */ bool *enabled) = 0;
/* Video Input Configuration */
virtual HRESULT SetVideoInputFormat (/* in */ BMDVideoConnection_v7_6 videoInputFormat) = 0;
virtual HRESULT GetVideoInputFormat (/* out */ BMDVideoConnection_v7_6 *videoInputFormat) = 0;
virtual HRESULT SetAnalogVideoInputFlags (/* in */ BMDAnalogVideoFlags analogVideoFlags) = 0;
virtual HRESULT GetAnalogVideoInputFlags (/* out */ BMDAnalogVideoFlags *analogVideoFlags) = 0;
virtual HRESULT SetVideoInputConversionMode (/* in */ BMDVideoInputConversionMode conversionMode) = 0;
virtual HRESULT GetVideoInputConversionMode (/* out */ BMDVideoInputConversionMode *conversionMode) = 0;
virtual HRESULT SetBlackVideoOutputDuringCapture (/* in */ bool blackOutInCapture) = 0;
virtual HRESULT GetBlackVideoOutputDuringCapture (/* out */ bool *blackOutInCapture) = 0;
virtual HRESULT Set32PulldownSequenceInitialTimecodeFrame (/* in */ uint32_t aFrameTimecode) = 0;
virtual HRESULT Get32PulldownSequenceInitialTimecodeFrame (/* out */ uint32_t *aFrameTimecode) = 0;
virtual HRESULT SetVancSourceLineMapping (/* in */ uint32_t activeLine1VANCsource, /* in */ uint32_t activeLine2VANCsource, /* in */ uint32_t activeLine3VANCsource) = 0;
virtual HRESULT GetVancSourceLineMapping (/* out */ uint32_t *activeLine1VANCsource, /* out */ uint32_t *activeLine2VANCsource, /* out */ uint32_t *activeLine3VANCsource) = 0;
/* Audio Input Configuration */
virtual HRESULT SetAudioInputFormat (/* in */ BMDAudioConnection audioInputFormat) = 0;
virtual HRESULT GetAudioInputFormat (/* out */ BMDAudioConnection *audioInputFormat) = 0;
};
/* Functions */
extern "C" {
IDeckLinkIterator* CreateDeckLinkIteratorInstance_v7_6 (void);
IDeckLinkGLScreenPreviewHelper_v7_6* CreateOpenGLScreenPreviewHelper_v7_6 (void);
IDeckLinkVideoConversion_v7_6* CreateVideoConversionInstance_v7_6 (void);
};
#endif // defined(__cplusplus)
#endif // __DeckLink_API_v7_6_h__

View File

@@ -1,88 +0,0 @@
/* -LICENSE-START-
** Copyright (c) 2010 Blackmagic Design
**
** Permission is hereby granted, free of charge, to any person or organization
** obtaining a copy of the software and accompanying documentation covered by
** this license (the "Software") to use, reproduce, display, distribute,
** execute, and transmit the Software, and to prepare derivative works of the
** Software, and to permit third-parties to whom the Software is furnished to
** do so, all subject to the following:
**
** The copyright notices in the Software and this entire statement, including
** the above license grant, this restriction and the following disclaimer,
** must be included in all copies of the Software, in whole or in part, and
** all derivative works of the Software, unless such copies or derivative
** works are solely in the form of machine-executable object code generated by
** a source language processor.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
** -LICENSE-END-
*/
/* DeckLinkAPI_v7_9.h */
#ifndef __DeckLink_API_v7_9_h__
#define __DeckLink_API_v7_9_h__
#include "DeckLinkAPI.h"
// Interface ID Declarations
#define IID_IDeckLinkDeckControl_v7_9 /* A4D81043-0619-42B7-8ED6-602D29041DF7 */ (REFIID){0xA4,0xD8,0x10,0x43,0x06,0x19,0x42,0xB7,0x8E,0xD6,0x60,0x2D,0x29,0x04,0x1D,0xF7}
#if defined(__cplusplus)
// Forward Declarations
class IDeckLinkDeckControl_v7_9;
/* Interface IDeckLinkDeckControl_v7_9 - Deck Control main interface */
class IDeckLinkDeckControl_v7_9 : public IUnknown
{
public:
virtual HRESULT Open (/* in */ BMDTimeScale timeScale, /* in */ BMDTimeValue timeValue, /* in */ bool timecodeIsDropFrame, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT Close (/* in */ bool standbyOn) = 0;
virtual HRESULT GetCurrentState (/* out */ BMDDeckControlMode *mode, /* out */ BMDDeckControlVTRControlState *vtrControlState, /* out */ BMDDeckControlStatusFlags *flags) = 0;
virtual HRESULT SetStandby (/* in */ bool standbyOn) = 0;
virtual HRESULT Play (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT Stop (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT TogglePlayStop (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT Eject (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT GoToTimecode (/* in */ BMDTimecodeBCD timecode, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT FastForward (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT Rewind (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT StepForward (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT StepBack (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT Jog (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT Shuttle (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT GetTimecodeString (/* out */ const char **currentTimeCode, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT GetTimecode (/* out */ IDeckLinkTimecode **currentTimecode, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT GetTimecodeBCD (/* out */ BMDTimecodeBCD *currentTimecode, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT SetPreroll (/* in */ uint32_t prerollSeconds) = 0;
virtual HRESULT GetPreroll (/* out */ uint32_t *prerollSeconds) = 0;
virtual HRESULT SetExportOffset (/* in */ int32_t exportOffsetFields) = 0;
virtual HRESULT GetExportOffset (/* out */ int32_t *exportOffsetFields) = 0;
virtual HRESULT GetManualExportOffset (/* out */ int32_t *deckManualExportOffsetFields) = 0;
virtual HRESULT SetCaptureOffset (/* in */ int32_t captureOffsetFields) = 0;
virtual HRESULT GetCaptureOffset (/* out */ int32_t *captureOffsetFields) = 0;
virtual HRESULT StartExport (/* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* in */ BMDDeckControlExportModeOpsFlags exportModeOps, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT StartCapture (/* in */ bool useVITC, /* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT GetDeviceID (/* out */ uint16_t *deviceId, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT Abort (void) = 0;
virtual HRESULT CrashRecordStart (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT CrashRecordStop (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT SetCallback (/* in */ IDeckLinkDeckControlStatusCallback *callback) = 0;
protected:
virtual ~IDeckLinkDeckControl_v7_9 () {}; // call Release method to drop reference count
};
#endif // defined(__cplusplus)
#endif // __DeckLink_API_v7_9_h__

View File

@@ -1,63 +0,0 @@
/* -LICENSE-START-
** Copyright (c) 2011 Blackmagic Design
**
** Permission is hereby granted, free of charge, to any person or organization
** obtaining a copy of the software and accompanying documentation covered by
** this license (the "Software") to use, reproduce, display, distribute,
** execute, and transmit the Software, and to prepare derivative works of the
** Software, and to permit third-parties to whom the Software is furnished to
** do so, all subject to the following:
**
** The copyright notices in the Software and this entire statement, including
** the above license grant, this restriction and the following disclaimer,
** must be included in all copies of the Software, in whole or in part, and
** all derivative works of the Software, unless such copies or derivative
** works are solely in the form of machine-executable object code generated by
** a source language processor.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
** -LICENSE-END-
*/
#ifndef BMD_DECKLINKAPI_v8_0_H
#define BMD_DECKLINKAPI_v8_0_H
#include "DeckLinkAPI.h"
// Interface ID Declarations
#define IID_IDeckLink_v8_0 /* 62BFF75D-6569-4E55-8D4D-66AA03829ABC */ (REFIID){0x62,0xBF,0xF7,0x5D,0x65,0x69,0x4E,0x55,0x8D,0x4D,0x66,0xAA,0x03,0x82,0x9A,0xBC}
#define IID_IDeckLinkIterator_v8_0 /* 74E936FC-CC28-4A67-81A0-1E94E52D4E69 */ (REFIID){0x74,0xE9,0x36,0xFC,0xCC,0x28,0x4A,0x67,0x81,0xA0,0x1E,0x94,0xE5,0x2D,0x4E,0x69}
#if defined (__cplusplus)
/* Interface IDeckLink_v8_0 - represents a DeckLink device */
class IDeckLink_v8_0 : public IUnknown
{
public:
virtual HRESULT GetModelName (/* out */ const char **modelName) = 0;
};
/* Interface IDeckLinkIterator_v8_0 - enumerates installed DeckLink hardware */
class IDeckLinkIterator_v8_0 : public IUnknown
{
public:
virtual HRESULT Next (/* out */ IDeckLink_v8_0 **deckLinkInstance) = 0;
};
extern "C" {
IDeckLinkIterator_v8_0* CreateDeckLinkIteratorInstance_v8_0 (void);
};
#endif // defined __cplusplus
#endif /* defined(BMD_DECKLINKAPI_v8_0_H) */

View File

@@ -1,111 +0,0 @@
/* -LICENSE-START-
** Copyright (c) 2011 Blackmagic Design
**
** Permission is hereby granted, free of charge, to any person or organization
** obtaining a copy of the software and accompanying documentation covered by
** this license (the "Software") to use, reproduce, display, distribute,
** execute, and transmit the Software, and to prepare derivative works of the
** Software, and to permit third-parties to whom the Software is furnished to
** do so, all subject to the following:
**
** The copyright notices in the Software and this entire statement, including
** the above license grant, this restriction and the following disclaimer,
** must be included in all copies of the Software, in whole or in part, and
** all derivative works of the Software, unless such copies or derivative
** works are solely in the form of machine-executable object code generated by
** a source language processor.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
** -LICENSE-END-
*/
#ifndef BMD_DECKLINKAPI_v8_1_H
#define BMD_DECKLINKAPI_v8_1_H
#include "DeckLinkAPI.h"
// Interface ID Declarations
#define IID_IDeckLinkDeckControlStatusCallback_v8_1 /* E5F693C1-4283-4716-B18F-C1431521955B */ (REFIID){0xE5,0xF6,0x93,0xC1,0x42,0x83,0x47,0x16,0xB1,0x8F,0xC1,0x43,0x15,0x21,0x95,0x5B}
#define IID_IDeckLinkDeckControl_v8_1 /* 522A9E39-0F3C-4742-94EE-D80DE335DA1D */ (REFIID){0x52,0x2A,0x9E,0x39,0x0F,0x3C,0x47,0x42,0x94,0xEE,0xD8,0x0D,0xE3,0x35,0xDA,0x1D}
/* Enum BMDDeckControlVTRControlState_v8_1 - VTR Control state */
typedef uint32_t BMDDeckControlVTRControlState_v8_1;
enum _BMDDeckControlVTRControlState_v8_1 {
bmdDeckControlNotInVTRControlMode_v8_1 = 'nvcm',
bmdDeckControlVTRControlPlaying_v8_1 = 'vtrp',
bmdDeckControlVTRControlRecording_v8_1 = 'vtrr',
bmdDeckControlVTRControlStill_v8_1 = 'vtra',
bmdDeckControlVTRControlSeeking_v8_1 = 'vtrs',
bmdDeckControlVTRControlStopped_v8_1 = 'vtro'
};
/* Interface IDeckLinkDeckControlStatusCallback_v8_1 - Deck control state change callback. */
class IDeckLinkDeckControlStatusCallback_v8_1 : public IUnknown
{
public:
virtual HRESULT TimecodeUpdate (/* in */ BMDTimecodeBCD currentTimecode) = 0;
virtual HRESULT VTRControlStateChanged (/* in */ BMDDeckControlVTRControlState_v8_1 newState, /* in */ BMDDeckControlError error) = 0;
virtual HRESULT DeckControlEventReceived (/* in */ BMDDeckControlEvent event, /* in */ BMDDeckControlError error) = 0;
virtual HRESULT DeckControlStatusChanged (/* in */ BMDDeckControlStatusFlags flags, /* in */ uint32_t mask) = 0;
protected:
virtual ~IDeckLinkDeckControlStatusCallback_v8_1 () {}; // call Release method to drop reference count
};
/* Interface IDeckLinkDeckControl_v8_1 - Deck Control main interface */
class IDeckLinkDeckControl_v8_1 : public IUnknown
{
public:
virtual HRESULT Open (/* in */ BMDTimeScale timeScale, /* in */ BMDTimeValue timeValue, /* in */ bool timecodeIsDropFrame, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT Close (/* in */ bool standbyOn) = 0;
virtual HRESULT GetCurrentState (/* out */ BMDDeckControlMode *mode, /* out */ BMDDeckControlVTRControlState_v8_1 *vtrControlState, /* out */ BMDDeckControlStatusFlags *flags) = 0;
virtual HRESULT SetStandby (/* in */ bool standbyOn) = 0;
virtual HRESULT SendCommand (/* in */ uint8_t *inBuffer, /* in */ uint32_t inBufferSize, /* out */ uint8_t *outBuffer, /* out */ uint32_t *outDataSize, /* in */ uint32_t outBufferSize, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT Play (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT Stop (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT TogglePlayStop (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT Eject (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT GoToTimecode (/* in */ BMDTimecodeBCD timecode, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT FastForward (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT Rewind (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT StepForward (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT StepBack (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT Jog (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT Shuttle (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT GetTimecodeString (/* out */ const char **currentTimeCode, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT GetTimecode (/* out */ IDeckLinkTimecode **currentTimecode, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT GetTimecodeBCD (/* out */ BMDTimecodeBCD *currentTimecode, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT SetPreroll (/* in */ uint32_t prerollSeconds) = 0;
virtual HRESULT GetPreroll (/* out */ uint32_t *prerollSeconds) = 0;
virtual HRESULT SetExportOffset (/* in */ int32_t exportOffsetFields) = 0;
virtual HRESULT GetExportOffset (/* out */ int32_t *exportOffsetFields) = 0;
virtual HRESULT GetManualExportOffset (/* out */ int32_t *deckManualExportOffsetFields) = 0;
virtual HRESULT SetCaptureOffset (/* in */ int32_t captureOffsetFields) = 0;
virtual HRESULT GetCaptureOffset (/* out */ int32_t *captureOffsetFields) = 0;
virtual HRESULT StartExport (/* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* in */ BMDDeckControlExportModeOpsFlags exportModeOps, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT StartCapture (/* in */ bool useVITC, /* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT GetDeviceID (/* out */ uint16_t *deviceId, /* out */ BMDDeckControlError *error) = 0;
virtual HRESULT Abort (void) = 0;
virtual HRESULT CrashRecordStart (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT CrashRecordStop (/* out */ BMDDeckControlError *error) = 0;
virtual HRESULT SetCallback (/* in */ IDeckLinkDeckControlStatusCallback_v8_1 *callback) = 0;
protected:
virtual ~IDeckLinkDeckControl_v8_1 () {}; // call Release method to drop reference count
};
#endif // BMD_DECKLINKAPI_v8_1_H

View File

@@ -1,81 +0,0 @@
/* -LICENSE-START-
** Copyright (c) 2012 Blackmagic Design
**
** Permission is hereby granted, free of charge, to any person or organization
** obtaining a copy of the software and accompanying documentation covered by
** this license (the "Software") to use, reproduce, display, distribute,
** execute, and transmit the Software, and to prepare derivative works of the
** Software, and to permit third-parties to whom the Software is furnished to
** do so, all subject to the following:
**
** The copyright notices in the Software and this entire statement, including
** the above license grant, this restriction and the following disclaimer,
** must be included in all copies of the Software, in whole or in part, and
** all derivative works of the Software, unless such copies or derivative
** works are solely in the form of machine-executable object code generated by
** a source language processor.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
** -LICENSE-END-
*/
#ifndef BMD_DECKLINKAPI_v9_2_H
#define BMD_DECKLINKAPI_v9_2_H
#include "DeckLinkAPI.h"
// Interface ID Declarations
#define IID_IDeckLinkInput_v9_2 /* 6D40EF78-28B9-4E21-990D-95BB7750A04F */ (REFIID){0x6D,0x40,0xEF,0x78,0x28,0xB9,0x4E,0x21,0x99,0x0D,0x95,0xBB,0x77,0x50,0xA0,0x4F}
#if defined(__cplusplus)
/* Interface IDeckLinkInput - Created by QueryInterface from IDeckLink. */
class IDeckLinkInput_v9_2 : public IUnknown
{
public:
virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags, /* out */ BMDDisplayModeSupport *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0;
virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0;
virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;
/* Video Input */
virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0;
virtual HRESULT DisableVideoInput (void) = 0;
virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t *availableFrameCount) = 0;
/* Audio Input */
virtual HRESULT EnableAudioInput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount) = 0;
virtual HRESULT DisableAudioInput (void) = 0;
virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t *availableSampleFrameCount) = 0;
/* Input Control */
virtual HRESULT StartStreams (void) = 0;
virtual HRESULT StopStreams (void) = 0;
virtual HRESULT PauseStreams (void) = 0;
virtual HRESULT FlushStreams (void) = 0;
virtual HRESULT SetCallback (/* in */ IDeckLinkInputCallback *theCallback) = 0;
/* Hardware Timing */
virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0;
protected:
virtual ~IDeckLinkInput_v9_2 () {}; // call Release method to drop reference count
};
#endif // defined(__cplusplus)
#endif // BMD_DECKLINKAPI_v9_2_H

View File

@@ -1,98 +0,0 @@
/* -LICENSE-START-
** Copyright (c) 2013 Blackmagic Design
**
** Permission is hereby granted, free of charge, to any person or organization
** obtaining a copy of the software and accompanying documentation covered by
** this license (the "Software") to use, reproduce, display, distribute,
** execute, and transmit the Software, and to prepare derivative works of the
** Software, and to permit third-parties to whom the Software is furnished to
** do so, all subject to the following:
**
** The copyright notices in the Software and this entire statement, including
** the above license grant, this restriction and the following disclaimer,
** must be included in all copies of the Software, in whole or in part, and
** all derivative works of the Software, unless such copies or derivative
** works are solely in the form of machine-executable object code generated by
** a source language processor.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
** DEALINGS IN THE SOFTWARE.
** -LICENSE-END-
*/
#ifndef BMD_DECKLINKAPI_v9_9_H
#define BMD_DECKLINKAPI_v9_9_H
#include "DeckLinkAPI.h"
// Interface ID Declarations
#define IID_IDeckLinkOutput_v9_9 /* A3EF0963-0862-44ED-92A9-EE89ABF431C7 */ (REFIID){0xA3,0xEF,0x09,0x63,0x08,0x62,0x44,0xED,0x92,0xA9,0xEE,0x89,0xAB,0xF4,0x31,0xC7}
#if defined(__cplusplus)
/* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */
class IDeckLinkOutput_v9_9 : public IUnknown
{
public:
virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoOutputFlags flags, /* out */ BMDDisplayModeSupport *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0;
virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0;
virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0;
/* Video Output */
virtual HRESULT EnableVideoOutput (/* in */ BMDDisplayMode displayMode, /* in */ BMDVideoOutputFlags flags) = 0;
virtual HRESULT DisableVideoOutput (void) = 0;
virtual HRESULT SetVideoOutputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0;
virtual HRESULT CreateVideoFrame (/* in */ int32_t width, /* in */ int32_t height, /* in */ int32_t rowBytes, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDFrameFlags flags, /* out */ IDeckLinkMutableVideoFrame **outFrame) = 0;
virtual HRESULT CreateAncillaryData (/* in */ BMDPixelFormat pixelFormat, /* out */ IDeckLinkVideoFrameAncillary **outBuffer) = 0;
virtual HRESULT DisplayVideoFrameSync (/* in */ IDeckLinkVideoFrame *theFrame) = 0;
virtual HRESULT ScheduleVideoFrame (/* in */ IDeckLinkVideoFrame *theFrame, /* in */ BMDTimeValue displayTime, /* in */ BMDTimeValue displayDuration, /* in */ BMDTimeScale timeScale) = 0;
virtual HRESULT SetScheduledFrameCompletionCallback (/* in */ IDeckLinkVideoOutputCallback *theCallback) = 0;
virtual HRESULT GetBufferedVideoFrameCount (/* out */ uint32_t *bufferedFrameCount) = 0;
/* Audio Output */
virtual HRESULT EnableAudioOutput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount, /* in */ BMDAudioOutputStreamType streamType) = 0;
virtual HRESULT DisableAudioOutput (void) = 0;
virtual HRESULT WriteAudioSamplesSync (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* out */ uint32_t *sampleFramesWritten) = 0;
virtual HRESULT BeginAudioPreroll (void) = 0;
virtual HRESULT EndAudioPreroll (void) = 0;
virtual HRESULT ScheduleAudioSamples (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* in */ BMDTimeValue streamTime, /* in */ BMDTimeScale timeScale, /* out */ uint32_t *sampleFramesWritten) = 0;
virtual HRESULT GetBufferedAudioSampleFrameCount (/* out */ uint32_t *bufferedSampleFrameCount) = 0;
virtual HRESULT FlushBufferedAudioSamples (void) = 0;
virtual HRESULT SetAudioCallback (/* in */ IDeckLinkAudioOutputCallback *theCallback) = 0;
/* Output Control */
virtual HRESULT StartScheduledPlayback (/* in */ BMDTimeValue playbackStartTime, /* in */ BMDTimeScale timeScale, /* in */ double playbackSpeed) = 0;
virtual HRESULT StopScheduledPlayback (/* in */ BMDTimeValue stopPlaybackAtTime, /* out */ BMDTimeValue *actualStopTime, /* in */ BMDTimeScale timeScale) = 0;
virtual HRESULT IsScheduledPlaybackRunning (/* out */ bool *active) = 0;
virtual HRESULT GetScheduledStreamTime (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *streamTime, /* out */ double *playbackSpeed) = 0;
virtual HRESULT GetReferenceStatus (/* out */ BMDReferenceStatus *referenceStatus) = 0;
/* Hardware Timing */
virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0;
protected:
virtual ~IDeckLinkOutput_v9_9 () {}; // call Release method to drop reference count
};
#endif // defined(__cplusplus)
#endif // BMD_DECKLINKAPI_v9_9_H

View File

@@ -894,7 +894,7 @@ void LbmFsgrSolver::cpDebugDisplay(int dispset)
// dot influence
if((mpControl->mDebugCpscale>0.) && cpDots) {
glPointSize(mpControl->mDebugCpscale * 8.);
glBegin(GL_POINTS);
GPUBegin(GL_POINTS);
for(int i=0; i<cparts->getSize(); i++) {
if((cpHideIna)&&( (cparts->getParticle(i)->influence<=0.) || (cparts->getParticle(i)->size<=0.) )) continue;
ntlVec3Gfx org( vec2G(cparts->getParticle(i)->pos ) );
@@ -911,7 +911,7 @@ void LbmFsgrSolver::cpDebugDisplay(int dispset)
// cp positions
if((mpControl->mDebugCpscale>0.) && cpDots) {
glPointSize(mpControl->mDebugCpscale * 3.);
glBegin(GL_POINTS);
GPUBegin(GL_POINTS);
glColor3f( 0,1,0 );
}
for(int i=0; i<cparts->getSize(); i++) {
@@ -934,7 +934,7 @@ void LbmFsgrSolver::cpDebugDisplay(int dispset)
const float scale = mpControl->mDebugAvgVelScale;
glColor3f( 1.0,1.0,1 );
glBegin(GL_LINES);
GPUBegin(GL_LINES);
for(int i=0; i<cparts->getSize(); i++) {
if((cpHideIna)&&( (cparts->getParticle(i)->influence<=0.) || (cparts->getParticle(i)->size<=0.) )) continue;
ntlVec3Gfx org( vec2G(cparts->getParticle(i)->pos ) );
@@ -955,7 +955,7 @@ void LbmFsgrSolver::cpDebugDisplay(int dispset)
// debug, for use of e.g. LBMGET_FORCE LbmControlData *mpControl = this;
# define TESTGET_FORCE(lev,i,j,k) mpControl->mCpForces[lev][ ((k*mLevel[lev].lSizey)+j)*mLevel[lev].lSizex+i ]
glBegin(GL_LINES);
GPUBegin(GL_LINES);
//const int lev=0;
for(int lev=0; lev<=mMaxRefine; lev++) {
FSGR_FORIJK_BOUNDS(lev) {

View File

@@ -1782,7 +1782,7 @@ void LbmFsgrSolver::debugDisplayNode(int dispset, CellIdentifierInterface* cell
case FLUIDDISPVelocities: {
// dont use cube display
LbmVec vel = this->getCellVelocity( cell, set );
glBegin(GL_LINES);
GPUBegin(GL_LINES);
glColor3f( 0.0,0.0,0.0 );
glVertex3f( org[0], org[1], org[2] );
org += vec2G(vel * 10.0 * cscale);

View File

@@ -287,8 +287,7 @@ const bool GLXEW_ARB_create_context_robustness =
attribs[i++] = 0;
/* Create a GL 3.x context */
if (m_fbconfig)
{
if (m_fbconfig) {
m_context = glXCreateContextAttribsARB(m_display, m_fbconfig, s_sharedContext, true, attribs);
}
else {

View File

@@ -125,8 +125,7 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragEnter(IDataObject *pDataObject, DWO
*/
HRESULT __stdcall GHOST_DropTargetWin32::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
{
if (m_window->canAcceptDragOperation())
{
if (m_window->canAcceptDragOperation()) {
*pdwEffect = allowedDropEffect(*pdwEffect);
}
else {
@@ -154,8 +153,7 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragLeave(void)
HRESULT __stdcall GHOST_DropTargetWin32::Drop(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
{
void *data = getGhostData(pDataObject);
if (m_window->canAcceptDragOperation())
{
if (m_window->canAcceptDragOperation()) {
*pdwEffect = allowedDropEffect(*pdwEffect);
}
@@ -189,15 +187,13 @@ GHOST_TDragnDropTypes GHOST_DropTargetWin32::getGhostType(IDataObject *pDataObje
* conversion, but we do the conversion ourself with WC_NO_BEST_FIT_CHARS.
*/
FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
if (pDataObject->QueryGetData(&fmtetc) == S_OK)
{
if (pDataObject->QueryGetData(&fmtetc) == S_OK) {
return GHOST_kDragnDropTypeString;
}
// Filesnames
fmtetc.cfFormat = CF_HDROP;
if (pDataObject->QueryGetData(&fmtetc) == S_OK)
{
if (pDataObject->QueryGetData(&fmtetc) == S_OK) {
return GHOST_kDragnDropTypeFilenames;
}

View File

@@ -167,11 +167,9 @@ void GHOST_EventManager::removeWindowEvents(GHOST_IWindow *window)
{
TEventStack::iterator iter;
iter = m_events.begin();
while (iter != m_events.end())
{
while (iter != m_events.end()) {
GHOST_IEvent *event = *iter;
if (event->getWindow() == window)
{
if (event->getWindow() == window) {
GHOST_PRINT("GHOST_EventManager::removeWindowEvents(): removing event\n");
/*
* Found an event for this window, remove it.
@@ -191,11 +189,9 @@ void GHOST_EventManager::removeTypeEvents(GHOST_TEventType type, GHOST_IWindow *
{
TEventStack::iterator iter;
iter = m_events.begin();
while (iter != m_events.end())
{
while (iter != m_events.end()) {
GHOST_IEvent *event = *iter;
if ((event->getType() == type) && (!window || (event->getWindow() == window)))
{
if ((event->getType() == type) && (!window || (event->getWindow() == window))) {
GHOST_PRINT("GHOST_EventManager::removeTypeEvents(): removing event\n");
/*
* Found an event of this type for the window, remove it.

View File

@@ -378,8 +378,7 @@ void GHOST_NDOFManager::updateButton(int button_number, bool press, GHOST_TUns64
NDOF_ButtonT button = (button_number < m_buttonCount) ? m_hidMap[button_number] : NDOF_BUTTON_NONE;
switch (button)
{
switch (button) {
case NDOF_BUTTON_NONE:
#ifdef DEBUG_NDOF_BUTTONS
printf("discarded\n");

View File

@@ -830,7 +830,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType,
window->updateDrawingContext();
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
//Mouse up event is trapped by the resizing event loop, so send it anyway to the window manager
pushEvent(new GHOST_EventButton(getMilliSeconds(), GHOST_kEventButtonUp, window, convertButton(0)));
pushEvent(new GHOST_EventButton(getMilliSeconds(), GHOST_kEventButtonUp, window, GHOST_kButtonMaskLeft));
//m_ignoreWindowSizedMessages = true;
}
break;
@@ -1278,19 +1278,29 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
switch ([event type]) {
case NSLeftMouseDown:
pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonDown, window, GHOST_kButtonMaskLeft));
handleTabletEvent(event); //Handle tablet events combined with mouse events
break;
case NSRightMouseDown:
pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonDown, window, GHOST_kButtonMaskRight));
handleTabletEvent(event); //Handle tablet events combined with mouse events
break;
case NSOtherMouseDown:
pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonDown, window, convertButton([event buttonNumber])));
//Handle tablet events combined with mouse events
handleTabletEvent(event);
handleTabletEvent(event); //Handle tablet events combined with mouse events
break;
case NSLeftMouseUp:
pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonUp, window, GHOST_kButtonMaskLeft));
handleTabletEvent(event); //Handle tablet events combined with mouse events
break;
case NSRightMouseUp:
pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonUp, window, GHOST_kButtonMaskRight));
handleTabletEvent(event); //Handle tablet events combined with mouse events
break;
case NSOtherMouseUp:
pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonUp, window, convertButton([event buttonNumber])));
//Handle tablet events combined with mouse events
handleTabletEvent(event);
handleTabletEvent(event); //Handle tablet events combined with mouse events
break;
case NSLeftMouseDragged:

View File

@@ -76,8 +76,7 @@ const GHOST_TUns8 *GHOST_SystemPathsWin32::getSystemDir(int, const char *version
HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16);
if (hResult == S_OK)
{
if (hResult == S_OK) {
conv_utf_16_to_8(knownpath_16, knownpath, MAX_PATH * 3);
strcat(knownpath, "\\Blender Foundation\\Blender\\");
strcat(knownpath, versionstr);
@@ -94,8 +93,7 @@ const GHOST_TUns8 *GHOST_SystemPathsWin32::getUserDir(int, const char *versionst
HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16);
if (hResult == S_OK)
{
if (hResult == S_OK) {
conv_utf_16_to_8(knownpath_16, knownpath, MAX_PATH * 3);
strcat(knownpath, "\\Blender Foundation\\Blender\\");
strcat(knownpath, versionstr);

View File

@@ -1545,8 +1545,7 @@ static bool isStartedFromCommandPrompt()
int GHOST_SystemWin32::toggleConsole(int action)
{
switch (action)
{
switch (action) {
case 3: // startup: hide if not started from command prompt
{
if (isStartedFromCommandPrompt()) {

View File

@@ -420,8 +420,7 @@ static Bool init_timestamp_scanner(Display *, XEvent *event, XPointer arg)
{
init_timestamp_data *data =
reinterpret_cast<init_timestamp_data *>(arg);
switch (event->type)
{
switch (event->type) {
case ButtonPress:
case ButtonRelease:
data->timestamp = event->xbutton.time;
@@ -1964,8 +1963,7 @@ int GHOST_X11_ApplicationIOErrorHandler(Display * /*display*/)
static bool match_token(const char *haystack, const char *needle)
{
const char *p, *q;
for (p = haystack; *p; )
{
for (p = haystack; *p; ) {
while (*p && isspace(*p))
p++;
if (!*p)

View File

@@ -38,8 +38,8 @@
#define glAccum DO_NOT_USE_glAccum
#undef glAlphaFunc
#define glAlphaFunc DO_NOT_USE_glAlphaFunc
#undef glBegin
#define glBegin DO_NOT_USE_glBegin
#undef GPUBegin
#define GPUBegin DO_NOT_USE_GPUBegin
#undef glBitmap
#define glBitmap DO_NOT_USE_glBitmap
#undef glCallList

View File

@@ -25,6 +25,7 @@
set(INC
.
# XXX, bad level include!
../../source/blender/blenlib
)
@@ -37,5 +38,4 @@ set(SRC
dvpapi.h
)
blender_add_lib(bf_intern_gpudirect "${SRC}" "${INC}" "${INC_SYS}")

View File

@@ -81,11 +81,9 @@ DVPStatus dvpGetLibrayVersion(uint32_t *major, uint32_t *minor)
DVPStatus dvpInitGLContext(uint32_t flags)
{
DVPStatus status;
if (!__dvpLibrary)
{
if (!__dvpLibrary) {
__dvpLibrary = BLI_dynlib_open(KDVPAPI_Name);
if (!__dvpLibrary)
{
if (!__dvpLibrary) {
return DVP_STATUS_ERROR;
}
// "?dvpInitGLContext@@YA?AW4DVPStatus@@I@Z";
@@ -129,7 +127,9 @@ DVPStatus dvpInitGLContext(uint32_t flags)
!__dvpGetRequiredConstantsGLCtx ||
!__dvpCreateGPUTextureGL ||
!__dvpUnbindFromGLCtx)
{
return DVP_STATUS_ERROR;
}
// check that the library version is what we want
if ((status = __dvpGetLibrayVersion(&__dvpMajorVersion, &__dvpMinorVersion)) != DVP_STATUS_OK)
return status;

Some files were not shown because too many files have changed in this diff Show More