~ubuntu-branches/ubuntu/maverick/blender/maverick

« back to all changes in this revision

Viewing changes to source/blender/src/editmesh_add.c

  • Committer: Bazaar Package Importer
  • Author(s): Khashayar Naderehvandi, Khashayar Naderehvandi, Alessio Treglia
  • Date: 2009-01-22 16:53:59 UTC
  • mfrom: (14.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090122165359-v0996tn7fbit64ni
Tags: 2.48a+dfsg-1ubuntu1
[ Khashayar Naderehvandi ]
* Merge from debian experimental (LP: #320045), Ubuntu remaining changes:
  - Add patch correcting header file locations.
  - Add libvorbis-dev and libgsm1-dev to Build-Depends.
  - Use avcodec_decode_audio2() in source/blender/src/hddaudio.c

[ Alessio Treglia ]
* Add missing previous changelog entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
379
379
        
380
380
        /* find the 4 edges */
381
381
        for(eed= em->edges.first; eed; eed= eed->next) {
382
 
                if(eed->f & SELECT) {
 
382
                if( (eed->f & SELECT) || (eed->v1->f & eed->v2->f & SELECT) ) {
383
383
                        if(eedar[0]==NULL) eedar[0]= eed;
384
384
                        else if(eedar[1]==NULL) eedar[1]= eed;
385
385
                        else if(eedar[2]==NULL) eedar[2]= eed;
598
598
        }
599
599
}
600
600
 
601
 
void addfaces_from_edgenet()
 
601
void addfaces_from_edgenet(void)
602
602
{
603
603
        EditVert *eve1, *eve2, *eve3, *eve4;
604
604
        EditMesh *em= G.editMesh;
765
765
                                /* if 4 edges exist, we just create the face, convex or not */
766
766
                                        efa= addface_from_edges();
767
767
                                        if(efa==NULL) {
 
768
                                                
768
769
                                                /* the order of vertices can be anything, 6 cases to check */
769
770
                                                if( convex(neweve[0]->co, neweve[1]->co, neweve[2]->co, neweve[3]->co) ) {
770
771
                                                        efa= addfacelist(neweve[0], neweve[1], neweve[2], neweve[3], NULL, NULL);
775
776
                                                else if( convex(neweve[0]->co, neweve[2]->co, neweve[1]->co, neweve[3]->co) ) {
776
777
                                                        efa= addfacelist(neweve[0], neweve[2], neweve[1], neweve[3], NULL, NULL);
777
778
                                                }
778
 
                                                
779
 
                                                else if( convex(neweve[1]->co, neweve[2]->co, neweve[3]->co, neweve[0]->co) ) {
780
 
                                                        efa= addfacelist(neweve[1], neweve[2], neweve[3], neweve[0], NULL, NULL);
781
 
                                                }
782
 
                                                else if( convex(neweve[1]->co, neweve[3]->co, neweve[0]->co, neweve[2]->co) ) {
783
 
                                                        efa= addfacelist(neweve[1], neweve[3], neweve[0], neweve[2], NULL, NULL);
784
 
                                                }
785
 
                                                else if( convex(neweve[1]->co, neweve[3]->co, neweve[2]->co, neweve[0]->co) ) {
786
 
                                                        efa= addfacelist(neweve[1], neweve[3], neweve[2], neweve[0], NULL, NULL);
787
 
                                                }
788
 
                                                else error("The selected vertices form a concave quad");
 
779
                                                else if( convex(neweve[0]->co, neweve[1]->co, neweve[3]->co, neweve[2]->co) ) {
 
780
                                                        efa= addfacelist(neweve[0], neweve[1], neweve[3], neweve[2], NULL, NULL);
 
781
                                                }
 
782
                                                else if( convex(neweve[0]->co, neweve[3]->co, neweve[2]->co, neweve[1]->co) ) {
 
783
                                                        efa= addfacelist(neweve[0], neweve[3], neweve[2], neweve[1], NULL, NULL);
 
784
                                                }
 
785
                                                else if( convex(neweve[0]->co, neweve[3]->co, neweve[1]->co, neweve[2]->co) ) {
 
786
                                                        efa= addfacelist(neweve[0], neweve[3], neweve[1], neweve[2], NULL, NULL);
 
787
                                                }
 
788
                                                else printf("cannot find nice quad from concave set of vertices\n");
789
789
                                        }
790
790
                                }
791
791
                        }
869
869
        return newob;
870
870
}
871
871
 
 
872
// HACK: these can also be found in cmoview.tga.c, but are here so that they can be found by linker
 
873
// this hack is only used so that scons+mingw + split-sources hack works
 
874
        // ------------------------------- start copied code
 
875
/* these are not the monkeys you are looking for */
 
876
int monkeyo= 4;
 
877
int monkeynv= 271;
 
878
int monkeynf= 250;
 
879
signed char monkeyv[271][3]= {
 
880
{-71,21,98},{-63,12,88},{-57,7,74},{-82,-3,79},{-82,4,92},
 
881
{-82,17,100},{-92,21,102},{-101,12,95},{-107,7,83},
 
882
{-117,31,84},{-109,31,95},{-96,31,102},{-92,42,102},
 
883
{-101,50,95},{-107,56,83},{-82,66,79},{-82,58,92},
 
884
{-82,46,100},{-71,42,98},{-63,50,88},{-57,56,74},
 
885
{-47,31,72},{-55,31,86},{-67,31,97},{-66,31,99},
 
886
{-70,43,100},{-82,48,103},{-93,43,105},{-98,31,105},
 
887
{-93,20,105},{-82,31,106},{-82,15,103},{-70,20,100},
 
888
{-127,55,95},{-127,45,105},{-127,-87,94},{-127,-41,100},
 
889
{-127,-24,102},{-127,-99,92},{-127,52,77},{-127,73,73},
 
890
{-127,115,-70},{-127,72,-109},{-127,9,-106},{-127,-49,-45},
 
891
{-101,-24,72},{-87,-56,73},{-82,-89,73},{-80,-114,68},
 
892
{-85,-121,67},{-104,-124,71},{-127,-126,74},{-71,-18,68},
 
893
{-46,-5,69},{-21,19,57},{-17,55,76},{-36,62,80},
 
894
{-64,77,88},{-86,97,94},{-107,92,97},{-119,63,96},
 
895
{-106,53,99},{-111,39,98},{-101,12,95},{-79,2,90},
 
896
{-64,8,86},{-47,24,83},{-45,38,83},{-50,48,85},
 
897
{-72,56,92},{-95,60,97},{-127,-98,94},{-113,-92,94},
 
898
{-112,-107,91},{-119,-113,89},{-127,-114,88},{-127,-25,96},
 
899
{-127,-18,95},{-114,-19,95},{-111,-29,96},{-116,-37,95},
 
900
{-76,-6,86},{-48,7,80},{-34,26,77},{-32,48,84},
 
901
{-39,53,93},{-71,70,102},{-87,82,107},{-101,79,109},
 
902
{-114,55,108},{-111,-13,104},{-100,-57,91},{-95,-90,88},
 
903
{-93,-105,85},{-97,-117,81},{-106,-119,81},{-127,-121,82},
 
904
{-127,6,93},{-127,27,98},{-85,61,95},{-106,18,96},
 
905
{-110,27,97},{-112,-88,94},{-117,-57,96},{-127,-57,96},
 
906
{-127,-42,95},{-115,-35,100},{-110,-29,102},{-113,-17,100},
 
907
{-122,-16,100},{-127,-26,106},{-121,-19,104},{-115,-20,104},
 
908
{-113,-29,106},{-117,-32,103},{-127,-37,103},{-94,-40,71},
 
909
{-106,-31,91},{-104,-40,91},{-97,-32,71},{-127,-112,88},
 
910
{-121,-111,88},{-115,-105,91},{-115,-95,93},{-127,-100,84},
 
911
{-115,-96,85},{-115,-104,82},{-121,-109,81},{-127,-110,81},
 
912
{-105,28,100},{-103,20,99},{-84,55,97},{-92,54,99},
 
913
{-73,51,99},{-55,45,89},{-52,37,88},{-53,25,87},
 
914
{-66,13,92},{-79,8,95},{-98,14,100},{-104,38,100},
 
915
{-100,48,100},{-97,46,97},{-102,38,97},{-96,16,97},
 
916
{-79,11,93},{-68,15,90},{-57,27,86},{-56,36,86},
 
917
{-59,43,87},{-74,50,96},{-91,51,98},{-84,52,96},
 
918
{-101,22,96},{-102,29,96},{-113,59,78},{-102,85,79},
 
919
{-84,88,76},{-65,71,71},{-40,58,63},{-25,52,59},
 
920
{-28,21,48},{-50,0,53},{-71,-12,60},{-127,115,37},
 
921
{-127,126,-10},{-127,-25,-86},{-127,-59,24},{-127,-125,59},
 
922
{-127,-103,44},{-127,-73,41},{-127,-62,36},{-18,30,7},
 
923
{-17,41,-6},{-28,34,-56},{-68,56,-90},{-33,-6,9},
 
924
{-51,-16,-21},{-45,-1,-55},{-84,7,-85},{-97,-45,52},
 
925
{-104,-53,33},{-90,-91,49},{-95,-64,50},{-85,-117,51},
 
926
{-109,-97,47},{-111,-69,46},{-106,-121,56},{-99,-36,55},
 
927
{-100,-29,60},{-101,-22,64},{-100,-50,21},{-89,-40,-34},
 
928
{-83,-19,-69},{-69,111,-49},{-69,119,-9},{-69,109,30},
 
929
{-68,67,55},{-34,52,43},{-46,58,36},{-45,90,7},
 
930
{-25,72,16},{-25,79,-15},{-45,96,-25},{-45,87,-57},
 
931
{-25,69,-46},{-48,42,-75},{-65,3,-70},{-22,42,-26},
 
932
{-75,-22,19},{-72,-25,-27},{-13,52,-30},{-28,-18,-16},
 
933
{6,-13,-42},{37,7,-55},{46,41,-54},{31,65,-54},
 
934
{4,61,-40},{3,53,-37},{25,56,-50},{35,37,-52},
 
935
{28,10,-52},{5,-5,-39},{-21,-9,-17},{-9,46,-28},
 
936
{-6,39,-37},{-14,-3,-27},{6,0,-47},{25,12,-57},
 
937
{31,32,-57},{23,46,-56},{4,44,-46},{-19,37,-27},
 
938
{-20,22,-35},{-30,12,-35},{-22,11,-35},{-19,2,-35},
 
939
{-23,-2,-35},{-34,0,-9},{-35,-3,-22},{-35,5,-24},
 
940
{-25,26,-27},{-13,31,-34},{-13,30,-41},{-23,-2,-41},
 
941
{-18,2,-41},{-21,10,-41},{-29,12,-41},{-19,22,-41},
 
942
{6,42,-53},{25,44,-62},{34,31,-63},{28,11,-62},
 
943
{7,0,-54},{-14,-2,-34},{-5,37,-44},{-13,14,-42},
 
944
{-7,8,-43},{1,16,-47},{-4,22,-45},{3,30,-48},
 
945
{8,24,-49},{15,27,-50},{12,35,-50},{4,56,-62},
 
946
{33,60,-70},{48,38,-64},{41,7,-68},{6,-11,-63},
 
947
{-26,-16,-42},{-17,49,-49},
 
948
};
 
949
 
 
950
signed char monkeyf[250][4]= {
 
951
{27,4,5,26}, {25,4,5,24}, {3,6,5,4}, {1,6,5,2}, {5,6,7,4}, 
 
952
{3,6,7,2}, {5,8,7,6}, {3,8,7,4}, {7,8,9,6}, 
 
953
{5,8,9,4}, {7,10,9,8}, {5,10,9,6}, {9,10,11,8}, 
 
954
{7,10,11,6}, {9,12,11,10}, {7,12,11,8}, {11,6,13,12}, 
 
955
{5,4,13,12}, {3,-2,13,12}, {-3,-4,13,12}, {-5,-10,13,12}, 
 
956
{-11,-12,14,12}, {-13,-18,14,13}, {-19,4,5,13}, {10,12,4,4}, 
 
957
{10,11,9,9}, {8,7,9,9}, {7,5,6,6}, {6,3,4,4}, 
 
958
{5,1,2,2}, {4,-1,0,0}, {3,-3,-2,-2}, {22,67,68,23}, 
 
959
{20,65,66,21}, {18,63,64,19}, {16,61,62,17}, {14,59,60,15}, 
 
960
{12,19,48,57}, {18,19,48,47}, {18,19,48,47}, {18,19,48,47}, 
 
961
{18,19,48,47}, {18,19,48,47}, {18,19,48,47}, {18,19,48,47}, 
 
962
{18,19,48,47}, {18,-9,-8,47}, {18,27,45,46}, {26,55,43,44}, 
 
963
{24,41,42,54}, {22,39,40,23}, {20,37,38,21}, {18,35,36,19}, 
 
964
{16,33,34,17}, {14,31,32,15}, {12,39,30,13}, {11,48,45,38}, 
 
965
{8,36,-19,9}, {8,-20,44,47}, {42,45,46,43}, {18,19,40,39}, 
 
966
{16,17,38,37}, {14,15,36,35}, {32,44,43,33}, {12,33,32,42}, 
 
967
{19,44,43,42}, {40,41,42,-27}, {8,9,39,-28}, {15,43,42,16}, 
 
968
{13,43,42,14}, {11,43,42,12}, {9,-30,42,10}, {37,12,38,-32}, 
 
969
{-33,37,45,46}, {-33,40,41,39}, {38,40,41,37}, {36,40,41,35}, 
 
970
{34,40,41,33}, {36,39,38,37}, {35,40,39,38}, {1,2,14,21}, 
 
971
{1,2,40,13}, {1,2,40,39}, {1,24,12,39}, {-34,36,38,11}, 
 
972
{35,38,36,37}, {-37,8,35,37}, {-11,-12,-45,40}, {-11,-12,39,38}, 
 
973
{-11,-12,37,36}, {-11,-12,35,34}, {33,34,40,41}, {33,34,38,39}, 
 
974
{33,34,36,37}, {33,-52,34,35}, {33,37,36,34}, {33,35,34,34}, 
 
975
{8,7,37,36}, {-32,7,35,46}, {-34,-33,45,46}, {4,-33,43,34}, 
 
976
{-34,-33,41,42}, {-34,-33,39,40}, {-34,-33,37,38}, {-34,-33,35,36}, 
 
977
{-34,-33,33,34}, {-34,-33,31,32}, {-34,-4,28,30}, {-5,-34,28,27}, 
 
978
{-35,-44,36,27}, {26,35,36,45}, {24,25,44,45}, {25,23,44,42}, 
 
979
{25,24,41,40}, {25,24,39,38}, {25,24,37,36}, {25,24,35,34}, 
 
980
{25,24,33,32}, {25,24,31,30}, {15,24,29,38}, {25,24,27,26}, 
 
981
{23,12,37,26}, {11,12,35,36}, {-86,-59,36,-80}, {-60,-61,36,35}, 
 
982
{-62,-63,36,35}, {-64,-65,36,35}, {-66,-67,36,35}, {-68,-69,36,35}, 
 
983
{-70,-71,36,35}, {-72,-73,36,35}, {-74,-75,36,35}, {42,43,53,58}, 
 
984
{40,41,57,56}, {38,39,55,57}, {-81,-80,37,56}, {-83,-82,55,52}, 
 
985
{-85,-84,51,49}, {-87,-86,48,49}, {47,50,51,48}, {46,48,51,49}, 
 
986
{43,46,49,44}, {-92,-91,45,42}, {-23,49,50,-20}, {-94,40,48,-24}, 
 
987
{-96,-22,48,49}, {-97,48,21,-90}, {-100,36,50,23}, {22,49,48,-100}, 
 
988
{-101,47,46,22}, {21,45,35,25}, {33,34,44,41}, {13,14,28,24}, 
 
989
{-107,26,30,-106}, {14,46,45,15}, {14,44,43,-110}, {-111,42,23,-110}, 
 
990
{6,7,45,46}, {45,44,47,46}, {45,46,47,48}, {47,46,49,48}, 
 
991
{17,49,47,48}, {17,36,46,48}, {35,36,44,45}, {35,36,40,43}, 
 
992
{35,36,38,39}, {-4,-3,37,35}, {-123,34,33,1}, {-9,-8,-7,-6}, 
 
993
{-10,-7,32,-125}, {-127,-11,-126,-126}, {-7,-6,5,31}, {4,5,33,30}, 
 
994
{4,39,33,32}, {4,35,32,38}, {20,21,39,38}, {4,37,38,5}, 
 
995
{-11,-10,36,3}, {-11,15,14,35}, {13,16,34,34}, {-13,14,13,13}, 
 
996
{-3,1,30,29}, {-3,28,29,1}, {-2,31,28,-1}, {12,13,27,30}, 
 
997
{-2,26,12,12}, {35,29,42,36}, {34,35,36,33}, {32,35,36,31}, 
 
998
{30,35,36,29}, {28,35,36,27}, {26,35,36,25}, {34,39,38,35}, 
 
999
{32,39,38,33}, {30,39,38,31}, {28,39,38,29}, {26,39,38,27}, 
 
1000
{25,31,32,38}, {-18,-17,45,44}, {-18,17,28,44}, {-24,-20,42,-23}, 
 
1001
{11,35,27,14}, {25,28,39,41}, {37,41,40,38}, {34,40,36,35}, 
 
1002
{32,40,39,33}, {30,39,31,40}, {21,29,39,22}, {-31,37,28,4}, 
 
1003
{-32,33,35,36}, {32,33,34,34}, {18,35,36,48}, {34,25,40,35}, 
 
1004
{24,25,38,39}, {24,25,36,37}, {24,25,34,35}, {24,25,32,33}, 
 
1005
{24,13,41,31}, {17,11,41,35}, {15,16,34,35}, {13,14,34,35}, 
 
1006
{11,12,34,35}, {9,10,34,35}, {7,8,34,35}, {26,25,37,36}, 
 
1007
{35,36,37,38}, {37,36,39,38}, {37,38,39,40}, {25,31,36,39}, 
 
1008
{18,34,35,30}, {17,22,30,33}, {19,29,21,20}, {16,26,29,17}, 
 
1009
{24,29,28,25}, {22,31,28,23}, {20,31,30,21}, {18,31,30,19}, 
 
1010
{16,30,17,17}, {-21,-22,35,34}, {-21,-22,33,32}, {-21,-22,31,30}, 
 
1011
{-21,-22,29,28}, {-21,-22,27,26}, {-28,-22,25,31}, {24,28,29,30}, 
 
1012
{23,24,26,27}, {23,24,25,25}, {-69,-35,-32,27}, {-70,26,25,-66}, 
 
1013
{-68,-67,24,-33}, 
 
1014
};
 
1015
        // ------------------------------- end copied code
 
1016
 
 
1017
 
872
1018
void make_prim(int type, float imat[3][3], int tot, int seg,
873
1019
                int subdiv, float dia, float d, int ext, int fill,
874
1020
        float cent[3])
1022
1168
                break;
1023
1169
        case 13: /* Monkey */
1024
1170
                {
1025
 
                        extern int monkeyo, monkeynv, monkeynf;
1026
 
                        extern signed char monkeyf[][4];
1027
 
                        extern signed char monkeyv[][3];
 
1171
                        //extern int monkeyo, monkeynv, monkeynf;
 
1172
                        //extern signed char monkeyf[][4];
 
1173
                        //extern signed char monkeyv[][3];
1028
1174
                        EditVert **tv= MEM_mallocN(sizeof(*tv)*monkeynv*2, "tv");
1029
 
                        EditFace *efa;
1030
1175
                        int i;
1031
1176
 
1032
1177
                        for (i=0; i<monkeynv; i++) {
1038
1183
                                tv[monkeynv+i]->f |= SELECT;
1039
1184
                        }
1040
1185
                        for (i=0; i<monkeynf; i++) {
1041
 
                                efa= addfacelist(tv[monkeyf[i][0]+i-monkeyo], tv[monkeyf[i][1]+i-monkeyo], tv[monkeyf[i][2]+i-monkeyo], (monkeyf[i][3]!=monkeyf[i][2])?tv[monkeyf[i][3]+i-monkeyo]:NULL, NULL, NULL);
1042
 
                                efa= addfacelist(tv[monkeynv+monkeyf[i][2]+i-monkeyo], tv[monkeynv+monkeyf[i][1]+i-monkeyo], tv[monkeynv+monkeyf[i][0]+i-monkeyo], (monkeyf[i][3]!=monkeyf[i][2])?tv[monkeynv+monkeyf[i][3]+i-monkeyo]:NULL, NULL, NULL);
 
1186
                                addfacelist(tv[monkeyf[i][0]+i-monkeyo], tv[monkeyf[i][1]+i-monkeyo], tv[monkeyf[i][2]+i-monkeyo], (monkeyf[i][3]!=monkeyf[i][2])?tv[monkeyf[i][3]+i-monkeyo]:NULL, NULL, NULL);
 
1187
                                addfacelist(tv[monkeynv+monkeyf[i][2]+i-monkeyo], tv[monkeynv+monkeyf[i][1]+i-monkeyo], tv[monkeynv+monkeyf[i][0]+i-monkeyo], (monkeyf[i][3]!=monkeyf[i][2])?tv[monkeynv+monkeyf[i][3]+i-monkeyo]:NULL, NULL, NULL);
1043
1188
                        }
1044
1189
 
1045
1190
                        MEM_freeN(tv);