forked from bartvdbraak/blender
Merging r46203 through r46413 from trunk into soc-2011-tomato
This commit is contained in:
commit
16d93f3881
@ -1641,6 +1641,7 @@ if(WITH_PYTHON)
|
||||
PATH_SUFFIXES
|
||||
site-packages
|
||||
dist-packages
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
if(NOT EXISTS "${PYTHON_NUMPY_PATH}")
|
||||
|
@ -354,7 +354,7 @@ public:
|
||||
|
||||
//! Calcs global transform of the offsets
|
||||
/*!
|
||||
Calcs the global transform for the joint offset for body A an B, and also calcs the agle differences between the bodies.
|
||||
Calcs the global transform for the joint offset for body A an B, and also calcs the angle differences between the bodies.
|
||||
\sa btGeneric6DofConstraint.getCalculatedTransformA , btGeneric6DofConstraint.getCalculatedTransformB, btGeneric6DofConstraint.calculateAngleInfo
|
||||
*/
|
||||
void calculateTransforms(const btTransform& transA,const btTransform& transB);
|
||||
|
@ -17,25 +17,16 @@ SConscript(['audaspace/SConscript',
|
||||
'smoke/SConscript',
|
||||
'raskter/SConscript'])
|
||||
|
||||
# NEW_CSG was intended for intern/csg, but
|
||||
# getting it to compile is difficult
|
||||
# intern/bsp has been used anyway, so
|
||||
# perhaps get rid of intern/csg?
|
||||
NEW_CSG = 'false'
|
||||
|
||||
if env ['WITH_BF_REMESH']:
|
||||
SConscript(['dualcon/SConscript'])
|
||||
|
||||
if env['WITH_BF_FLUID']:
|
||||
SConscript(['elbeem/SConscript'])
|
||||
|
||||
|
||||
if env['WITH_BF_CYCLES']:
|
||||
SConscript(['cycles/SConscript'])
|
||||
|
||||
if NEW_CSG == 'false':
|
||||
SConscript(['bsp/SConscript'])
|
||||
else:
|
||||
SConscript(['csg/SConscript'])
|
||||
SConscript(['bsp/SConscript'])
|
||||
|
||||
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'):
|
||||
SConscript(['utfconv/SConscript'])
|
||||
|
@ -174,8 +174,14 @@ public:
|
||||
std::cerr << "-" << typeid(*m_reference).name() << std::endl;
|
||||
#endif
|
||||
if(AUD_ReferenceHandler::decref(m_original))
|
||||
{
|
||||
pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
|
||||
delete m_reference;
|
||||
pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
|
||||
}
|
||||
else
|
||||
{
|
||||
pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -194,7 +200,11 @@ public:
|
||||
std::cerr << "-" << typeid(*m_reference).name() << std::endl;
|
||||
#endif
|
||||
if(AUD_ReferenceHandler::decref(m_original))
|
||||
{
|
||||
pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
|
||||
delete m_reference;
|
||||
pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
|
||||
}
|
||||
|
||||
m_original = ref.m_original;
|
||||
m_reference = ref.m_reference;
|
||||
|
@ -154,6 +154,7 @@ void AUD_SequencerHandle::seek(float position)
|
||||
if(seekpos < 0)
|
||||
seekpos = 0;
|
||||
seekpos += m_entry->m_skip;
|
||||
m_handle->setPitch(1.0f);
|
||||
m_handle->seek(seekpos);
|
||||
if(position < m_entry->m_begin)
|
||||
m_handle->pause();
|
||||
|
@ -290,8 +290,22 @@ static void xml_read_camera(const XMLReadState& state, pugi::xml_node node)
|
||||
cam->type = CAMERA_ORTHOGRAPHIC;
|
||||
else if(xml_equal_string(node, "type", "perspective"))
|
||||
cam->type = CAMERA_PERSPECTIVE;
|
||||
else if(xml_equal_string(node, "type", "environment"))
|
||||
cam->type = CAMERA_ENVIRONMENT;
|
||||
else if(xml_equal_string(node, "type", "panorama"))
|
||||
cam->type = CAMERA_PANORAMA;
|
||||
|
||||
if(xml_equal_string(node, "panorama_type", "equirectangular"))
|
||||
cam->panorama_type = PANORAMA_EQUIRECTANGULAR;
|
||||
else if(xml_equal_string(node, "panorama_type", "fisheye_equidistant"))
|
||||
cam->panorama_type = PANORAMA_FISHEYE_EQUIDISTANT;
|
||||
else if(xml_equal_string(node, "panorama_type", "fisheye_equisolid"))
|
||||
cam->panorama_type = PANORAMA_FISHEYE_EQUISOLID;
|
||||
|
||||
xml_read_float(&cam->fisheye_fov, node, "fisheye_fov");
|
||||
xml_read_float(&cam->fisheye_lens, node, "fisheye_lens");
|
||||
|
||||
xml_read_float(&cam->sensorwidth, node, "sensorwidth");
|
||||
xml_read_float(&cam->sensorheight, node, "sensorheight");
|
||||
|
||||
|
||||
cam->matrix = state.tfm;
|
||||
|
||||
|
@ -54,3 +54,9 @@ aperture_types = (
|
||||
('RADIUS', "Radius", "Directly change the size of the aperture"),
|
||||
('FSTOP', "F/stop", "Change the size of the aperture by f/stops"),
|
||||
)
|
||||
|
||||
panorama_types = (
|
||||
('EQUIRECTANGULAR', "Equirectangular", "Render the scene with a spherical camera, also known as Lat Long panorama"),
|
||||
('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions"),
|
||||
('FISHEYE_EQUISOLID', "Fisheye Equisolid", "Similar to most fisheye modern lens, take sensor dimensions into consideration"),
|
||||
)
|
||||
|
@ -278,6 +278,25 @@ class CyclesCameraSettings(bpy.types.PropertyGroup):
|
||||
subtype='ANGLE',
|
||||
default=0,
|
||||
)
|
||||
cls.panorama_type = EnumProperty(
|
||||
name="Panorama Type",
|
||||
description="Distortion to use for the calculation",
|
||||
items=enums.panorama_types,
|
||||
default='FISHEYE_EQUISOLID',
|
||||
)
|
||||
cls.fisheye_fov = FloatProperty(
|
||||
name="Field of View",
|
||||
description="Field of view for the fisheye lens",
|
||||
min=0.1745, soft_max=2*math.pi, max=10.0*math.pi,
|
||||
subtype='ANGLE',
|
||||
default=math.pi,
|
||||
)
|
||||
cls.fisheye_lens = FloatProperty(
|
||||
name="Fisheye Lens",
|
||||
description="Lens focal length (mm)",
|
||||
min=0.01, soft_max=15.0, max=100.0,
|
||||
default=10.5,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def unregister(cls):
|
||||
|
@ -48,6 +48,10 @@ struct BlenderCamera {
|
||||
|
||||
float2 pixelaspect;
|
||||
|
||||
PanoramaType panorama_type;
|
||||
float fisheye_fov;
|
||||
float fisheye_lens;
|
||||
|
||||
enum { AUTO, HORIZONTAL, VERTICAL } sensor_fit;
|
||||
float sensor_width;
|
||||
float sensor_height;
|
||||
@ -94,9 +98,37 @@ static void blender_camera_from_object(BlenderCamera *bcam, BL::Object b_ob)
|
||||
bcam->nearclip = b_camera.clip_start();
|
||||
bcam->farclip = b_camera.clip_end();
|
||||
|
||||
bcam->type = (b_camera.type() == BL::Camera::type_ORTHO)? CAMERA_ORTHOGRAPHIC: CAMERA_PERSPECTIVE;
|
||||
if(bcam->type == CAMERA_PERSPECTIVE && b_camera.use_panorama())
|
||||
bcam->type = CAMERA_ENVIRONMENT;
|
||||
switch(b_camera.type())
|
||||
{
|
||||
case BL::Camera::type_ORTHO:
|
||||
bcam->type = CAMERA_ORTHOGRAPHIC;
|
||||
break;
|
||||
case BL::Camera::type_PANO:
|
||||
bcam->type = CAMERA_PANORAMA;
|
||||
break;
|
||||
case BL::Camera::type_PERSP:
|
||||
default:
|
||||
bcam->type = CAMERA_PERSPECTIVE;
|
||||
break;
|
||||
}
|
||||
|
||||
switch(RNA_enum_get(&ccamera, "panorama_type"))
|
||||
{
|
||||
case 1:
|
||||
bcam->panorama_type = PANORAMA_FISHEYE_EQUIDISTANT;
|
||||
break;
|
||||
case 2:
|
||||
bcam->panorama_type = PANORAMA_FISHEYE_EQUISOLID;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
bcam->panorama_type = PANORAMA_EQUIRECTANGULAR;
|
||||
break;
|
||||
}
|
||||
|
||||
bcam->fisheye_fov = RNA_float_get(&ccamera, "fisheye_fov");
|
||||
bcam->fisheye_lens = RNA_float_get(&ccamera, "fisheye_lens");
|
||||
|
||||
bcam->ortho_scale = b_camera.ortho_scale();
|
||||
|
||||
bcam->lens = b_camera.lens();
|
||||
@ -138,7 +170,7 @@ static Transform blender_camera_matrix(const Transform& tfm, CameraType type)
|
||||
{
|
||||
Transform result;
|
||||
|
||||
if(type == CAMERA_ENVIRONMENT) {
|
||||
if(type == CAMERA_PANORAMA) {
|
||||
/* make it so environment camera needs to be pointed in the direction
|
||||
of the positive x-axis to match an environment texture, this way
|
||||
it is looking at the center of the texture */
|
||||
@ -172,6 +204,9 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
|
||||
bool horizontal_fit;
|
||||
float sensor_size;
|
||||
|
||||
cam->sensorwidth = bcam->sensor_width;
|
||||
cam->sensorheight = bcam->sensor_height;
|
||||
|
||||
if(bcam->sensor_fit == BlenderCamera::AUTO) {
|
||||
horizontal_fit = (xratio > yratio);
|
||||
sensor_size = bcam->sensor_width;
|
||||
@ -203,7 +238,7 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
|
||||
aspectratio = bcam->ortho_scale/2.0f;
|
||||
}
|
||||
|
||||
if(bcam->type == CAMERA_ENVIRONMENT) {
|
||||
if(bcam->type == CAMERA_PANORAMA) {
|
||||
/* set viewplane */
|
||||
cam->left = 0.0f;
|
||||
cam->right = 1.0f;
|
||||
@ -240,6 +275,11 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
|
||||
/* type */
|
||||
cam->type = bcam->type;
|
||||
|
||||
/* panorama */
|
||||
cam->panorama_type = bcam->panorama_type;
|
||||
cam->fisheye_fov = bcam->fisheye_fov;
|
||||
cam->fisheye_lens = bcam->fisheye_lens;
|
||||
|
||||
/* perspective */
|
||||
cam->fov = 2.0f*atan((0.5f*sensor_size)/bcam->lens/aspectratio);
|
||||
cam->focaldistance = bcam->focaldistance;
|
||||
|
@ -202,7 +202,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated)
|
||||
{
|
||||
/* test if we can instance or if the object is modified */
|
||||
BL::ID b_ob_data = b_ob.data();
|
||||
BL::ID key = (object_is_modified(b_ob))? b_ob: b_ob_data;
|
||||
BL::ID key = (BKE_object_is_modified(b_ob))? b_ob: b_ob_data;
|
||||
BL::Material material_override = render_layer.material_override;
|
||||
|
||||
/* find shader indices */
|
||||
@ -309,7 +309,7 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion)
|
||||
|
||||
/* skip objects without deforming modifiers. this is not a totally reliable,
|
||||
* would need a more extensive check to see which objects are animated */
|
||||
if(!size || !ccl::object_is_deform_modified(b_ob, b_scene, preview))
|
||||
if(!size || !ccl::BKE_object_is_deform_modified(b_ob, b_scene, preview))
|
||||
return;
|
||||
|
||||
/* get derived mesh */
|
||||
|
@ -34,10 +34,10 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* Utilities */
|
||||
|
||||
bool BlenderSync::object_is_modified(BL::Object b_ob)
|
||||
bool BlenderSync::BKE_object_is_modified(BL::Object b_ob)
|
||||
{
|
||||
/* test if we can instance or if the object is modified */
|
||||
if(ccl::object_is_modified(b_ob, b_scene, preview)) {
|
||||
if(ccl::BKE_object_is_modified(b_ob, b_scene, preview)) {
|
||||
/* modifiers */
|
||||
return true;
|
||||
}
|
||||
@ -286,7 +286,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
|
||||
BL::Scene::objects_iterator b_ob;
|
||||
|
||||
for(b_scene.objects.begin(b_ob); b_ob != b_scene.objects.end(); ++b_ob) {
|
||||
bool hide = (b_v3d)? b_ob->hide(): b_ob->hide_render();
|
||||
bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render();
|
||||
uint ob_layer = get_layer(b_ob->layers());
|
||||
|
||||
if(!hide && (ob_layer & scene_layer)) {
|
||||
|
@ -97,6 +97,13 @@ static void get_tex_mapping(TextureMapping *mapping, BL::ShaderNodeMapping b_map
|
||||
mapping->translation = get_float3(b_mapping.translation());
|
||||
mapping->rotation = get_float3(b_mapping.rotation());
|
||||
mapping->scale = get_float3(b_mapping.scale());
|
||||
|
||||
mapping->use_minmax = b_mapping.use_min() || b_mapping.use_max();
|
||||
|
||||
if(b_mapping.use_min())
|
||||
mapping->min = get_float3(b_mapping.min());
|
||||
if(b_mapping.use_max())
|
||||
mapping->max = get_float3(b_mapping.max());
|
||||
}
|
||||
|
||||
static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::ShaderNode b_node)
|
||||
@ -323,6 +330,10 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Shader
|
||||
node = new LightPathNode();
|
||||
break;
|
||||
}
|
||||
case BL::ShaderNode::type_LIGHT_FALLOFF: {
|
||||
node = new LightFalloffNode();
|
||||
break;
|
||||
}
|
||||
case BL::ShaderNode::type_TEX_IMAGE: {
|
||||
BL::ShaderNodeTexImage b_image_node(b_node);
|
||||
BL::Image b_image(b_image_node.image());
|
||||
|
@ -87,7 +87,7 @@ bool BlenderSync::sync_recalc()
|
||||
|
||||
if(object_is_mesh(*b_ob)) {
|
||||
if(b_ob->is_updated_data() || b_ob->data().is_updated()) {
|
||||
BL::ID key = object_is_modified(*b_ob)? *b_ob: b_ob->data();
|
||||
BL::ID key = BKE_object_is_modified(*b_ob)? *b_ob: b_ob->data();
|
||||
mesh_map.set_recalc(key);
|
||||
}
|
||||
}
|
||||
@ -215,6 +215,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
|
||||
render_layer.holdout_layer = 0;
|
||||
render_layer.material_override = PointerRNA_NULL;
|
||||
render_layer.use_background = true;
|
||||
render_layer.use_viewport_visibility = true;
|
||||
render_layer.samples = 0;
|
||||
return;
|
||||
}
|
||||
@ -234,6 +235,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
|
||||
render_layer.layer |= render_layer.holdout_layer;
|
||||
render_layer.material_override = b_rlay->material_override();
|
||||
render_layer.use_background = b_rlay->use_sky();
|
||||
render_layer.use_viewport_visibility = false;
|
||||
render_layer.samples = b_rlay->samples();
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ private:
|
||||
|
||||
/* util */
|
||||
void find_shader(BL::ID id, vector<uint>& used_shaders, int default_shader);
|
||||
bool object_is_modified(BL::Object b_ob);
|
||||
bool BKE_object_is_modified(BL::Object b_ob);
|
||||
bool object_is_mesh(BL::Object b_ob);
|
||||
bool object_is_light(BL::Object b_ob);
|
||||
|
||||
@ -113,6 +113,7 @@ private:
|
||||
: scene_layer(0), layer(0), holdout_layer(0),
|
||||
material_override(PointerRNA_NULL),
|
||||
use_background(true),
|
||||
use_viewport_visibility(false),
|
||||
samples(0)
|
||||
{}
|
||||
|
||||
@ -122,6 +123,7 @@ private:
|
||||
uint holdout_layer;
|
||||
BL::Material material_override;
|
||||
bool use_background;
|
||||
bool use_viewport_visibility;
|
||||
int samples;
|
||||
} render_layer;
|
||||
};
|
||||
|
@ -91,12 +91,12 @@ static inline void object_free_duplilist(BL::Object self)
|
||||
rna_Object_free_duplilist(self.ptr.data, NULL);
|
||||
}
|
||||
|
||||
static inline bool object_is_modified(BL::Object self, BL::Scene scene, bool preview)
|
||||
static inline bool BKE_object_is_modified(BL::Object self, BL::Scene scene, bool preview)
|
||||
{
|
||||
return rna_Object_is_modified(self.ptr.data, scene.ptr.data, (preview)? (1<<0): (1<<1))? true: false;
|
||||
}
|
||||
|
||||
static inline bool object_is_deform_modified(BL::Object self, BL::Scene scene, bool preview)
|
||||
static inline bool BKE_object_is_deform_modified(BL::Object self, BL::Scene scene, bool preview)
|
||||
{
|
||||
return rna_Object_is_deform_modified(self.ptr.data, scene.ptr.data, (preview)? (1<<0): (1<<1))? true: false;
|
||||
}
|
||||
|
@ -120,6 +120,7 @@ BVHObjectBinning::BVHObjectBinning(const BVHRange& job, BVHReference *prims)
|
||||
bx = merge(bx,bin_bounds[i][0]); r_area[i][0] = bx.half_area();
|
||||
by = merge(by,bin_bounds[i][1]); r_area[i][1] = by.half_area();
|
||||
bz = merge(bz,bin_bounds[i][2]); r_area[i][2] = bz.half_area();
|
||||
r_area[i][3] = r_area[i][2];
|
||||
}
|
||||
|
||||
/* sweep from left to right and compute SAH */
|
||||
|
@ -36,12 +36,12 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
class BVHBuildTask : public Task {
|
||||
public:
|
||||
BVHBuildTask(InnerNode *node_, int child_, BVHObjectBinning& range_, int level_)
|
||||
: node(node_), child(child_), level(level_), range(range_) {}
|
||||
BVHBuildTask(BVHBuild *build, InnerNode *node, int child, BVHObjectBinning& range_, int level)
|
||||
: range(range_)
|
||||
{
|
||||
run = function_bind(&BVHBuild::thread_build_node, build, node, child, &range, level);
|
||||
}
|
||||
|
||||
InnerNode *node;
|
||||
int child;
|
||||
int level;
|
||||
BVHObjectBinning range;
|
||||
};
|
||||
|
||||
@ -55,8 +55,7 @@ BVHBuild::BVHBuild(const vector<Object*>& objects_,
|
||||
prim_object(prim_object_),
|
||||
params(params_),
|
||||
progress(progress_),
|
||||
progress_start_time(0.0),
|
||||
task_pool(function_bind(&BVHBuild::thread_build_node, this, _1, _2))
|
||||
progress_start_time(0.0)
|
||||
{
|
||||
spatial_min_overlap = 0.0f;
|
||||
}
|
||||
@ -177,7 +176,7 @@ BVHNode* BVHBuild::run()
|
||||
/* multithreaded binning build */
|
||||
BVHObjectBinning rootbin(root, (references.size())? &references[0]: NULL);
|
||||
rootnode = build_node(rootbin, 0);
|
||||
task_pool.wait();
|
||||
task_pool.wait_work();
|
||||
}
|
||||
|
||||
/* delete if we cancelled */
|
||||
@ -210,25 +209,24 @@ void BVHBuild::progress_update()
|
||||
progress_start_time = time_dt();
|
||||
}
|
||||
|
||||
void BVHBuild::thread_build_node(Task *task_, int thread_id)
|
||||
void BVHBuild::thread_build_node(InnerNode *inner, int child, BVHObjectBinning *range, int level)
|
||||
{
|
||||
if(progress.get_cancel())
|
||||
return;
|
||||
|
||||
/* build nodes */
|
||||
BVHBuildTask *task = (BVHBuildTask*)task_;
|
||||
BVHNode *node = build_node(task->range, task->level);
|
||||
BVHNode *node = build_node(*range, level);
|
||||
|
||||
/* set child in inner node */
|
||||
task->node->children[task->child] = node;
|
||||
inner->children[child] = node;
|
||||
|
||||
/* update progress */
|
||||
if(task->range.size() < THREAD_TASK_SIZE) {
|
||||
if(range->size() < THREAD_TASK_SIZE) {
|
||||
/*rotate(node, INT_MAX, 5);*/
|
||||
|
||||
thread_scoped_lock lock(build_mutex);
|
||||
|
||||
progress_count += task->range.size();
|
||||
progress_count += range->size();
|
||||
progress_update();
|
||||
}
|
||||
}
|
||||
@ -262,8 +260,8 @@ BVHNode* BVHBuild::build_node(const BVHObjectBinning& range, int level)
|
||||
/* threaded build */
|
||||
inner = new InnerNode(range.bounds());
|
||||
|
||||
task_pool.push(new BVHBuildTask(inner, 0, left, level + 1), true);
|
||||
task_pool.push(new BVHBuildTask(inner, 1, right, level + 1), true);
|
||||
task_pool.push(new BVHBuildTask(this, inner, 0, left, level + 1), true);
|
||||
task_pool.push(new BVHBuildTask(this, inner, 1, right, level + 1), true);
|
||||
}
|
||||
|
||||
return inner;
|
||||
|
@ -29,7 +29,9 @@
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
class BVHBuildTask;
|
||||
class BVHParams;
|
||||
class InnerNode;
|
||||
class Mesh;
|
||||
class Object;
|
||||
class Progress;
|
||||
@ -54,6 +56,7 @@ protected:
|
||||
friend class BVHMixedSplit;
|
||||
friend class BVHObjectSplit;
|
||||
friend class BVHSpatialSplit;
|
||||
friend class BVHBuildTask;
|
||||
|
||||
/* adding references */
|
||||
void add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh, int i);
|
||||
@ -68,7 +71,7 @@ protected:
|
||||
|
||||
/* threads */
|
||||
enum { THREAD_TASK_SIZE = 4096 };
|
||||
void thread_build_node(Task *task_, int thread_id);
|
||||
void thread_build_node(InnerNode *node, int child, BVHObjectBinning *range, int level);
|
||||
thread_mutex build_mutex;
|
||||
|
||||
/* progress */
|
||||
|
@ -44,7 +44,6 @@ public:
|
||||
KernelGlobals *kg;
|
||||
|
||||
CPUDevice(int threads_num)
|
||||
: task_pool(function_bind(&CPUDevice::thread_run, this, _1, _2))
|
||||
{
|
||||
kg = kernel_globals_create();
|
||||
|
||||
@ -113,10 +112,8 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
void thread_run(Task *task_, int thread_id)
|
||||
void thread_run(DeviceTask *task)
|
||||
{
|
||||
DeviceTask *task = (DeviceTask*)task_;
|
||||
|
||||
if(task->type == DeviceTask::PATH_TRACE)
|
||||
thread_path_trace(*task);
|
||||
else if(task->type == DeviceTask::TONEMAP)
|
||||
@ -125,6 +122,15 @@ public:
|
||||
thread_shader(*task);
|
||||
}
|
||||
|
||||
class CPUDeviceTask : public DeviceTask {
|
||||
public:
|
||||
CPUDeviceTask(CPUDevice *device, DeviceTask& task)
|
||||
: DeviceTask(task)
|
||||
{
|
||||
run = function_bind(&CPUDevice::thread_run, device, this);
|
||||
}
|
||||
};
|
||||
|
||||
void thread_path_trace(DeviceTask& task)
|
||||
{
|
||||
if(task_pool.cancelled())
|
||||
@ -226,12 +232,12 @@ public:
|
||||
task.split(tasks, TaskScheduler::num_threads()*10);
|
||||
|
||||
foreach(DeviceTask& task, tasks)
|
||||
task_pool.push(new DeviceTask(task));
|
||||
task_pool.push(new CPUDeviceTask(this, task));
|
||||
}
|
||||
|
||||
void task_wait()
|
||||
{
|
||||
task_pool.wait();
|
||||
task_pool.wait_work();
|
||||
}
|
||||
|
||||
void task_cancel()
|
||||
|
@ -172,11 +172,18 @@ public:
|
||||
|
||||
CUresult result;
|
||||
|
||||
if(background)
|
||||
if(background) {
|
||||
result = cuCtxCreate(&cuContext, 0, cuDevice);
|
||||
else
|
||||
}
|
||||
else {
|
||||
result = cuGLCtxCreate(&cuContext, 0, cuDevice);
|
||||
|
||||
if(result != CUDA_SUCCESS) {
|
||||
result = cuCtxCreate(&cuContext, 0, cuDevice);
|
||||
background = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(cuda_error(result))
|
||||
return;
|
||||
|
||||
@ -686,14 +693,25 @@ public:
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
cuda_assert(cuGraphicsGLRegisterBuffer(&pmem.cuPBOresource, pmem.cuPBO, CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE))
|
||||
CUresult result = cuGraphicsGLRegisterBuffer(&pmem.cuPBOresource, pmem.cuPBO, CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE);
|
||||
|
||||
cuda_pop_context();
|
||||
if(!cuda_error(result)) {
|
||||
cuda_pop_context();
|
||||
|
||||
mem.device_pointer = pmem.cuTexId;
|
||||
pixel_mem_map[mem.device_pointer] = pmem;
|
||||
mem.device_pointer = pmem.cuTexId;
|
||||
pixel_mem_map[mem.device_pointer] = pmem;
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
/* failed to register buffer, fallback to no interop */
|
||||
glDeleteBuffers(1, &pmem.cuPBO);
|
||||
glDeleteTextures(1, &pmem.cuTexId);
|
||||
|
||||
cuda_pop_context();
|
||||
|
||||
background = true;
|
||||
}
|
||||
}
|
||||
|
||||
Device::pixels_alloc(mem);
|
||||
|
@ -33,6 +33,7 @@ set(SRC_HEADERS
|
||||
kernel_object.h
|
||||
kernel_passes.h
|
||||
kernel_path.h
|
||||
kernel_projection.h
|
||||
kernel_qbvh.h
|
||||
kernel_random.h
|
||||
kernel_shader.h
|
||||
|
@ -132,16 +132,30 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Environment Camera */
|
||||
/* Panorama Camera */
|
||||
|
||||
__device void camera_sample_environment(KernelGlobals *kg, float raster_x, float raster_y, Ray *ray)
|
||||
__device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float raster_y, Ray *ray)
|
||||
{
|
||||
Transform rastertocamera = kernel_data.cam.rastertocamera;
|
||||
float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
|
||||
|
||||
/* create ray form raster position */
|
||||
ray->P = make_float3(0.0f, 0.0f, 0.0f);
|
||||
ray->D = equirectangular_to_direction(Pcamera.x, Pcamera.y);
|
||||
|
||||
#ifdef __CAMERA_CLIPPING__
|
||||
/* clipping */
|
||||
ray->t = kernel_data.cam.cliplength;
|
||||
#else
|
||||
ray->t = FLT_MAX;
|
||||
#endif
|
||||
|
||||
ray->D = panorama_to_direction(kg, Pcamera.x, Pcamera.y);
|
||||
|
||||
/* indicates ray should not receive any light, outside of the lens */
|
||||
if(len_squared(ray->D) == 0.0f) {
|
||||
ray->t = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
/* transform ray from camera to world */
|
||||
Transform cameratoworld = kernel_data.cam.cameratoworld;
|
||||
@ -161,17 +175,11 @@ __device void camera_sample_environment(KernelGlobals *kg, float raster_x, float
|
||||
ray->dP.dy = make_float3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x + 1.0f, raster_y, 0.0f));
|
||||
ray->dD.dx = normalize(transform_direction(&cameratoworld, equirectangular_to_direction(Pcamera.x, Pcamera.y))) - ray->D;
|
||||
ray->dD.dx = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y))) - ray->D;
|
||||
|
||||
Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f));
|
||||
ray->dD.dy = normalize(transform_direction(&cameratoworld, equirectangular_to_direction(Pcamera.x, Pcamera.y))) - ray->D;
|
||||
#endif
|
||||
ray->dD.dy = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y))) - ray->D;
|
||||
|
||||
#ifdef __CAMERA_CLIPPING__
|
||||
/* clipping */
|
||||
ray->t = kernel_data.cam.cliplength;
|
||||
#else
|
||||
ray->t = FLT_MAX;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -198,7 +206,7 @@ __device void camera_sample(KernelGlobals *kg, int x, int y, float filter_u, flo
|
||||
else if(kernel_data.cam.type == CAMERA_ORTHOGRAPHIC)
|
||||
camera_sample_orthographic(kg, raster_x, raster_y, ray);
|
||||
else
|
||||
camera_sample_environment(kg, raster_x, raster_y, ray);
|
||||
camera_sample_panorama(kg, raster_x, raster_y, ray);
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@ -91,8 +91,8 @@ __device_inline void sample_uniform_hemisphere(const float3 N,
|
||||
float3 *omega_in, float *pdf)
|
||||
{
|
||||
float z = randu;
|
||||
float r = sqrtf(max(0.f, 1.f - z*z));
|
||||
float phi = 2.f * M_PI_F * randv;
|
||||
float r = sqrtf(max(0.0f, 1.0f - z*z));
|
||||
float phi = 2.0f * M_PI_F * randv;
|
||||
float x = r * cosf(phi);
|
||||
float y = r * sinf(phi);
|
||||
|
||||
@ -185,77 +185,6 @@ __device float2 regular_polygon_sample(float corners, float rotation, float u, f
|
||||
return make_float2(cr*p.x - sr*p.y, sr*p.x + cr*p.y);
|
||||
}
|
||||
|
||||
/* Spherical coordinates <-> Cartesian direction */
|
||||
|
||||
__device float2 direction_to_spherical(float3 dir)
|
||||
{
|
||||
float theta = acosf(dir.z);
|
||||
float phi = atan2f(dir.x, dir.y);
|
||||
|
||||
return make_float2(theta, phi);
|
||||
}
|
||||
|
||||
__device float3 spherical_to_direction(float theta, float phi)
|
||||
{
|
||||
return make_float3(
|
||||
sinf(theta)*cosf(phi),
|
||||
sinf(theta)*sinf(phi),
|
||||
cosf(theta));
|
||||
}
|
||||
|
||||
/* Equirectangular coordinates <-> Cartesian direction */
|
||||
|
||||
__device float2 direction_to_equirectangular(float3 dir)
|
||||
{
|
||||
float u = -atan2f(dir.y, dir.x)/(2.0f*M_PI_F) + 0.5f;
|
||||
float v = atan2f(dir.z, hypotf(dir.x, dir.y))/M_PI_F + 0.5f;
|
||||
|
||||
return make_float2(u, v);
|
||||
}
|
||||
|
||||
__device float3 equirectangular_to_direction(float u, float v)
|
||||
{
|
||||
float phi = M_PI_F*(1.0f - 2.0f*u);
|
||||
float theta = M_PI_F*(1.0f - v);
|
||||
|
||||
return make_float3(
|
||||
sin(theta)*cos(phi),
|
||||
sin(theta)*sin(phi),
|
||||
cos(theta));
|
||||
}
|
||||
|
||||
/* Mirror Ball <-> Cartesion direction */
|
||||
|
||||
__device float3 mirrorball_to_direction(float u, float v)
|
||||
{
|
||||
/* point on sphere */
|
||||
float3 dir;
|
||||
|
||||
dir.x = 2.0f*u - 1.0f;
|
||||
dir.z = 2.0f*v - 1.0f;
|
||||
dir.y = -sqrt(max(1.0f - dir.x*dir.x - dir.z*dir.z, 0.0f));
|
||||
|
||||
/* reflection */
|
||||
float3 I = make_float3(0.0f, -1.0f, 0.0f);
|
||||
|
||||
return 2.0f*dot(dir, I)*dir - I;
|
||||
}
|
||||
|
||||
__device float2 direction_to_mirrorball(float3 dir)
|
||||
{
|
||||
/* inverse of mirrorball_to_direction */
|
||||
dir.y -= 1.0f;
|
||||
|
||||
float div = 2.0f*sqrt(max(-0.5f*dir.y, 0.0f));
|
||||
if(div > 0.0f)
|
||||
dir /= div;
|
||||
|
||||
float u = 0.5f*(dir.x + 1.0f);
|
||||
float v = 0.5f*(dir.z + 1.0f);
|
||||
|
||||
return make_float2(u, v);
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __KERNEL_MONTECARLO_CL__ */
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "kernel_differential.h"
|
||||
#include "kernel_montecarlo.h"
|
||||
#include "kernel_projection.h"
|
||||
#include "kernel_object.h"
|
||||
#include "kernel_triangle.h"
|
||||
#ifdef __QBVH__
|
||||
@ -474,7 +475,12 @@ __device void kernel_path_trace(KernelGlobals *kg,
|
||||
camera_sample(kg, x, y, filter_u, filter_v, lens_u, lens_v, time, &ray);
|
||||
|
||||
/* integrate */
|
||||
float4 L = kernel_path_integrate(kg, &rng, sample, ray, buffer);
|
||||
float4 L;
|
||||
|
||||
if (ray.t != 0.f)
|
||||
L = kernel_path_integrate(kg, &rng, sample, ray, buffer);
|
||||
else
|
||||
L = make_float4(0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
/* accumulate result in output buffer */
|
||||
kernel_write_pass_float4(buffer, sample, L);
|
||||
|
210
intern/cycles/kernel/kernel_projection.h
Normal file
210
intern/cycles/kernel/kernel_projection.h
Normal file
@ -0,0 +1,210 @@
|
||||
/*
|
||||
* Parts adapted from Open Shading Language with this license:
|
||||
*
|
||||
* Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Modifications Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Sony Pictures Imageworks nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __KERNEL_PROJECTION_CL__
|
||||
#define __KERNEL_PROJECTION_CL__
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* Spherical coordinates <-> Cartesian direction */
|
||||
|
||||
__device float2 direction_to_spherical(float3 dir)
|
||||
{
|
||||
float theta = acosf(dir.z);
|
||||
float phi = atan2f(dir.x, dir.y);
|
||||
|
||||
return make_float2(theta, phi);
|
||||
}
|
||||
|
||||
__device float3 spherical_to_direction(float theta, float phi)
|
||||
{
|
||||
return make_float3(
|
||||
sinf(theta)*cosf(phi),
|
||||
sinf(theta)*sinf(phi),
|
||||
cosf(theta));
|
||||
}
|
||||
|
||||
/* Equirectangular coordinates <-> Cartesian direction */
|
||||
|
||||
__device float2 direction_to_equirectangular(float3 dir)
|
||||
{
|
||||
float u = -atan2f(dir.y, dir.x)/(2.0f*M_PI_F) + 0.5f;
|
||||
float v = atan2f(dir.z, hypotf(dir.x, dir.y))/M_PI_F + 0.5f;
|
||||
|
||||
return make_float2(u, v);
|
||||
}
|
||||
|
||||
__device float3 equirectangular_to_direction(float u, float v)
|
||||
{
|
||||
float phi = M_PI_F*(1.0f - 2.0f*u);
|
||||
float theta = M_PI_F*(1.0f - v);
|
||||
|
||||
return make_float3(
|
||||
sin(theta)*cos(phi),
|
||||
sin(theta)*sin(phi),
|
||||
cos(theta));
|
||||
}
|
||||
|
||||
/* Fisheye <-> Cartesian direction */
|
||||
|
||||
__device float2 direction_to_fisheye(float3 dir, float fov)
|
||||
{
|
||||
float r = atan2f(sqrt(dir.y*dir.y + dir.z*dir.z), dir.x) / fov;
|
||||
float phi = atan2(dir.z, dir.y);
|
||||
|
||||
float u = r * cos(phi) + 0.5f;
|
||||
float v = r * sin(phi) + 0.5f;
|
||||
|
||||
return make_float2(u, v);
|
||||
}
|
||||
|
||||
__device float3 fisheye_to_direction(float u, float v, float fov)
|
||||
{
|
||||
u = (u - 0.5f) * 2.0f;
|
||||
v = (v - 0.5f) * 2.0f;
|
||||
|
||||
float r = sqrt(u*u + v*v);
|
||||
|
||||
if(r > 1.0f)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
float phi = acosf((r != 0.0f)? u/r: 0.0f);
|
||||
float theta = asinf(r) * (fov / M_PI_F);
|
||||
|
||||
if(v < 0.0f) phi = -phi;
|
||||
|
||||
return make_float3(
|
||||
cosf(theta),
|
||||
-cosf(phi)*sinf(theta),
|
||||
sinf(phi)*sinf(theta)
|
||||
);
|
||||
}
|
||||
|
||||
__device float2 direction_to_fisheye_equisolid(float3 dir, float lens, float width, float height)
|
||||
{
|
||||
float theta = acosf(dir.x);
|
||||
float r = 2.0f * lens * sinf(theta * 0.5f);
|
||||
float phi = atan2f(dir.z, dir.y);
|
||||
|
||||
float u = r * cosf(phi) / width + 0.5f;
|
||||
float v = r * sinf(phi) / height + 0.5f;
|
||||
|
||||
return make_float2(u, v);
|
||||
}
|
||||
|
||||
__device float3 fisheye_equisolid_to_direction(float u, float v, float lens, float fov, float width, float height)
|
||||
{
|
||||
u = (u - 0.5f) * width;
|
||||
v = (v - 0.5f) * height;
|
||||
|
||||
float rmax = 2.0f * lens * sinf(fov * 0.25f);
|
||||
float r = sqrt(u*u + v*v);
|
||||
|
||||
if(r > rmax)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
float phi = acosf((r != 0.0f)? u/r: 0.0f);
|
||||
float theta = 2.0f * asinf(r/(2.0f * lens));
|
||||
|
||||
if(v < 0.0f) phi = -phi;
|
||||
|
||||
return make_float3(
|
||||
cosf(theta),
|
||||
-cosf(phi)*sinf(theta),
|
||||
sinf(phi)*sinf(theta)
|
||||
);
|
||||
}
|
||||
|
||||
/* Mirror Ball <-> Cartesion direction */
|
||||
|
||||
__device float3 mirrorball_to_direction(float u, float v)
|
||||
{
|
||||
/* point on sphere */
|
||||
float3 dir;
|
||||
|
||||
dir.x = 2.0f*u - 1.0f;
|
||||
dir.z = 2.0f*v - 1.0f;
|
||||
dir.y = -sqrt(max(1.0f - dir.x*dir.x - dir.z*dir.z, 0.0f));
|
||||
|
||||
/* reflection */
|
||||
float3 I = make_float3(0.0f, -1.0f, 0.0f);
|
||||
|
||||
return 2.0f*dot(dir, I)*dir - I;
|
||||
}
|
||||
|
||||
__device float2 direction_to_mirrorball(float3 dir)
|
||||
{
|
||||
/* inverse of mirrorball_to_direction */
|
||||
dir.y -= 1.0f;
|
||||
|
||||
float div = 2.0f*sqrt(max(-0.5f*dir.y, 0.0f));
|
||||
if(div > 0.0f)
|
||||
dir /= div;
|
||||
|
||||
float u = 0.5f*(dir.x + 1.0f);
|
||||
float v = 0.5f*(dir.z + 1.0f);
|
||||
|
||||
return make_float2(u, v);
|
||||
}
|
||||
|
||||
__device float3 panorama_to_direction(KernelGlobals *kg, float u, float v)
|
||||
{
|
||||
switch(kernel_data.cam.panorama_type) {
|
||||
case PANORAMA_EQUIRECTANGULAR:
|
||||
return equirectangular_to_direction(u, v);
|
||||
case PANORAMA_FISHEYE_EQUIDISTANT:
|
||||
return fisheye_to_direction(u, v, kernel_data.cam.fisheye_fov);
|
||||
case PANORAMA_FISHEYE_EQUISOLID:
|
||||
default:
|
||||
return fisheye_equisolid_to_direction(u, v, kernel_data.cam.fisheye_lens,
|
||||
kernel_data.cam.fisheye_fov, kernel_data.cam.sensorwidth, kernel_data.cam.sensorheight);
|
||||
}
|
||||
}
|
||||
|
||||
__device float2 direction_to_panorama(KernelGlobals *kg, float3 dir)
|
||||
{
|
||||
switch(kernel_data.cam.panorama_type) {
|
||||
case PANORAMA_EQUIRECTANGULAR:
|
||||
return direction_to_equirectangular(dir);
|
||||
case PANORAMA_FISHEYE_EQUIDISTANT:
|
||||
return direction_to_fisheye(dir, kernel_data.cam.fisheye_fov);
|
||||
case PANORAMA_FISHEYE_EQUISOLID:
|
||||
default:
|
||||
return direction_to_fisheye_equisolid(dir, kernel_data.cam.fisheye_lens,
|
||||
kernel_data.cam.sensorwidth, kernel_data.cam.sensorheight);
|
||||
}
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __KERNEL_PROJECTION_CL__ */
|
||||
|
@ -180,7 +180,8 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd,
|
||||
}
|
||||
|
||||
sd->flag = kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2);
|
||||
sd->flag |= kernel_tex_fetch(__object_flag, sd->object);
|
||||
if(sd->object != -1)
|
||||
sd->flag |= kernel_tex_fetch(__object_flag, sd->object);
|
||||
|
||||
#ifdef __DPDU__
|
||||
/* dPdu/dPdv */
|
||||
|
@ -217,15 +217,42 @@ __device float4 triangle_motion_vector(KernelGlobals *kg, ShaderData *sd)
|
||||
tfm = object_fetch_transform(kg, sd->object, TIME_INVALID, OBJECT_TRANSFORM_MOTION_POST);
|
||||
motion_post = transform_point(&tfm, motion_post);
|
||||
|
||||
/* camera motion */
|
||||
tfm = kernel_data.cam.worldtoraster;
|
||||
float3 P = transform_perspective(&tfm, sd->P);
|
||||
float3 P;
|
||||
|
||||
tfm = kernel_data.cam.motion.pre;
|
||||
motion_pre = transform_perspective(&tfm, motion_pre) - P;
|
||||
/* camera motion, for perspective/orthographic motion.pre/post will be a
|
||||
world-to-raster matrix, for panorama it's world-to-camera */
|
||||
if (kernel_data.cam.type != CAMERA_PANORAMA) {
|
||||
tfm = kernel_data.cam.worldtoraster;
|
||||
P = transform_perspective(&tfm, sd->P);
|
||||
|
||||
tfm = kernel_data.cam.motion.post;
|
||||
motion_post = P - transform_perspective(&tfm, motion_post);
|
||||
tfm = kernel_data.cam.motion.pre;
|
||||
motion_pre = transform_perspective(&tfm, motion_pre);
|
||||
|
||||
tfm = kernel_data.cam.motion.post;
|
||||
motion_post = transform_perspective(&tfm, motion_post);
|
||||
}
|
||||
else {
|
||||
tfm = kernel_data.cam.worldtocamera;
|
||||
P = normalize(transform_point(&tfm, sd->P));
|
||||
P = float2_to_float3(direction_to_panorama(kg, P));
|
||||
P.x *= kernel_data.cam.width;
|
||||
P.y *= kernel_data.cam.height;
|
||||
|
||||
tfm = kernel_data.cam.motion.pre;
|
||||
motion_pre = normalize(transform_point(&tfm, motion_pre));
|
||||
motion_pre = float2_to_float3(direction_to_panorama(kg, motion_pre));
|
||||
motion_pre.x *= kernel_data.cam.width;
|
||||
motion_pre.y *= kernel_data.cam.height;
|
||||
|
||||
tfm = kernel_data.cam.motion.post;
|
||||
motion_post = normalize(transform_point(&tfm, motion_post));
|
||||
motion_post = float2_to_float3(direction_to_panorama(kg, motion_post));
|
||||
motion_post.x *= kernel_data.cam.width;
|
||||
motion_post.y *= kernel_data.cam.height;
|
||||
}
|
||||
|
||||
motion_pre = motion_pre - P;
|
||||
motion_post = P - motion_post;
|
||||
|
||||
return make_float4(motion_pre.x, motion_pre.y, motion_post.x, motion_post.y);
|
||||
}
|
||||
|
@ -173,25 +173,25 @@ typedef enum PassType {
|
||||
PASS_NONE = 0,
|
||||
PASS_COMBINED = 1,
|
||||
PASS_DEPTH = 2,
|
||||
PASS_NORMAL = 8,
|
||||
PASS_UV = 16,
|
||||
PASS_OBJECT_ID = 32,
|
||||
PASS_MATERIAL_ID = 64,
|
||||
PASS_DIFFUSE_COLOR = 128,
|
||||
PASS_GLOSSY_COLOR = 256,
|
||||
PASS_TRANSMISSION_COLOR = 512,
|
||||
PASS_DIFFUSE_INDIRECT = 1024,
|
||||
PASS_GLOSSY_INDIRECT = 2048,
|
||||
PASS_TRANSMISSION_INDIRECT = 4096,
|
||||
PASS_DIFFUSE_DIRECT = 8192,
|
||||
PASS_GLOSSY_DIRECT = 16384,
|
||||
PASS_TRANSMISSION_DIRECT = 32768,
|
||||
PASS_EMISSION = 65536,
|
||||
PASS_BACKGROUND = 131072,
|
||||
PASS_AO = 262144,
|
||||
PASS_SHADOW = 524288,
|
||||
PASS_MOTION = 1048576,
|
||||
PASS_MOTION_WEIGHT = 2097152
|
||||
PASS_NORMAL = 4,
|
||||
PASS_UV = 8,
|
||||
PASS_OBJECT_ID = 16,
|
||||
PASS_MATERIAL_ID = 32,
|
||||
PASS_DIFFUSE_COLOR = 64,
|
||||
PASS_GLOSSY_COLOR = 128,
|
||||
PASS_TRANSMISSION_COLOR = 256,
|
||||
PASS_DIFFUSE_INDIRECT = 512,
|
||||
PASS_GLOSSY_INDIRECT = 1024,
|
||||
PASS_TRANSMISSION_INDIRECT = 2048,
|
||||
PASS_DIFFUSE_DIRECT = 4096,
|
||||
PASS_GLOSSY_DIRECT = 8192,
|
||||
PASS_TRANSMISSION_DIRECT = 16384,
|
||||
PASS_EMISSION = 32768,
|
||||
PASS_BACKGROUND = 65536,
|
||||
PASS_AO = 131072,
|
||||
PASS_SHADOW = 262144,
|
||||
PASS_MOTION = 524288,
|
||||
PASS_MOTION_WEIGHT = 1048576
|
||||
} PassType;
|
||||
|
||||
#define PASS_ALL (~0)
|
||||
@ -268,7 +268,15 @@ typedef enum LightType {
|
||||
enum CameraType {
|
||||
CAMERA_PERSPECTIVE,
|
||||
CAMERA_ORTHOGRAPHIC,
|
||||
CAMERA_ENVIRONMENT
|
||||
CAMERA_PANORAMA
|
||||
};
|
||||
|
||||
/* Panorama Type */
|
||||
|
||||
enum PanoramaType {
|
||||
PANORAMA_EQUIRECTANGULAR,
|
||||
PANORAMA_FISHEYE_EQUIDISTANT,
|
||||
PANORAMA_FISHEYE_EQUISOLID
|
||||
};
|
||||
|
||||
/* Differential */
|
||||
@ -452,7 +460,11 @@ typedef struct ShaderData {
|
||||
typedef struct KernelCamera {
|
||||
/* type */
|
||||
int type;
|
||||
int pad1, pad2, pad3;
|
||||
|
||||
/* panorama */
|
||||
int panorama_type;
|
||||
float fisheye_fov;
|
||||
float fisheye_lens;
|
||||
|
||||
/* matrices */
|
||||
Transform cameratoworld;
|
||||
@ -476,6 +488,13 @@ typedef struct KernelCamera {
|
||||
float nearclip;
|
||||
float cliplength;
|
||||
|
||||
/* sensor size */
|
||||
float sensorwidth;
|
||||
float sensorheight;
|
||||
|
||||
/* render size */
|
||||
float width, height;
|
||||
|
||||
/* more matrices */
|
||||
Transform screentoworld;
|
||||
Transform rastertoworld;
|
||||
|
@ -326,6 +326,9 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
|
||||
case NODE_MAPPING:
|
||||
svm_node_mapping(kg, sd, stack, node.y, node.z, &offset);
|
||||
break;
|
||||
case NODE_MIN_MAX:
|
||||
svm_node_min_max(kg, sd, stack, node.y, node.z, &offset);
|
||||
break;
|
||||
case NODE_TEX_COORD:
|
||||
svm_node_tex_coord(kg, sd, stack, node.y, node.z);
|
||||
break;
|
||||
@ -344,6 +347,9 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
|
||||
case NODE_RGB_CURVES:
|
||||
svm_node_rgb_curves(kg, sd, stack, node, &offset);
|
||||
break;
|
||||
case NODE_LIGHT_FALLOFF:
|
||||
svm_node_light_falloff(sd, stack, node);
|
||||
break;
|
||||
case NODE_END:
|
||||
default:
|
||||
#ifndef __MULTI_CLOSURE__
|
||||
|
@ -39,5 +39,32 @@ __device void svm_node_light_path(ShaderData *sd, float *stack, uint type, uint
|
||||
stack_store_float(stack, out_offset, info);
|
||||
}
|
||||
|
||||
/* Light Falloff Node */
|
||||
|
||||
__device void svm_node_light_falloff(ShaderData *sd, float *stack, uint4 node)
|
||||
{
|
||||
uint strength_offset, out_offset, smooth_offset;
|
||||
|
||||
decode_node_uchar4(node.z, &strength_offset, &smooth_offset, &out_offset, NULL);
|
||||
|
||||
float strength = stack_load_float(stack, strength_offset);
|
||||
uint type = node.y;
|
||||
|
||||
switch(type) {
|
||||
case NODE_LIGHT_FALLOFF_QUADRATIC: break;
|
||||
case NODE_LIGHT_FALLOFF_LINEAR: strength *= sd->ray_length; break;
|
||||
case NODE_LIGHT_FALLOFF_CONSTANT: strength *= sd->ray_length*sd->ray_length; break;
|
||||
}
|
||||
|
||||
float smooth = stack_load_float(stack, smooth_offset);
|
||||
|
||||
if(smooth > 0.0f) {
|
||||
float squared = sd->ray_length*sd->ray_length;
|
||||
strength *= squared/(smooth + squared);
|
||||
}
|
||||
|
||||
stack_store_float(stack, out_offset, strength);
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@ -34,5 +34,16 @@ __device void svm_node_mapping(KernelGlobals *kg, ShaderData *sd, float *stack,
|
||||
stack_store_float3(stack, out_offset, r);
|
||||
}
|
||||
|
||||
__device void svm_node_min_max(KernelGlobals *kg, ShaderData *sd, float *stack, uint vec_offset, uint out_offset, int *offset)
|
||||
{
|
||||
float3 v = stack_load_float3(stack, vec_offset);
|
||||
|
||||
float3 mn = float4_to_float3(read_node_float(kg, offset));
|
||||
float3 mx = float4_to_float3(read_node_float(kg, offset));
|
||||
|
||||
float3 r = min(max(mn, v), mx);
|
||||
stack_store_float3(stack, out_offset, r);
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@ -20,12 +20,35 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* Texture Coordinate Node */
|
||||
|
||||
__device float3 svm_background_offset(KernelGlobals *kg)
|
||||
__device_inline float3 svm_background_offset(KernelGlobals *kg)
|
||||
{
|
||||
Transform cameratoworld = kernel_data.cam.cameratoworld;
|
||||
return make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
|
||||
}
|
||||
|
||||
__device_inline float3 svm_world_to_ndc(KernelGlobals *kg, ShaderData *sd, float3 P)
|
||||
{
|
||||
if(kernel_data.cam.type != CAMERA_PANORAMA) {
|
||||
if(sd->object != ~0)
|
||||
P += svm_background_offset(kg);
|
||||
|
||||
Transform tfm = kernel_data.cam.worldtondc;
|
||||
return transform_perspective(&tfm, P);
|
||||
}
|
||||
else {
|
||||
Transform tfm = kernel_data.cam.worldtocamera;
|
||||
|
||||
if(sd->object != ~0)
|
||||
P = normalize(transform_point(&tfm, P));
|
||||
else
|
||||
P = normalize(transform_direction(&tfm, P));
|
||||
|
||||
float2 uv = direction_to_panorama(kg, P);;
|
||||
|
||||
return make_float3(uv.x, uv.y, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
__device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, float *stack, uint type, uint out_offset)
|
||||
{
|
||||
float3 data;
|
||||
@ -59,12 +82,7 @@ __device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, float *stack
|
||||
break;
|
||||
}
|
||||
case NODE_TEXCO_WINDOW: {
|
||||
Transform tfm = kernel_data.cam.worldtondc;
|
||||
|
||||
if(sd->object != ~0)
|
||||
data = transform_perspective(&tfm, sd->P);
|
||||
else
|
||||
data = transform_perspective(&tfm, sd->P + svm_background_offset(kg));
|
||||
data = svm_world_to_ndc(kg, sd, sd->P);
|
||||
break;
|
||||
}
|
||||
case NODE_TEXCO_REFLECTION: {
|
||||
@ -113,12 +131,7 @@ __device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, floa
|
||||
break;
|
||||
}
|
||||
case NODE_TEXCO_WINDOW: {
|
||||
Transform tfm = kernel_data.cam.worldtondc;
|
||||
|
||||
if(sd->object != ~0)
|
||||
data = transform_perspective(&tfm, sd->P + sd->dP.dx);
|
||||
else
|
||||
data = transform_perspective(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg));
|
||||
data = svm_world_to_ndc(kg, sd, sd->P + sd->dP.dx);
|
||||
break;
|
||||
}
|
||||
case NODE_TEXCO_REFLECTION: {
|
||||
@ -170,12 +183,7 @@ __device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, floa
|
||||
break;
|
||||
}
|
||||
case NODE_TEXCO_WINDOW: {
|
||||
Transform tfm = kernel_data.cam.worldtondc;
|
||||
|
||||
if(sd->object != ~0)
|
||||
data = transform_perspective(&tfm, sd->P + sd->dP.dy);
|
||||
else
|
||||
data = transform_perspective(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg));
|
||||
data = svm_world_to_ndc(kg, sd, sd->P + sd->dP.dy);
|
||||
break;
|
||||
}
|
||||
case NODE_TEXCO_REFLECTION: {
|
||||
|
@ -90,7 +90,9 @@ typedef enum NodeType {
|
||||
NODE_TEX_CHECKER = 5700,
|
||||
NODE_BRIGHTCONTRAST = 5800,
|
||||
NODE_RGB_RAMP = 5900,
|
||||
NODE_RGB_CURVES = 6000
|
||||
NODE_RGB_CURVES = 6000,
|
||||
NODE_MIN_MAX = 6100,
|
||||
NODE_LIGHT_FALLOFF = 6200
|
||||
} NodeType;
|
||||
|
||||
typedef enum NodeAttributeType {
|
||||
@ -119,6 +121,12 @@ typedef enum NodeLightPath {
|
||||
NODE_LP_ray_length
|
||||
} NodeLightPath;
|
||||
|
||||
typedef enum NodeLightFalloff {
|
||||
NODE_LIGHT_FALLOFF_QUADRATIC,
|
||||
NODE_LIGHT_FALLOFF_LINEAR,
|
||||
NODE_LIGHT_FALLOFF_CONSTANT
|
||||
} NodeLightFalloff;
|
||||
|
||||
typedef enum NodeTexCoord {
|
||||
NODE_TEXCO_NORMAL,
|
||||
NODE_TEXCO_OBJECT,
|
||||
|
@ -39,8 +39,14 @@ Camera::Camera()
|
||||
use_motion = false;
|
||||
|
||||
type = CAMERA_PERSPECTIVE;
|
||||
panorama_type = PANORAMA_EQUIRECTANGULAR;
|
||||
fisheye_fov = M_PI_F;
|
||||
fisheye_lens = 10.5f;
|
||||
fov = M_PI_F/4.0f;
|
||||
|
||||
sensorwidth = 0.036;
|
||||
sensorheight = 0.024;
|
||||
|
||||
nearclip = 1e-5f;
|
||||
farclip = 1e5f;
|
||||
|
||||
@ -152,13 +158,25 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
|
||||
kcam->have_motion = 0;
|
||||
|
||||
if(need_motion == Scene::MOTION_PASS) {
|
||||
if(use_motion) {
|
||||
kcam->motion.pre = transform_inverse(motion.pre * rastertocamera);
|
||||
kcam->motion.post = transform_inverse(motion.post * rastertocamera);
|
||||
if(type == CAMERA_PANORAMA) {
|
||||
if(use_motion) {
|
||||
kcam->motion.pre = transform_inverse(motion.pre);
|
||||
kcam->motion.post = transform_inverse(motion.post);
|
||||
}
|
||||
else {
|
||||
kcam->motion.pre = kcam->worldtocamera;
|
||||
kcam->motion.post = kcam->worldtocamera;
|
||||
}
|
||||
}
|
||||
else {
|
||||
kcam->motion.pre = worldtoraster;
|
||||
kcam->motion.post = worldtoraster;
|
||||
if(use_motion) {
|
||||
kcam->motion.pre = transform_inverse(motion.pre * rastertocamera);
|
||||
kcam->motion.post = transform_inverse(motion.post * rastertocamera);
|
||||
}
|
||||
else {
|
||||
kcam->motion.pre = worldtoraster;
|
||||
kcam->motion.post = worldtoraster;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(need_motion == Scene::MOTION_BLUR) {
|
||||
@ -181,6 +199,19 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
|
||||
/* type */
|
||||
kcam->type = type;
|
||||
|
||||
/* panorama */
|
||||
kcam->panorama_type = panorama_type;
|
||||
kcam->fisheye_fov = fisheye_fov;
|
||||
kcam->fisheye_lens = fisheye_lens;
|
||||
|
||||
/* sensor size */
|
||||
kcam->sensorwidth = sensorwidth;
|
||||
kcam->sensorheight = sensorheight;
|
||||
|
||||
/* render size */
|
||||
kcam->width = width;
|
||||
kcam->height = height;
|
||||
|
||||
/* store differentials */
|
||||
kcam->dx = float3_to_float4(dx);
|
||||
kcam->dy = float3_to_float4(dy);
|
||||
@ -208,6 +239,8 @@ bool Camera::modified(const Camera& cam)
|
||||
(fov == cam.fov) &&
|
||||
(nearclip == cam.nearclip) &&
|
||||
(farclip == cam.farclip) &&
|
||||
(sensorwidth == cam.sensorwidth) &&
|
||||
(sensorheight == cam.sensorheight) &&
|
||||
// modified for progressive render
|
||||
// (width == cam.width) &&
|
||||
// (height == cam.height) &&
|
||||
@ -217,7 +250,10 @@ bool Camera::modified(const Camera& cam)
|
||||
(top == cam.top) &&
|
||||
(matrix == cam.matrix) &&
|
||||
(motion == cam.motion) &&
|
||||
(use_motion == cam.use_motion));
|
||||
(use_motion == cam.use_motion) &&
|
||||
(panorama_type == cam.panorama_type) &&
|
||||
(fisheye_fov == cam.fisheye_fov) &&
|
||||
(fisheye_lens == cam.fisheye_lens));
|
||||
}
|
||||
|
||||
void Camera::tag_update()
|
||||
|
@ -50,6 +50,15 @@ public:
|
||||
CameraType type;
|
||||
float fov;
|
||||
|
||||
/* panorama */
|
||||
PanoramaType panorama_type;
|
||||
float fisheye_fov;
|
||||
float fisheye_lens;
|
||||
|
||||
/* sensor */
|
||||
float sensorwidth;
|
||||
float sensorheight;
|
||||
|
||||
/* clipping */
|
||||
float nearclip;
|
||||
float farclip;
|
||||
|
@ -324,8 +324,10 @@ bool ImageManager::file_load_float_image(Image *img, device_vector<float4>& tex_
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int slot)
|
||||
void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int slot, Progress *progress)
|
||||
{
|
||||
if(progress->get_cancel())
|
||||
return;
|
||||
if(osl_texture_system)
|
||||
return;
|
||||
|
||||
@ -342,6 +344,9 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl
|
||||
}
|
||||
|
||||
if(is_float) {
|
||||
string filename = path_filename(float_images[slot - TEX_IMAGE_FLOAT_START]->filename);
|
||||
progress->set_status("Updating Images", "Loading " + filename);
|
||||
|
||||
device_vector<float4>& tex_img = dscene->tex_float_image[slot - TEX_IMAGE_FLOAT_START];
|
||||
|
||||
if(tex_img.device_pointer)
|
||||
@ -365,6 +370,9 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl
|
||||
device->tex_alloc(name.c_str(), tex_img, true, true);
|
||||
}
|
||||
else {
|
||||
string filename = path_filename(images[slot]->filename);
|
||||
progress->set_status("Updating Images", "Loading " + filename);
|
||||
|
||||
device_vector<uchar4>& tex_img = dscene->tex_image[slot];
|
||||
|
||||
if(tex_img.device_pointer)
|
||||
@ -387,6 +395,8 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl
|
||||
|
||||
device->tex_alloc(name.c_str(), tex_img, true, true);
|
||||
}
|
||||
|
||||
img->need_load = false;
|
||||
}
|
||||
|
||||
void ImageManager::device_free_image(Device *device, DeviceScene *dscene, int slot)
|
||||
@ -431,39 +441,37 @@ void ImageManager::device_update(Device *device, DeviceScene *dscene, Progress&
|
||||
{
|
||||
if(!need_update)
|
||||
return;
|
||||
|
||||
TaskPool pool;
|
||||
|
||||
for(size_t slot = 0; slot < images.size(); slot++) {
|
||||
if(images[slot]) {
|
||||
if(images[slot]->users == 0) {
|
||||
device_free_image(device, dscene, slot);
|
||||
}
|
||||
else if(images[slot]->need_load) {
|
||||
string name = path_filename(images[slot]->filename);
|
||||
progress.set_status("Updating Images", "Loading " + name);
|
||||
device_load_image(device, dscene, slot);
|
||||
images[slot]->need_load = false;
|
||||
}
|
||||
if(!images[slot])
|
||||
continue;
|
||||
|
||||
if(progress.get_cancel()) return;
|
||||
if(images[slot]->users == 0) {
|
||||
device_free_image(device, dscene, slot);
|
||||
}
|
||||
else if(images[slot]->need_load) {
|
||||
if(!osl_texture_system)
|
||||
pool.push(function_bind(&ImageManager::device_load_image, this, device, dscene, slot, &progress));
|
||||
}
|
||||
}
|
||||
|
||||
for(size_t slot = 0; slot < float_images.size(); slot++) {
|
||||
if(float_images[slot]) {
|
||||
if(float_images[slot]->users == 0) {
|
||||
device_free_image(device, dscene, slot + TEX_IMAGE_FLOAT_START);
|
||||
}
|
||||
else if(float_images[slot]->need_load) {
|
||||
string name = path_filename(float_images[slot]->filename);
|
||||
progress.set_status("Updating Images", "Loading " + name);
|
||||
device_load_image(device, dscene, slot + TEX_IMAGE_FLOAT_START);
|
||||
float_images[slot]->need_load = false;
|
||||
}
|
||||
if(!float_images[slot])
|
||||
continue;
|
||||
|
||||
if(progress.get_cancel()) return;
|
||||
if(float_images[slot]->users == 0) {
|
||||
device_free_image(device, dscene, slot + TEX_IMAGE_FLOAT_START);
|
||||
}
|
||||
else if(float_images[slot]->need_load) {
|
||||
if(!osl_texture_system)
|
||||
pool.push(function_bind(&ImageManager::device_load_image, this, device, dscene, slot + TEX_IMAGE_FLOAT_START, &progress));
|
||||
}
|
||||
}
|
||||
|
||||
pool.wait_work();
|
||||
|
||||
need_update = false;
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ private:
|
||||
bool file_load_image(Image *img, device_vector<uchar4>& tex_img);
|
||||
bool file_load_float_image(Image *img, device_vector<float4>& tex_img);
|
||||
|
||||
void device_load_image(Device *device, DeviceScene *dscene, int slot);
|
||||
void device_load_image(Device *device, DeviceScene *dscene, int slot, Progress *progess);
|
||||
void device_free_image(Device *device, DeviceScene *dscene, int slot);
|
||||
};
|
||||
|
||||
|
@ -26,8 +26,6 @@
|
||||
#include "util_foreach.h"
|
||||
#include "util_progress.h"
|
||||
|
||||
#include "kernel_montecarlo.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
static void dump_background_pixels(Device *device, DeviceScene *dscene, int res, vector<float3>& pixels)
|
||||
|
@ -242,31 +242,47 @@ void Mesh::pack_verts(float4 *tri_verts, float4 *tri_vindex, size_t vert_offset)
|
||||
}
|
||||
}
|
||||
|
||||
void Mesh::compute_bvh(SceneParams *params, Progress& progress)
|
||||
void Mesh::compute_bvh(SceneParams *params, Progress *progress, int n, int total)
|
||||
{
|
||||
Object object;
|
||||
object.mesh = this;
|
||||
if(progress->get_cancel())
|
||||
return;
|
||||
|
||||
vector<Object*> objects;
|
||||
objects.push_back(&object);
|
||||
compute_bounds();
|
||||
|
||||
if(bvh && !need_update_rebuild) {
|
||||
progress.set_substatus("Refitting BVH");
|
||||
bvh->objects = objects;
|
||||
bvh->refit(progress);
|
||||
if(!transform_applied) {
|
||||
string msg = "Updating Mesh BVH ";
|
||||
if(name == "")
|
||||
msg += string_printf("%u/%u", (uint)(n+1), (uint)total);
|
||||
else
|
||||
msg += string_printf("%s %u/%u", name.c_str(), (uint)(n+1), (uint)total);
|
||||
|
||||
Object object;
|
||||
object.mesh = this;
|
||||
|
||||
vector<Object*> objects;
|
||||
objects.push_back(&object);
|
||||
|
||||
if(bvh && !need_update_rebuild) {
|
||||
progress->set_status(msg, "Refitting BVH");
|
||||
bvh->objects = objects;
|
||||
bvh->refit(*progress);
|
||||
}
|
||||
else {
|
||||
progress->set_status(msg, "Building BVH");
|
||||
|
||||
BVHParams bparams;
|
||||
bparams.use_cache = params->use_bvh_cache;
|
||||
bparams.use_spatial_split = params->use_bvh_spatial_split;
|
||||
bparams.use_qbvh = params->use_qbvh;
|
||||
|
||||
delete bvh;
|
||||
bvh = BVH::create(bparams, objects);
|
||||
bvh->build(*progress);
|
||||
}
|
||||
}
|
||||
else {
|
||||
progress.set_substatus("Building BVH");
|
||||
|
||||
BVHParams bparams;
|
||||
bparams.use_cache = params->use_bvh_cache;
|
||||
bparams.use_spatial_split = params->use_bvh_spatial_split;
|
||||
bparams.use_qbvh = params->use_qbvh;
|
||||
|
||||
delete bvh;
|
||||
bvh = BVH::create(bparams, objects);
|
||||
bvh->build(progress);
|
||||
}
|
||||
need_update = false;
|
||||
need_update_rebuild = false;
|
||||
}
|
||||
|
||||
void Mesh::tag_update(Scene *scene, bool rebuild)
|
||||
@ -686,35 +702,22 @@ void MeshManager::device_update(Device *device, DeviceScene *dscene, Scene *scen
|
||||
}
|
||||
|
||||
/* update bvh */
|
||||
size_t i = 0, num_instance_bvh = 0;
|
||||
size_t i = 0, num_bvh = 0;
|
||||
|
||||
foreach(Mesh *mesh, scene->meshes)
|
||||
if(mesh->need_update && !mesh->transform_applied)
|
||||
num_instance_bvh++;
|
||||
num_bvh++;
|
||||
|
||||
TaskPool pool;
|
||||
|
||||
foreach(Mesh *mesh, scene->meshes) {
|
||||
if(mesh->need_update) {
|
||||
mesh->compute_bounds();
|
||||
|
||||
if(!mesh->transform_applied) {
|
||||
string msg = "Updating Mesh BVH ";
|
||||
if(mesh->name == "")
|
||||
msg += string_printf("%u/%u", (uint)(i+1), (uint)num_instance_bvh);
|
||||
else
|
||||
msg += string_printf("%s %u/%u", mesh->name.c_str(), (uint)(i+1), (uint)num_instance_bvh);
|
||||
progress.set_status(msg, "Building BVH");
|
||||
|
||||
mesh->compute_bvh(&scene->params, progress);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if(progress.get_cancel()) return;
|
||||
|
||||
mesh->need_update = false;
|
||||
mesh->need_update_rebuild = false;
|
||||
pool.push(function_bind(&Mesh::compute_bvh, mesh, &scene->params, &progress, i, num_bvh));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
pool.wait_work();
|
||||
|
||||
foreach(Shader *shader, scene->shaders)
|
||||
shader->need_update_attributes = false;
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
|
||||
void pack_normals(Scene *scene, float4 *normal, float4 *vnormal);
|
||||
void pack_verts(float4 *tri_verts, float4 *tri_vindex, size_t vert_offset);
|
||||
void compute_bvh(SceneParams *params, Progress& progress);
|
||||
void compute_bvh(SceneParams *params, Progress *progress, int n, int total);
|
||||
|
||||
bool need_attribute(Scene *scene, AttributeStandard std);
|
||||
bool need_attribute(Scene *scene, ustring name);
|
||||
|
@ -33,6 +33,11 @@ TextureMapping::TextureMapping()
|
||||
rotation = make_float3(0.0f, 0.0f, 0.0f);
|
||||
scale = make_float3(1.0f, 1.0f, 1.0f);
|
||||
|
||||
min = make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX);
|
||||
max = make_float3(FLT_MAX, FLT_MAX, FLT_MAX);
|
||||
|
||||
use_minmax = false;
|
||||
|
||||
x_mapping = X;
|
||||
y_mapping = Y;
|
||||
z_mapping = Z;
|
||||
@ -69,6 +74,8 @@ bool TextureMapping::skip()
|
||||
|
||||
if(x_mapping != X || y_mapping != Y || z_mapping != Z)
|
||||
return false;
|
||||
if(use_minmax)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -85,6 +92,12 @@ void TextureMapping::compile(SVMCompiler& compiler, int offset_in, int offset_ou
|
||||
compiler.add_node(tfm.y);
|
||||
compiler.add_node(tfm.z);
|
||||
compiler.add_node(tfm.w);
|
||||
|
||||
if(use_minmax) {
|
||||
compiler.add_node(NODE_MIN_MAX, offset_out, offset_out);
|
||||
compiler.add_node(float3_to_float4(min));
|
||||
compiler.add_node(float3_to_float4(max));
|
||||
}
|
||||
}
|
||||
|
||||
/* Image Texture */
|
||||
@ -1686,6 +1699,54 @@ void LightPathNode::compile(OSLCompiler& compiler)
|
||||
compiler.add(this, "node_light_path");
|
||||
}
|
||||
|
||||
/* Light Path */
|
||||
|
||||
LightFalloffNode::LightFalloffNode()
|
||||
: ShaderNode("light_path")
|
||||
{
|
||||
add_input("Strength", SHADER_SOCKET_FLOAT, 100.0f);
|
||||
add_input("Smooth", SHADER_SOCKET_FLOAT, 0.0f);
|
||||
add_output("Quadratic", SHADER_SOCKET_FLOAT);
|
||||
add_output("Linear", SHADER_SOCKET_FLOAT);
|
||||
add_output("Constant", SHADER_SOCKET_FLOAT);
|
||||
}
|
||||
|
||||
void LightFalloffNode::compile(SVMCompiler& compiler)
|
||||
{
|
||||
ShaderInput *strength_in = input("Strength");
|
||||
ShaderInput *smooth_in = input("Smooth");
|
||||
|
||||
compiler.stack_assign(strength_in);
|
||||
compiler.stack_assign(smooth_in);
|
||||
|
||||
ShaderOutput *out = output("Quadratic");
|
||||
if(!out->links.empty()) {
|
||||
compiler.stack_assign(out);
|
||||
compiler.add_node(NODE_LIGHT_FALLOFF, NODE_LIGHT_FALLOFF_QUADRATIC,
|
||||
compiler.encode_uchar4(strength_in->stack_offset, smooth_in->stack_offset, out->stack_offset));
|
||||
}
|
||||
|
||||
out = output("Linear");
|
||||
if(!out->links.empty()) {
|
||||
compiler.stack_assign(out);
|
||||
compiler.add_node(NODE_LIGHT_FALLOFF, NODE_LIGHT_FALLOFF_LINEAR,
|
||||
compiler.encode_uchar4(strength_in->stack_offset, smooth_in->stack_offset, out->stack_offset));
|
||||
compiler.add_node(NODE_LIGHT_FALLOFF, NODE_LIGHT_FALLOFF_LINEAR, out->stack_offset);
|
||||
}
|
||||
|
||||
out = output("Constant");
|
||||
if(!out->links.empty()) {
|
||||
compiler.stack_assign(out);
|
||||
compiler.add_node(NODE_LIGHT_FALLOFF, NODE_LIGHT_FALLOFF_CONSTANT,
|
||||
compiler.encode_uchar4(strength_in->stack_offset, smooth_in->stack_offset, out->stack_offset));
|
||||
}
|
||||
}
|
||||
|
||||
void LightFalloffNode::compile(OSLCompiler& compiler)
|
||||
{
|
||||
compiler.add(this, "node_light_falloff");
|
||||
}
|
||||
|
||||
/* Value */
|
||||
|
||||
ValueNode::ValueNode()
|
||||
|
@ -41,6 +41,9 @@ public:
|
||||
float3 rotation;
|
||||
float3 scale;
|
||||
|
||||
float3 min, max;
|
||||
bool use_minmax;
|
||||
|
||||
enum Mapping { NONE=0, X=1, Y=2, Z=3 };
|
||||
Mapping x_mapping, y_mapping, z_mapping;
|
||||
|
||||
@ -277,6 +280,11 @@ public:
|
||||
SHADER_NODE_CLASS(LightPathNode)
|
||||
};
|
||||
|
||||
class LightFalloffNode : public ShaderNode {
|
||||
public:
|
||||
SHADER_NODE_CLASS(LightFalloffNode)
|
||||
};
|
||||
|
||||
class ValueNode : public ShaderNode {
|
||||
public:
|
||||
SHADER_NODE_CLASS(ValueNode)
|
||||
|
@ -507,6 +507,11 @@ __device_inline float3 fabs(float3 a)
|
||||
|
||||
#endif
|
||||
|
||||
__device_inline float3 float2_to_float3(const float2 a)
|
||||
{
|
||||
return make_float3(a.x, a.y, 0.0f);
|
||||
}
|
||||
|
||||
__device_inline float3 float4_to_float3(const float4 a)
|
||||
{
|
||||
return make_float3(a.x, a.y, a.z);
|
||||
|
@ -25,14 +25,12 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* Task Pool */
|
||||
|
||||
TaskPool::TaskPool(const TaskRunFunction& run_)
|
||||
TaskPool::TaskPool()
|
||||
{
|
||||
num = 0;
|
||||
num_done = 0;
|
||||
|
||||
do_cancel = false;
|
||||
|
||||
run = run_;
|
||||
}
|
||||
|
||||
TaskPool::~TaskPool()
|
||||
@ -50,12 +48,55 @@ void TaskPool::push(Task *task, bool front)
|
||||
TaskScheduler::push(entry, front);
|
||||
}
|
||||
|
||||
void TaskPool::wait()
|
||||
void TaskPool::push(const TaskRunFunction& run, bool front)
|
||||
{
|
||||
thread_scoped_lock lock(done_mutex);
|
||||
push(new Task(run), front);
|
||||
}
|
||||
|
||||
while(num_done != num)
|
||||
done_cond.wait(lock);
|
||||
void TaskPool::wait_work()
|
||||
{
|
||||
thread_scoped_lock done_lock(done_mutex);
|
||||
|
||||
while(num_done != num) {
|
||||
thread_scoped_lock queue_lock(TaskScheduler::queue_mutex);
|
||||
|
||||
/* find task from this pool. if we get a task from another pool,
|
||||
* we can get into deadlock */
|
||||
TaskScheduler::Entry work_entry;
|
||||
bool found_entry = false;
|
||||
list<TaskScheduler::Entry>::iterator it;
|
||||
|
||||
for(it = TaskScheduler::queue.begin(); it != TaskScheduler::queue.end(); it++) {
|
||||
TaskScheduler::Entry& entry = *it;
|
||||
|
||||
if(entry.pool == this) {
|
||||
work_entry = entry;
|
||||
found_entry = true;
|
||||
TaskScheduler::queue.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
queue_lock.unlock();
|
||||
|
||||
/* if found task, do it, otherwise wait until other tasks are done */
|
||||
if(found_entry) {
|
||||
done_lock.unlock();
|
||||
|
||||
/* run task */
|
||||
work_entry.task->run();
|
||||
|
||||
/* delete task */
|
||||
delete work_entry.task;
|
||||
|
||||
/* notify pool task was done */
|
||||
done_increase(1);
|
||||
|
||||
done_lock.lock();
|
||||
}
|
||||
else
|
||||
done_cond.wait(done_lock);
|
||||
}
|
||||
}
|
||||
|
||||
void TaskPool::cancel()
|
||||
@ -63,7 +104,12 @@ void TaskPool::cancel()
|
||||
TaskScheduler::clear(this);
|
||||
|
||||
do_cancel = true;
|
||||
wait();
|
||||
{
|
||||
thread_scoped_lock lock(done_mutex);
|
||||
|
||||
while(num_done != num)
|
||||
done_cond.wait(lock);
|
||||
}
|
||||
do_cancel = false;
|
||||
}
|
||||
|
||||
@ -94,6 +140,7 @@ void TaskPool::done_increase(int done)
|
||||
thread_mutex TaskScheduler::mutex;
|
||||
int TaskScheduler::users = 0;
|
||||
vector<thread*> TaskScheduler::threads;
|
||||
vector<int> TaskScheduler::thread_level;
|
||||
volatile bool TaskScheduler::do_exit = false;
|
||||
|
||||
list<TaskScheduler::Entry> TaskScheduler::queue;
|
||||
@ -114,9 +161,12 @@ void TaskScheduler::init(int num_threads)
|
||||
num_threads = system_cpu_thread_count();
|
||||
|
||||
threads.resize(num_threads);
|
||||
thread_level.resize(num_threads);
|
||||
|
||||
for(size_t i = 0; i < threads.size(); i++)
|
||||
for(size_t i = 0; i < threads.size(); i++) {
|
||||
threads[i] = new thread(function_bind(&TaskScheduler::thread_run, i));
|
||||
thread_level[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
users++;
|
||||
@ -140,6 +190,7 @@ void TaskScheduler::exit()
|
||||
}
|
||||
|
||||
threads.clear();
|
||||
thread_level.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,7 +221,7 @@ void TaskScheduler::thread_run(int thread_id)
|
||||
/* keep popping off tasks */
|
||||
while(thread_wait_pop(entry)) {
|
||||
/* run task */
|
||||
entry.pool->run(entry.task, thread_id);
|
||||
entry.task->run();
|
||||
|
||||
/* delete task */
|
||||
delete entry.task;
|
||||
@ -196,20 +247,20 @@ void TaskScheduler::push(Entry& entry, bool front)
|
||||
|
||||
void TaskScheduler::clear(TaskPool *pool)
|
||||
{
|
||||
thread_scoped_lock lock(TaskScheduler::queue_mutex);
|
||||
thread_scoped_lock lock(queue_mutex);
|
||||
|
||||
/* erase all tasks from this pool from the queue */
|
||||
list<TaskScheduler::Entry>::iterator it = TaskScheduler::queue.begin();
|
||||
list<Entry>::iterator it = queue.begin();
|
||||
int done = 0;
|
||||
|
||||
while(it != TaskScheduler::queue.end()) {
|
||||
TaskScheduler::Entry& entry = *it;
|
||||
while(it != queue.end()) {
|
||||
Entry& entry = *it;
|
||||
|
||||
if(entry.pool == pool) {
|
||||
done++;
|
||||
delete entry.task;
|
||||
|
||||
it = TaskScheduler::queue.erase(it);
|
||||
it = queue.erase(it);
|
||||
}
|
||||
else
|
||||
it++;
|
||||
|
@ -29,7 +29,7 @@ class Task;
|
||||
class TaskPool;
|
||||
class TaskScheduler;
|
||||
|
||||
typedef boost::function<void(Task*,int)> TaskRunFunction;
|
||||
typedef boost::function<void(void)> TaskRunFunction;
|
||||
|
||||
/* Task
|
||||
*
|
||||
@ -39,7 +39,11 @@ class Task
|
||||
{
|
||||
public:
|
||||
Task() {};
|
||||
Task(const TaskRunFunction& run_) : run(run_) {}
|
||||
|
||||
virtual ~Task() {}
|
||||
|
||||
TaskRunFunction run;
|
||||
};
|
||||
|
||||
/* Task Pool
|
||||
@ -54,12 +58,13 @@ public:
|
||||
class TaskPool
|
||||
{
|
||||
public:
|
||||
TaskPool(const TaskRunFunction& run);
|
||||
TaskPool();
|
||||
~TaskPool();
|
||||
|
||||
void push(Task *task, bool front = false);
|
||||
void push(const TaskRunFunction& run, bool front = false);
|
||||
|
||||
void wait(); /* wait until all tasks are done */
|
||||
void wait_work(); /* work and wait until all tasks are done */
|
||||
void cancel(); /* cancel all tasks, keep worker threads running */
|
||||
void stop(); /* stop all worker threads */
|
||||
|
||||
@ -70,8 +75,6 @@ protected:
|
||||
|
||||
void done_increase(int done);
|
||||
|
||||
TaskRunFunction run;
|
||||
|
||||
thread_mutex done_mutex;
|
||||
thread_condition_variable done_cond;
|
||||
|
||||
@ -103,6 +106,7 @@ protected:
|
||||
static thread_mutex mutex;
|
||||
static int users;
|
||||
static vector<thread*> threads;
|
||||
static vector<int> thread_level;
|
||||
static volatile bool do_exit;
|
||||
|
||||
static list<Entry> queue;
|
||||
|
@ -253,7 +253,7 @@ __device_inline bool transform_uniform_scale(const Transform& tfm, float& scale)
|
||||
/* the epsilon here is quite arbitrary, but this function is only used for
|
||||
surface area and bump, where we except it to not be so sensitive */
|
||||
Transform ttfm = transform_transpose(tfm);
|
||||
float eps = 1e-7f;
|
||||
float eps = 1e-6f;
|
||||
|
||||
float sx = len_squared(float4_to_float3(tfm.x));
|
||||
float sy = len_squared(float4_to_float3(tfm.y));
|
||||
@ -261,7 +261,7 @@ __device_inline bool transform_uniform_scale(const Transform& tfm, float& scale)
|
||||
float stx = len_squared(float4_to_float3(ttfm.x));
|
||||
float sty = len_squared(float4_to_float3(ttfm.y));
|
||||
float stz = len_squared(float4_to_float3(ttfm.z));
|
||||
|
||||
|
||||
if(fabsf(sx - sy) < eps && fabsf(sx - sz) < eps &&
|
||||
fabsf(sx - stx) < eps && fabsf(sx - sty) < eps &&
|
||||
fabsf(sx - stz) < eps) {
|
||||
|
@ -37,6 +37,8 @@ GHOST_NDOFManagerX11::GHOST_NDOFManagerX11(GHOST_System& sys)
|
||||
setDeadZone(0.1f); /* how to calibrate on Linux? throw away slight motion! */
|
||||
|
||||
if (spnav_open() != -1) {
|
||||
m_available = true;
|
||||
|
||||
/* determine exactly which device (if any) is plugged in */
|
||||
|
||||
#define MAX_LINE_LENGTH 100
|
||||
@ -49,7 +51,6 @@ GHOST_NDOFManagerX11::GHOST_NDOFManagerX11(GHOST_System& sys)
|
||||
unsigned short vendor_id = 0, product_id = 0;
|
||||
if (sscanf(line, "Bus %*d Device %*d: ID %hx:%hx", &vendor_id, &product_id) == 2)
|
||||
if (setDevice(vendor_id, product_id)) {
|
||||
m_available = true;
|
||||
break; /* stop looking once the first 3D mouse is found */
|
||||
}
|
||||
}
|
||||
|
@ -247,6 +247,7 @@ protected:
|
||||
* @return Indication whether the event was handled.
|
||||
*/
|
||||
GHOST_TSuccess handleTabletEvent(void *eventPtr, short eventType);
|
||||
bool handleTabletEvent(void *eventPtr);
|
||||
|
||||
/**
|
||||
* Handles a mouse event.
|
||||
|
@ -1280,7 +1280,7 @@ GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest()
|
||||
GHOST_Window* window = (GHOST_Window*)m_windowManager->getActiveWindow();
|
||||
|
||||
//Discard quit event if we are in cursor grab sequence
|
||||
if (window && (window->getCursorGrabMode() != GHOST_kGrabDisable) && (window->getCursorGrabMode() != GHOST_kGrabNormal))
|
||||
if (window && window->getCursorGrabModeIsWarp())
|
||||
return GHOST_kExitCancel;
|
||||
|
||||
//Check open windows if some changes are not saved
|
||||
@ -1329,7 +1329,7 @@ bool GHOST_SystemCocoa::handleOpenDocumentRequest(void *filepathStr)
|
||||
}
|
||||
|
||||
//Discard event if we are in cursor grab sequence, it'll lead to "stuck cursor" situation if the alert panel is raised
|
||||
if (window && (window->getCursorGrabMode() != GHOST_kGrabDisable) && (window->getCursorGrabMode() != GHOST_kGrabNormal))
|
||||
if (window && window->getCursorGrabModeIsWarp())
|
||||
return GHOST_kExitCancel;
|
||||
|
||||
//Check open windows if some changes are not saved
|
||||
@ -1421,6 +1421,23 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
bool GHOST_SystemCocoa::handleTabletEvent(void *eventPtr)
|
||||
{
|
||||
NSEvent *event = (NSEvent *)eventPtr;
|
||||
|
||||
switch ([event subtype]) {
|
||||
case NX_SUBTYPE_TABLET_POINT:
|
||||
handleTabletEvent(eventPtr, NSTabletPoint);
|
||||
return true;
|
||||
case NX_SUBTYPE_TABLET_PROXIMITY:
|
||||
handleTabletEvent(eventPtr, NSTabletProximity);
|
||||
return true;
|
||||
default:
|
||||
//No tablet event included : do nothing
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
{
|
||||
@ -1432,7 +1449,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
//printf("\nW failure for event 0x%x",[event type]);
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
|
||||
switch ([event type])
|
||||
{
|
||||
case NSLeftMouseDown:
|
||||
@ -1440,17 +1457,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
case NSOtherMouseDown:
|
||||
pushEvent(new GHOST_EventButton([event timestamp]*1000, GHOST_kEventButtonDown, window, convertButton([event buttonNumber])));
|
||||
//Handle tablet events combined with mouse events
|
||||
switch ([event subtype]) {
|
||||
case NX_SUBTYPE_TABLET_POINT:
|
||||
handleTabletEvent(eventPtr, NSTabletPoint);
|
||||
break;
|
||||
case NX_SUBTYPE_TABLET_PROXIMITY:
|
||||
handleTabletEvent(eventPtr, NSTabletProximity);
|
||||
break;
|
||||
default:
|
||||
//No tablet event included : do nothing
|
||||
break;
|
||||
}
|
||||
handleTabletEvent(event);
|
||||
break;
|
||||
|
||||
case NSLeftMouseUp:
|
||||
@ -1458,37 +1465,27 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
case NSOtherMouseUp:
|
||||
pushEvent(new GHOST_EventButton([event timestamp]*1000, GHOST_kEventButtonUp, window, convertButton([event buttonNumber])));
|
||||
//Handle tablet events combined with mouse events
|
||||
switch ([event subtype]) {
|
||||
case NX_SUBTYPE_TABLET_POINT:
|
||||
handleTabletEvent(eventPtr, NSTabletPoint);
|
||||
break;
|
||||
case NX_SUBTYPE_TABLET_PROXIMITY:
|
||||
handleTabletEvent(eventPtr, NSTabletProximity);
|
||||
break;
|
||||
default:
|
||||
//No tablet event included : do nothing
|
||||
break;
|
||||
}
|
||||
handleTabletEvent(event);
|
||||
break;
|
||||
|
||||
case NSLeftMouseDragged:
|
||||
case NSRightMouseDragged:
|
||||
case NSOtherMouseDragged:
|
||||
//Handle tablet events combined with mouse events
|
||||
switch ([event subtype]) {
|
||||
case NX_SUBTYPE_TABLET_POINT:
|
||||
handleTabletEvent(eventPtr, NSTabletPoint);
|
||||
break;
|
||||
case NX_SUBTYPE_TABLET_PROXIMITY:
|
||||
handleTabletEvent(eventPtr, NSTabletProximity);
|
||||
break;
|
||||
default:
|
||||
//No tablet event included : do nothing
|
||||
break;
|
||||
}
|
||||
handleTabletEvent(event);
|
||||
|
||||
case NSMouseMoved:
|
||||
switch (window->getCursorGrabMode()) {
|
||||
case NSMouseMoved:
|
||||
{
|
||||
GHOST_TGrabCursorMode grab_mode = window->getCursorGrabMode();
|
||||
|
||||
/* TODO: CHECK IF THIS IS A TABLET EVENT */
|
||||
bool is_tablet = false;
|
||||
|
||||
if (is_tablet && window->getCursorGrabModeIsWarp()) {
|
||||
grab_mode = GHOST_kGrabDisable;
|
||||
}
|
||||
|
||||
switch (grab_mode) {
|
||||
case GHOST_kGrabHide: //Cursor hidden grab operation : no cursor move
|
||||
{
|
||||
GHOST_TInt32 x_warp, y_warp, x_accum, y_accum, x, y;
|
||||
@ -1563,7 +1560,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case NSScrollWheel:
|
||||
{
|
||||
|
@ -649,8 +649,10 @@ GHOST_EventCursor* GHOST_SystemWin32::processCursorEvent(GHOST_TEventType type,
|
||||
|
||||
system->getCursorPosition(x_screen, y_screen);
|
||||
|
||||
if(window->getCursorGrabMode() != GHOST_kGrabDisable && window->getCursorGrabMode() != GHOST_kGrabNormal)
|
||||
{
|
||||
/* TODO: CHECK IF THIS IS A TABLET EVENT */
|
||||
bool is_tablet = false;
|
||||
|
||||
if (is_tablet == false && window->getCursorGrabModeIsWarp()) {
|
||||
GHOST_TInt32 x_new= x_screen;
|
||||
GHOST_TInt32 y_new= y_screen;
|
||||
GHOST_TInt32 x_accum, y_accum;
|
||||
|
@ -471,9 +471,14 @@ GHOST_SystemX11::processEvent(XEvent *xe)
|
||||
case MotionNotify:
|
||||
{
|
||||
XMotionEvent &xme = xe->xmotion;
|
||||
|
||||
if(window->getCursorGrabMode() != GHOST_kGrabDisable && window->getCursorGrabMode() != GHOST_kGrabNormal)
|
||||
{
|
||||
|
||||
#ifdef WITH_X11_XINPUT
|
||||
bool is_tablet = window->GetXTablet().CommonData.Active != GHOST_kTabletModeNone;
|
||||
#else
|
||||
bool is_tablet = false;
|
||||
#endif
|
||||
|
||||
if (is_tablet == false && window->getCursorGrabModeIsWarp()) {
|
||||
GHOST_TInt32 x_new= xme.x_root;
|
||||
GHOST_TInt32 y_new= xme.y_root;
|
||||
GHOST_TInt32 x_accum, y_accum;
|
||||
|
@ -161,6 +161,7 @@ public:
|
||||
*/
|
||||
inline virtual bool getCursorVisibility() const;
|
||||
inline virtual GHOST_TGrabCursorMode getCursorGrabMode() const;
|
||||
inline virtual bool getCursorGrabModeIsWarp() const;
|
||||
inline virtual void getCursorGrabInitPos(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
|
||||
inline virtual void getCursorGrabAccum(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
|
||||
inline virtual void setCursorGrabAccum(GHOST_TInt32 x, GHOST_TInt32 y);
|
||||
@ -362,6 +363,12 @@ inline GHOST_TGrabCursorMode GHOST_Window::getCursorGrabMode() const
|
||||
return m_cursorGrab;
|
||||
}
|
||||
|
||||
inline bool GHOST_Window::getCursorGrabModeIsWarp() const
|
||||
{
|
||||
return (m_cursorGrab == GHOST_kGrabWrap) ||
|
||||
(m_cursorGrab == GHOST_kGrabHide);
|
||||
}
|
||||
|
||||
inline void GHOST_Window::getCursorGrabInitPos(GHOST_TInt32 &x, GHOST_TInt32 &y) const
|
||||
{
|
||||
x = m_cursorGrabInitPos[0];
|
||||
|
@ -55,7 +55,7 @@
|
||||
#endif
|
||||
|
||||
// Some more multisample defines
|
||||
#define WGL_SAMPLE_BUFERS_ARB 0x2041
|
||||
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
||||
#define WGL_SAMPLES_ARB 0x2042
|
||||
|
||||
// win64 doesn't define GWL_USERDATA
|
||||
|
@ -41,5 +41,7 @@ void* operator new (size_t size, const char *str)
|
||||
|
||||
void operator delete (void *p)
|
||||
{
|
||||
MEM_freeN(p);
|
||||
/* delete NULL is valid in c++ */
|
||||
if(p)
|
||||
MEM_freeN(p);
|
||||
}
|
||||
|
@ -118,16 +118,24 @@ class SaveDirty(Operator):
|
||||
unique_paths = set()
|
||||
for image in bpy.data.images:
|
||||
if image.is_dirty:
|
||||
filepath = bpy.path.abspath(image.filepath)
|
||||
if "\\" not in filepath and "/" not in filepath:
|
||||
self.report({'WARNING'}, "Invalid path: " + filepath)
|
||||
elif filepath in unique_paths:
|
||||
self.report({'WARNING'},
|
||||
"Path used by more then one image: %r" %
|
||||
filepath)
|
||||
if image.packed_file:
|
||||
if image.library:
|
||||
self.report({'WARNING'},
|
||||
"Packed library image: %r from library %r can't be re-packed" %
|
||||
(image.name, image.library.filepath))
|
||||
else:
|
||||
image.pack(as_png=True)
|
||||
else:
|
||||
unique_paths.add(filepath)
|
||||
image.save()
|
||||
filepath = bpy.path.abspath(image.filepath, library=image.library)
|
||||
if "\\" not in filepath and "/" not in filepath:
|
||||
self.report({'WARNING'}, "Invalid path: " + filepath)
|
||||
elif filepath in unique_paths:
|
||||
self.report({'WARNING'},
|
||||
"Path used by more then one image: %r" %
|
||||
filepath)
|
||||
else:
|
||||
unique_paths.add(filepath)
|
||||
image.save()
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
|
@ -65,12 +65,10 @@ class MotionPathButtonsPanel():
|
||||
sub.prop(mpath, "frame_start", text="From")
|
||||
sub.prop(mpath, "frame_end", text="To")
|
||||
|
||||
sub = col.column() # align=True
|
||||
sub.operator_context = 'EXEC_DEFAULT'
|
||||
if bones:
|
||||
col.operator("pose.paths_calculate", text="Update", icon='BONE_DATA')
|
||||
col.operator("pose.paths_update", text="Update Paths", icon='BONE_DATA')
|
||||
else:
|
||||
col.operator("object.paths_calculate", text="Update", icon='OBJECT_DATA')
|
||||
col.operator("object.paths_update", text="Update Paths", icon='OBJECT_DATA')
|
||||
else:
|
||||
col.label(text="Not available yet...", icon='ERROR')
|
||||
col.label(text="Calculate Paths first", icon='INFO')
|
||||
|
@ -65,14 +65,10 @@ class DATA_PT_skeleton(ArmatureButtonsPanel, Panel):
|
||||
col.label(text="Protected Layers:")
|
||||
col.prop(arm, "layers_protected", text="")
|
||||
|
||||
layout.label(text="Deform:")
|
||||
flow = layout.column_flow()
|
||||
flow.prop(arm, "use_deform_vertex_groups", text="Vertex Groups")
|
||||
flow.prop(arm, "use_deform_envelopes", text="Envelopes")
|
||||
flow.prop(arm, "use_deform_preserve_volume", text="Quaternion")
|
||||
|
||||
if context.scene.render.engine == 'BLENDER_GAME':
|
||||
layout.row().prop(arm, "deform_method", expand=True)
|
||||
col = layout.column()
|
||||
col.label(text="Deform:")
|
||||
col.prop(arm, "deform_method", expand=True)
|
||||
|
||||
|
||||
class DATA_PT_display(ArmatureButtonsPanel, Panel):
|
||||
|
@ -87,10 +87,16 @@ class DATA_PT_lens(CameraButtonsPanel, Panel):
|
||||
elif cam.type == 'ORTHO':
|
||||
col.prop(cam, "ortho_scale")
|
||||
|
||||
col = layout.column()
|
||||
col.enabled = cam.type == 'PERSP'
|
||||
|
||||
col.prop(cam, "use_panorama")
|
||||
elif cam.type == 'PANO':
|
||||
if context.scene.render.engine == 'CYCLES':
|
||||
ccam = cam.cycles
|
||||
col.prop(ccam, "panorama_type", text="Type")
|
||||
if ccam.panorama_type == 'FISHEYE_EQUIDISTANT':
|
||||
col.prop(ccam, "fisheye_fov")
|
||||
elif ccam.panorama_type == 'FISHEYE_EQUISOLID':
|
||||
row = layout.row()
|
||||
row.prop(ccam, "fisheye_lens", text="Lens")
|
||||
row.prop(ccam, "fisheye_fov")
|
||||
|
||||
split = layout.split()
|
||||
|
||||
|
@ -173,9 +173,11 @@ class DATA_PT_geometry_curve(CurveButtonsPanel, Panel):
|
||||
col.label(text="Bevel Object:")
|
||||
col.prop(curve, "bevel_object", text="")
|
||||
|
||||
row = col.row()
|
||||
row.active = (curve.bevel_object is not None)
|
||||
row.prop(curve, "use_fill_caps")
|
||||
col = layout.column(align=True)
|
||||
col.active = (curve.bevel_object is not None)
|
||||
col.prop(curve, "use_fill_caps")
|
||||
col.prop(curve, "bevel_factor_start")
|
||||
col.prop(curve, "bevel_factor_end")
|
||||
|
||||
|
||||
class DATA_PT_pathanim(CurveButtonsPanelCurve, Panel):
|
||||
|
@ -90,6 +90,11 @@ class CLIP_HT_header(Header):
|
||||
layout.label(text="Average solve error: %.4f" %
|
||||
(r.average_error))
|
||||
|
||||
if sc.view == 'DOPESHEET':
|
||||
layout.label(text="Sort by:")
|
||||
layout.prop(sc, "dopesheet_sort_method", text="")
|
||||
layout.prop(sc, "invert_dopesheet_sort", text="Invert")
|
||||
|
||||
layout.template_running_jobs()
|
||||
|
||||
|
||||
|
@ -277,6 +277,13 @@ class TEXT_MT_edit(Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("text.move_lines",
|
||||
text="Move line(s) up").direction = 'UP'
|
||||
layout.operator("text.move_lines",
|
||||
text="Move line(s) down").direction = 'DOWN'
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.menu("TEXT_MT_edit_select")
|
||||
layout.menu("TEXT_MT_edit_markers")
|
||||
|
||||
|
@ -81,10 +81,12 @@ class TIME_HT_header(Header):
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(toolsettings, "use_keyframe_insert_auto", text="", toggle=True)
|
||||
row.prop(toolsettings, "use_keyframe_insert_keyingset", text="", toggle=True)
|
||||
if screen.is_animation_playing and toolsettings.use_keyframe_insert_auto:
|
||||
subsub = row.row()
|
||||
subsub.prop(toolsettings, "use_record_with_nla", toggle=True)
|
||||
if toolsettings.use_keyframe_insert_auto:
|
||||
row.prop(toolsettings, "use_keyframe_insert_keyingset", text="", toggle=True)
|
||||
|
||||
if screen.is_animation_playing:
|
||||
subsub = row.row()
|
||||
subsub.prop(toolsettings, "use_record_with_nla", toggle=True)
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop_search(scene.keying_sets_all, "active", scene, "keying_sets_all", text="")
|
||||
|
@ -135,7 +135,9 @@ class ShowHideMenu():
|
||||
layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
|
||||
|
||||
|
||||
class VIEW3D_MT_transform(Menu):
|
||||
# Standard transforms which apply to all cases
|
||||
# NOTE: this doesn't seem to be able to be used directly
|
||||
class VIEW3D_MT_transform_base(Menu):
|
||||
bl_label = "Transform"
|
||||
|
||||
# TODO: get rid of the custom text strings?
|
||||
@ -156,22 +158,38 @@ class VIEW3D_MT_transform(Menu):
|
||||
layout.operator("transform.warp", text="Warp")
|
||||
layout.operator("transform.push_pull", text="Push/Pull")
|
||||
|
||||
|
||||
# Generic transform menu - geometry types
|
||||
class VIEW3D_MT_transform(VIEW3D_MT_transform_base):
|
||||
def draw(self, context):
|
||||
# base menu
|
||||
VIEW3D_MT_transform_base.draw(self, context)
|
||||
|
||||
# generic...
|
||||
layout = self.layout
|
||||
layout.separator()
|
||||
|
||||
layout.operator("transform.translate", text="Move Texture Space").texture_space = True
|
||||
layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
|
||||
|
||||
|
||||
# Object-specific extensions to Transform menu
|
||||
class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base):
|
||||
def draw(self, context):
|
||||
# base menu
|
||||
VIEW3D_MT_transform_base.draw(self, context)
|
||||
|
||||
# object-specific option follow...
|
||||
layout = self.layout
|
||||
layout.separator()
|
||||
|
||||
obj = context.object
|
||||
if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'} and obj.data.draw_type in {'BBONE', 'ENVELOPE'}:
|
||||
layout.operator("transform.transform", text="Scale Envelope/BBone").mode = 'BONE_SIZE'
|
||||
|
||||
if context.edit_object and context.edit_object.type == 'ARMATURE':
|
||||
layout.operator("armature.align")
|
||||
else:
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
|
||||
layout.operator("transform.translate", text="Move Texture Space").texture_space = True
|
||||
layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
|
||||
|
||||
layout.separator()
|
||||
|
||||
@ -191,6 +209,25 @@ class VIEW3D_MT_transform(Menu):
|
||||
layout.operator("object.anim_transforms_to_deltas")
|
||||
|
||||
|
||||
# Armature EditMode extensions to Transform menu
|
||||
class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base):
|
||||
def draw(self, context):
|
||||
# base menu
|
||||
VIEW3D_MT_transform_base.draw(self, context)
|
||||
|
||||
# armature specific extensions follow...
|
||||
layout = self.layout
|
||||
layout.separator()
|
||||
|
||||
obj = context.object
|
||||
if (obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'} and
|
||||
obj.data.draw_type in {'BBONE', 'ENVELOPE'}):
|
||||
layout.operator("transform.transform", text="Scale Envelope/BBone").mode = 'BONE_SIZE'
|
||||
|
||||
if context.edit_object and context.edit_object.type == 'ARMATURE':
|
||||
layout.operator("armature.align")
|
||||
|
||||
|
||||
class VIEW3D_MT_mirror(Menu):
|
||||
bl_label = "Mirror"
|
||||
|
||||
@ -377,6 +414,11 @@ class VIEW3D_MT_view_align(Menu):
|
||||
layout.operator("view3d.view_selected")
|
||||
layout.operator("view3d.view_center_cursor")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("view3d.view_lock_to_active")
|
||||
layout.operator("view3d.view_lock_clear")
|
||||
|
||||
|
||||
class VIEW3D_MT_view_align_selected(Menu):
|
||||
bl_label = "Align View to Selected"
|
||||
@ -699,7 +741,7 @@ class VIEW3D_MT_object(Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.menu("VIEW3D_MT_transform")
|
||||
layout.menu("VIEW3D_MT_transform_object")
|
||||
layout.menu("VIEW3D_MT_mirror")
|
||||
layout.menu("VIEW3D_MT_object_clear")
|
||||
layout.menu("VIEW3D_MT_object_apply")
|
||||
@ -1152,7 +1194,7 @@ class VIEW3D_MT_vertex_group(Menu):
|
||||
if ob.mode == 'EDIT' or (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex):
|
||||
if ob.vertex_groups.active:
|
||||
layout.separator()
|
||||
layout.operator("object.vertex_group_assign", text="Assign to Active Group")
|
||||
layout.operator("object.vertex_group_assign", text="Assign to Active Group").new = False
|
||||
layout.operator("object.vertex_group_remove_from", text="Remove from Active Group").all = False
|
||||
layout.operator("object.vertex_group_remove_from", text="Remove from All").all = True
|
||||
layout.separator()
|
||||
@ -1317,7 +1359,7 @@ class VIEW3D_MT_pose(Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.menu("VIEW3D_MT_transform")
|
||||
layout.menu("VIEW3D_MT_transform_armature")
|
||||
|
||||
layout.menu("VIEW3D_MT_pose_transform")
|
||||
layout.menu("VIEW3D_MT_pose_apply")
|
||||
@ -1496,6 +1538,24 @@ class VIEW3D_MT_pose_apply(Menu):
|
||||
layout.operator("pose.visual_transform_apply")
|
||||
|
||||
|
||||
class VIEW3D_MT_pose_specials(Menu):
|
||||
bl_label = "Specials"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.operator("pose.select_constraint_target")
|
||||
layout.operator("pose.flip_names")
|
||||
layout.operator("pose.paths_calculate")
|
||||
layout.operator("pose.paths_clear")
|
||||
layout.operator("pose.user_transforms_clear")
|
||||
layout.operator("pose.user_transforms_clear", text="Clear User Transforms (All)").only_selected = False
|
||||
layout.operator("pose.relax")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator_menu_enum("pose.autoside_names", "axis")
|
||||
|
||||
|
||||
class BoneOptions:
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -1615,6 +1675,7 @@ class VIEW3D_MT_edit_mesh_specials(Menu):
|
||||
layout.operator("mesh.blend_from_shape")
|
||||
layout.operator("mesh.shape_propagate_to_all")
|
||||
layout.operator("mesh.select_vertex_path")
|
||||
layout.operator("mesh.sort_elements")
|
||||
|
||||
|
||||
class VIEW3D_MT_edit_mesh_select_mode(Menu):
|
||||
@ -1690,8 +1751,7 @@ class VIEW3D_MT_edit_mesh_vertices(Menu):
|
||||
|
||||
layout.operator("mesh.vertices_smooth")
|
||||
layout.operator("mesh.remove_doubles")
|
||||
layout.operator("mesh.vertices_sort")
|
||||
layout.operator("mesh.vertices_randomize")
|
||||
layout.operator("mesh.sort_elements", text="Sort Vertices").elements = {"VERT"}
|
||||
|
||||
layout.operator("mesh.select_vertex_path")
|
||||
|
||||
@ -1736,6 +1796,7 @@ class VIEW3D_MT_edit_mesh_edges(Menu):
|
||||
layout.operator("mesh.bevel")
|
||||
layout.operator("mesh.edge_split")
|
||||
layout.operator("mesh.bridge_edge_loops")
|
||||
layout.operator("mesh.sort_elements", text="Sort Edges").elements = {"EDGE"}
|
||||
|
||||
layout.separator()
|
||||
|
||||
@ -1768,7 +1829,7 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
|
||||
layout.operator("mesh.bevel")
|
||||
layout.operator("mesh.solidify")
|
||||
layout.operator("mesh.wireframe")
|
||||
layout.operator("mesh.sort_faces")
|
||||
layout.operator("mesh.sort_elements", text="Sort Faces").elements = {"FACE"}
|
||||
|
||||
layout.separator()
|
||||
|
||||
@ -2072,7 +2133,7 @@ class VIEW3D_MT_edit_armature(Menu):
|
||||
edit_object = context.edit_object
|
||||
arm = edit_object.data
|
||||
|
||||
layout.menu("VIEW3D_MT_transform")
|
||||
layout.menu("VIEW3D_MT_transform_armature")
|
||||
layout.menu("VIEW3D_MT_mirror")
|
||||
layout.menu("VIEW3D_MT_snap")
|
||||
layout.menu("VIEW3D_MT_edit_armature_roll")
|
||||
|
@ -145,10 +145,10 @@ class VIEW3D_PT_tools_meshedit(View3DPanel, Panel):
|
||||
row = col.row(align=True)
|
||||
props = row.operator("mesh.knife_tool", text="Knife")
|
||||
props.use_occlude_geometry = True
|
||||
props.only_select = False
|
||||
props.only_selected = False
|
||||
props = row.operator("mesh.knife_tool", text="Select")
|
||||
props.use_occlude_geometry = False
|
||||
props.only_select = True
|
||||
props.only_selected = True
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Remove:")
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -42,108 +42,108 @@
|
||||
|
||||
/* implementation */
|
||||
|
||||
void *avi_converter_from_avi_rgb (AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||
void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||
{
|
||||
int x, y, i, rowstride;
|
||||
unsigned char *buf;
|
||||
AviBitmapInfoHeader *bi;
|
||||
short bits= 32;
|
||||
short bits = 32;
|
||||
|
||||
(void)size; /* unused */
|
||||
|
||||
bi= (AviBitmapInfoHeader *) movie->streams[stream].sf;
|
||||
if (bi) bits= bi->BitCount;
|
||||
bi = (AviBitmapInfoHeader *) movie->streams[stream].sf;
|
||||
if (bi) bits = bi->BitCount;
|
||||
|
||||
if (bits==16) {
|
||||
if (bits == 16) {
|
||||
unsigned short *pxl;
|
||||
unsigned char *to;
|
||||
#ifdef __BIG_ENDIAN__
|
||||
unsigned char *pxla;
|
||||
#endif
|
||||
|
||||
buf = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "fromavirgbbuf");
|
||||
buf = MEM_mallocN(movie->header->Height * movie->header->Width * 3, "fromavirgbbuf");
|
||||
|
||||
y= movie->header->Height;
|
||||
to= buf;
|
||||
y = movie->header->Height;
|
||||
to = buf;
|
||||
|
||||
while (y--) {
|
||||
pxl= (unsigned short *) (buffer + y * movie->header->Width * 2);
|
||||
pxl = (unsigned short *) (buffer + y * movie->header->Width * 2);
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
pxla= (unsigned char *)pxl;
|
||||
pxla = (unsigned char *)pxl;
|
||||
#endif
|
||||
|
||||
x= movie->header->Width;
|
||||
x = movie->header->Width;
|
||||
while (x--) {
|
||||
#ifdef __BIG_ENDIAN__
|
||||
i= pxla[0];
|
||||
pxla[0]= pxla[1];
|
||||
pxla[1]= i;
|
||||
i = pxla[0];
|
||||
pxla[0] = pxla[1];
|
||||
pxla[1] = i;
|
||||
|
||||
pxla+=2;
|
||||
pxla += 2;
|
||||
#endif
|
||||
|
||||
*(to++)= ((*pxl>>10)&0x1f)*8;
|
||||
*(to++)= ((*pxl>>5)&0x1f)*8;
|
||||
*(to++)= (*pxl&0x1f)*8;
|
||||
*(to++) = ((*pxl >> 10) & 0x1f) * 8;
|
||||
*(to++) = ((*pxl >> 5) & 0x1f) * 8;
|
||||
*(to++) = (*pxl & 0x1f) * 8;
|
||||
pxl++;
|
||||
}
|
||||
}
|
||||
|
||||
MEM_freeN (buffer);
|
||||
MEM_freeN(buffer);
|
||||
|
||||
return buf;
|
||||
}
|
||||
else {
|
||||
buf = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "fromavirgbbuf");
|
||||
buf = MEM_mallocN(movie->header->Height * movie->header->Width * 3, "fromavirgbbuf");
|
||||
|
||||
rowstride = movie->header->Width*3;
|
||||
if (bits!=16) if (movie->header->Width%2) rowstride++;
|
||||
rowstride = movie->header->Width * 3;
|
||||
if (bits != 16) if (movie->header->Width % 2) rowstride++;
|
||||
|
||||
for (y=0; y < movie->header->Height; y++) {
|
||||
memcpy (&buf[y*movie->header->Width*3], &buffer[((movie->header->Height-1)-y)*rowstride], movie->header->Width*3);
|
||||
for (y = 0; y < movie->header->Height; y++) {
|
||||
memcpy(&buf[y * movie->header->Width * 3], &buffer[((movie->header->Height - 1) - y) * rowstride], movie->header->Width * 3);
|
||||
}
|
||||
|
||||
for (y=0; y < movie->header->Height*movie->header->Width*3; y+=3) {
|
||||
for (y = 0; y < movie->header->Height * movie->header->Width * 3; y += 3) {
|
||||
i = buf[y];
|
||||
buf[y] = buf[y+2];
|
||||
buf[y+2] = i;
|
||||
buf[y] = buf[y + 2];
|
||||
buf[y + 2] = i;
|
||||
}
|
||||
|
||||
MEM_freeN (buffer);
|
||||
MEM_freeN(buffer);
|
||||
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
void *avi_converter_to_avi_rgb (AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||
void *avi_converter_to_avi_rgb(AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||
{
|
||||
int y, x, i, rowstride;
|
||||
unsigned char *buf;
|
||||
|
||||
(void)stream; /* unused */
|
||||
|
||||
*size= movie->header->Height * movie->header->Width * 3;
|
||||
if (movie->header->Width%2) *size+= movie->header->Height;
|
||||
*size = movie->header->Height * movie->header->Width * 3;
|
||||
if (movie->header->Width % 2) *size += movie->header->Height;
|
||||
|
||||
buf = MEM_mallocN (*size, "toavirgbbuf");
|
||||
buf = MEM_mallocN(*size, "toavirgbbuf");
|
||||
|
||||
rowstride = movie->header->Width*3;
|
||||
if (movie->header->Width%2) rowstride++;
|
||||
rowstride = movie->header->Width * 3;
|
||||
if (movie->header->Width % 2) rowstride++;
|
||||
|
||||
for (y=0; y < movie->header->Height; y++) {
|
||||
memcpy (&buf[y*rowstride], &buffer[((movie->header->Height-1)-y)*movie->header->Width*3], movie->header->Width*3);
|
||||
for (y = 0; y < movie->header->Height; y++) {
|
||||
memcpy(&buf[y * rowstride], &buffer[((movie->header->Height - 1) - y) * movie->header->Width * 3], movie->header->Width * 3);
|
||||
}
|
||||
|
||||
for (y=0; y < movie->header->Height; y++) {
|
||||
for (x=0; x < movie->header->Width*3; x+=3) {
|
||||
i = buf[y*rowstride+x];
|
||||
buf[y*rowstride+x] = buf[y*rowstride+x+2];
|
||||
buf[y*rowstride+x+2] = i;
|
||||
for (y = 0; y < movie->header->Height; y++) {
|
||||
for (x = 0; x < movie->header->Width * 3; x += 3) {
|
||||
i = buf[y * rowstride + x];
|
||||
buf[y * rowstride + x] = buf[y * rowstride + x + 2];
|
||||
buf[y * rowstride + x + 2] = i;
|
||||
}
|
||||
}
|
||||
|
||||
MEM_freeN (buffer);
|
||||
MEM_freeN(buffer);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "mjpeg.h"
|
||||
#include "rgb32.h"
|
||||
|
||||
void *avi_format_convert (AviMovie *movie, int stream, void *buffer, AviFormat from, AviFormat to, int *size)
|
||||
void *avi_format_convert(AviMovie *movie, int stream, void *buffer, AviFormat from, AviFormat to, int *size)
|
||||
{
|
||||
if (from == to)
|
||||
return buffer;
|
||||
@ -53,32 +53,32 @@ void *avi_format_convert (AviMovie *movie, int stream, void *buffer, AviFormat f
|
||||
}
|
||||
|
||||
switch (to) {
|
||||
case AVI_FORMAT_RGB24:
|
||||
switch (from) {
|
||||
case AVI_FORMAT_RGB24:
|
||||
switch (from) {
|
||||
case AVI_FORMAT_AVI_RGB:
|
||||
buffer = avi_converter_from_avi_rgb(movie, stream, buffer, size);
|
||||
break;
|
||||
case AVI_FORMAT_MJPEG:
|
||||
buffer = avi_converter_from_mjpeg(movie, stream, buffer, size);
|
||||
break;
|
||||
case AVI_FORMAT_RGB32:
|
||||
buffer = avi_converter_from_rgb32(movie, stream, buffer, size);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case AVI_FORMAT_AVI_RGB:
|
||||
buffer = avi_converter_from_avi_rgb (movie, stream, buffer, size);
|
||||
buffer = avi_converter_to_avi_rgb(movie, stream, buffer, size);
|
||||
break;
|
||||
case AVI_FORMAT_MJPEG:
|
||||
buffer = avi_converter_from_mjpeg (movie, stream, buffer, size);
|
||||
buffer = avi_converter_to_mjpeg(movie, stream, buffer, size);
|
||||
break;
|
||||
case AVI_FORMAT_RGB32:
|
||||
buffer = avi_converter_from_rgb32 (movie, stream, buffer, size);
|
||||
buffer = avi_converter_to_rgb32(movie, stream, buffer, size);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case AVI_FORMAT_AVI_RGB:
|
||||
buffer = avi_converter_to_avi_rgb (movie, stream, buffer, size);
|
||||
break;
|
||||
case AVI_FORMAT_MJPEG:
|
||||
buffer = avi_converter_to_mjpeg (movie, stream, buffer, size);
|
||||
break;
|
||||
case AVI_FORMAT_RGB32:
|
||||
buffer = avi_converter_to_rgb32 (movie, stream, buffer, size);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return buffer;
|
||||
@ -88,10 +88,10 @@ int avi_get_data_id(AviFormat format, int stream)
|
||||
{
|
||||
char fcc[5];
|
||||
|
||||
if (avi_get_format_type (format) == FCC("vids"))
|
||||
sprintf (fcc, "%2.2ddc", stream);
|
||||
else if (avi_get_format_type (format) == FCC("auds"))
|
||||
sprintf (fcc, "%2.2ddc", stream);
|
||||
if (avi_get_format_type(format) == FCC("vids"))
|
||||
sprintf(fcc, "%2.2ddc", stream);
|
||||
else if (avi_get_format_type(format) == FCC("auds"))
|
||||
sprintf(fcc, "%2.2ddc", stream);
|
||||
else
|
||||
return 0;
|
||||
|
||||
@ -101,48 +101,48 @@ int avi_get_data_id(AviFormat format, int stream)
|
||||
int avi_get_format_type(AviFormat format)
|
||||
{
|
||||
switch (format) {
|
||||
case AVI_FORMAT_RGB24:
|
||||
case AVI_FORMAT_RGB32:
|
||||
case AVI_FORMAT_AVI_RGB:
|
||||
case AVI_FORMAT_MJPEG:
|
||||
return FCC("vids");
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
case AVI_FORMAT_RGB24:
|
||||
case AVI_FORMAT_RGB32:
|
||||
case AVI_FORMAT_AVI_RGB:
|
||||
case AVI_FORMAT_MJPEG:
|
||||
return FCC("vids");
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int avi_get_format_fcc(AviFormat format)
|
||||
{
|
||||
switch (format) {
|
||||
case AVI_FORMAT_RGB24:
|
||||
case AVI_FORMAT_RGB32:
|
||||
case AVI_FORMAT_AVI_RGB:
|
||||
return FCC("DIB ");
|
||||
break;
|
||||
case AVI_FORMAT_MJPEG:
|
||||
return FCC("MJPG");
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
case AVI_FORMAT_RGB24:
|
||||
case AVI_FORMAT_RGB32:
|
||||
case AVI_FORMAT_AVI_RGB:
|
||||
return FCC("DIB ");
|
||||
break;
|
||||
case AVI_FORMAT_MJPEG:
|
||||
return FCC("MJPG");
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int avi_get_format_compression(AviFormat format)
|
||||
{
|
||||
switch (format) {
|
||||
case AVI_FORMAT_RGB24:
|
||||
case AVI_FORMAT_RGB32:
|
||||
case AVI_FORMAT_AVI_RGB:
|
||||
return 0;
|
||||
break;
|
||||
case AVI_FORMAT_MJPEG:
|
||||
return FCC("MJPG");
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
case AVI_FORMAT_RGB24:
|
||||
case AVI_FORMAT_RGB32:
|
||||
case AVI_FORMAT_AVI_RGB:
|
||||
return 0;
|
||||
break;
|
||||
case AVI_FORMAT_MJPEG:
|
||||
return FCC("MJPG");
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -46,125 +46,125 @@
|
||||
#endif
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
static void invert (int *num)
|
||||
static void invert(int *num)
|
||||
{
|
||||
int new=0, i, j;
|
||||
int new = 0, i, j;
|
||||
|
||||
for (j=0; j < 4; j++) {
|
||||
for (i=0; i<8; i++) {
|
||||
new |= ((*num>>(j*8+i))&1)<<((3-j)*8+i);
|
||||
for (j = 0; j < 4; j++) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
new |= ((*num >> (j * 8 + i)) & 1) << ((3 - j) * 8 + i);
|
||||
}
|
||||
}
|
||||
|
||||
*num = new;
|
||||
}
|
||||
|
||||
static void sinvert (short int *num)
|
||||
static void sinvert(short int *num)
|
||||
{
|
||||
short int new=0;
|
||||
short int new = 0;
|
||||
int i, j;
|
||||
|
||||
for (j=0; j < 2; j++) {
|
||||
for (i=0; i<8; i++) {
|
||||
new |= ((*num>>(j*8+i))&1)<<((1-j)*8+i);
|
||||
for (j = 0; j < 2; j++) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
new |= ((*num >> (j * 8 + i)) & 1) << ((1 - j) * 8 + i);
|
||||
}
|
||||
}
|
||||
|
||||
*num = new;
|
||||
}
|
||||
|
||||
static void Ichunk (AviChunk *chunk)
|
||||
static void Ichunk(AviChunk *chunk)
|
||||
{
|
||||
invert (&chunk->fcc);
|
||||
invert (&chunk->size);
|
||||
invert(&chunk->fcc);
|
||||
invert(&chunk->size);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
static void Ilist (AviList *list)
|
||||
static void Ilist(AviList *list)
|
||||
{
|
||||
invert (&list->fcc);
|
||||
invert (&list->size);
|
||||
invert (&list->ids);
|
||||
invert(&list->fcc);
|
||||
invert(&list->size);
|
||||
invert(&list->ids);
|
||||
}
|
||||
|
||||
static void Imainh (AviMainHeader *mainh)
|
||||
static void Imainh(AviMainHeader *mainh)
|
||||
{
|
||||
invert (&mainh->fcc);
|
||||
invert (&mainh->size);
|
||||
invert (&mainh->MicroSecPerFrame);
|
||||
invert (&mainh->MaxBytesPerSec);
|
||||
invert (&mainh->PaddingGranularity);
|
||||
invert (&mainh->Flags);
|
||||
invert (&mainh->TotalFrames);
|
||||
invert (&mainh->InitialFrames);
|
||||
invert (&mainh->Streams);
|
||||
invert (&mainh->SuggestedBufferSize);
|
||||
invert (&mainh->Width);
|
||||
invert (&mainh->Height);
|
||||
invert (&mainh->Reserved[0]);
|
||||
invert (&mainh->Reserved[1]);
|
||||
invert (&mainh->Reserved[2]);
|
||||
invert (&mainh->Reserved[3]);
|
||||
invert(&mainh->fcc);
|
||||
invert(&mainh->size);
|
||||
invert(&mainh->MicroSecPerFrame);
|
||||
invert(&mainh->MaxBytesPerSec);
|
||||
invert(&mainh->PaddingGranularity);
|
||||
invert(&mainh->Flags);
|
||||
invert(&mainh->TotalFrames);
|
||||
invert(&mainh->InitialFrames);
|
||||
invert(&mainh->Streams);
|
||||
invert(&mainh->SuggestedBufferSize);
|
||||
invert(&mainh->Width);
|
||||
invert(&mainh->Height);
|
||||
invert(&mainh->Reserved[0]);
|
||||
invert(&mainh->Reserved[1]);
|
||||
invert(&mainh->Reserved[2]);
|
||||
invert(&mainh->Reserved[3]);
|
||||
}
|
||||
|
||||
static void Istreamh (AviStreamHeader *streamh)
|
||||
static void Istreamh(AviStreamHeader *streamh)
|
||||
{
|
||||
invert (&streamh->fcc);
|
||||
invert (&streamh->size);
|
||||
invert (&streamh->Type);
|
||||
invert (&streamh->Handler);
|
||||
invert (&streamh->Flags);
|
||||
sinvert (&streamh->Priority);
|
||||
sinvert (&streamh->Language);
|
||||
invert (&streamh->InitialFrames);
|
||||
invert (&streamh->Scale);
|
||||
invert (&streamh->Rate);
|
||||
invert (&streamh->Start);
|
||||
invert (&streamh->Length);
|
||||
invert (&streamh->SuggestedBufferSize);
|
||||
invert (&streamh->Quality);
|
||||
invert (&streamh->SampleSize);
|
||||
sinvert (&streamh->left);
|
||||
sinvert (&streamh->right);
|
||||
sinvert (&streamh->top);
|
||||
sinvert (&streamh->bottom);
|
||||
invert(&streamh->fcc);
|
||||
invert(&streamh->size);
|
||||
invert(&streamh->Type);
|
||||
invert(&streamh->Handler);
|
||||
invert(&streamh->Flags);
|
||||
sinvert(&streamh->Priority);
|
||||
sinvert(&streamh->Language);
|
||||
invert(&streamh->InitialFrames);
|
||||
invert(&streamh->Scale);
|
||||
invert(&streamh->Rate);
|
||||
invert(&streamh->Start);
|
||||
invert(&streamh->Length);
|
||||
invert(&streamh->SuggestedBufferSize);
|
||||
invert(&streamh->Quality);
|
||||
invert(&streamh->SampleSize);
|
||||
sinvert(&streamh->left);
|
||||
sinvert(&streamh->right);
|
||||
sinvert(&streamh->top);
|
||||
sinvert(&streamh->bottom);
|
||||
}
|
||||
|
||||
static void Ibitmaph (AviBitmapInfoHeader *bitmaph)
|
||||
static void Ibitmaph(AviBitmapInfoHeader *bitmaph)
|
||||
{
|
||||
invert (&bitmaph->fcc);
|
||||
invert (&bitmaph->size);
|
||||
invert (&bitmaph->Size);
|
||||
invert (&bitmaph->Width);
|
||||
invert (&bitmaph->Height);
|
||||
sinvert (&bitmaph->Planes);
|
||||
sinvert (&bitmaph->BitCount);
|
||||
invert (&bitmaph->Compression);
|
||||
invert (&bitmaph->SizeImage);
|
||||
invert (&bitmaph->XPelsPerMeter);
|
||||
invert (&bitmaph->YPelsPerMeter);
|
||||
invert (&bitmaph->ClrUsed);
|
||||
invert (&bitmaph->ClrImportant);
|
||||
invert(&bitmaph->fcc);
|
||||
invert(&bitmaph->size);
|
||||
invert(&bitmaph->Size);
|
||||
invert(&bitmaph->Width);
|
||||
invert(&bitmaph->Height);
|
||||
sinvert(&bitmaph->Planes);
|
||||
sinvert(&bitmaph->BitCount);
|
||||
invert(&bitmaph->Compression);
|
||||
invert(&bitmaph->SizeImage);
|
||||
invert(&bitmaph->XPelsPerMeter);
|
||||
invert(&bitmaph->YPelsPerMeter);
|
||||
invert(&bitmaph->ClrUsed);
|
||||
invert(&bitmaph->ClrImportant);
|
||||
}
|
||||
|
||||
static void Imjpegu (AviMJPEGUnknown *mjpgu)
|
||||
static void Imjpegu(AviMJPEGUnknown *mjpgu)
|
||||
{
|
||||
invert (&mjpgu->a);
|
||||
invert (&mjpgu->b);
|
||||
invert (&mjpgu->c);
|
||||
invert (&mjpgu->d);
|
||||
invert (&mjpgu->e);
|
||||
invert (&mjpgu->f);
|
||||
invert (&mjpgu->g);
|
||||
invert(&mjpgu->a);
|
||||
invert(&mjpgu->b);
|
||||
invert(&mjpgu->c);
|
||||
invert(&mjpgu->d);
|
||||
invert(&mjpgu->e);
|
||||
invert(&mjpgu->f);
|
||||
invert(&mjpgu->g);
|
||||
}
|
||||
|
||||
static void Iindexe (AviIndexEntry *indexe)
|
||||
static void Iindexe(AviIndexEntry *indexe)
|
||||
{
|
||||
invert (&indexe->ChunkId);
|
||||
invert (&indexe->Flags);
|
||||
invert (&indexe->Offset);
|
||||
invert (&indexe->Size);
|
||||
invert(&indexe->ChunkId);
|
||||
invert(&indexe->Flags);
|
||||
invert(&indexe->Offset);
|
||||
invert(&indexe->Size);
|
||||
}
|
||||
#endif /* __BIG_ENDIAN__ */
|
||||
|
||||
@ -173,53 +173,53 @@ void awrite(AviMovie *movie, void *datain, int block, int size, FILE *fp, int ty
|
||||
#ifdef __BIG_ENDIAN__
|
||||
void *data;
|
||||
|
||||
data = MEM_mallocN (size, "avi endian");
|
||||
data = MEM_mallocN(size, "avi endian");
|
||||
|
||||
memcpy (data, datain, size);
|
||||
memcpy(data, datain, size);
|
||||
|
||||
switch (type) {
|
||||
case AVI_RAW:
|
||||
fwrite (data, block, size, fp);
|
||||
break;
|
||||
case AVI_CHUNK:
|
||||
Ichunk ((AviChunk *) data);
|
||||
fwrite (data, block, size, fp);
|
||||
break;
|
||||
case AVI_LIST:
|
||||
Ilist ((AviList *) data);
|
||||
fwrite (data, block, size, fp);
|
||||
break;
|
||||
case AVI_MAINH:
|
||||
Imainh ((AviMainHeader *) data);
|
||||
fwrite (data, block, size, fp);
|
||||
break;
|
||||
case AVI_STREAMH:
|
||||
Istreamh ((AviStreamHeader *) data);
|
||||
fwrite (data, block, size, fp);
|
||||
break;
|
||||
case AVI_BITMAPH:
|
||||
Ibitmaph ((AviBitmapInfoHeader *) data);
|
||||
if (size==sizeof(AviBitmapInfoHeader) + sizeof(AviMJPEGUnknown)) {
|
||||
Imjpegu((AviMJPEGUnknown*)((char*)data+sizeof(AviBitmapInfoHeader)));
|
||||
}
|
||||
fwrite (data, block, size, fp);
|
||||
break;
|
||||
case AVI_MJPEGU:
|
||||
Imjpegu ((AviMJPEGUnknown *) data);
|
||||
fwrite (data, block, size, fp);
|
||||
break;
|
||||
case AVI_INDEXE:
|
||||
Iindexe ((AviIndexEntry *) data);
|
||||
fwrite (data, block, size, fp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case AVI_RAW:
|
||||
fwrite(data, block, size, fp);
|
||||
break;
|
||||
case AVI_CHUNK:
|
||||
Ichunk((AviChunk *) data);
|
||||
fwrite(data, block, size, fp);
|
||||
break;
|
||||
case AVI_LIST:
|
||||
Ilist((AviList *) data);
|
||||
fwrite(data, block, size, fp);
|
||||
break;
|
||||
case AVI_MAINH:
|
||||
Imainh((AviMainHeader *) data);
|
||||
fwrite(data, block, size, fp);
|
||||
break;
|
||||
case AVI_STREAMH:
|
||||
Istreamh((AviStreamHeader *) data);
|
||||
fwrite(data, block, size, fp);
|
||||
break;
|
||||
case AVI_BITMAPH:
|
||||
Ibitmaph((AviBitmapInfoHeader *) data);
|
||||
if (size == sizeof(AviBitmapInfoHeader) + sizeof(AviMJPEGUnknown)) {
|
||||
Imjpegu((AviMJPEGUnknown *)((char *)data + sizeof(AviBitmapInfoHeader)));
|
||||
}
|
||||
fwrite(data, block, size, fp);
|
||||
break;
|
||||
case AVI_MJPEGU:
|
||||
Imjpegu((AviMJPEGUnknown *) data);
|
||||
fwrite(data, block, size, fp);
|
||||
break;
|
||||
case AVI_INDEXE:
|
||||
Iindexe((AviIndexEntry *) data);
|
||||
fwrite(data, block, size, fp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
MEM_freeN (data);
|
||||
MEM_freeN(data);
|
||||
#else /* __BIG_ENDIAN__ */
|
||||
(void)movie; /* unused */
|
||||
(void)type; /* unused */
|
||||
fwrite (datain, block, size, fp);
|
||||
fwrite(datain, block, size, fp);
|
||||
#endif /* __BIG_ENDIAN__ */
|
||||
}
|
||||
|
@ -42,14 +42,14 @@
|
||||
|
||||
#include "mjpeg.h"
|
||||
|
||||
#define PADUP(num, amt) ((num+(amt-1))&~(amt-1))
|
||||
#define PADUP(num, amt) ((num + (amt - 1)) & ~(amt - 1))
|
||||
|
||||
static void jpegmemdestmgr_build (j_compress_ptr cinfo, unsigned char *buffer, int bufsize);
|
||||
static void jpegmemsrcmgr_build (j_decompress_ptr dinfo, unsigned char *buffer, int bufsize);
|
||||
static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, int bufsize);
|
||||
static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, unsigned char *buffer, int bufsize);
|
||||
|
||||
static int numbytes;
|
||||
|
||||
static void add_huff_table (j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val)
|
||||
static void add_huff_table(j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val)
|
||||
{
|
||||
if (*htblptr == NULL)
|
||||
*htblptr = jpeg_alloc_huff_table((j_common_ptr) dinfo);
|
||||
@ -64,25 +64,30 @@ static void add_huff_table (j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const U
|
||||
/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */
|
||||
/* IMPORTANT: these are only valid for 8-bit data precision! */
|
||||
|
||||
static void std_huff_tables (j_decompress_ptr dinfo)
|
||||
static void std_huff_tables(j_decompress_ptr dinfo)
|
||||
{
|
||||
static const UINT8 bits_dc_luminance[17] =
|
||||
{ /* 0-base */
|
||||
0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
|
||||
0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
static const UINT8 val_dc_luminance[] =
|
||||
{
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
|
||||
};
|
||||
|
||||
static const UINT8 bits_dc_chrominance[17] =
|
||||
{ /* 0-base */
|
||||
0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
|
||||
0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
|
||||
};
|
||||
static const UINT8 val_dc_chrominance[] =
|
||||
{
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
|
||||
};
|
||||
|
||||
static const UINT8 bits_ac_luminance[17] =
|
||||
{ /* 0-base */
|
||||
0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d };
|
||||
0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d
|
||||
};
|
||||
static const UINT8 val_ac_luminance[] =
|
||||
{
|
||||
0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
|
||||
@ -105,10 +110,12 @@ static void std_huff_tables (j_decompress_ptr dinfo)
|
||||
0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
|
||||
0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
|
||||
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa };
|
||||
0xf9, 0xfa
|
||||
};
|
||||
static const UINT8 bits_ac_chrominance[17] =
|
||||
{ /* 0-base */
|
||||
0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 };
|
||||
0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77
|
||||
};
|
||||
static const UINT8 val_ac_chrominance[] =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
|
||||
@ -131,16 +138,17 @@ static void std_huff_tables (j_decompress_ptr dinfo)
|
||||
0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
|
||||
0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
|
||||
0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa };
|
||||
0xf9, 0xfa
|
||||
};
|
||||
|
||||
add_huff_table(dinfo, &dinfo->dc_huff_tbl_ptrs[0],
|
||||
bits_dc_luminance, val_dc_luminance);
|
||||
bits_dc_luminance, val_dc_luminance);
|
||||
add_huff_table(dinfo, &dinfo->ac_huff_tbl_ptrs[0],
|
||||
bits_ac_luminance, val_ac_luminance);
|
||||
bits_ac_luminance, val_ac_luminance);
|
||||
add_huff_table(dinfo, &dinfo->dc_huff_tbl_ptrs[1],
|
||||
bits_dc_chrominance, val_dc_chrominance);
|
||||
bits_dc_chrominance, val_dc_chrominance);
|
||||
add_huff_table(dinfo, &dinfo->ac_huff_tbl_ptrs[1],
|
||||
bits_ac_chrominance, val_ac_chrominance);
|
||||
bits_ac_chrominance, val_ac_chrominance);
|
||||
}
|
||||
|
||||
static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsigned int width, unsigned int height, int bufsize)
|
||||
@ -152,7 +160,7 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign
|
||||
|
||||
(void)width; /* unused */
|
||||
|
||||
numbytes= 0;
|
||||
numbytes = 0;
|
||||
|
||||
dinfo.err = jpeg_std_error(&jerr);
|
||||
jpeg_create_decompress(&dinfo);
|
||||
@ -166,8 +174,8 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign
|
||||
|
||||
jpeg_start_decompress(&dinfo);
|
||||
|
||||
rowstride= dinfo.output_width*dinfo.output_components;
|
||||
for (y= 0; y<dinfo.output_height; y++) {
|
||||
rowstride = dinfo.output_width * dinfo.output_components;
|
||||
for (y = 0; y < dinfo.output_height; y++) {
|
||||
jpeg_read_scanlines(&dinfo, (JSAMPARRAY) &outBuffer, 1);
|
||||
outBuffer += rowstride;
|
||||
}
|
||||
@ -175,18 +183,18 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign
|
||||
|
||||
if (dinfo.output_height >= height) return 0;
|
||||
|
||||
inBuffer+= numbytes;
|
||||
jpegmemsrcmgr_build(&dinfo, inBuffer, bufsize-numbytes);
|
||||
inBuffer += numbytes;
|
||||
jpegmemsrcmgr_build(&dinfo, inBuffer, bufsize - numbytes);
|
||||
|
||||
numbytes= 0;
|
||||
numbytes = 0;
|
||||
jpeg_read_header(&dinfo, TRUE);
|
||||
if (dinfo.dc_huff_tbl_ptrs[0] == NULL) {
|
||||
std_huff_tables(&dinfo);
|
||||
}
|
||||
|
||||
jpeg_start_decompress(&dinfo);
|
||||
rowstride= dinfo.output_width*dinfo.output_components;
|
||||
for (y= 0; y<dinfo.output_height; y++) {
|
||||
rowstride = dinfo.output_width * dinfo.output_components;
|
||||
for (y = 0; y < dinfo.output_height; y++) {
|
||||
jpeg_read_scanlines(&dinfo, (JSAMPARRAY) &outBuffer, 1);
|
||||
outBuffer += rowstride;
|
||||
}
|
||||
@ -214,9 +222,9 @@ static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char *
|
||||
cinfo.in_color_space = JCS_RGB;
|
||||
|
||||
jpeg_set_defaults(&cinfo);
|
||||
jpeg_set_colorspace (&cinfo, JCS_YCbCr);
|
||||
jpeg_set_colorspace(&cinfo, JCS_YCbCr);
|
||||
|
||||
jpeg_set_quality (&cinfo, quality, TRUE);
|
||||
jpeg_set_quality(&cinfo, quality, TRUE);
|
||||
|
||||
cinfo.dc_huff_tbl_ptrs[0]->sent_table = TRUE;
|
||||
cinfo.dc_huff_tbl_ptrs[1]->sent_table = TRUE;
|
||||
@ -232,24 +240,24 @@ static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char *
|
||||
|
||||
jpeg_start_compress(&cinfo, FALSE);
|
||||
|
||||
i=0;
|
||||
i = 0;
|
||||
marker[i++] = 'A';
|
||||
marker[i++] = 'V';
|
||||
marker[i++] = 'I';
|
||||
marker[i++] = '1';
|
||||
marker[i++] = 0;
|
||||
while (i<60)
|
||||
while (i < 60)
|
||||
marker[i++] = 32;
|
||||
|
||||
jpeg_write_marker (&cinfo, JPEG_APP0, marker, 60);
|
||||
jpeg_write_marker(&cinfo, JPEG_APP0, marker, 60);
|
||||
|
||||
i=0;
|
||||
while (i<60)
|
||||
i = 0;
|
||||
while (i < 60)
|
||||
marker[i++] = 0;
|
||||
|
||||
jpeg_write_marker (&cinfo, JPEG_COM, marker, 60);
|
||||
jpeg_write_marker(&cinfo, JPEG_COM, marker, 60);
|
||||
|
||||
rowstride= cinfo.image_width*cinfo.input_components;
|
||||
rowstride = cinfo.image_width * cinfo.input_components;
|
||||
for (y = 0; y < cinfo.image_height; y++) {
|
||||
jpeg_write_scanlines(&cinfo, (JSAMPARRAY) &inBuffer, 1);
|
||||
inBuffer += rowstride;
|
||||
@ -260,43 +268,43 @@ static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char *
|
||||
|
||||
static void interlace(unsigned char *to, unsigned char *from, int width, int height)
|
||||
{
|
||||
int i, rowstride= width*3;
|
||||
int i, rowstride = width * 3;
|
||||
|
||||
for (i=0; i<height; i++) {
|
||||
if (i&1)
|
||||
memcpy (&to[i*rowstride], &from[(i/2 + height/2)*rowstride], rowstride);
|
||||
for (i = 0; i < height; i++) {
|
||||
if (i & 1)
|
||||
memcpy(&to[i * rowstride], &from[(i / 2 + height / 2) * rowstride], rowstride);
|
||||
else
|
||||
memcpy (&to[i*rowstride], &from[(i/2)*rowstride], rowstride);
|
||||
memcpy(&to[i * rowstride], &from[(i / 2) * rowstride], rowstride);
|
||||
}
|
||||
}
|
||||
|
||||
static void deinterlace(int odd, unsigned char *to, unsigned char *from, int width, int height)
|
||||
{
|
||||
int i, rowstride= width*3;
|
||||
int i, rowstride = width * 3;
|
||||
|
||||
for (i=0; i<height; i++) {
|
||||
if ((i&1)==odd)
|
||||
memcpy (&to[(i/2 + height/2)*rowstride], &from[i*rowstride], rowstride);
|
||||
for (i = 0; i < height; i++) {
|
||||
if ((i & 1) == odd)
|
||||
memcpy(&to[(i / 2 + height / 2) * rowstride], &from[i * rowstride], rowstride);
|
||||
else
|
||||
memcpy (&to[(i/2)*rowstride], &from[i*rowstride], rowstride);
|
||||
memcpy(&to[(i / 2) * rowstride], &from[i * rowstride], rowstride);
|
||||
}
|
||||
}
|
||||
|
||||
static int check_and_decode_jpeg(unsigned char *inbuf, unsigned char *outbuf, int width, int height, int bufsize)
|
||||
{
|
||||
/* JPEG's are always multiples of 16, extra is cropped out AVI's */
|
||||
if ((width&0xF) || (height&0xF)) {
|
||||
/* JPEG's are always multiples of 16, extra is cropped out AVI's */
|
||||
if ((width & 0xF) || (height & 0xF)) {
|
||||
int i, rrowstride, jrowstride;
|
||||
int jwidth= PADUP(width, 16);
|
||||
int jheight= PADUP(height, 16);
|
||||
unsigned char *tmpbuf= MEM_mallocN(jwidth*jheight*3, "avi.check_and_decode_jpeg");
|
||||
int ret= Decode_JPEG(inbuf, tmpbuf, jwidth, jheight, bufsize);
|
||||
|
||||
/* crop the tmpbuf into the real buffer */
|
||||
rrowstride= width*3;
|
||||
jrowstride= jwidth*3;
|
||||
for (i=0; i<height; i++)
|
||||
memcpy(&outbuf[i*rrowstride], &tmpbuf[i*jrowstride], rrowstride);
|
||||
int jwidth = PADUP(width, 16);
|
||||
int jheight = PADUP(height, 16);
|
||||
unsigned char *tmpbuf = MEM_mallocN(jwidth * jheight * 3, "avi.check_and_decode_jpeg");
|
||||
int ret = Decode_JPEG(inbuf, tmpbuf, jwidth, jheight, bufsize);
|
||||
|
||||
/* crop the tmpbuf into the real buffer */
|
||||
rrowstride = width * 3;
|
||||
jrowstride = jwidth * 3;
|
||||
for (i = 0; i < height; i++)
|
||||
memcpy(&outbuf[i * rrowstride], &tmpbuf[i * jrowstride], rrowstride);
|
||||
MEM_freeN(tmpbuf);
|
||||
|
||||
return ret;
|
||||
@ -308,22 +316,22 @@ static int check_and_decode_jpeg(unsigned char *inbuf, unsigned char *outbuf, in
|
||||
|
||||
static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned char *inbuf, int width, int height, int bufsize)
|
||||
{
|
||||
/* JPEG's are always multiples of 16, extra is ignored in AVI's */
|
||||
if ((width&0xF) || (height&0xF)) {
|
||||
/* JPEG's are always multiples of 16, extra is ignored in AVI's */
|
||||
if ((width & 0xF) || (height & 0xF)) {
|
||||
int i, rrowstride, jrowstride;
|
||||
int jwidth= PADUP(width, 16);
|
||||
int jheight= PADUP(height, 16);
|
||||
unsigned char *tmpbuf= MEM_mallocN(jwidth*jheight*3, "avi.check_and_compress_jpeg");
|
||||
|
||||
/* resize the realbuf into the tmpbuf */
|
||||
rrowstride= width*3;
|
||||
jrowstride= jwidth*3;
|
||||
for (i=0; i<jheight; i++) {
|
||||
if (i<height)
|
||||
memcpy(&tmpbuf[i*jrowstride], &inbuf[i*rrowstride], rrowstride);
|
||||
int jwidth = PADUP(width, 16);
|
||||
int jheight = PADUP(height, 16);
|
||||
unsigned char *tmpbuf = MEM_mallocN(jwidth * jheight * 3, "avi.check_and_compress_jpeg");
|
||||
|
||||
/* resize the realbuf into the tmpbuf */
|
||||
rrowstride = width * 3;
|
||||
jrowstride = jwidth * 3;
|
||||
for (i = 0; i < jheight; i++) {
|
||||
if (i < height)
|
||||
memcpy(&tmpbuf[i * jrowstride], &inbuf[i * rrowstride], rrowstride);
|
||||
else
|
||||
memset(&tmpbuf[i*jrowstride], 0, rrowstride);
|
||||
memset(&tmpbuf[i*jrowstride+rrowstride], 0, jrowstride-rrowstride);
|
||||
memset(&tmpbuf[i * jrowstride], 0, rrowstride);
|
||||
memset(&tmpbuf[i * jrowstride + rrowstride], 0, jrowstride - rrowstride);
|
||||
}
|
||||
|
||||
Compress_JPEG(quality, outbuf, tmpbuf, jwidth, jheight, bufsize);
|
||||
@ -335,57 +343,57 @@ static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned
|
||||
}
|
||||
}
|
||||
|
||||
void *avi_converter_from_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||
void *avi_converter_from_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||
{
|
||||
int deint;
|
||||
unsigned char *buf;
|
||||
|
||||
(void)stream; /* unused */
|
||||
|
||||
buf= MEM_mallocN (movie->header->Height * movie->header->Width * 3, "avi.avi_converter_from_mjpeg 1");
|
||||
buf = MEM_mallocN(movie->header->Height * movie->header->Width * 3, "avi.avi_converter_from_mjpeg 1");
|
||||
|
||||
deint= check_and_decode_jpeg(buffer, buf, movie->header->Width, movie->header->Height, *size);
|
||||
deint = check_and_decode_jpeg(buffer, buf, movie->header->Width, movie->header->Height, *size);
|
||||
|
||||
MEM_freeN(buffer);
|
||||
|
||||
if (deint) {
|
||||
buffer = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "avi.avi_converter_from_mjpeg 2");
|
||||
interlace (buffer, buf, movie->header->Width, movie->header->Height);
|
||||
MEM_freeN (buf);
|
||||
buffer = MEM_mallocN(movie->header->Height * movie->header->Width * 3, "avi.avi_converter_from_mjpeg 2");
|
||||
interlace(buffer, buf, movie->header->Width, movie->header->Height);
|
||||
MEM_freeN(buf);
|
||||
|
||||
buf= buffer;
|
||||
buf = buffer;
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||
void *avi_converter_to_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||
{
|
||||
unsigned char *buf;
|
||||
int bufsize= *size;
|
||||
int bufsize = *size;
|
||||
|
||||
numbytes = 0;
|
||||
*size= 0;
|
||||
*size = 0;
|
||||
|
||||
buf = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "avi.avi_converter_to_mjpeg 1");
|
||||
buf = MEM_mallocN(movie->header->Height * movie->header->Width * 3, "avi.avi_converter_to_mjpeg 1");
|
||||
if (!movie->interlace) {
|
||||
check_and_compress_jpeg(movie->streams[stream].sh.Quality/100, buf, buffer, movie->header->Width, movie->header->Height, bufsize);
|
||||
check_and_compress_jpeg(movie->streams[stream].sh.Quality / 100, buf, buffer, movie->header->Width, movie->header->Height, bufsize);
|
||||
}
|
||||
else {
|
||||
deinterlace (movie->odd_fields, buf, buffer, movie->header->Width, movie->header->Height);
|
||||
MEM_freeN (buffer);
|
||||
deinterlace(movie->odd_fields, buf, buffer, movie->header->Width, movie->header->Height);
|
||||
MEM_freeN(buffer);
|
||||
|
||||
buffer= buf;
|
||||
buf= MEM_mallocN (movie->header->Height * movie->header->Width * 3, "avi.avi_converter_to_mjpeg 2");
|
||||
buffer = buf;
|
||||
buf = MEM_mallocN(movie->header->Height * movie->header->Width * 3, "avi.avi_converter_to_mjpeg 2");
|
||||
|
||||
check_and_compress_jpeg(movie->streams[stream].sh.Quality/100, buf, buffer, movie->header->Width, movie->header->Height/2, bufsize/2);
|
||||
*size+= numbytes;
|
||||
numbytes=0;
|
||||
check_and_compress_jpeg(movie->streams[stream].sh.Quality/100, buf+*size, buffer+(movie->header->Height/2)*movie->header->Width*3, movie->header->Width, movie->header->Height/2, bufsize/2);
|
||||
check_and_compress_jpeg(movie->streams[stream].sh.Quality / 100, buf, buffer, movie->header->Width, movie->header->Height / 2, bufsize / 2);
|
||||
*size += numbytes;
|
||||
numbytes = 0;
|
||||
check_and_compress_jpeg(movie->streams[stream].sh.Quality / 100, buf + *size, buffer + (movie->header->Height / 2) * movie->header->Width * 3, movie->header->Width, movie->header->Height / 2, bufsize / 2);
|
||||
}
|
||||
*size += numbytes;
|
||||
|
||||
MEM_freeN (buffer);
|
||||
MEM_freeN(buffer);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@ -405,23 +413,23 @@ static boolean jpegmemdestmgr_empty_output_buffer(j_compress_ptr cinfo)
|
||||
|
||||
static void jpegmemdestmgr_term_destination(j_compress_ptr cinfo)
|
||||
{
|
||||
numbytes-= cinfo->dest->free_in_buffer;
|
||||
numbytes -= cinfo->dest->free_in_buffer;
|
||||
|
||||
MEM_freeN(cinfo->dest);
|
||||
}
|
||||
|
||||
static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, int bufsize)
|
||||
{
|
||||
cinfo->dest= MEM_mallocN(sizeof(*(cinfo->dest)), "avi.jpegmemdestmgr_build");
|
||||
cinfo->dest = MEM_mallocN(sizeof(*(cinfo->dest)), "avi.jpegmemdestmgr_build");
|
||||
|
||||
cinfo->dest->init_destination= jpegmemdestmgr_init_destination;
|
||||
cinfo->dest->empty_output_buffer= jpegmemdestmgr_empty_output_buffer;
|
||||
cinfo->dest->term_destination= jpegmemdestmgr_term_destination;
|
||||
cinfo->dest->init_destination = jpegmemdestmgr_init_destination;
|
||||
cinfo->dest->empty_output_buffer = jpegmemdestmgr_empty_output_buffer;
|
||||
cinfo->dest->term_destination = jpegmemdestmgr_term_destination;
|
||||
|
||||
cinfo->dest->next_output_byte= buffer;
|
||||
cinfo->dest->free_in_buffer= bufsize;
|
||||
cinfo->dest->next_output_byte = buffer;
|
||||
cinfo->dest->free_in_buffer = bufsize;
|
||||
|
||||
numbytes= bufsize;
|
||||
numbytes = bufsize;
|
||||
}
|
||||
|
||||
/* Decompression from memory */
|
||||
@ -433,48 +441,48 @@ static void jpegmemsrcmgr_init_source(j_decompress_ptr dinfo)
|
||||
|
||||
static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo)
|
||||
{
|
||||
unsigned char *buf= (unsigned char*) dinfo->src->next_input_byte-2;
|
||||
unsigned char *buf = (unsigned char *) dinfo->src->next_input_byte - 2;
|
||||
|
||||
/* if we get called, must have run out of data */
|
||||
/* if we get called, must have run out of data */
|
||||
WARNMS(dinfo, JWRN_JPEG_EOF);
|
||||
|
||||
buf[0]= (JOCTET) 0xFF;
|
||||
buf[1]= (JOCTET) JPEG_EOI;
|
||||
buf[0] = (JOCTET) 0xFF;
|
||||
buf[1] = (JOCTET) JPEG_EOI;
|
||||
|
||||
dinfo->src->next_input_byte= buf;
|
||||
dinfo->src->bytes_in_buffer= 2;
|
||||
dinfo->src->next_input_byte = buf;
|
||||
dinfo->src->bytes_in_buffer = 2;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void jpegmemsrcmgr_skip_input_data(j_decompress_ptr dinfo, long skipcnt)
|
||||
{
|
||||
if (dinfo->src->bytes_in_buffer<skipcnt)
|
||||
skipcnt= dinfo->src->bytes_in_buffer;
|
||||
if (dinfo->src->bytes_in_buffer < skipcnt)
|
||||
skipcnt = dinfo->src->bytes_in_buffer;
|
||||
|
||||
dinfo->src->next_input_byte+= skipcnt;
|
||||
dinfo->src->bytes_in_buffer-= skipcnt;
|
||||
dinfo->src->next_input_byte += skipcnt;
|
||||
dinfo->src->bytes_in_buffer -= skipcnt;
|
||||
}
|
||||
|
||||
static void jpegmemsrcmgr_term_source(j_decompress_ptr dinfo)
|
||||
{
|
||||
numbytes-= dinfo->src->bytes_in_buffer;
|
||||
numbytes -= dinfo->src->bytes_in_buffer;
|
||||
|
||||
MEM_freeN(dinfo->src);
|
||||
}
|
||||
|
||||
static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, unsigned char *buffer, int bufsize)
|
||||
{
|
||||
dinfo->src= MEM_mallocN(sizeof(*(dinfo->src)), "avi.jpegmemsrcmgr_build");
|
||||
dinfo->src = MEM_mallocN(sizeof(*(dinfo->src)), "avi.jpegmemsrcmgr_build");
|
||||
|
||||
dinfo->src->init_source= jpegmemsrcmgr_init_source;
|
||||
dinfo->src->fill_input_buffer= jpegmemsrcmgr_fill_input_buffer;
|
||||
dinfo->src->skip_input_data= jpegmemsrcmgr_skip_input_data;
|
||||
dinfo->src->resync_to_restart= jpeg_resync_to_restart;
|
||||
dinfo->src->term_source= jpegmemsrcmgr_term_source;
|
||||
dinfo->src->init_source = jpegmemsrcmgr_init_source;
|
||||
dinfo->src->fill_input_buffer = jpegmemsrcmgr_fill_input_buffer;
|
||||
dinfo->src->skip_input_data = jpegmemsrcmgr_skip_input_data;
|
||||
dinfo->src->resync_to_restart = jpeg_resync_to_restart;
|
||||
dinfo->src->term_source = jpegmemsrcmgr_term_source;
|
||||
|
||||
dinfo->src->bytes_in_buffer= bufsize;
|
||||
dinfo->src->next_input_byte= buffer;
|
||||
dinfo->src->bytes_in_buffer = bufsize;
|
||||
dinfo->src->next_input_byte = buffer;
|
||||
|
||||
numbytes= bufsize;
|
||||
numbytes = bufsize;
|
||||
}
|
||||
|
@ -54,78 +54,78 @@ AviError AVI_set_compress_option(AviMovie *movie, int option_type, int stream, A
|
||||
return AVI_ERROR_OPTION;
|
||||
|
||||
switch (option_type) {
|
||||
case AVI_OPTION_TYPE_MAIN:
|
||||
switch (option) {
|
||||
case AVI_OPTION_WIDTH:
|
||||
movie->header->Width = *((int *) opt_data);
|
||||
movie->header->SuggestedBufferSize = movie->header->Width*movie->header->Height*3;
|
||||
case AVI_OPTION_TYPE_MAIN:
|
||||
switch (option) {
|
||||
case AVI_OPTION_WIDTH:
|
||||
movie->header->Width = *((int *) opt_data);
|
||||
movie->header->SuggestedBufferSize = movie->header->Width * movie->header->Height * 3;
|
||||
|
||||
for (i = 0; i < movie->header->Streams; i++) {
|
||||
if (avi_get_format_type(movie->streams[i].format) == FCC("vids")) {
|
||||
((AviBitmapInfoHeader *) movie->streams[i].sf)->Width = *((int *) opt_data);
|
||||
movie->streams[i].sh.SuggestedBufferSize = movie->header->SuggestedBufferSize;
|
||||
movie->streams[i].sh.right = *((int *) opt_data);
|
||||
((AviBitmapInfoHeader *) movie->streams[i].sf)->SizeImage = movie->header->SuggestedBufferSize;
|
||||
fseek(movie->fp, movie->offset_table[1 + i * 2 + 1], SEEK_SET);
|
||||
awrite(movie, movie->streams[i].sf, 1, movie->streams[i].sf_size, movie->fp, AVI_BITMAPH);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case AVI_OPTION_HEIGHT:
|
||||
movie->header->Height = *((int *) opt_data);
|
||||
movie->header->SuggestedBufferSize = movie->header->Width * movie->header->Height * 3;
|
||||
|
||||
for (i = 0; i < movie->header->Streams; i++) {
|
||||
if (avi_get_format_type(movie->streams[i].format) == FCC("vids")) {
|
||||
((AviBitmapInfoHeader *) movie->streams[i].sf)->Height = *((int *) opt_data);
|
||||
movie->streams[i].sh.SuggestedBufferSize = movie->header->SuggestedBufferSize;
|
||||
movie->streams[i].sh.bottom = *((int *) opt_data);
|
||||
((AviBitmapInfoHeader *) movie->streams[i].sf)->SizeImage = movie->header->SuggestedBufferSize;
|
||||
fseek(movie->fp, movie->offset_table[1 + i * 2 + 1], SEEK_SET);
|
||||
awrite(movie, movie->streams[i].sf, 1, movie->streams[i].sf_size, movie->fp, AVI_BITMAPH);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case AVI_OPTION_QUALITY:
|
||||
for (i = 0; i < movie->header->Streams; i++) {
|
||||
if (avi_get_format_type(movie->streams[i].format) == FCC("vids")) {
|
||||
movie->streams[i].sh.Quality = (*((int *) opt_data)) * 100;
|
||||
fseek(movie->fp, movie->offset_table[1 + i * 2 + 1], SEEK_SET);
|
||||
awrite(movie, movie->streams[i].sf, 1, movie->streams[i].sf_size, movie->fp, AVI_BITMAPH);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case AVI_OPTION_FRAMERATE:
|
||||
useconds = (int)(1000000 / (*((double *) opt_data)));
|
||||
if (useconds)
|
||||
movie->header->MicroSecPerFrame = useconds;
|
||||
|
||||
for (i = 0; i < movie->header->Streams; i++) {
|
||||
if (avi_get_format_type(movie->streams[i].format) == FCC("vids")) {
|
||||
movie->streams[i].sh.Scale = movie->header->MicroSecPerFrame;
|
||||
fseek(movie->fp, movie->offset_table[1 + i * 2 + 1], SEEK_SET);
|
||||
awrite(movie, movie->streams[i].sf, 1, movie->streams[i].sf_size, movie->fp, AVI_BITMAPH);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i < movie->header->Streams; i++) {
|
||||
if (avi_get_format_type(movie->streams[i].format) == FCC("vids")) {
|
||||
((AviBitmapInfoHeader *) movie->streams[i].sf)->Width = *((int *) opt_data);
|
||||
movie->streams[i].sh.SuggestedBufferSize = movie->header->SuggestedBufferSize;
|
||||
movie->streams[i].sh.right = *((int *) opt_data);
|
||||
((AviBitmapInfoHeader *) movie->streams[i].sf)->SizeImage = movie->header->SuggestedBufferSize;
|
||||
fseek (movie->fp, movie->offset_table[1+i*2+1], SEEK_SET);
|
||||
awrite (movie, movie->streams[i].sf, 1, movie->streams[i].sf_size, movie->fp, AVI_BITMAPH);
|
||||
}
|
||||
}
|
||||
|
||||
fseek(movie->fp, movie->offset_table[0], SEEK_SET);
|
||||
awrite(movie, movie->header, 1, sizeof(AviMainHeader), movie->fp, AVI_MAINH);
|
||||
|
||||
break;
|
||||
|
||||
case AVI_OPTION_HEIGHT:
|
||||
movie->header->Height = *((int *) opt_data);
|
||||
movie->header->SuggestedBufferSize = movie->header->Width*movie->header->Height*3;
|
||||
|
||||
for (i=0; i < movie->header->Streams; i++) {
|
||||
if (avi_get_format_type(movie->streams[i].format) == FCC("vids")) {
|
||||
((AviBitmapInfoHeader *) movie->streams[i].sf)->Height = *((int *) opt_data);
|
||||
movie->streams[i].sh.SuggestedBufferSize = movie->header->SuggestedBufferSize;
|
||||
movie->streams[i].sh.bottom = *((int *) opt_data);
|
||||
((AviBitmapInfoHeader *) movie->streams[i].sf)->SizeImage = movie->header->SuggestedBufferSize;
|
||||
fseek (movie->fp, movie->offset_table[1+i*2+1], SEEK_SET);
|
||||
awrite (movie, movie->streams[i].sf, 1, movie->streams[i].sf_size, movie->fp, AVI_BITMAPH);
|
||||
}
|
||||
}
|
||||
|
||||
case AVI_OPTION_TYPE_STRH:
|
||||
break;
|
||||
|
||||
case AVI_OPTION_QUALITY:
|
||||
for (i=0; i < movie->header->Streams; i++) {
|
||||
if (avi_get_format_type(movie->streams[i].format) == FCC("vids")) {
|
||||
movie->streams[i].sh.Quality = (*((int *) opt_data))*100;
|
||||
fseek (movie->fp, movie->offset_table[1+i*2+1], SEEK_SET);
|
||||
awrite (movie, movie->streams[i].sf, 1, movie->streams[i].sf_size, movie->fp, AVI_BITMAPH);
|
||||
}
|
||||
}
|
||||
case AVI_OPTION_TYPE_STRF:
|
||||
break;
|
||||
default:
|
||||
return AVI_ERROR_OPTION;
|
||||
break;
|
||||
|
||||
case AVI_OPTION_FRAMERATE:
|
||||
useconds = (int)(1000000/(*((double *) opt_data)));
|
||||
if (useconds)
|
||||
movie->header->MicroSecPerFrame = useconds;
|
||||
|
||||
for (i=0; i < movie->header->Streams; i++) {
|
||||
if (avi_get_format_type(movie->streams[i].format) == FCC("vids")) {
|
||||
movie->streams[i].sh.Scale = movie->header->MicroSecPerFrame;
|
||||
fseek (movie->fp, movie->offset_table[1+i*2+1], SEEK_SET);
|
||||
awrite (movie, movie->streams[i].sf, 1, movie->streams[i].sf_size, movie->fp, AVI_BITMAPH);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fseek (movie->fp, movie->offset_table[0], SEEK_SET);
|
||||
awrite (movie, movie->header, 1, sizeof(AviMainHeader), movie->fp, AVI_MAINH);
|
||||
|
||||
break;
|
||||
case AVI_OPTION_TYPE_STRH:
|
||||
break;
|
||||
case AVI_OPTION_TYPE_STRF:
|
||||
break;
|
||||
default:
|
||||
return AVI_ERROR_OPTION;
|
||||
break;
|
||||
}
|
||||
|
||||
return AVI_ERROR_NONE;
|
||||
|
@ -39,33 +39,33 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "rgb32.h"
|
||||
|
||||
void *avi_converter_from_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||
void *avi_converter_from_rgb32(AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||
{
|
||||
int y, x, rowstridea, rowstrideb;
|
||||
unsigned char *buf;
|
||||
|
||||
(void)stream; /* unused */
|
||||
|
||||
buf = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "fromrgb32buf");
|
||||
buf = MEM_mallocN(movie->header->Height * movie->header->Width * 3, "fromrgb32buf");
|
||||
*size = movie->header->Height * movie->header->Width * 3;
|
||||
|
||||
rowstridea = movie->header->Width*3;
|
||||
rowstrideb = movie->header->Width*4;
|
||||
rowstridea = movie->header->Width * 3;
|
||||
rowstrideb = movie->header->Width * 4;
|
||||
|
||||
for (y=0; y < movie->header->Height; y++) {
|
||||
for (x=0; x < movie->header->Width; x++) {
|
||||
buf[y*rowstridea + x*3 + 0] = buffer[y*rowstrideb + x*4 + 3];
|
||||
buf[y*rowstridea + x*3 + 1] = buffer[y*rowstrideb + x*4 + 2];
|
||||
buf[y*rowstridea + x*3 + 2] = buffer[y*rowstrideb + x*4 + 1];
|
||||
for (y = 0; y < movie->header->Height; y++) {
|
||||
for (x = 0; x < movie->header->Width; x++) {
|
||||
buf[y * rowstridea + x * 3 + 0] = buffer[y * rowstrideb + x * 4 + 3];
|
||||
buf[y * rowstridea + x * 3 + 1] = buffer[y * rowstrideb + x * 4 + 2];
|
||||
buf[y * rowstridea + x * 3 + 2] = buffer[y * rowstrideb + x * 4 + 1];
|
||||
}
|
||||
}
|
||||
|
||||
MEM_freeN (buffer);
|
||||
MEM_freeN(buffer);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||
void *avi_converter_to_rgb32(AviMovie *movie, int stream, unsigned char *buffer, int *size)
|
||||
{
|
||||
int i;
|
||||
unsigned char *buf;
|
||||
@ -73,20 +73,20 @@ void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer
|
||||
|
||||
(void)stream; /* unused */
|
||||
|
||||
buf= MEM_mallocN (movie->header->Height * movie->header->Width * 4, "torgb32buf");
|
||||
*size= movie->header->Height * movie->header->Width * 4;
|
||||
buf = MEM_mallocN(movie->header->Height * movie->header->Width * 4, "torgb32buf");
|
||||
*size = movie->header->Height * movie->header->Width * 4;
|
||||
|
||||
memset(buf, 255, *size);
|
||||
|
||||
to= buf; from= buffer;
|
||||
i=movie->header->Height*movie->header->Width;
|
||||
to = buf; from = buffer;
|
||||
i = movie->header->Height * movie->header->Width;
|
||||
|
||||
while (i--) {
|
||||
memcpy(to, from, 3);
|
||||
to+=4; from+=3;
|
||||
to += 4; from += 3;
|
||||
}
|
||||
|
||||
MEM_freeN (buffer);
|
||||
MEM_freeN(buffer);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ typedef struct FontBLF {
|
||||
/* max texture size. */
|
||||
int max_tex_size;
|
||||
|
||||
/* current opengl texture bind, avoids calling glGet */
|
||||
/* cache current OpenGL texture to save calls into the API */
|
||||
int tex_bind_state;
|
||||
|
||||
/* font options. */
|
||||
|
@ -664,22 +664,22 @@ void DM_update_weight_mcol(struct Object *ob, struct DerivedMesh *dm, int const
|
||||
typedef struct DMVertexAttribs {
|
||||
struct {
|
||||
struct MTFace *array;
|
||||
int emOffset, glIndex, glTexco;
|
||||
int em_offset, gl_index, gl_texco;
|
||||
} tface[MAX_MTFACE];
|
||||
|
||||
struct {
|
||||
struct MCol *array;
|
||||
int emOffset, glIndex;
|
||||
int em_offset, gl_index;
|
||||
} mcol[MAX_MCOL];
|
||||
|
||||
struct {
|
||||
float (*array)[4];
|
||||
int emOffset, glIndex;
|
||||
int em_offset, gl_index;
|
||||
} tang;
|
||||
|
||||
struct {
|
||||
float (*array)[3];
|
||||
int emOffset, glIndex, glTexco;
|
||||
int em_offset, gl_index, gl_texco;
|
||||
} orco;
|
||||
|
||||
int tottface, totmcol, tottang, totorco;
|
||||
|
@ -59,13 +59,13 @@ extern "C" {
|
||||
struct bAction *add_empty_action(const char name[]);
|
||||
|
||||
/* Allocate a copy of the given Action and all its data */
|
||||
struct bAction *copy_action(struct bAction *src);
|
||||
struct bAction *BKE_action_copy(struct bAction *src);
|
||||
|
||||
/* Deallocate all of the Action's data, but not the Action itself */
|
||||
void free_action(struct bAction *act);
|
||||
void BKE_action_free(struct bAction *act);
|
||||
|
||||
// XXX is this needed?
|
||||
void make_local_action(struct bAction *act);
|
||||
void BKE_action_make_local(struct bAction *act);
|
||||
|
||||
|
||||
/* Action API ----------------- */
|
||||
@ -122,7 +122,7 @@ void action_groups_add_channel(struct bAction *act, struct bActionGroup *agrp, s
|
||||
void action_groups_remove_channel(struct bAction *act, struct FCurve *fcu);
|
||||
|
||||
/* Find a group with the given name */
|
||||
struct bActionGroup *action_groups_find_named(struct bAction *act, const char name[]);
|
||||
struct bActionGroup *BKE_action_group_find_name(struct bAction *act, const char name[]);
|
||||
|
||||
/* Clear all 'temp' flags on all groups */
|
||||
void action_groups_clear_tempflags(struct bAction *act);
|
||||
@ -133,71 +133,71 @@ void action_groups_clear_tempflags(struct bAction *act);
|
||||
* Deallocates a pose channel.
|
||||
* Does not free the pose channel itself.
|
||||
*/
|
||||
void free_pose_channel(struct bPoseChannel *pchan);
|
||||
void BKE_pose_channel_free(struct bPoseChannel *pchan);
|
||||
|
||||
/**
|
||||
* Removes and deallocates all channels from a pose.
|
||||
* Does not free the pose itself.
|
||||
*/
|
||||
void free_pose_channels(struct bPose *pose);
|
||||
void BKE_pose_channels_free(struct bPose *pose);
|
||||
|
||||
/**
|
||||
* Removes the hash for quick lookup of channels, must
|
||||
* be done when adding/removing channels.
|
||||
*/
|
||||
void make_pose_channels_hash(struct bPose *pose);
|
||||
void free_pose_channels_hash(struct bPose *pose);
|
||||
void BKE_pose_channels_hash_make(struct bPose *pose);
|
||||
void BKE_pose_channels_hash_free(struct bPose *pose);
|
||||
|
||||
/**
|
||||
* Removes and deallocates all data from a pose, and also frees the pose.
|
||||
*/
|
||||
void free_pose(struct bPose *pose);
|
||||
void BKE_pose_free(struct bPose *pose);
|
||||
|
||||
/**
|
||||
* Allocate a new pose on the heap, and copy the src pose and it's channels
|
||||
* into the new pose. *dst is set to the newly allocated structure, and assumed to be NULL.
|
||||
*/
|
||||
void copy_pose(struct bPose **dst, struct bPose *src, int copyconstraints);
|
||||
void BKE_pose_copy_data(struct bPose **dst, struct bPose *src, int copyconstraints);
|
||||
|
||||
/**
|
||||
* Copy the internal members of each pose channel including constraints
|
||||
* and ID-Props, used when duplicating bones in editmode.
|
||||
*/
|
||||
void duplicate_pose_channel_data(struct bPoseChannel *pchan, const struct bPoseChannel *pchan_from);
|
||||
void BKE_pose_channel_copy_data(struct bPoseChannel *pchan, const struct bPoseChannel *pchan_from);
|
||||
|
||||
/**
|
||||
* Return a pointer to the pose channel of the given name
|
||||
* from this pose.
|
||||
*/
|
||||
struct bPoseChannel *get_pose_channel(const struct bPose *pose, const char *name);
|
||||
struct bPoseChannel *BKE_pose_channel_find_name(const struct bPose *pose, const char *name);
|
||||
|
||||
/**
|
||||
* Return a pointer to the active pose channel from this Object.
|
||||
* (Note: Object, not bPose is used here, as we need layer info from Armature)
|
||||
*/
|
||||
struct bPoseChannel *get_active_posechannel(struct Object *ob);
|
||||
struct bPoseChannel *BKE_pose_channel_active(struct Object *ob);
|
||||
|
||||
/**
|
||||
* Looks to see if the channel with the given name
|
||||
* already exists in this pose - if not a new one is
|
||||
* allocated and initialized.
|
||||
*/
|
||||
struct bPoseChannel *verify_pose_channel(struct bPose* pose, const char* name);
|
||||
struct bPoseChannel *BKE_pose_channel_verify(struct bPose* pose, const char* name);
|
||||
|
||||
/* Copy the data from the action-pose (src) into the pose */
|
||||
void extract_pose_from_pose(struct bPose *pose, const struct bPose *src);
|
||||
|
||||
/* sets constraint flags */
|
||||
void update_pose_constraint_flags(struct bPose *pose);
|
||||
void BKE_pose_update_constraint_flags(struct bPose *pose);
|
||||
|
||||
/* return the name of structure pointed by pose->ikparam */
|
||||
const char *get_ikparam_name(struct bPose *pose);
|
||||
const char *BKE_pose_ikparam_get_name(struct bPose *pose);
|
||||
|
||||
/* allocate and initialize pose->ikparam according to pose->iksolver */
|
||||
void init_pose_ikparam(struct bPose *pose);
|
||||
void BKE_pose_ikparam_init(struct bPose *pose);
|
||||
|
||||
/* initialize a bItasc structure with default value */
|
||||
void init_pose_itasc(struct bItasc *itasc);
|
||||
void BKE_pose_itasc_init(struct bItasc *itasc);
|
||||
|
||||
/* clears BONE_UNKEYED flags for frame changing */
|
||||
// XXX to be depreceated for a more general solution in animsys...
|
||||
@ -206,10 +206,10 @@ void framechange_poses_clear_unkeyed(void);
|
||||
/* Bone Groups API --------------------- */
|
||||
|
||||
/* Adds a new bone-group */
|
||||
void pose_add_group(struct Object *ob);
|
||||
void BKE_pose_add_group(struct Object *ob);
|
||||
|
||||
/* Remove the active bone-group */
|
||||
void pose_remove_group(struct Object *ob);
|
||||
void BKE_pose_remove_group(struct Object *ob);
|
||||
|
||||
/* Assorted Evaluation ----------------- */
|
||||
|
||||
@ -217,9 +217,9 @@ void pose_remove_group(struct Object *ob);
|
||||
void what_does_obaction(struct Object *ob, struct Object *workob, struct bPose *pose, struct bAction *act, char groupname[], float cframe);
|
||||
|
||||
/* for proxy */
|
||||
void copy_pose_result(struct bPose *to, struct bPose *from);
|
||||
void BKE_pose_copy_result(struct bPose *to, struct bPose *from);
|
||||
/* clear all transforms */
|
||||
void rest_pose(struct bPose *pose);
|
||||
void BKE_pose_rest(struct bPose *pose);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
@ -75,28 +75,28 @@ typedef struct PoseTree
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct bArmature *add_armature(const char *name);
|
||||
struct bArmature *get_armature(struct Object *ob);
|
||||
void free_bonelist (struct ListBase *lb);
|
||||
void free_armature(struct bArmature *arm);
|
||||
void make_local_armature(struct bArmature *arm);
|
||||
struct bArmature *copy_armature(struct bArmature *arm);
|
||||
struct bArmature *BKE_armature_add(const char *name);
|
||||
struct bArmature *BKE_armature_from_object(struct Object *ob);
|
||||
void BKE_armature_bonelist_free (struct ListBase *lb);
|
||||
void BKE_armature_free(struct bArmature *arm);
|
||||
void BKE_armature_make_local(struct bArmature *arm);
|
||||
struct bArmature *BKE_armature_copy(struct bArmature *arm);
|
||||
|
||||
/* Bounding box. */
|
||||
struct BoundBox *BKE_armature_get_bb(struct Object *ob);
|
||||
struct BoundBox *BKE_armature_boundbox_get(struct Object *ob);
|
||||
|
||||
int bone_autoside_name (char name[64], int strip_number, short axis, float head, float tail);
|
||||
|
||||
struct Bone *get_named_bone (struct bArmature *arm, const char *name);
|
||||
struct Bone *BKE_armature_find_bone_name (struct bArmature *arm, const char *name);
|
||||
|
||||
float distfactor_to_bone(const float vec[3], const float b1[3], const float b2[3], float r1, float r2, float rdist);
|
||||
|
||||
void where_is_armature (struct bArmature *arm);
|
||||
void where_is_armature_bone(struct Bone *bone, struct Bone *prevbone);
|
||||
void armature_rebuild_pose(struct Object *ob, struct bArmature *arm);
|
||||
void where_is_pose (struct Scene *scene, struct Object *ob);
|
||||
void where_is_pose_bone(struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime, int do_extra);
|
||||
void where_is_pose_bone_tail(struct bPoseChannel *pchan);
|
||||
void BKE_armature_where_is(struct bArmature *arm);
|
||||
void BKE_armature_where_is_bone(struct Bone *bone, struct Bone *prevbone);
|
||||
void BKE_pose_rebuild(struct Object *ob, struct bArmature *arm);
|
||||
void BKE_pose_where_is(struct Scene *scene, struct Object *ob);
|
||||
void BKE_pose_where_is_bone(struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime, int do_extra);
|
||||
void BKE_pose_where_is_bone_tail(struct bPoseChannel *pchan);
|
||||
|
||||
/* get_objectspace_bone_matrix has to be removed still */
|
||||
void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[][4], int root, int posed);
|
||||
@ -106,23 +106,23 @@ void mat3_to_vec_roll(float mat[][3], float *vec, float *roll);
|
||||
int get_selected_defgroups(struct Object *ob, char *defbase_sel, int defbase_len);
|
||||
|
||||
/* Common Conversions Between Co-ordinate Spaces */
|
||||
void armature_mat_world_to_pose(struct Object *ob, float inmat[][4], float outmat[][4]);
|
||||
void armature_loc_world_to_pose(struct Object *ob, const float inloc[3], float outloc[3]);
|
||||
void armature_mat_pose_to_bone(struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]);
|
||||
void armature_loc_pose_to_bone(struct bPoseChannel *pchan, const float inloc[3], float outloc[3]);
|
||||
void armature_mat_bone_to_pose(struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]);
|
||||
void armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float arm_mat[][4]);
|
||||
void BKE_armature_mat_world_to_pose(struct Object *ob, float inmat[][4], float outmat[][4]);
|
||||
void BKE_armature_loc_world_to_pose(struct Object *ob, const float inloc[3], float outloc[3]);
|
||||
void BKE_armature_mat_pose_to_bone(struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]);
|
||||
void BKE_armature_loc_pose_to_bone(struct bPoseChannel *pchan, const float inloc[3], float outloc[3]);
|
||||
void BKE_armature_mat_bone_to_pose(struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]);
|
||||
void BKE_armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float arm_mat[][4]);
|
||||
|
||||
void armature_mat_pose_to_bone_ex(struct Object *ob, struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]);
|
||||
void BKE_armature_mat_pose_to_bone_ex(struct Object *ob, struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]);
|
||||
|
||||
void pchan_mat3_to_rot(struct bPoseChannel *pchan, float mat[][3], short use_compat);
|
||||
void pchan_apply_mat4(struct bPoseChannel *pchan, float mat[][4], short use_comat);
|
||||
void pchan_to_mat4(struct bPoseChannel *pchan, float chan_mat[4][4]);
|
||||
void pchan_calc_mat(struct bPoseChannel *pchan);
|
||||
void BKE_pchan_mat3_to_rot(struct bPoseChannel *pchan, float mat[][3], short use_compat);
|
||||
void BKE_pchan_apply_mat4(struct bPoseChannel *pchan, float mat[][4], short use_comat);
|
||||
void BKE_pchan_to_mat4(struct bPoseChannel *pchan, float chan_mat[4][4]);
|
||||
void BKE_pchan_calc_mat(struct bPoseChannel *pchan);
|
||||
|
||||
/* Get the "pchan to pose" transform matrix. These matrices apply the effects of
|
||||
* HINGE/NO_SCALE/NO_LOCAL_LOCATION options over the pchan loc/rot/scale transformations. */
|
||||
void pchan_to_pose_mat(struct bPoseChannel *pchan, float rotscale_mat[][4], float loc_mat[][4]);
|
||||
void BKE_pchan_to_pose_mat(struct bPoseChannel *pchan, float rotscale_mat[][4], float loc_mat[][4]);
|
||||
|
||||
/* Rotation Mode Conversions - Used for PoseChannels + Objects... */
|
||||
void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode);
|
||||
|
@ -42,7 +42,7 @@ extern "C" {
|
||||
* and keep comment above the defines.
|
||||
* Use STRINGIFY() rather than defining with quotes */
|
||||
#define BLENDER_VERSION 263
|
||||
#define BLENDER_SUBVERSION 3
|
||||
#define BLENDER_SUBVERSION 4
|
||||
|
||||
#define BLENDER_MINVERSION 250
|
||||
#define BLENDER_MINSUBVERSION 0
|
||||
|
@ -41,34 +41,34 @@ struct wmOperator;
|
||||
// enum CurveMappingPreset;
|
||||
|
||||
/* datablock functions */
|
||||
struct Brush *add_brush(const char *name);
|
||||
struct Brush *copy_brush(struct Brush *brush);
|
||||
void make_local_brush(struct Brush *brush);
|
||||
void free_brush(struct Brush *brush);
|
||||
struct Brush *BKE_brush_add(const char *name);
|
||||
struct Brush *BKE_brush_copy(struct Brush *brush);
|
||||
void BKE_brush_make_local(struct Brush *brush);
|
||||
void BKE_brush_free(struct Brush *brush);
|
||||
|
||||
void brush_reset_sculpt(struct Brush *brush);
|
||||
void BKE_brush_sculpt_reset(struct Brush *brush);
|
||||
|
||||
/* image icon function */
|
||||
struct ImBuf *get_brush_icon(struct Brush *brush);
|
||||
|
||||
/* brush library operations used by different paint panels */
|
||||
int brush_texture_set_nr(struct Brush *brush, int nr);
|
||||
int brush_texture_delete(struct Brush *brush);
|
||||
int brush_clone_image_set_nr(struct Brush *brush, int nr);
|
||||
int brush_clone_image_delete(struct Brush *brush);
|
||||
int BKE_brush_texture_set_nr(struct Brush *brush, int nr);
|
||||
int BKE_brush_texture_delete(struct Brush *brush);
|
||||
int BKE_brush_clone_image_set_nr(struct Brush *brush, int nr);
|
||||
int BKE_brush_clone_image_delete(struct Brush *brush);
|
||||
|
||||
/* jitter */
|
||||
void brush_jitter_pos(const struct Scene *scene, struct Brush *brush,
|
||||
void BKE_brush_jitter_pos(const struct Scene *scene, struct Brush *brush,
|
||||
const float pos[2], float jitterpos[2]);
|
||||
|
||||
/* brush curve */
|
||||
void brush_curve_preset(struct Brush *b, /*enum CurveMappingPreset*/int preset);
|
||||
float brush_curve_strength_clamp(struct Brush *br, float p, const float len);
|
||||
float brush_curve_strength(struct Brush *br, float p, const float len); /* used for sculpt */
|
||||
void BKE_brush_curve_preset(struct Brush *b, /*enum CurveMappingPreset*/int preset);
|
||||
float BKE_brush_curve_strength_clamp(struct Brush *br, float p, const float len);
|
||||
float BKE_brush_curve_strength(struct Brush *br, float p, const float len); /* used for sculpt */
|
||||
|
||||
/* sampling */
|
||||
void brush_sample_tex(const struct Scene *scene, struct Brush *brush, const float xy[2], float rgba[4], const int thread);
|
||||
void brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size,
|
||||
void BKE_brush_sample_tex(const struct Scene *scene, struct Brush *brush, const float xy[2], float rgba[4], const int thread);
|
||||
void BKE_brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size,
|
||||
struct ImBuf **imbuf, int use_color_correction);
|
||||
|
||||
/* painting */
|
||||
@ -76,48 +76,48 @@ struct BrushPainter;
|
||||
typedef struct BrushPainter BrushPainter;
|
||||
typedef int (*BrushFunc)(void *user, struct ImBuf *ibuf, const float lastpos[2], const float pos[2]);
|
||||
|
||||
BrushPainter *brush_painter_new(struct Scene *scene, struct Brush *brush);
|
||||
void brush_painter_require_imbuf(BrushPainter *painter, short flt,
|
||||
BrushPainter *BKE_brush_painter_new(struct Scene *scene, struct Brush *brush);
|
||||
void BKE_brush_painter_require_imbuf(BrushPainter *painter, short flt,
|
||||
short texonly, int size);
|
||||
int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2],
|
||||
int BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2],
|
||||
double time, float pressure, void *user, int use_color_correction);
|
||||
void brush_painter_break_stroke(BrushPainter *painter);
|
||||
void brush_painter_free(BrushPainter *painter);
|
||||
void BKE_brush_painter_break_stroke(BrushPainter *painter);
|
||||
void BKE_brush_painter_free(BrushPainter *painter);
|
||||
|
||||
/* texture */
|
||||
unsigned int *brush_gen_texture_cache(struct Brush *br, int half_side);
|
||||
unsigned int *BKE_brush_gen_texture_cache(struct Brush *br, int half_side);
|
||||
|
||||
/* radial control */
|
||||
struct ImBuf *brush_gen_radial_control_imbuf(struct Brush *br);
|
||||
struct ImBuf *BKE_brush_gen_radial_control_imbuf(struct Brush *br);
|
||||
|
||||
/* unified strength and size */
|
||||
|
||||
int brush_size(const struct Scene *scene, struct Brush *brush);
|
||||
void brush_set_size(struct Scene *scene, struct Brush *brush, int value);
|
||||
int BKE_brush_size_get(const struct Scene *scene, struct Brush *brush);
|
||||
void BKE_brush_size_set(struct Scene *scene, struct Brush *brush, int value);
|
||||
|
||||
float brush_unprojected_radius(const struct Scene *scene, struct Brush *brush);
|
||||
void brush_set_unprojected_radius(struct Scene *scene, struct Brush *brush, float value);
|
||||
float BKE_brush_unprojected_radius_get(const struct Scene *scene, struct Brush *brush);
|
||||
void BKE_brush_unprojected_radius_set(struct Scene *scene, struct Brush *brush, float value);
|
||||
|
||||
float brush_alpha(const struct Scene *scene, struct Brush *brush);
|
||||
float brush_weight(const Scene *scene, struct Brush *brush);
|
||||
void brush_set_weight(const Scene *scene, struct Brush *brush, float value);
|
||||
float BKE_brush_alpha_get(const struct Scene *scene, struct Brush *brush);
|
||||
float BKE_brush_weight_get(const Scene *scene, struct Brush *brush);
|
||||
void BKE_brush_weight_set(const Scene *scene, struct Brush *brush, float value);
|
||||
|
||||
int brush_use_locked_size(const struct Scene *scene, struct Brush *brush);
|
||||
int brush_use_alpha_pressure(const struct Scene *scene, struct Brush *brush);
|
||||
int brush_use_size_pressure(const struct Scene *scene, struct Brush *brush);
|
||||
int BKE_brush_use_locked_size(const struct Scene *scene, struct Brush *brush);
|
||||
int BKE_brush_use_alpha_pressure(const struct Scene *scene, struct Brush *brush);
|
||||
int BKE_brush_use_size_pressure(const struct Scene *scene, struct Brush *brush);
|
||||
|
||||
/* scale unprojected radius to reflect a change in the brush's 2D size */
|
||||
void brush_scale_unprojected_radius(float *unprojected_radius,
|
||||
void BKE_brush_scale_unprojected_radius(float *unprojected_radius,
|
||||
int new_brush_size,
|
||||
int old_brush_size);
|
||||
|
||||
/* scale brush size to reflect a change in the brush's unprojected radius */
|
||||
void brush_scale_size(int *brush_size,
|
||||
void BKE_brush_scale_size(int *BKE_brush_size_get,
|
||||
float new_unprojected_radius,
|
||||
float old_unprojected_radius);
|
||||
|
||||
/* debugging only */
|
||||
void brush_debug_print_state(struct Brush *br);
|
||||
void BKE_brush_debug_print_state(struct Brush *br);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -48,18 +48,18 @@ struct View3D;
|
||||
|
||||
/* Camera Datablock */
|
||||
|
||||
void *add_camera(const char *name);
|
||||
struct Camera *copy_camera(struct Camera *cam);
|
||||
void make_local_camera(struct Camera *cam);
|
||||
void free_camera(struct Camera *ca);
|
||||
void *BKE_camera_add(const char *name);
|
||||
struct Camera *BKE_camera_copy(struct Camera *cam);
|
||||
void BKE_camera_make_local(struct Camera *cam);
|
||||
void BKE_camera_free(struct Camera *ca);
|
||||
|
||||
/* Camera Usage */
|
||||
|
||||
float object_camera_dof_distance(struct Object *ob);
|
||||
void object_camera_mode(struct RenderData *rd, struct Object *ob);
|
||||
float BKE_camera_object_dof_distance(struct Object *ob);
|
||||
void BKE_camera_object_mode(struct RenderData *rd, struct Object *ob);
|
||||
|
||||
int camera_sensor_fit(int sensor_fit, float sizex, float sizey);
|
||||
float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y);
|
||||
int BKE_camera_sensor_fit(int sensor_fit, float sizex, float sizey);
|
||||
float BKE_camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y);
|
||||
|
||||
/* Camera Parameters:
|
||||
*
|
||||
@ -102,21 +102,21 @@ typedef struct CameraParams {
|
||||
float winmat[4][4];
|
||||
} CameraParams;
|
||||
|
||||
void camera_params_init(CameraParams *params);
|
||||
void camera_params_from_object(CameraParams *params, struct Object *camera);
|
||||
void camera_params_from_view3d(CameraParams *params, struct View3D *v3d, struct RegionView3D *rv3d);
|
||||
void BKE_camera_params_init(CameraParams *params);
|
||||
void BKE_camera_params_from_object(CameraParams *params, struct Object *camera);
|
||||
void BKE_camera_params_from_view3d(CameraParams *params, struct View3D *v3d, struct RegionView3D *rv3d);
|
||||
|
||||
void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy);
|
||||
void camera_params_compute_matrix(CameraParams *params);
|
||||
void BKE_camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy);
|
||||
void BKE_camera_params_compute_matrix(CameraParams *params);
|
||||
|
||||
/* Camera View Frame */
|
||||
|
||||
void camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const short do_clip, const float scale[3],
|
||||
void BKE_camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const short do_clip, const float scale[3],
|
||||
float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]);
|
||||
|
||||
void camera_view_frame(struct Scene *scene, struct Camera *camera, float r_vec[4][3]);
|
||||
void BKE_camera_view_frame(struct Scene *scene, struct Camera *camera, float r_vec[4][3]);
|
||||
|
||||
int camera_view_frame_fit_to_scene(
|
||||
int BKE_camera_view_frame_fit_to_scene(
|
||||
struct Scene *scene, struct View3D *v3d, struct Object *camera_ob,
|
||||
float r_co[3]);
|
||||
|
||||
|
@ -62,7 +62,7 @@ typedef struct bConstraintOb {
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
|
||||
/* Callback format for performing operations on ID-pointers for Constraints */
|
||||
typedef void (*ConstraintIDFunc)(struct bConstraint *con, struct ID **idpoin, void *userdata);
|
||||
typedef void (*ConstraintIDFunc)(struct bConstraint *con, struct ID **idpoin, short isReference, void *userdata);
|
||||
|
||||
/* ....... */
|
||||
|
||||
@ -87,8 +87,6 @@ typedef struct bConstraintTypeInfo {
|
||||
/* data management function pointers - special handling */
|
||||
/* free any data that is allocated separately (optional) */
|
||||
void (*free_data)(struct bConstraint *con);
|
||||
/* adjust pointer to other ID-data using ID_NEW(), but not to targets (optional) */
|
||||
void (*relink_data)(struct bConstraint *con);
|
||||
/* run the provided callback function on all the ID-blocks linked to the constraint */
|
||||
void (*id_looper)(struct bConstraint *con, ConstraintIDFunc func, void *userdata);
|
||||
/* copy any special data that is allocated separately (optional) */
|
||||
|
@ -63,7 +63,7 @@ void BKE_curve_make_local(struct Curve *cu);
|
||||
short BKE_curve_type_get(struct Curve *cu);
|
||||
void BKE_curve_type_test(struct Object *ob);
|
||||
void BKE_curve_curve_dimension_update(struct Curve *cu);
|
||||
void BKE_curve_tex_space_calc(struct Curve *cu);
|
||||
void BKE_curve_texspace_calc(struct Curve *cu);
|
||||
|
||||
int BKE_curve_minmax(struct Curve *cu, float min[3], float max[3]);
|
||||
int BKE_curve_center_median(struct Curve *cu, float cent[3]);
|
||||
|
@ -78,29 +78,28 @@ typedef struct DispList {
|
||||
unsigned int *bevelSplitFlag;
|
||||
} DispList;
|
||||
|
||||
extern void copy_displist(struct ListBase *lbn, struct ListBase *lb);
|
||||
extern void free_disp_elem(DispList *dl);
|
||||
extern DispList *find_displist_create(struct ListBase *lb, int type);
|
||||
extern DispList *find_displist(struct ListBase *lb, int type);
|
||||
extern void addnormalsDispList(struct ListBase *lb);
|
||||
extern void count_displist(struct ListBase *lb, int *totvert, int *totface);
|
||||
extern void freedisplist(struct ListBase *lb);
|
||||
extern int displist_has_faces(struct ListBase *lb);
|
||||
void BKE_displist_copy(struct ListBase *lbn, struct ListBase *lb);
|
||||
void BKE_displist_elem_free(DispList *dl);
|
||||
DispList *BKE_displist_find_or_create(struct ListBase *lb, int type);
|
||||
DispList *BKE_displist_find(struct ListBase *lb, int type);
|
||||
void BKE_displist_normals_add(struct ListBase *lb);
|
||||
void BKE_displist_count(struct ListBase *lb, int *totvert, int *totface);
|
||||
void BKE_displist_free(struct ListBase *lb);
|
||||
int BKE_displist_has_faces(struct ListBase *lb);
|
||||
|
||||
extern void makeDispListSurf(struct Scene *scene, struct Object *ob, struct ListBase *dispbase, struct DerivedMesh **derivedFinal, int forRender, int forOrco);
|
||||
extern void makeDispListCurveTypes(struct Scene *scene, struct Object *ob, int forOrco);
|
||||
extern void makeDispListCurveTypes_forRender(struct Scene *scene, struct Object *ob, struct ListBase *dispbase, struct DerivedMesh **derivedFinal, int forOrco);
|
||||
extern void makeDispListCurveTypes_forOrco(struct Scene *scene, struct Object *ob, struct ListBase *dispbase);
|
||||
extern void makeDispListMBall(struct Scene *scene, struct Object *ob);
|
||||
extern void makeDispListMBall_forRender(struct Scene *scene, struct Object *ob, struct ListBase *dispbase);
|
||||
void BKE_displist_make_surf(struct Scene *scene, struct Object *ob, struct ListBase *dispbase, struct DerivedMesh **derivedFinal, int forRender, int forOrco);
|
||||
void BKE_displist_make_curveTypes(struct Scene *scene, struct Object *ob, int forOrco);
|
||||
void BKE_displist_make_curveTypes_forRender(struct Scene *scene, struct Object *ob, struct ListBase *dispbase, struct DerivedMesh **derivedFinal, int forOrco);
|
||||
void BKE_displist_make_curveTypes_forOrco(struct Scene *scene, struct Object *ob, struct ListBase *dispbase);
|
||||
void BKE_displist_make_mball(struct Scene *scene, struct Object *ob);
|
||||
void BKE_displist_make_mball_forRender(struct Scene *scene, struct Object *ob, struct ListBase *dispbase);
|
||||
|
||||
int surfindex_displist(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4);
|
||||
void filldisplist(struct ListBase *dispbase, struct ListBase *to, int flipnormal);
|
||||
int BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4);
|
||||
void BKE_displist_fill(struct ListBase *dispbase, struct ListBase *to, int flipnormal);
|
||||
|
||||
float calc_taper(struct Scene *scene, struct Object *taperobj, int cur, int tot);
|
||||
float BKE_displist_calc_taper(struct Scene *scene, struct Object *taperobj, int cur, int tot);
|
||||
|
||||
/* add Orco layer to the displist object which has got derived mesh and return orco */
|
||||
float *makeOrcoDispList(struct Scene *scene, struct Object *ob, struct DerivedMesh *derivedFinal, int forRender);
|
||||
float *BKE_displist_make_orco(struct Scene *scene, struct Object *ob, struct DerivedMesh *derivedFinal, int forRender);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -71,17 +71,17 @@ typedef struct EditFont {
|
||||
} EditFont;
|
||||
|
||||
|
||||
void BKE_font_register_builtin(void *mem, int size);
|
||||
void BKE_vfont_builtin_register(void *mem, int size);
|
||||
|
||||
void free_vfont(struct VFont *sc);
|
||||
void free_ttfont(void);
|
||||
struct VFont *get_builtin_font(void);
|
||||
struct VFont *load_vfont(struct Main *bmain, const char *name);
|
||||
struct TmpFont *vfont_find_tmpfont(struct VFont *vfont);
|
||||
void BKE_vfont_free(struct VFont *sc);
|
||||
void BKE_vfont_free_global_ttf(void);
|
||||
struct VFont *BKE_vfont_builtin_get(void);
|
||||
struct VFont *BKE_vfont_load(struct Main *bmain, const char *name);
|
||||
struct TmpFont *BKE_vfont_find_tmpfont(struct VFont *vfont);
|
||||
|
||||
struct chartrans *BKE_text_to_curve(struct Main *bmain, struct Scene *scene, struct Object *ob, int mode);
|
||||
struct chartrans *BKE_vfont_to_curve(struct Main *bmain, struct Scene *scene, struct Object *ob, int mode);
|
||||
|
||||
int BKE_font_getselection(struct Object *ob, int *start, int *end);
|
||||
int BKE_vfont_select_get(struct Object *ob, int *start, int *end);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ struct bGPDframe;
|
||||
void free_gpencil_strokes(struct bGPDframe *gpf);
|
||||
void free_gpencil_frames(struct bGPDlayer *gpl);
|
||||
void free_gpencil_layers(struct ListBase *list);
|
||||
void free_gpencil_data(struct bGPdata *gpd);
|
||||
void BKE_gpencil_free(struct bGPdata *gpd);
|
||||
|
||||
struct bGPDframe *gpencil_frame_addnew(struct bGPDlayer *gpl, int cframe);
|
||||
struct bGPDlayer *gpencil_layer_addnew(struct bGPdata *gpd);
|
||||
|
@ -40,10 +40,10 @@ struct Object;
|
||||
struct bAction;
|
||||
struct Scene;
|
||||
|
||||
void free_group_objects(struct Group *group);
|
||||
void unlink_group(struct Group *group);
|
||||
void BKE_group_free(struct Group *group);
|
||||
void BKE_group_unlink(struct Group *group);
|
||||
struct Group *add_group(const char *name);
|
||||
struct Group *copy_group(struct Group *group);
|
||||
struct Group *BKE_group_copy(struct Group *group);
|
||||
int add_to_group(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base);
|
||||
int rem_from_group(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base);
|
||||
struct Group *find_group(struct Object *ob, struct Group *group);
|
||||
|
@ -46,14 +46,14 @@ struct Object;
|
||||
struct ImageFormatData;
|
||||
|
||||
/* call from library */
|
||||
void free_image(struct Image *me);
|
||||
void BKE_image_free(struct Image *me);
|
||||
|
||||
void BKE_stamp_info(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf);
|
||||
void BKE_imbuf_stamp_info(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf);
|
||||
void BKE_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels);
|
||||
int BKE_alphatest_ibuf(struct ImBuf *ibuf);
|
||||
int BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
|
||||
int BKE_write_ibuf(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
|
||||
int BKE_write_ibuf_as(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf, const short is_copy);
|
||||
int BKE_imbuf_alpha_test(struct ImBuf *ibuf);
|
||||
int BKE_imbuf_write_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
|
||||
int BKE_imbuf_write(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
|
||||
int BKE_imbuf_write_as(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf, const short is_copy);
|
||||
void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, const char imtype, const short use_ext, const short use_frames);
|
||||
int BKE_add_image_extension(char *string, const char imtype);
|
||||
char BKE_ftype_to_imtype(const int ftype);
|
||||
@ -72,11 +72,11 @@ void BKE_imformat_defaults(struct ImageFormatData *im_format);
|
||||
|
||||
struct anim *openanim(const char *name, int flags, int streamindex);
|
||||
|
||||
void image_de_interlace(struct Image *ima, int odd);
|
||||
void BKE_image_de_interlace(struct Image *ima, int odd);
|
||||
|
||||
void make_local_image(struct Image *ima);
|
||||
void BKE_image_make_local(struct Image *ima);
|
||||
|
||||
void tag_image_time(struct Image *ima);
|
||||
void BKE_image_tag_time(struct Image *ima);
|
||||
void free_old_images(void);
|
||||
|
||||
/* ********************************** NEW IMAGE API *********************** */
|
||||
@ -130,13 +130,15 @@ struct ImBuf *BKE_image_get_ibuf(struct Image *ima, struct ImageUser *iuser);
|
||||
struct ImBuf *BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **lock_r);
|
||||
void BKE_image_release_ibuf(struct Image *ima, void *lock);
|
||||
|
||||
/* returns a new image or NULL if it can't load */
|
||||
struct Image *BKE_image_load(const char *filepath);
|
||||
/* returns existing Image when filename/type is same (frame optional) */
|
||||
struct Image *BKE_add_image_file(const char *name);
|
||||
struct Image *BKE_image_load_exists(const char *filepath);
|
||||
|
||||
/* adds image, adds ibuf, generates color or pattern */
|
||||
struct Image *BKE_add_image_size(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short uvtestgrid, float color[4]);
|
||||
struct Image *BKE_image_add_generated(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short uvtestgrid, float color[4]);
|
||||
/* adds image from imbuf, owns imbuf */
|
||||
struct Image *BKE_add_image_imbuf(struct ImBuf *ibuf);
|
||||
struct Image *BKE_image_add_from_imbuf(struct ImBuf *ibuf);
|
||||
|
||||
/* for reload, refresh, pack */
|
||||
void BKE_image_signal(struct Image *ima, struct ImageUser *iuser, int signal);
|
||||
@ -148,8 +150,8 @@ struct Image *BKE_image_verify_viewer(int type, const char *name);
|
||||
void BKE_image_assign_ibuf(struct Image *ima, struct ImBuf *ibuf);
|
||||
|
||||
/* called on frame change or before render */
|
||||
void BKE_image_user_calc_frame(struct ImageUser *iuser, int cfra, int fieldnr);
|
||||
int BKE_image_user_get_frame(const struct ImageUser *iuser, int cfra, int fieldnr);
|
||||
void BKE_image_user_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr);
|
||||
int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, int fieldnr);
|
||||
|
||||
/* sets index offset for multilayer files */
|
||||
struct RenderPass *BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser);
|
||||
@ -176,7 +178,7 @@ void BKE_image_memorypack(struct Image *ima);
|
||||
void BKE_image_print_memlist(void);
|
||||
|
||||
/* empty image block, of similar type and filename */
|
||||
struct Image *copy_image(struct Image *ima);
|
||||
struct Image *BKE_image_copy(struct Image *ima);
|
||||
|
||||
/* merge source into dest, and free source */
|
||||
void BKE_image_merge(struct Image *dest, struct Image *source);
|
||||
|
@ -45,7 +45,7 @@ void do_versions_ipos_to_animato(struct Main *main);
|
||||
|
||||
/* --------------------- xxx stuff ------------------------ */
|
||||
|
||||
void free_ipo(struct Ipo *ipo);
|
||||
void BKE_ipo_free(struct Ipo *ipo);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
@ -47,12 +47,12 @@ struct Mesh;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void free_key(struct Key *sc);
|
||||
void BKE_key_free(struct Key *sc);
|
||||
void free_key_nolib(struct Key *key);
|
||||
struct Key *add_key(struct ID *id);
|
||||
struct Key *copy_key(struct Key *key);
|
||||
struct Key *BKE_key_copy(struct Key *key);
|
||||
struct Key *copy_key_nolib(struct Key *key);
|
||||
void make_local_key(struct Key *key);
|
||||
void BKE_key_make_local(struct Key *key);
|
||||
void sort_keys(struct Key *key);
|
||||
|
||||
void key_curve_position_weights(float t, float *data, int type);
|
||||
|
@ -38,11 +38,11 @@ extern "C" {
|
||||
|
||||
struct Lamp;
|
||||
|
||||
void *add_lamp(const char *name);
|
||||
struct Lamp *copy_lamp(struct Lamp *la);
|
||||
void *BKE_lamp_add(const char *name);
|
||||
struct Lamp *BKE_lamp_copy(struct Lamp *la);
|
||||
struct Lamp *localize_lamp(struct Lamp *la);
|
||||
void make_local_lamp(struct Lamp *la);
|
||||
void free_lamp(struct Lamp *la);
|
||||
void BKE_lamp_make_local(struct Lamp *la);
|
||||
void BKE_lamp_free(struct Lamp *la);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -41,11 +41,11 @@ struct DerivedMesh;
|
||||
struct BPoint;
|
||||
struct MDeformVert;
|
||||
|
||||
void resizelattice(struct Lattice *lt, int u, int v, int w, struct Object *ltOb);
|
||||
struct Lattice *add_lattice(const char *name);
|
||||
struct Lattice *copy_lattice(struct Lattice *lt);
|
||||
void free_lattice(struct Lattice *lt);
|
||||
void make_local_lattice(struct Lattice *lt);
|
||||
void BKE_lattice_resize(struct Lattice *lt, int u, int v, int w, struct Object *ltOb);
|
||||
struct Lattice *BKE_lattice_add(const char *name);
|
||||
struct Lattice *BKE_lattice_copy(struct Lattice *lt);
|
||||
void BKE_lattice_free(struct Lattice *lt);
|
||||
void BKE_lattice_make_local(struct Lattice *lt);
|
||||
void calc_lat_fudu(int flag, int res, float *fu, float *du);
|
||||
|
||||
void init_latt_deform(struct Object *oblatt, struct Object *ob);
|
||||
@ -69,11 +69,11 @@ void armature_deform_verts(struct Object *armOb, struct Object *target,
|
||||
float (*defMats)[3][3], int numVerts, int deformflag,
|
||||
float (*prevCos)[3], const char *defgrp_name);
|
||||
|
||||
float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3];
|
||||
void lattice_applyVertexCos(struct Object *ob, float (*vertexCos)[3]);
|
||||
void lattice_calc_modifiers(struct Scene *scene, struct Object *ob);
|
||||
float (*BKE_lattice_vertexcos_get(struct Object *ob, int *numVerts_r))[3];
|
||||
void BKE_lattice_vertexcos_apply(struct Object *ob, float (*vertexCos)[3]);
|
||||
void BKE_lattice_modifiers_calc(struct Scene *scene, struct Object *ob);
|
||||
|
||||
struct MDeformVert* lattice_get_deform_verts(struct Object *lattice);
|
||||
struct MDeformVert* BKE_lattice_deform_verts_get(struct Object *lattice);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -45,15 +45,16 @@ struct bContext;
|
||||
struct PointerRNA;
|
||||
struct PropertyRNA;
|
||||
|
||||
void *alloc_libblock(struct ListBase *lb, short type, const char *name);
|
||||
void *copy_libblock(struct ID *id);
|
||||
void copy_libblock_data(struct ID *id, const struct ID *id_from, const short do_action);
|
||||
void *BKE_libblock_alloc(struct ListBase *lb, short type, const char *name);
|
||||
void *BKE_libblock_copy(struct ID *id);
|
||||
void BKE_libblock_copy_data(struct ID *id, const struct ID *id_from, const short do_action);
|
||||
|
||||
void BKE_id_lib_local_paths(struct Main *bmain, struct Library *lib, struct ID *id);
|
||||
void id_lib_extern(struct ID *id);
|
||||
void BKE_library_filepath_set(struct Library *lib, const char *filepath);
|
||||
void id_us_plus(struct ID *id);
|
||||
void id_us_min(struct ID *id);
|
||||
|
||||
int id_make_local(struct ID *id, int test);
|
||||
int id_single_user(struct bContext *C, struct ID *id, struct PointerRNA *ptr, struct PropertyRNA *prop);
|
||||
int id_copy(struct ID *id, struct ID **newid, int test);
|
||||
@ -68,8 +69,8 @@ struct ListBase *which_libbase(struct Main *mainlib, short type);
|
||||
#define MAX_LIBARRAY 41
|
||||
int set_listbasepointers(struct Main *main, struct ListBase **lb);
|
||||
|
||||
void free_libblock(struct ListBase *lb, void *idv);
|
||||
void free_libblock_us(struct ListBase *lb, void *idv);
|
||||
void BKE_libblock_free(struct ListBase *lb, void *idv);
|
||||
void BKE_libblock_free_us(struct ListBase *lb, void *idv);
|
||||
void free_main(struct Main *mainvar);
|
||||
|
||||
void tag_main_idcode(struct Main *mainvar, const short type, const short tag);
|
||||
@ -81,7 +82,7 @@ void name_uiprefix_id(char *name, struct ID *id);
|
||||
void test_idbutton(char *name);
|
||||
void text_idbutton(struct ID *id, char *text);
|
||||
void BKE_library_make_local(struct Main *bmain, struct Library *lib, int untagged_only);
|
||||
struct ID *find_id(const char *type, const char *name);
|
||||
struct ID *BKE_libblock_find_name(const short type, const char *name);
|
||||
void clear_id_newpoins(void);
|
||||
|
||||
void IDnames_to_pupstring(const char **str, const char *title, const char *extraops,
|
||||
|
@ -46,15 +46,15 @@ struct MTFace;
|
||||
/* materials */
|
||||
|
||||
void init_def_material(void);
|
||||
void free_material(struct Material *sc);
|
||||
void BKE_material_free(struct Material *sc);
|
||||
void test_object_materials(struct ID *id);
|
||||
void resize_object_material(struct Object *ob, const short totcol);
|
||||
void init_material(struct Material *ma);
|
||||
struct Material *add_material(const char *name);
|
||||
struct Material *copy_material(struct Material *ma);
|
||||
struct Material *BKE_material_add(const char *name);
|
||||
struct Material *BKE_material_copy(struct Material *ma);
|
||||
struct Material *localize_material(struct Material *ma);
|
||||
struct Material *give_node_material(struct Material *ma); /* returns node material or self */
|
||||
void make_local_material(struct Material *ma);
|
||||
void BKE_material_make_local(struct Material *ma);
|
||||
void extern_local_matarar(struct Material **matar, short totcol);
|
||||
|
||||
void automatname(struct Material *);
|
||||
|
@ -37,30 +37,30 @@ struct Object;
|
||||
struct Scene;
|
||||
struct MetaElem;
|
||||
|
||||
void BKE_metaball_unlink(struct MetaBall *mb);
|
||||
void BKE_metaball_free(struct MetaBall *mb);
|
||||
struct MetaBall *BKE_metaball_add(const char *name);
|
||||
struct MetaBall *BKE_metaball_copy(struct MetaBall *mb);
|
||||
void BKE_mball_unlink(struct MetaBall *mb);
|
||||
void BKE_mball_free(struct MetaBall *mb);
|
||||
struct MetaBall *BKE_mball_add(const char *name);
|
||||
struct MetaBall *BKE_mball_copy(struct MetaBall *mb);
|
||||
|
||||
void BKE_metaball_make_local(struct MetaBall *mb);
|
||||
void BKE_mball_make_local(struct MetaBall *mb);
|
||||
|
||||
void BKE_metaball_cubeTable_free(void);
|
||||
void BKE_mball_cubeTable_free(void);
|
||||
|
||||
void BKE_metaball_polygonize(struct Scene *scene, struct Object *ob, struct ListBase *dispbase);
|
||||
int BKE_metaball_is_basis_for(struct Object *ob1, struct Object *ob2);
|
||||
int BKE_metaball_is_basis(struct Object *ob);
|
||||
struct Object *BKE_metaball_basis_find(struct Scene *scene, struct Object *ob);
|
||||
void BKE_mball_polygonize(struct Scene *scene, struct Object *ob, struct ListBase *dispbase);
|
||||
int BKE_mball_is_basis_for(struct Object *ob1, struct Object *ob2);
|
||||
int BKE_mball_is_basis(struct Object *ob);
|
||||
struct Object *BKE_mball_basis_find(struct Scene *scene, struct Object *ob);
|
||||
|
||||
void BKE_metaball_tex_space_calc(struct Object *ob);
|
||||
float *BKE_metaball_make_orco(struct Object *ob, struct ListBase *dispbase);
|
||||
void BKE_mball_texspace_calc(struct Object *ob);
|
||||
float *BKE_mball_make_orco(struct Object *ob, struct ListBase *dispbase);
|
||||
|
||||
void BKE_metaball_properties_copy(struct Scene *scene, struct Object *active_object);
|
||||
void BKE_mball_properties_copy(struct Scene *scene, struct Object *active_object);
|
||||
|
||||
int BKE_metaball_minmax(struct MetaBall *mb, float min[3], float max[3]);
|
||||
int BKE_metaball_center_median(struct MetaBall *mb, float cent[3]);
|
||||
int BKE_metaball_center_bounds(struct MetaBall *mb, float cent[3]);
|
||||
void BKE_metaball_translate(struct MetaBall *mb, float offset[3]);
|
||||
int BKE_mball_minmax(struct MetaBall *mb, float min[3], float max[3]);
|
||||
int BKE_mball_center_median(struct MetaBall *mb, float cent[3]);
|
||||
int BKE_mball_center_bounds(struct MetaBall *mb, float cent[3]);
|
||||
void BKE_mball_translate(struct MetaBall *mb, float offset[3]);
|
||||
|
||||
struct MetaElem *BKE_metaball_element_add(struct MetaBall *mb, const int type);
|
||||
struct MetaElem *BKE_mball_element_add(struct MetaBall *mb, const int type);
|
||||
|
||||
#endif
|
||||
|
@ -76,109 +76,109 @@ struct BMesh *BKE_mesh_to_bmesh(struct Mesh *me, struct Object *ob);
|
||||
* if both of the above are 0, it'll use the indices of the mpolys of the MPoly
|
||||
* data in pdata, and ignore the origindex layer altogether.
|
||||
*/
|
||||
int mesh_recalcTessellation(struct CustomData *fdata, struct CustomData *ldata, struct CustomData *pdata,
|
||||
struct MVert *mvert,
|
||||
int totface, int totloop, int totpoly,
|
||||
const int do_face_normals);
|
||||
int BKE_mesh_recalc_tessellation(struct CustomData *fdata, struct CustomData *ldata, struct CustomData *pdata,
|
||||
struct MVert *mvert,
|
||||
int totface, int totloop, int totpoly,
|
||||
const int do_face_normals);
|
||||
|
||||
/* for forwards compat only quad->tri polys to mface, skip ngons.
|
||||
*/
|
||||
int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
|
||||
struct CustomData *pdata, int totface, int totloop, int totpoly);
|
||||
int BKE_mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
|
||||
struct CustomData *pdata, int totface, int totloop, int totpoly);
|
||||
|
||||
/*calculates a face normal.*/
|
||||
void mesh_calc_poly_normal(struct MPoly *mpoly, struct MLoop *loopstart,
|
||||
struct MVert *mvarray, float no[3]);
|
||||
|
||||
void mesh_calc_poly_normal_coords(struct MPoly *mpoly, struct MLoop *loopstart,
|
||||
const float (*vertex_coords)[3], float no[3]);
|
||||
void BKE_mesh_calc_poly_normal_coords(struct MPoly *mpoly, struct MLoop *loopstart,
|
||||
const float (*vertex_coords)[3], float no[3]);
|
||||
|
||||
void mesh_calc_poly_center(struct MPoly *mpoly, struct MLoop *loopstart,
|
||||
struct MVert *mvarray, float cent[3]);
|
||||
void BKE_mesh_calc_poly_center(struct MPoly *mpoly, struct MLoop *loopstart,
|
||||
struct MVert *mvarray, float cent[3]);
|
||||
|
||||
float mesh_calc_poly_area(struct MPoly *mpoly, struct MLoop *loopstart,
|
||||
struct MVert *mvarray, float polynormal[3]);
|
||||
float BKE_mesh_calc_poly_area(struct MPoly *mpoly, struct MLoop *loopstart,
|
||||
struct MVert *mvarray, float polynormal[3]);
|
||||
|
||||
/* Find the index of the loop in 'poly' which references vertex,
|
||||
* returns -1 if not found */
|
||||
int poly_find_loop_from_vert(const struct MPoly *poly,
|
||||
const struct MLoop *loopstart,
|
||||
unsigned vert);
|
||||
const struct MLoop *loopstart,
|
||||
unsigned vert);
|
||||
|
||||
/* Fill 'adj_r' with the loop indices in 'poly' adjacent to the
|
||||
* vertex. Returns the index of the loop matching vertex, or -1 if the
|
||||
* vertex is not in 'poly' */
|
||||
int poly_get_adj_loops_from_vert(unsigned adj_r[3], const struct MPoly *poly,
|
||||
const struct MLoop *mloop, unsigned vert);
|
||||
const struct MLoop *mloop, unsigned vert);
|
||||
|
||||
/* update the hide flag for edges and polys from the corresponding
|
||||
* flag in verts */
|
||||
void mesh_flush_hidden_from_verts(const struct MVert *mvert,
|
||||
const struct MLoop *mloop,
|
||||
struct MEdge *medge, int totedge,
|
||||
struct MPoly *mpoly, int totpoly);
|
||||
void BKE_mesh_flush_hidden_from_verts(const struct MVert *mvert,
|
||||
const struct MLoop *mloop,
|
||||
struct MEdge *medge, int totedge,
|
||||
struct MPoly *mpoly, int totpoly);
|
||||
|
||||
void unlink_mesh(struct Mesh *me);
|
||||
void free_mesh(struct Mesh *me, int unlink);
|
||||
struct Mesh *add_mesh(const char *name);
|
||||
struct Mesh *copy_mesh(struct Mesh *me);
|
||||
void BKE_mesh_unlink(struct Mesh *me);
|
||||
void BKE_mesh_free(struct Mesh *me, int unlink);
|
||||
struct Mesh *BKE_mesh_add(const char *name);
|
||||
struct Mesh *BKE_mesh_copy(struct Mesh *me);
|
||||
void mesh_update_customdata_pointers(struct Mesh *me, const short do_ensure_tess_cd);
|
||||
|
||||
void make_local_mesh(struct Mesh *me);
|
||||
void boundbox_mesh(struct Mesh *me, float *loc, float *size);
|
||||
void tex_space_mesh(struct Mesh *me);
|
||||
float *get_mesh_orco_verts(struct Object *ob);
|
||||
void transform_mesh_orco_verts(struct Mesh *me, float (*orco)[3], int totvert, int invert);
|
||||
void BKE_mesh_make_local(struct Mesh *me);
|
||||
void BKE_mesh_boundbox_calc(struct Mesh *me, float *loc, float *size);
|
||||
void BKE_mesh_texspace_calc(struct Mesh *me);
|
||||
float *BKE_mesh_orco_verts_get(struct Object *ob);
|
||||
void BKE_mesh_orco_verts_transform(struct Mesh *me, float (*orco)[3], int totvert, int invert);
|
||||
int test_index_face(struct MFace *mface, struct CustomData *mfdata, int mfindex, int nr);
|
||||
struct Mesh *get_mesh(struct Object *ob);
|
||||
struct Mesh *BKE_mesh_from_object(struct Object *ob);
|
||||
void set_mesh(struct Object *ob, struct Mesh *me);
|
||||
void mball_to_mesh(struct ListBase *lb, struct Mesh *me);
|
||||
int nurbs_to_mdata(struct Object *ob, struct MVert **allvert, int *totvert,
|
||||
struct MEdge **alledge, int *totedge, struct MLoop **allloop, struct MPoly **allpoly,
|
||||
int *totloop, int *totpoly);
|
||||
int nurbs_to_mdata_customdb(struct Object *ob, struct ListBase *dispbase, struct MVert **allvert, int *_totvert,
|
||||
struct MEdge **alledge, int *_totedge, struct MLoop **allloop, struct MPoly **allpoly,
|
||||
int *_totloop, int *_totpoly);
|
||||
void nurbs_to_mesh(struct Object *ob);
|
||||
void mesh_to_curve(struct Scene *scene, struct Object *ob);
|
||||
void BKE_mesh_from_metaball(struct ListBase *lb, struct Mesh *me);
|
||||
int BKE_mesh_nurbs_to_mdata(struct Object *ob, struct MVert **allvert, int *totvert,
|
||||
struct MEdge **alledge, int *totedge, struct MLoop **allloop, struct MPoly **allpoly,
|
||||
int *totloop, int *totpoly);
|
||||
int BKE_mesh_nurbs_to_mdata_customdb(struct Object *ob, struct ListBase *dispbase, struct MVert **allvert, int *_totvert,
|
||||
struct MEdge **alledge, int *_totedge, struct MLoop **allloop, struct MPoly **allpoly,
|
||||
int *_totloop, int *_totpoly);
|
||||
void BKE_mesh_from_nurbs(struct Object *ob);
|
||||
void BKE_mesh_from_curve(struct Scene *scene, struct Object *ob);
|
||||
void free_dverts(struct MDeformVert *dvert, int totvert);
|
||||
void copy_dverts(struct MDeformVert *dst, struct MDeformVert *src, int totvert); /* __NLA */
|
||||
void mesh_delete_material_index(struct Mesh *me, short index);
|
||||
void mesh_set_smooth_flag(struct Object *meshOb, int enableSmooth);
|
||||
void BKE_mesh_delete_material_index(struct Mesh *me, short index);
|
||||
void BKE_mesh_smooth_flag_set(struct Object *meshOb, int enableSmooth);
|
||||
void BKE_mesh_convert_mfaces_to_mpolys(struct Mesh *mesh);
|
||||
void mesh_calc_normals_tessface(struct MVert *mverts, int numVerts, struct MFace *mfaces, int numFaces, float (*faceNors_r)[3]);
|
||||
void BKE_mesh_calc_normals_tessface(struct MVert *mverts, int numVerts, struct MFace *mfaces, int numFaces, float (*faceNors_r)[3]);
|
||||
|
||||
/* used for unit testing; compares two meshes, checking only
|
||||
* differences we care about. should be usable with leaf's
|
||||
* testing framework I get RNA work done, will use hackish
|
||||
* testing code for now.*/
|
||||
const char *mesh_cmp(struct Mesh *me1, struct Mesh *me2, float thresh);
|
||||
const char *BKE_mesh_cmp(struct Mesh *me1, struct Mesh *me2, float thresh);
|
||||
|
||||
struct BoundBox *mesh_get_bb(struct Object *ob);
|
||||
void mesh_get_texspace(struct Mesh *me, float r_loc[3], float r_rot[3], float r_size[3]);
|
||||
struct BoundBox *BKE_mesh_boundbox_get(struct Object *ob);
|
||||
void BKE_mesh_texspace_get(struct Mesh *me, float r_loc[3], float r_rot[3], float r_size[3]);
|
||||
|
||||
/* if old, it converts mface->edcode to edge drawflags */
|
||||
void make_edges(struct Mesh *me, int old);
|
||||
void BKE_mesh_make_edges(struct Mesh *me, int old);
|
||||
|
||||
void mesh_strip_loose_faces(struct Mesh *me); /* Needed for compatibility (some old read code). */
|
||||
void mesh_strip_loose_polysloops(struct Mesh *me);
|
||||
void mesh_strip_loose_edges(struct Mesh *me);
|
||||
void BKE_mesh_strip_loose_faces(struct Mesh *me); /* Needed for compatibility (some old read code). */
|
||||
void BKE_mesh_strip_loose_polysloops(struct Mesh *me);
|
||||
void BKE_mesh_strip_loose_edges(struct Mesh *me);
|
||||
|
||||
/* Calculate vertex and face normals, face normals are returned in *faceNors_r if non-NULL
|
||||
* and vertex normals are stored in actual mverts.
|
||||
*/
|
||||
void mesh_calc_normals_mapping(
|
||||
void BKE_mesh_calc_normals_mapping(
|
||||
struct MVert *mverts, int numVerts,
|
||||
struct MLoop *mloop, struct MPoly *mpolys, int numLoops, int numPolys, float (*polyNors_r)[3],
|
||||
struct MFace *mfaces, int numFaces, int *origIndexFace, float (*faceNors_r)[3]);
|
||||
/* extended version of 'mesh_calc_normals' with option not to calc vertex normals */
|
||||
void mesh_calc_normals_mapping_ex(
|
||||
/* extended version of 'BKE_mesh_calc_normals' with option not to calc vertex normals */
|
||||
void BKE_mesh_calc_normals_mapping_ex(
|
||||
struct MVert *mverts, int numVerts,
|
||||
struct MLoop *mloop, struct MPoly *mpolys, int numLoops, int numPolys, float (*polyNors_r)[3],
|
||||
struct MFace *mfaces, int numFaces, int *origIndexFace, float (*faceNors_r)[3],
|
||||
const short only_face_normals);
|
||||
|
||||
void mesh_calc_normals(
|
||||
void BKE_mesh_calc_normals(
|
||||
struct MVert *mverts, int numVerts,
|
||||
struct MLoop *mloop, struct MPoly *mpolys,
|
||||
int numLoops, int numPolys, float (*polyNors_r)[3]);
|
||||
@ -246,9 +246,10 @@ typedef struct UvElementMap {
|
||||
* to make that many islands, he can bite me :p */
|
||||
#define INVALID_ISLAND 0xFFFF
|
||||
|
||||
UvVertMap *make_uv_vert_map(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, unsigned int totpoly, unsigned int totvert, int selected, float *limit);
|
||||
UvMapVert *get_uv_map_vert(UvVertMap *vmap, unsigned int v);
|
||||
void free_uv_vert_map(UvVertMap *vmap);
|
||||
UvVertMap *BKE_mesh_uv_vert_map_make(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv,
|
||||
unsigned int totpoly, unsigned int totvert, int selected, float *limit);
|
||||
UvMapVert *BKE_mesh_uv_vert_map_get_vert(UvVertMap *vmap, unsigned int v);
|
||||
void BKE_mesh_uv_vert_map_free(UvVertMap *vmap);
|
||||
|
||||
/* Connectivity data */
|
||||
typedef struct MeshElemMap {
|
||||
@ -270,10 +271,10 @@ void create_vert_edge_map(struct ListBase **map, IndexNode **mem, const struct M
|
||||
|
||||
/* vertex level transformations & checks (no derived mesh) */
|
||||
|
||||
int minmax_mesh(struct Mesh *me, float min[3], float max[3]);
|
||||
int mesh_center_median(struct Mesh *me, float cent[3]);
|
||||
int mesh_center_bounds(struct Mesh *me, float cent[3]);
|
||||
void mesh_translate(struct Mesh *me, float offset[3], int do_keys);
|
||||
int BKE_mesh_minmax(struct Mesh *me, float r_min[3], float r_max[3]);
|
||||
int BKE_mesh_center_median(struct Mesh *me, float cent[3]);
|
||||
int BKE_mesh_center_bounds(struct Mesh *me, float cent[3]);
|
||||
void BKE_mesh_translate(struct Mesh *me, float offset[3], int do_keys);
|
||||
|
||||
/* mesh_validate.c */
|
||||
/* XXX Loop v/e are unsigned, so using max uint_32 value as invalid marker... */
|
||||
@ -298,10 +299,10 @@ void BKE_mesh_tessface_ensure(struct Mesh *mesh);
|
||||
void BKE_mesh_tessface_clear(struct Mesh *mesh);
|
||||
|
||||
/* Convert a triangle or quadrangle of loop/poly data to tessface data */
|
||||
void mesh_loops_to_mface_corners(struct CustomData *fdata, struct CustomData *ldata,
|
||||
struct CustomData *pdata, int lindex[4], int findex,
|
||||
const int polyindex, const int mf_len,
|
||||
const int numTex, const int numCol, const int hasPCol, const int hasOrigSpace);
|
||||
void BKE_mesh_loops_to_mface_corners(struct CustomData *fdata, struct CustomData *ldata,
|
||||
struct CustomData *pdata, int lindex[4], int findex,
|
||||
const int polyindex, const int mf_len,
|
||||
const int numTex, const int numCol, const int hasPCol, const int hasOrigSpace);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -508,9 +508,10 @@ struct ShadeResult;
|
||||
#define SH_NODE_LAYER_WEIGHT 160
|
||||
#define SH_NODE_VOLUME_TRANSPARENT 161
|
||||
#define SH_NODE_VOLUME_ISOTROPIC 162
|
||||
#define SH_NODE_GAMMA 163
|
||||
#define SH_NODE_TEX_CHECKER 164
|
||||
#define SH_NODE_GAMMA 163
|
||||
#define SH_NODE_TEX_CHECKER 164
|
||||
#define SH_NODE_BRIGHTCONTRAST 165
|
||||
#define SH_NODE_LIGHT_FALLOFF 166
|
||||
|
||||
/* custom defines options for Material node */
|
||||
#define SH_NODE_MAT_DIFF 1
|
||||
|
@ -50,64 +50,66 @@ struct RenderData;
|
||||
struct rctf;
|
||||
struct MovieClip;
|
||||
|
||||
void clear_workob(struct Object *workob);
|
||||
void what_does_parent(struct Scene *scene, struct Object *ob, struct Object *workob);
|
||||
void BKE_object_workob_clear(struct Object *workob);
|
||||
void BKE_object_workob_calc_parent(struct Scene *scene, struct Object *ob, struct Object *workob);
|
||||
|
||||
void copy_baseflags(struct Scene *scene);
|
||||
void copy_objectflags(struct Scene *scene);
|
||||
struct SoftBody *copy_softbody(struct SoftBody *sb);
|
||||
struct BulletSoftBody *copy_bulletsoftbody(struct BulletSoftBody *sb);
|
||||
void copy_object_particlesystems(struct Object *obn, struct Object *ob);
|
||||
void copy_object_softbody(struct Object *obn, struct Object *ob);
|
||||
void object_free_particlesystems(struct Object *ob);
|
||||
void object_free_softbody(struct Object *ob);
|
||||
void object_free_bulletsoftbody(struct Object *ob);
|
||||
void update_base_layer(struct Scene *scene, struct Object *ob);
|
||||
void BKE_object_copy_particlesystems(struct Object *obn, struct Object *ob);
|
||||
void BKE_object_copy_softbody(struct Object *obn, struct Object *ob);
|
||||
void BKE_object_free_particlesystems(struct Object *ob);
|
||||
void BKE_object_free_softbody(struct Object *ob);
|
||||
void BKE_object_free_bulletsoftbody(struct Object *ob);
|
||||
void BKE_object_update_base_layer(struct Scene *scene, struct Object *ob);
|
||||
|
||||
void free_object(struct Object *ob);
|
||||
void object_free_display(struct Object *ob);
|
||||
void BKE_object_free(struct Object *ob);
|
||||
void BKE_object_free_display(struct Object *ob);
|
||||
|
||||
int object_support_modifier_type(struct Object *ob, int modifier_type);
|
||||
int BKE_object_support_modifier_type_check(struct Object *ob, int modifier_type);
|
||||
|
||||
void object_link_modifiers(struct Object *ob, struct Object *from);
|
||||
void object_free_modifiers(struct Object *ob);
|
||||
void BKE_object_link_modifiers(struct Object *ob, struct Object *from);
|
||||
void BKE_object_free_modifiers(struct Object *ob);
|
||||
|
||||
void object_make_proxy(struct Object *ob, struct Object *target, struct Object *gob);
|
||||
void object_copy_proxy_drivers(struct Object *ob, struct Object *target);
|
||||
void BKE_object_make_proxy(struct Object *ob, struct Object *target, struct Object *gob);
|
||||
void BKE_object_copy_proxy_drivers(struct Object *ob, struct Object *target);
|
||||
|
||||
void unlink_object(struct Object *ob);
|
||||
int exist_object(struct Object *obtest);
|
||||
void BKE_object_unlink(struct Object *ob);
|
||||
int BKE_object_exists_check(struct Object *obtest);
|
||||
|
||||
struct Object *add_only_object(int type, const char *name);
|
||||
struct Object *add_object(struct Scene *scene, int type);
|
||||
struct Object *BKE_object_add_only_object(int type, const char *name);
|
||||
struct Object *BKE_object_add(struct Scene *scene, int type);
|
||||
void *BKE_object_obdata_add_from_type(int type);
|
||||
|
||||
struct Object *copy_object(struct Object *ob);
|
||||
void make_local_object(struct Object *ob);
|
||||
int object_is_libdata(struct Object *ob);
|
||||
int object_data_is_libdata(struct Object *ob);
|
||||
struct Object *BKE_object_copy(struct Object *ob);
|
||||
void BKE_object_make_local(struct Object *ob);
|
||||
int BKE_object_is_libdata(struct Object *ob);
|
||||
int BKE_object_obdata_is_libdata(struct Object *ob);
|
||||
|
||||
void object_scale_to_mat3(struct Object *ob, float mat[][3]);
|
||||
void object_rot_to_mat3(struct Object *ob, float mat[][3]);
|
||||
void object_mat3_to_rot(struct Object *ob, float mat[][3], short use_compat);
|
||||
void object_to_mat3(struct Object *ob, float mat[][3]);
|
||||
void object_to_mat4(struct Object *ob, float mat[][4]);
|
||||
void object_apply_mat4(struct Object *ob, float mat[][4], const short use_compat, const short use_parent);
|
||||
void BKE_object_scale_to_mat3(struct Object *ob, float mat[][3]);
|
||||
void BKE_object_rot_to_mat3(struct Object *ob, float mat[][3]);
|
||||
void BKE_object_mat3_to_rot(struct Object *ob, float mat[][3], short use_compat);
|
||||
void BKE_object_to_mat3(struct Object *ob, float mat[][3]);
|
||||
void BKE_object_to_mat4(struct Object *ob, float mat[][4]);
|
||||
void BKE_object_apply_mat4(struct Object *ob, float mat[][4], const short use_compat, const short use_parent);
|
||||
|
||||
struct Object *object_pose_armature_get(struct Object *ob);
|
||||
struct Object *BKE_object_pose_armature_get(struct Object *ob);
|
||||
|
||||
void where_is_object_time(struct Scene *scene, struct Object *ob, float ctime);
|
||||
void where_is_object(struct Scene *scene, struct Object *ob);
|
||||
void where_is_object_simul(struct Scene *scene, struct Object *ob);
|
||||
void where_is_object_mat(struct Scene *scene, struct Object *ob, float obmat[4][4]);
|
||||
void BKE_object_where_is_calc(struct Scene *scene, struct Object *ob);
|
||||
void BKE_object_where_is_calc_time(struct Scene *scene, struct Object *ob, float ctime);
|
||||
void BKE_object_where_is_calc_simul(struct Scene *scene, struct Object *ob);
|
||||
void BKE_object_where_is_calc_mat4(struct Scene *scene, struct Object *ob, float obmat[4][4]);
|
||||
|
||||
struct BoundBox *unit_boundbox(void);
|
||||
void boundbox_set_from_min_max(struct BoundBox *bb, float min[3], float max[3]);
|
||||
struct BoundBox *object_get_boundbox(struct Object *ob);
|
||||
void object_get_dimensions(struct Object *ob, float vec[3]);
|
||||
void object_set_dimensions(struct Object *ob, const float *value);
|
||||
void object_boundbox_flag(struct Object *ob, int flag, int set);
|
||||
void minmax_object(struct Object *ob, float min[3], float max[3]);
|
||||
int minmax_object_duplis(struct Scene *scene, struct Object *ob, float min[3], float max[3]);
|
||||
/* possibly belong in own moduke? */
|
||||
struct BoundBox *BKE_boundbox_alloc_unit(void);
|
||||
void BKE_boundbox_init_from_minmax(struct BoundBox *bb, float min[3], float max[3]);
|
||||
int BKE_boundbox_ray_hit_check(struct BoundBox *bb, float ray_start[3], float ray_normal[3]);
|
||||
|
||||
struct BoundBox *BKE_object_boundbox_get(struct Object *ob);
|
||||
void BKE_object_dimensions_get(struct Object *ob, float vec[3]);
|
||||
void BKE_object_dimensions_set(struct Object *ob, const float *value);
|
||||
void BKE_object_boundbox_flag(struct Object *ob, int flag, int set);
|
||||
void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3]);
|
||||
int BKE_object_minmax_dupli(struct Scene *scene, struct Object *ob, float r_min[3], float r_max[3]);
|
||||
|
||||
/* sometimes min-max isn't enough, we need to loop over each point */
|
||||
void BKE_object_foreach_display_point(
|
||||
@ -121,10 +123,8 @@ void BKE_scene_foreach_display_point(
|
||||
|
||||
int BKE_object_parent_loop_check(const struct Object *parent, const struct Object *ob);
|
||||
|
||||
int ray_hit_boundbox(struct BoundBox *bb, float ray_start[3], float ray_normal[3]);
|
||||
|
||||
void *object_tfm_backup(struct Object *ob);
|
||||
void object_tfm_restore(struct Object *ob, void *obtfm_pt);
|
||||
void *BKE_object_tfm_backup(struct Object *ob);
|
||||
void BKE_object_tfm_restore(struct Object *ob, void *obtfm_pt);
|
||||
|
||||
typedef struct ObjectTfmProtectedChannels {
|
||||
float loc[3], dloc[3];
|
||||
@ -135,28 +135,28 @@ typedef struct ObjectTfmProtectedChannels {
|
||||
float rotAngle, drotAngle;
|
||||
} ObjectTfmProtectedChannels;
|
||||
|
||||
void object_tfm_protected_backup(const struct Object *ob,
|
||||
ObjectTfmProtectedChannels *obtfm);
|
||||
void BKE_object_tfm_protected_backup(const struct Object *ob,
|
||||
ObjectTfmProtectedChannels *obtfm);
|
||||
|
||||
void object_tfm_protected_restore(struct Object *ob,
|
||||
const ObjectTfmProtectedChannels *obtfm,
|
||||
const short protectflag);
|
||||
void BKE_object_tfm_protected_restore(struct Object *ob,
|
||||
const ObjectTfmProtectedChannels *obtfm,
|
||||
const short protectflag);
|
||||
|
||||
void object_handle_update(struct Scene *scene, struct Object *ob);
|
||||
void object_sculpt_modifiers_changed(struct Object *ob);
|
||||
void BKE_object_handle_update(struct Scene *scene, struct Object *ob);
|
||||
void BKE_object_sculpt_modifiers_changed(struct Object *ob);
|
||||
|
||||
int give_obdata_texspace(struct Object *ob, short **texflag, float **loc, float **size, float **rot);
|
||||
int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot);
|
||||
|
||||
int object_insert_ptcache(struct Object *ob);
|
||||
int BKE_object_insert_ptcache(struct Object *ob);
|
||||
// void object_delete_ptcache(struct Object *ob, int index);
|
||||
struct KeyBlock *object_insert_shape_key(struct Scene *scene, struct Object *ob, const char *name, int from_mix);
|
||||
struct KeyBlock *BKE_object_insert_shape_key(struct Scene *scene, struct Object *ob, const char *name, int from_mix);
|
||||
|
||||
int object_is_modified(struct Scene *scene, struct Object *ob);
|
||||
int object_is_deform_modified(struct Scene *scene, struct Object *ob);
|
||||
int BKE_object_is_modified(struct Scene *scene, struct Object *ob);
|
||||
int BKE_object_is_deform_modified(struct Scene *scene, struct Object *ob);
|
||||
|
||||
void object_relink(struct Object *ob);
|
||||
void BKE_object_relink(struct Object *ob);
|
||||
|
||||
struct MovieClip *object_get_movieclip(struct Scene *scene, struct Object *ob, int use_default);
|
||||
struct MovieClip *BKE_object_movieclip_get(struct Scene *scene, struct Object *ob, int use_default);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -103,6 +103,10 @@ typedef struct SculptSession {
|
||||
|
||||
struct SculptStroke *stroke;
|
||||
struct StrokeCache *cache;
|
||||
|
||||
/* last paint/sculpt stroke location */
|
||||
int last_stroke_valid;
|
||||
float last_stroke[3];
|
||||
} SculptSession;
|
||||
|
||||
void free_sculptsession(struct Object *ob);
|
||||
|
@ -246,7 +246,7 @@ void psys_check_group_weights(struct ParticleSettings *part);
|
||||
int psys_uses_gravity(struct ParticleSimulationData *sim);
|
||||
|
||||
/* free */
|
||||
void psys_free_settings(struct ParticleSettings *part);
|
||||
void BKE_particlesettings_free(struct ParticleSettings *part);
|
||||
void psys_free_path_cache(struct ParticleSystem *psys, struct PTCacheEdit *edit);
|
||||
void psys_free(struct Object * ob, struct ParticleSystem * psys);
|
||||
|
||||
@ -266,8 +266,8 @@ struct ParticleSystemModifierData *psys_get_modifier(struct Object *ob, struct P
|
||||
struct ModifierData *object_add_particle_system(struct Scene *scene, struct Object *ob, const char *name);
|
||||
void object_remove_particle_system(struct Scene *scene, struct Object *ob);
|
||||
struct ParticleSettings *psys_new_settings(const char *name, struct Main *main);
|
||||
struct ParticleSettings *psys_copy_settings(struct ParticleSettings *part);
|
||||
void make_local_particlesettings(struct ParticleSettings *part);
|
||||
struct ParticleSettings *BKE_particlesettings_copy(struct ParticleSettings *part);
|
||||
void BKE_particlesettings_make_local(struct ParticleSettings *part);
|
||||
|
||||
void psys_reset(struct ParticleSystem *psys, int mode);
|
||||
|
||||
|
@ -61,40 +61,44 @@ struct Base *_setlooper_base_step(struct Scene **sce_iter, struct Base *base);
|
||||
void free_avicodecdata(struct AviCodecData *acd);
|
||||
void free_qtcodecdata(struct QuicktimeCodecData *acd);
|
||||
|
||||
void free_scene(struct Scene *sce);
|
||||
struct Scene *add_scene(const char *name);
|
||||
struct Base *object_in_scene(struct Object *ob, struct Scene *sce);
|
||||
void BKE_scene_free(struct Scene *sce);
|
||||
struct Scene *BKE_scene_add(const char *name);
|
||||
|
||||
void set_scene_bg(struct Main *bmain, struct Scene *sce);
|
||||
struct Scene *set_scene_name(struct Main *bmain, const char *name);
|
||||
/* base functions */
|
||||
struct Base *BKE_scene_base_find(struct Scene *scene, struct Object *ob);
|
||||
struct Base *BKE_scene_base_add(struct Scene *sce, struct Object *ob);
|
||||
void BKE_scene_base_deselect_all(struct Scene *sce);
|
||||
void BKE_scene_base_select(struct Scene *sce, struct Base *selbase);
|
||||
int BKE_scene_base_iter_next(struct Scene **scene, int val, struct Base **base, struct Object **ob);
|
||||
|
||||
struct Scene *copy_scene(struct Scene *sce, int type);
|
||||
void unlink_scene(struct Main *bmain, struct Scene *sce, struct Scene *newsce);
|
||||
void BKE_scene_base_flag_to_objects(struct Scene *scene);
|
||||
void BKE_scene_base_flag_from_objects(struct Scene *scene);
|
||||
|
||||
int next_object(struct Scene **scene, int val, struct Base **base, struct Object **ob);
|
||||
struct Object *scene_find_camera(struct Scene *sc);
|
||||
struct Object *scene_camera_switch_find(struct Scene *scene); // DURIAN_CAMERA_SWITCH
|
||||
int scene_camera_switch_update(struct Scene *scene);
|
||||
void BKE_scene_set_background(struct Main *bmain, struct Scene *sce);
|
||||
struct Scene *BKE_scene_set_name(struct Main *bmain, const char *name);
|
||||
|
||||
char *scene_find_marker_name(struct Scene *scene, int frame);
|
||||
char *scene_find_last_marker_name(struct Scene *scene, int frame);
|
||||
struct Scene *BKE_scene_copy(struct Scene *sce, int type);
|
||||
void BKE_scene_unlink(struct Main *bmain, struct Scene *sce, struct Scene *newsce);
|
||||
|
||||
struct Base *scene_add_base(struct Scene *sce, struct Object *ob);
|
||||
void scene_deselect_all(struct Scene *sce);
|
||||
void scene_select_base(struct Scene *sce, struct Base *selbase);
|
||||
struct Object *BKE_scene_camera_find(struct Scene *sc);
|
||||
struct Object *BKE_scene_camera_switch_find(struct Scene *scene); // DURIAN_CAMERA_SWITCH
|
||||
int BKE_scene_camera_switch_update(struct Scene *scene);
|
||||
|
||||
char *BKE_scene_find_marker_name(struct Scene *scene, int frame);
|
||||
char *BKE_scene_find_last_marker_name(struct Scene *scene, int frame);
|
||||
|
||||
/* checks for cycle, returns 1 if it's all OK */
|
||||
int scene_check_setscene(struct Main *bmain, struct Scene *sce);
|
||||
int BKE_scene_validate_setscene(struct Main *bmain, struct Scene *sce);
|
||||
|
||||
float BKE_curframe(struct Scene *scene);
|
||||
float BKE_frame_to_ctime(struct Scene *scene, const float frame);
|
||||
float BKE_scene_frame_get(struct Scene *scene);
|
||||
float BKE_scene_frame_get_from_ctime(struct Scene *scene, const float frame);
|
||||
|
||||
void scene_update_tagged(struct Main *bmain, struct Scene *sce);
|
||||
void BKE_scene_update_tagged(struct Main *bmain, struct Scene *sce);
|
||||
|
||||
void scene_update_for_newframe(struct Main *bmain, struct Scene *sce, unsigned int lay);
|
||||
void BKE_scene_update_for_newframe(struct Main *bmain, struct Scene *sce, unsigned int lay);
|
||||
|
||||
struct SceneRenderLayer *scene_add_render_layer(struct Scene *sce, const char *name);
|
||||
int scene_remove_render_layer(struct Main *main, struct Scene *scene, struct SceneRenderLayer *srl);
|
||||
struct SceneRenderLayer *BKE_scene_add_render_layer(struct Scene *sce, const char *name);
|
||||
int BKE_scene_remove_render_layer(struct Main *main, struct Scene *scene, struct SceneRenderLayer *srl);
|
||||
|
||||
/* render profile */
|
||||
int get_render_subsurf_level(struct RenderData *r, int level);
|
||||
@ -102,7 +106,7 @@ int get_render_child_particle_number(struct RenderData *r, int num);
|
||||
int get_render_shadow_samples(struct RenderData *r, int samples);
|
||||
float get_render_aosss_error(struct RenderData *r, float error);
|
||||
|
||||
int scene_use_new_shading_nodes(struct Scene *scene);
|
||||
int BKE_scene_use_new_shading_nodes(struct Scene *scene);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ float BKE_screen_view3d_zoom_to_fac(float camzoom);
|
||||
float BKE_screen_view3d_zoom_from_fac(float zoomfac);
|
||||
|
||||
/* screen */
|
||||
void free_screen(struct bScreen *sc);
|
||||
void BKE_screen_free(struct bScreen *sc);
|
||||
unsigned int BKE_screen_visible_layers(struct bScreen *screen, struct Scene *scene);
|
||||
|
||||
#endif
|
||||
|
@ -77,7 +77,7 @@ void sound_delete_cache(struct bSound* sound);
|
||||
|
||||
void sound_load(struct Main *main, struct bSound* sound);
|
||||
|
||||
void sound_free(struct bSound* sound);
|
||||
void BKE_sound_free(struct bSound* sound);
|
||||
|
||||
#ifdef __AUD_C_API_H__
|
||||
AUD_Device* sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, float volume);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user