#include <vtkActor.h>#include <vtkByteSwap.h>#include <vtkCamera.h>#include <vtkCellArray.h>#include <vtkLight.h>#include <vtkPolyDataMapper.h>#include <vtkPolyDataNormals.h>#include <vtkProperty.h>#include <vtkRenderer.h>#include <vtkStripper.h>#include <vtkObjectFactory.h>#include "vtk3DSOurImporter.h"Include dependency graph for vtk3DSOurImporter.cpp:

Go to the source code of this file.
Functions | |
| void | cleanup_name (char *) |
| void | list_insert (vtk3DSList **root, vtk3DSList *new_node) |
| void * | list_find (vtk3DSList **root, const char *name) |
| void | list_kill (vtk3DSList **root) |
| vtk3DSMatProp * | create_mprop (void) |
| vtk3DSMesh * | create_mesh (char *name, int vertices, int faces) |
| int | parse_3ds_file (vtk3DSOurImporter *importer) |
| void | parse_3ds (vtk3DSOurImporter *importer, vtk3DSChunk *mainchunk) |
| void | parse_mdata (vtk3DSOurImporter *importer, vtk3DSChunk *mainchunk) |
| void | parse_fog (vtk3DSOurImporter *importer, vtk3DSChunk *mainchunk) |
| void | parse_fog_bgnd (vtk3DSOurImporter *importer) |
| void | parse_mat_entry (vtk3DSOurImporter *importer, vtk3DSChunk *mainchunk) |
| char * | parse_mapname (vtk3DSOurImporter *importer, vtk3DSChunk *mainchunk) |
| void | parse_named_object (vtk3DSOurImporter *importer, vtk3DSChunk *mainchunk) |
| void | parse_n_tri_object (vtk3DSOurImporter *importer, vtk3DSChunk *mainchunk) |
| void | parse_point_array (vtk3DSOurImporter *importer, vtk3DSMesh *mesh) |
| void | parse_face_array (vtk3DSOurImporter *importer, vtk3DSMesh *mesh, vtk3DSChunk *mainchunk) |
| void | parse_msh_mat_group (vtk3DSOurImporter *importer, vtk3DSMesh *mesh) |
| void | parse_smooth_group (vtk3DSOurImporter *importer) |
| void | parse_mesh_matrix (vtk3DSOurImporter *importer, vtk3DSMesh *mesh) |
| void | parse_n_direct_light (vtk3DSOurImporter *importer, vtk3DSChunk *mainchunk) |
| void | parse_dl_spotlight (vtk3DSOurImporter *importer) |
| void | parse_n_camera (vtk3DSOurImporter *importer) |
| void | parse_colour (vtk3DSOurImporter *importer, vtk3DSColour *colour) |
| void | parse_colour_f (vtk3DSOurImporter *importer, vtk3DSColour *colour) |
| void | parse_colour_24 (vtk3DSOurImporter *importer, vtk3DSColour_24 *colour) |
| float | parse_percentage (vtk3DSOurImporter *importer) |
| short | parse_int_percentage (vtk3DSOurImporter *importer) |
| float | parse_float_percentage (vtk3DSOurImporter *importer) |
| vtk3DSMaterial * | update_materials (vtk3DSOurImporter *importer, const char *new_material, int ext) |
| void | start_chunk (vtk3DSOurImporter *importer, vtk3DSChunk *chunk) |
| void | end_chunk (vtk3DSOurImporter *importer, vtk3DSChunk *chunk) |
| byte | read_byte (vtk3DSOurImporter *importer) |
| word | read_word (vtk3DSOurImporter *importer) |
| dword | read_dword (vtk3DSOurImporter *importer) |
| float | read_float (vtk3DSOurImporter *importer) |
| void | read_point (vtk3DSOurImporter *importer, vtk3DSVector v) |
| char * | read_string (vtk3DSOurImporter *importer) |
| void | parse_fog_bgnd (vtk3DSOurImporter *vtkNotUsed(importer)) |
| void | parse_smooth_group (vtk3DSOurImporter *vtkNotUsed(importer)) |
| void | parse_mesh_matrix (vtk3DSOurImporter *vtkNotUsed(importer), vtk3DSMesh *vtkNotUsed(mesh)) |
Variables | |
| vtk3DSColour | Black = {0.0, 0.0, 0.0} |
| char | obj_name [80] = "" |
| vtk3DSColour | fog_colour = {0.0, 0.0, 0.0} |
| vtk3DSColour | col = {0.0, 0.0, 0.0} |
| vtk3DSColour | global_amb = {0.1, 0.1, 0.1} |
| vtk3DSVector | pos = {0.0, 0.0, 0.0} |
| vtk3DSVector | target = {0.0, 0.0, 0.0} |
| float | hotspot = -1 |
| float | falloff = -1 |
| vtk3DSMatProp | DefaultMaterial |
|
|
Definition at line 1183 of file vtk3DSOurImporter.cpp. Referenced by parse_mat_entry(), parse_msh_mat_group(), and parse_named_object().
01184 {
01185 char *tmp = (char *) malloc (strlen(name)+2);
01186 int i;
01187
01188 /* Remove any leading blanks or quotes */
01189 i = 0;
01190 while ((name[i] == ' ' || name[i] == '"') && name[i] != '\0')
01191 {
01192 i++;
01193 }
01194 strcpy (tmp, &name[i]);
01195
01196 /* Remove any trailing blanks or quotes */
01197 for (i = strlen(tmp)-1; i >= 0; i--)
01198 {
01199 if (isprint(tmp[i]) && !isspace(tmp[i]) && tmp[i] != '"')
01200 {
01201 break;
01202 }
01203 else
01204 {
01205 tmp[i] = '\0';
01206 }
01207 }
01208
01209 strcpy (name, tmp);
01210
01211 /* Prefix the letter 'N' to materials that begin with a digit */
01212 if (!isdigit (name[0]))
01213 {
01214 strcpy (tmp, name);
01215 }
01216 else
01217 {
01218 tmp[0] = 'N';
01219 strcpy (&tmp[1], name);
01220 }
01221
01222 /* Replace all illegal charaters in name with underscores */
01223 for (i = 0; tmp[i] != '\0'; i++)
01224 {
01225 if (!isalnum(tmp[i]))
01226 {
01227 tmp[i] = '_';
01228 }
01229 }
01230
01231 strcpy (name, tmp);
01232
01233 free (tmp);
01234 }
|
|
||||||||||||||||
|
Definition at line 481 of file vtk3DSOurImporter.cpp. Referenced by parse_n_tri_object().
00482 {
00483 vtk3DSMesh *new_mesh;
00484
00485 new_mesh = (vtk3DSMesh *) malloc (sizeof(*new_mesh));
00486 strcpy (new_mesh->name, name);
00487
00488 new_mesh->vertices = vertices;
00489
00490 if (vertices <= 0)
00491 {
00492 new_mesh->vertex = NULL;
00493 }
00494 else
00495 {
00496 new_mesh->vertex = (vtk3DSVector *) malloc(vertices * sizeof(*new_mesh->vertex));
00497 }
00498
00499 new_mesh->faces = faces;
00500
00501 if (faces <= 0)
00502 {
00503 new_mesh->face = NULL;
00504 new_mesh->mtl = NULL;
00505 }
00506 else
00507 {
00508 new_mesh->face = (vtk3DSFace *) malloc (faces * sizeof(*new_mesh->face));
00509 new_mesh->mtl = (vtk3DSMaterial **) malloc (faces * sizeof(*new_mesh->mtl));
00510 }
00511
00512 new_mesh->hidden = 0;
00513 new_mesh->shadow = 1;
00514
00515 new_mesh->anActor = NULL;
00516 new_mesh->aMapper = NULL;
00517 new_mesh->aNormals = NULL;
00518 new_mesh->aStripper = NULL;
00519 new_mesh->aPoints = NULL;
00520 new_mesh->aCellArray = NULL;
00521 new_mesh->aPolyData = NULL;
00522 return new_mesh;
00523 }
|
|
|
Definition at line 455 of file vtk3DSOurImporter.cpp. References Black. Referenced by parse_mat_entry().
00456 {
00457 vtk3DSMatProp *new_mprop;
00458
00459 new_mprop = (vtk3DSMatProp *) malloc (sizeof(*new_mprop));
00460 strcpy (new_mprop->name, "");
00461 new_mprop->ambient = Black;
00462 new_mprop->diffuse = Black;
00463 new_mprop->specular = Black;
00464 new_mprop->shininess = 0.0;
00465 new_mprop->transparency = 0.0;
00466 new_mprop->reflection = 0.0;
00467 new_mprop->self_illum = 0;
00468
00469 strcpy (new_mprop->tex_map, "");
00470 new_mprop->tex_strength = 0.0;
00471
00472 strcpy (new_mprop->bump_map, "");
00473 new_mprop->bump_strength = 0.0;
00474
00475 new_mprop->aProperty = vtkProperty::New ();
00476 return new_mprop;
00477 }
|
|
||||||||||||
|
Definition at line 1101 of file vtk3DSOurImporter.cpp. References vtk3DSOurImporter::GetFileFD(). Referenced by parse_3ds(), parse_3ds_file(), parse_colour(), parse_face_array(), parse_fog(), parse_mapname(), parse_mat_entry(), parse_mdata(), parse_n_direct_light(), parse_n_tri_object(), parse_named_object(), and parse_percentage().
01102 {
01103 fseek (importer->GetFileFD(), chunk->end, 0);
01104 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 411 of file vtk3DSOurImporter.cpp.
00412 {
00413 vtk3DSList *p;
00414 for (p = *root; p != (vtk3DSList *) NULL; p = (vtk3DSList *) p->next)
00415 {
00416 if (strcmp (p->name, name) == 0)
00417 {
00418 break;
00419 }
00420 }
00421 return (void *)p;
00422 }
|
|
||||||||||||
|
Definition at line 403 of file vtk3DSOurImporter.cpp.
00404 {
00405 new_node->next = *root;
00406 *root = new_node;
00407 }
|
|
|
Definition at line 425 of file vtk3DSOurImporter.cpp.
00426 {
00427 vtk3DSList *temp;
00428
00429 while (*root != (vtk3DSList *) NULL)
00430 {
00431 temp = *root;
00432 *root = (vtk3DSList *) (*root)->next;
00433 free (temp);
00434 }
00435 }
|
|
||||||||||||
|
Definition at line 546 of file vtk3DSOurImporter.cpp. References end_chunk(), parse_mdata(), and start_chunk(). Referenced by parse_3ds_file().
00547 {
00548 vtk3DSChunk chunk;
00549
00550 do
00551 {
00552 start_chunk (importer, &chunk);
00553
00554 if (chunk.end <= mainchunk->end)
00555 {
00556 switch (chunk.tag)
00557 {
00558 case 0x3D3D: parse_mdata (importer, &chunk);
00559 break;
00560 }
00561 }
00562 end_chunk (importer, &chunk);
00563 } while (chunk.end <= mainchunk->end);
00564 }
|
Here is the call graph for this function:

|
|
Definition at line 526 of file vtk3DSOurImporter.cpp. References end_chunk(), parse_3ds(), and start_chunk(). Referenced by vtk3DSOurImporter::Read3DS().
00527 {
00528 vtk3DSChunk chunk;
00529
00530 start_chunk(importer, &chunk);
00531
00532 if (chunk.tag == 0x4D4D)
00533 {
00534 parse_3ds (importer, &chunk);
00535 }
00536 else
00537 {
00538 vtkGenericWarningMacro(<< "Error: Input file is not .3DS format\n");
00539 return 0;
00540 }
00541
00542 end_chunk (importer, &chunk);
00543 return 1;
00544 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 1007 of file vtk3DSOurImporter.cpp. References end_chunk(), parse_colour_24(), parse_colour_f(), and start_chunk(). Referenced by parse_fog(), parse_mat_entry(), parse_mdata(), and parse_n_direct_light().
01008 {
01009 vtk3DSChunk chunk;
01010 vtk3DSColour_24 colour_24;
01011
01012 start_chunk (importer, &chunk);
01013
01014 switch (chunk.tag)
01015 {
01016 case 0x0010: parse_colour_f (importer, colour);
01017 break;
01018
01019 case 0x0011: parse_colour_24 (importer, &colour_24);
01020 colour->red = colour_24.red/255.0;
01021 colour->green = colour_24.green/255.0;
01022 colour->blue = colour_24.blue/255.0;
01023 break;
01024
01025 default: vtkGenericWarningMacro(<< "Error parsing colour");
01026 }
01027
01028 end_chunk (importer, &chunk);
01029 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 1040 of file vtk3DSOurImporter.cpp. References read_byte(). Referenced by parse_colour().
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 1032 of file vtk3DSOurImporter.cpp. References read_float(). Referenced by parse_colour().
01033 {
01034 colour->red = read_float(importer);
01035 colour->green = read_float(importer);
01036 colour->blue = read_float(importer);
01037 }
|
Here is the call graph for this function:

|
|
Definition at line 974 of file vtk3DSOurImporter.cpp. References falloff, hotspot, read_float(), read_point(), and target. Referenced by parse_n_direct_light().
00975 {
00976 read_point (importer, target);
00977
00978 hotspot = read_float(importer);
00979 falloff = read_float(importer);
00980 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 805 of file vtk3DSOurImporter.cpp. References end_chunk(), parse_msh_mat_group(), parse_smooth_group(), read_word(), start_chunk(), and update_materials(). Referenced by parse_n_tri_object().
00806 {
00807 vtk3DSChunk chunk;
00808 int i;
00809 mesh->faces = read_word(importer);
00810 mesh->face = (vtk3DSFace *) malloc (mesh->faces * sizeof(*(mesh->face)));
00811 mesh->mtl = (vtk3DSMaterial **) malloc (mesh->faces * sizeof(*(mesh->mtl)));
00812
00813 for (i = 0; i < mesh->faces; i++)
00814 {
00815 mesh->face[i].a = read_word(importer);
00816 mesh->face[i].b = read_word(importer);
00817 mesh->face[i].c = read_word(importer);
00818 //fprintf (stdout, "face %d: %d,%d,%d, %d \n", i, mesh->face[i].a, mesh->face[i].b, mesh->face[i].c, read_word(importer));
00819 (void)read_word(importer); //flags not implemented: bit 0 - CA visible, bit 1 - BC visible, bit 2 - AB visible
00820 mesh->mtl[i] = NULL;
00821 }
00822
00823 do
00824 {
00825 start_chunk (importer, &chunk);
00826 if (chunk.end <= mainchunk->end)
00827 {
00828 switch (chunk.tag)
00829 {
00830 case 0x4130: parse_msh_mat_group(importer, mesh);
00831 break;
00832 case 0x4150: parse_smooth_group(importer);
00833 break;
00834 }
00835 }
00836
00837 end_chunk (importer, &chunk);
00838 } while (chunk.end <= mainchunk->end);
00839
00840 for (i = 0; i < mesh->faces; i++)
00841 {
00842 if (mesh->mtl[i] == (vtk3DSMaterial *) NULL)
00843 {
00844 mesh->mtl[i] = update_materials (importer, "Default", 0);
00845 }
00846 }
00847 }
|
Here is the call graph for this function:

|
|
Definition at line 1080 of file vtk3DSOurImporter.cpp. References read_float(). Referenced by parse_percentage().
01081 {
01082 float percent = read_float(importer);
01083
01084 return percent;
01085 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 600 of file vtk3DSOurImporter.cpp. References end_chunk(), fog_colour, parse_colour(), parse_fog_bgnd(), read_float(), and start_chunk(). Referenced by parse_mdata().
00601 {
00602 vtk3DSChunk chunk;
00603
00604 (void)read_float(importer);
00605 (void)read_float(importer);
00606 (void) read_float(importer);
00607 (void)read_float(importer);
00608
00609 parse_colour (importer, &fog_colour);
00610
00611 do
00612 {
00613 start_chunk (importer, &chunk);
00614
00615 if (chunk.end <= mainchunk->end)
00616 {
00617 switch (chunk.tag)
00618 {
00619 case 0x2210: parse_fog_bgnd(importer);
00620 break;
00621 }
00622 }
00623
00624 end_chunk (importer, &chunk);
00625 } while (chunk.end <= mainchunk->end);
00626 }
|
Here is the call graph for this function:

|
|
Definition at line 629 of file vtk3DSOurImporter.cpp. Referenced by parse_fog(), and parse_mdata().
00630 {
00631 }
|
|
|
|
|
|
Definition at line 1072 of file vtk3DSOurImporter.cpp. References read_word(). Referenced by parse_percentage().
01073 {
01074 word percent = read_word(importer);
01075
01076 return percent;
01077 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 697 of file vtk3DSOurImporter.cpp. References end_chunk(), read_string(), and start_chunk(). Referenced by parse_mat_entry().
00698 {
00699 static char name[80] = "";
00700 vtk3DSChunk chunk;
00701
00702 do
00703 {
00704 start_chunk (importer, &chunk);
00705
00706 if (chunk.end <= mainchunk->end)
00707 {
00708 switch (chunk.tag)
00709 {
00710 case 0xA300: strcpy (name, read_string(importer));
00711 break;
00712 }
00713 }
00714
00715 end_chunk (importer, &chunk);
00716 } while (chunk.end <= mainchunk->end);
00717
00718 return name;
00719 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 634 of file vtk3DSOurImporter.cpp. References cleanup_name(), create_mprop(), end_chunk(), vtk3DSOurImporter::MatPropList, parse_colour(), parse_mapname(), parse_percentage(), read_string(), and start_chunk(). Referenced by parse_mdata().
00635 {
00636 vtk3DSChunk chunk;
00637 vtk3DSMatProp *mprop;
00638
00639 mprop = create_mprop();
00640
00641 do
00642 {
00643 start_chunk (importer, &chunk);
00644 if (chunk.end <= mainchunk->end)
00645 {
00646 switch (chunk.tag)
00647 {
00648 case 0xA000: strcpy (mprop->name, read_string(importer));
00649 cleanup_name (mprop->name);
00650 break;
00651
00652 case 0xA010: parse_colour (importer, &mprop->ambient);
00653 break;
00654
00655 case 0xA020: parse_colour (importer, &mprop->diffuse);
00656 break;
00657
00658 case 0xA030: parse_colour (importer, &mprop->specular);
00659 break;
00660
00661 case 0xA040: mprop->shininess = 100.0*parse_percentage(importer);
00662 break;
00663
00664 case 0xA050: mprop->transparency = parse_percentage(importer);
00665 break;
00666
00667 case 0xA080: mprop->self_illum = 1;
00668 break;
00669
00670 case 0xA220: mprop->reflection = parse_percentage(importer);
00671 (void)parse_mapname (importer, &chunk);
00672 break;
00673
00674 case 0xA310: if (mprop->reflection == 0.0)
00675 {
00676 mprop->reflection = 1.0;
00677 }
00678 break;
00679
00680 case 0xA200: mprop->tex_strength = parse_percentage(importer);
00681 strcpy (mprop->tex_map, parse_mapname (importer, &chunk));
00682 break;
00683
00684 case 0xA230: mprop->bump_strength = parse_percentage(importer);
00685 strcpy (mprop->bump_map, parse_mapname (importer, &chunk));
00686 break;
00687 }
00688 }
00689
00690 end_chunk (importer, &chunk);
00691 } while (chunk.end <= mainchunk->end);
00692
00693 VTK_LIST_INSERT (importer->MatPropList, mprop);
00694 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 567 of file vtk3DSOurImporter.cpp. References end_chunk(), global_amb, parse_colour(), parse_fog(), parse_fog_bgnd(), parse_mat_entry(), parse_named_object(), and start_chunk(). Referenced by parse_3ds().
00568 {
00569 vtk3DSChunk chunk;
00570 vtk3DSColour bgnd_colour;
00571
00572 do
00573 {
00574 start_chunk (importer, &chunk);
00575
00576 if (chunk.end <= mainchunk->end)
00577 {
00578 switch (chunk.tag)
00579 {
00580 case 0x2100: parse_colour (importer, &global_amb);
00581 break;
00582 case 0x1200: parse_colour (importer, &bgnd_colour);
00583 break;
00584 case 0x2200: parse_fog (importer, &chunk);
00585 break;
00586 case 0x2210: parse_fog_bgnd(importer);
00587 break;
00588 case 0xAFFF: parse_mat_entry (importer, &chunk);
00589 break;
00590 case 0x4000: parse_named_object (importer, &chunk);
00591 break;
00592 }
00593 }
00594
00595 end_chunk (importer, &chunk);
00596 } while (chunk.end <= mainchunk->end);
00597 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 875 of file vtk3DSOurImporter.cpp. Referenced by parse_n_tri_object().
00876 {
00877 // vtkGenericWarningMacro(<< "mesh matrix detected but not used\n");
00878 }
|
|
||||||||||||
|
|
|
||||||||||||
|
Definition at line 850 of file vtk3DSOurImporter.cpp. References cleanup_name(), read_string(), read_word(), and update_materials(). Referenced by parse_face_array().
00851 {
00852 vtk3DSMaterial *new_mtl;
00853 char mtlname[80];
00854 int mtlcnt;
00855 int i, face;
00856
00857 strcpy (mtlname, read_string(importer));
00858 cleanup_name (mtlname);
00859
00860 new_mtl = update_materials (importer, mtlname, 0);
00861
00862 mtlcnt = read_word(importer);
00863
00864 for (i = 0; i < mtlcnt; i++)
00865 {
00866 face = read_word(importer);
00867 mesh->mtl[face] = new_mtl;
00868 }
00869 }
|
Here is the call graph for this function:

|
|
Definition at line 983 of file vtk3DSOurImporter.cpp. References vtk3DSOurImporter::CameraList, obj_name, pos, read_float(), read_point(), and target. Referenced by parse_named_object().
00984 {
00985 float bank;
00986 float lens;
00987 vtk3DSCamera *c = (vtk3DSCamera *) malloc (sizeof (vtk3DSCamera));
00988
00989 read_point (importer, pos);
00990 read_point (importer, target);
00991 bank = read_float(importer);
00992 lens = read_float(importer);
00993
00994 strcpy (c->name, obj_name);
00995 c->pos[0] = pos[0];
00996 c->pos[1] = pos[1];
00997 c->pos[2] = pos[2];
00998 c->target[0] = target[0];
00999 c->target[1] = target[1];
01000 c->target[2] = target[2];
01001 c->lens = lens;
01002 c->bank = bank;
01003
01004 VTK_LIST_INSERT (importer->CameraList, c);
01005 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 881 of file vtk3DSOurImporter.cpp. References col, end_chunk(), falloff, hotspot, obj_name, vtk3DSOurImporter::OmniList, parse_colour(), parse_dl_spotlight(), pos, read_point(), vtk3DSOurImporter::SpotLightList, start_chunk(), and target. Referenced by parse_named_object().
00882 {
00883 vtk3DSChunk chunk;
00884 vtk3DSSpotLight *s;
00885 vtk3DSOmniLight *o;
00886 int spot_flag = 0;
00887
00888 read_point (importer, pos);
00889 parse_colour (importer, &col);
00890
00891 do
00892 {
00893 start_chunk (importer, &chunk);
00894
00895 if (chunk.end <= mainchunk->end)
00896 {
00897 switch (chunk.tag)
00898 {
00899 case 0x4620: break;
00900 case 0x4610: parse_dl_spotlight(importer);
00901 spot_flag = 1;
00902 break;
00903 }
00904 }
00905
00906 end_chunk (importer, &chunk);
00907 } while (chunk.end <= mainchunk->end);
00908
00909 if (!spot_flag)
00910 {
00911 o = (vtk3DSOmniLight *) VTK_LIST_FIND (importer->OmniList, obj_name);
00912
00913 if (o != NULL)
00914 {
00915 pos[0] = o->pos[0];
00916 pos[1] = o->pos[1];
00917 pos[2] = o->pos[2];
00918 col = o->col;
00919 }
00920 else
00921 {
00922 o = (vtk3DSOmniLight *) malloc (sizeof (*o));
00923 o->pos[0] = pos[0];
00924 o->pos[1] = pos[1];
00925 o->pos[2] = pos[2];
00926 o->col = col ;
00927 strcpy (o->name, obj_name);
00928 VTK_LIST_INSERT (importer->OmniList, o);
00929 }
00930 }
00931 else
00932 {
00933 s = (vtk3DSSpotLight *) VTK_LIST_FIND (importer->SpotLightList, obj_name);
00934
00935 if (s != NULL)
00936 {
00937 pos[0] = s->pos[0];
00938 pos[1] = s->pos[1];
00939 pos[2] = s->pos[2];
00940 target[0] = s->target[0];
00941 target[1] = s->target[1];
00942 target[2] = s->target[2];
00943 col = s->col;
00944 hotspot = s->hotspot;
00945 falloff = s->falloff;
00946 }
00947 else
00948 {
00949 if (falloff <= 0.0)
00950 {
00951 falloff = 180.0;
00952 }
00953 if (hotspot <= 0.0)
00954 {
00955 hotspot = 0.7*falloff;
00956 }
00957 s = (vtk3DSSpotLight *) malloc (sizeof (*s));
00958 s->pos[0] = pos[0];
00959 s->pos[1] = pos[1];
00960 s->pos[2] = pos[2];
00961 s->target[0] = target[0];
00962 s->target[1] = target[1];
00963 s->target[2] = target[2];
00964 s->col = col ;
00965 s->hotspot = hotspot;
00966 s->falloff = falloff;
00967 strcpy (s->name, obj_name);
00968 VTK_LIST_INSERT (importer->SpotLightList, s);
00969 }
00970 }
00971 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 763 of file vtk3DSOurImporter.cpp. References create_mesh(), end_chunk(), vtk3DSOurImporter::MeshList, obj_name, parse_face_array(), parse_mesh_matrix(), parse_point_array(), and start_chunk(). Referenced by parse_named_object().
00764 {
00765 vtk3DSMesh *mesh;
00766 vtk3DSChunk chunk;
00767
00768 mesh = create_mesh (obj_name, 0, 0);
00769
00770 do
00771 {
00772 start_chunk (importer, &chunk);
00773
00774 if (chunk.end <= mainchunk->end)
00775 {
00776 switch (chunk.tag)
00777 {
00778 case 0x4110: parse_point_array(importer, mesh);
00779 break;
00780 case 0x4120: parse_face_array (importer, mesh, &chunk);
00781 break;
00782 case 0x4160: parse_mesh_matrix(importer, mesh);
00783 break;
00784 }
00785 }
00786
00787 end_chunk (importer, &chunk);
00788 } while (chunk.end <= mainchunk->end);
00789
00790 VTK_LIST_INSERT (importer->MeshList, mesh);
00791 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 722 of file vtk3DSOurImporter.cpp. References cleanup_name(), end_chunk(), obj_name, parse_n_camera(), parse_n_direct_light(), parse_n_tri_object(), read_string(), and start_chunk(). Referenced by parse_mdata().
00723 {
00724 vtk3DSMesh *mesh;
00725 vtk3DSChunk chunk;
00726
00727 strcpy (obj_name, read_string(importer));
00728 cleanup_name (obj_name);
00729
00730 mesh = NULL;
00731
00732 do
00733 {
00734 start_chunk (importer, &chunk);
00735 if (chunk.end <= mainchunk->end)
00736 {
00737 switch (chunk.tag)
00738 {
00739 case 0x4100: parse_n_tri_object (importer, &chunk);
00740 break;
00741 case 0x4600: parse_n_direct_light (importer, &chunk);
00742 break;
00743 case 0x4700: parse_n_camera(importer);
00744 break;
00745 case 0x4010: if (mesh != NULL)
00746 {
00747 mesh->hidden = 1;
00748 }
00749 break;
00750 case 0x4012: if (mesh != NULL)
00751 {
00752 mesh->shadow = 0;
00753 }
00754 break;
00755 }
00756 }
00757
00758 end_chunk (importer, &chunk);
00759 } while (chunk.end <= mainchunk->end);
00760
00761 }
|
Here is the call graph for this function:

|
|
Definition at line 1048 of file vtk3DSOurImporter.cpp. References end_chunk(), parse_float_percentage(), parse_int_percentage(), and start_chunk(). Referenced by parse_mat_entry().
01049 {
01050 vtk3DSChunk chunk;
01051 float percent = 0.0;
01052
01053 start_chunk (importer, &chunk);
01054
01055 switch (chunk.tag)
01056 {
01057 case 0x0030: percent = parse_int_percentage(importer)/100.0;
01058 break;
01059
01060 case 0x0031: percent = parse_float_percentage(importer);
01061 break;
01062
01063 default: vtkGenericWarningMacro( << "Error parsing percentage\n");
01064 }
01065
01066 end_chunk (importer, &chunk);
01067
01068 return percent;
01069 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 794 of file vtk3DSOurImporter.cpp. References read_point(), and read_word(). Referenced by parse_n_tri_object().
00795 {
00796 int i;
00797 mesh->vertices = read_word(importer);
00798 mesh->vertex = (vtk3DSVector *) malloc (mesh->vertices * sizeof(*(mesh->vertex)));
00799 for (i = 0; i < mesh->vertices; i++)
00800 {
00801 read_point (importer, mesh->vertex[i]);
00802 }
00803 }
|
Here is the call graph for this function:

|
|
Definition at line 871 of file vtk3DSOurImporter.cpp. Referenced by parse_face_array().
00872 {
00873 }
|
|
|
|
|
|
Definition at line 1107 of file vtk3DSOurImporter.cpp. References vtk3DSOurImporter::GetFileFD(). Referenced by parse_colour_24(), and read_string().
01108 {
01109 byte data;
01110
01111 data = fgetc (importer->GetFileFD());
01112
01113 return data;
01114 }
|
Here is the call graph for this function:

|
|
Definition at line 1128 of file vtk3DSOurImporter.cpp. References vtk3DSOurImporter::GetFileFD(). Referenced by start_chunk().
01129 {
01130 dword data;
01131
01132 if (fread (&data, 4, 1, importer->GetFileFD()) != 1)
01133 {
01134 // vtkGenericWarningMacro(<<"Pre-mature end of file in read_dword\n");
01135 data = 0;
01136 }
01137
01138 vtkByteSwap::Swap4LE ((char *) &data);
01139 return data;
01140 }
|
Here is the call graph for this function:

|
|
Definition at line 1143 of file vtk3DSOurImporter.cpp. References vtk3DSOurImporter::GetFileFD(). Referenced by parse_colour_f(), parse_dl_spotlight(), parse_float_percentage(), parse_fog(), parse_n_camera(), and read_point().
01144 {
01145 float data;
01146
01147 fread (&data, 4, 1, importer->GetFileFD());
01148 vtkByteSwap::Swap4LE ((char *) &data);
01149 /* TIFFSwabLong (&data);*/
01150
01151 return data;
01152 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 1155 of file vtk3DSOurImporter.cpp. References read_float(). Referenced by parse_dl_spotlight(), parse_n_camera(), parse_n_direct_light(), and parse_point_array().
01156 {
01157 v[0] = read_float(importer);
01158 v[1] = read_float(importer);
01159 v[2] = read_float(importer);
01160 }
|
Here is the call graph for this function:

|
|
Definition at line 1163 of file vtk3DSOurImporter.cpp. References read_byte(). Referenced by parse_mapname(), parse_mat_entry(), parse_msh_mat_group(), and parse_named_object().
01164 {
01165 static char string[80];
01166 int i;
01167
01168 for (i = 0; i < 80; i++)
01169 {
01170 string[i] = read_byte(importer);
01171
01172 if (string[i] == '\0')
01173 {
01174 break;
01175 }
01176 }
01177
01178 return string;
01179 }
|
Here is the call graph for this function:

|
|
Definition at line 1117 of file vtk3DSOurImporter.cpp. References vtk3DSOurImporter::GetFileFD(). Referenced by parse_face_array(), parse_int_percentage(), parse_msh_mat_group(), parse_point_array(), and start_chunk().
01118 {
01119 word data;
01120
01121 fread (&data, 2, 1, importer->GetFileFD());
01122 vtkByteSwap::Swap2LE ((short *) &data);
01123 /* swab ((char *) &data, (char *) &sdata, 2);*/
01124
01125 return data;
01126 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 1088 of file vtk3DSOurImporter.cpp. References vtk3DSOurImporter::GetFileFD(), read_dword(), and read_word(). Referenced by parse_3ds(), parse_3ds_file(), parse_colour(), parse_face_array(), parse_fog(), parse_mapname(), parse_mat_entry(), parse_mdata(), parse_n_direct_light(), parse_n_tri_object(), parse_named_object(), and parse_percentage().
01089 {
01090 chunk->start = ftell(importer->GetFileFD());
01091 chunk->tag = read_word(importer);
01092 chunk->length = read_dword(importer);
01093 if (chunk->length == 0)
01094 {
01095 chunk->length = 1;
01096 }
01097 chunk->end = chunk->start + chunk->length;
01098 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 438 of file vtk3DSOurImporter.cpp. References vtk3DSOurImporter::MaterialList. Referenced by parse_face_array(), and parse_msh_mat_group().
00439 {
00440 vtk3DSMaterial *p;
00441
00442 p = (vtk3DSMaterial *) VTK_LIST_FIND (importer->MaterialList, new_material);
00443
00444 if (p == NULL)
00445 {
00446 p = (vtk3DSMaterial *) malloc (sizeof (*p));
00447 strcpy (p->name, new_material);
00448 p->external = ext;
00449 VTK_LIST_INSERT (importer->MaterialList, p);
00450 }
00451 return p;
00452 }
|
|
|
Definition at line 69 of file vtk3DSOurImporter.cpp. Referenced by create_mprop(). |
|
|
Definition at line 72 of file vtk3DSOurImporter.cpp. Referenced by parse_n_direct_light(). |
|
|
Initial value:
{ "Default", NULL,
{1.0, 1.0, 1.0}, {1.0, 1.0, 1.0}, {1.0, 1.0, 1.0},
70.0,
0.0,
0.0,
0,
"",
0.0,
"",
0.0,
NULL}
Definition at line 79 of file vtk3DSOurImporter.cpp. Referenced by vtk3DSOurImporter::Read3DS(). |
|
|
Definition at line 77 of file vtk3DSOurImporter.cpp. Referenced by parse_dl_spotlight(), and parse_n_direct_light(). |
|
|
Definition at line 71 of file vtk3DSOurImporter.cpp. Referenced by parse_fog(). |
|
|
Definition at line 73 of file vtk3DSOurImporter.cpp. Referenced by parse_mdata(). |
|
|
Definition at line 76 of file vtk3DSOurImporter.cpp. Referenced by parse_dl_spotlight(), and parse_n_direct_light(). |
|
|
Definition at line 70 of file vtk3DSOurImporter.cpp. Referenced by parse_n_camera(), parse_n_direct_light(), parse_n_tri_object(), and parse_named_object(). |
|
|
Definition at line 74 of file vtk3DSOurImporter.cpp. Referenced by parse_n_camera(), and parse_n_direct_light(). |
|
|
Definition at line 75 of file vtk3DSOurImporter.cpp. Referenced by parse_dl_spotlight(), parse_n_camera(), and parse_n_direct_light(). |
1.3.2