~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/blender/blenkernel/intern/sketch.c

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 *
3
 
 * $Id: sketch.c 28395 2010-04-23 23:57:00Z campbellbarton $
4
 
 *
 
1
/*
5
2
 * ***** BEGIN GPL LICENSE BLOCK *****
6
3
 *
7
4
 * This program is free software; you can redistribute it and/or
23
20
 * ***** END GPL LICENSE BLOCK *****
24
21
 */
25
22
 
 
23
/** \file blender/blenkernel/intern/sketch.c
 
24
 *  \ingroup bke
 
25
 */
 
26
 
 
27
 
26
28
#include <string.h>
27
29
#include <math.h>
28
30
#include <float.h>
31
33
 
32
34
#include "BLI_blenlib.h"
33
35
#include "BLI_math.h"
 
36
#include "BLI_utildefines.h"
34
37
 
35
38
#include "BKE_sketch.h"
36
 
#include "BKE_utildefines.h"
 
39
 
37
40
 
38
41
#include "DNA_userdef_types.h"
39
42
 
53
56
        MEM_freeN(sketch);
54
57
}
55
58
 
56
 
SK_Sketch* createSketch()
 
59
SK_Sketch* createSketch(void)
57
60
{
58
61
        SK_Sketch *sketch;
59
62
 
68
71
        return sketch;
69
72
}
70
73
 
71
 
void sk_initPoint(SK_Point *pt, SK_DrawData *dd, float *no)
 
74
void sk_initPoint(SK_Point *pt, SK_DrawData *dd, const float no[3])
72
75
{
73
 
        if (no)
74
 
        {
75
 
                VECCOPY(pt->no, no);
76
 
                normalize_v3(pt->no);
 
76
        if (no) {
 
77
                normalize_v3_v3(pt->no, no);
77
78
        }
78
 
        else
79
 
        {
80
 
                pt->no[0] = 0;
81
 
                pt->no[1] = 0;
82
 
                pt->no[2] = 1;
 
79
        else {
 
80
                pt->no[0] = 0.0f;
 
81
                pt->no[1] = 0.0f;
 
82
                pt->no[2] = 1.0f;
83
83
        }
84
84
        pt->p2d[0] = dd->mval[0];
85
85
        pt->p2d[1] = dd->mval[1];
102
102
        MEM_freeN(stk);
103
103
}
104
104
 
105
 
SK_Stroke* sk_createStroke()
 
105
SK_Stroke* sk_createStroke(void)
106
106
{
107
107
        SK_Stroke *stk;
108
108
 
240
240
        prev = stk->points + start;
241
241
        next = stk->points + end;
242
242
 
243
 
        VECCOPY(pt1.p, p_start);
244
 
        VECCOPY(pt1.no, prev->no);
 
243
        copy_v3_v3(pt1.p, p_start);
 
244
        copy_v3_v3(pt1.no, prev->no);
245
245
        pt1.mode = prev->mode;
246
246
        pt1.type = prev->type;
247
247
 
248
 
        VECCOPY(pt2.p, p_end);
249
 
        VECCOPY(pt2.no, next->no);
 
248
        copy_v3_v3(pt2.p, p_end);
 
249
        copy_v3_v3(pt2.no, next->no);
250
250
        pt2.mode = next->mode;
251
251
        pt2.type = next->type;
252
252
 
258
258
                float delta = (float)i / (float)total;
259
259
                float *p = stk->points[start + 1 + i].p;
260
260
 
261
 
                VECCOPY(p, delta_p);
262
 
                mul_v3_fl(p, delta);
 
261
                mul_v3_v3fl(p, delta_p, delta);
263
262
                add_v3_v3(p, p_start);
264
263
        }
265
264
}
318
317
 
319
318
        total = end - start + 1;
320
319
 
321
 
        VECCOPY(normal, stk->points[start].no);
 
320
        copy_v3_v3(normal, stk->points[start].no);
322
321
 
323
322
        sub_v3_v3v3(distance, stk->points[end].p, stk->points[start].p);
324
323
        project_v3_v3v3(normal, distance, normal);
333
332
                sub_v3_v3v3(distance, p, stk->points[start].p);
334
333
                project_v3_v3v3(distance, distance, normal);
335
334
 
336
 
                VECCOPY(offset, normal);
 
335
                copy_v3_v3(offset, normal);
337
336
                mul_v3_fl(offset, d);
338
337
 
339
338
                sub_v3_v3(p, distance);
415
414
                        float max_dist = 16; /* more than 4 pixels */
416
415
                        
417
416
                        /* find the next marked point */
418
 
                        while(marked[le] == 0)
 
417
                        while (marked[le] == 0)
419
418
                        {
420
419
                                le++;
421
420
                        }
425
424
                        v1[0] = old_points[ls].p2d[1] - old_points[le].p2d[1]; 
426
425
                        
427
426
 
428
 
                        for( i = ls + 1; i < le; i++ )
 
427
                        for ( i = ls + 1; i < le; i++ )
429
428
                        {
430
429
                                float mul;
431
430
                                float dist;
538
537
        return retval;
539
538
}
540
539
 
541
 
void sk_initDrawData(SK_DrawData *dd, short mval[2])
 
540
void sk_initDrawData(SK_DrawData *dd, const int mval[2])
542
541
{
543
542
        dd->mval[0] = mval[0];
544
543
        dd->mval[1] = mval[1];
574
573
                        stk->selected = 0;
575
574
                }
576
575
        }
577
 
        else if (mode == 0)
578
 
        {
 
576
        else if (mode == 0) {
579
577
                for (stk = sketch->strokes.first; stk; stk = stk->next)
580
578
                {
581
579
                        stk->selected = 1;
582
580
                }
583
581
        }
584
 
        else if (mode == 1)
585
 
        {
 
582
        else if (mode == 1) {
586
583
                int selected = 1;
587
584
 
588
585
                for (stk = sketch->strokes.first; stk; stk = stk->next)