Changeset 8334 in orxonox.OLD for branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
- Timestamp:
- Jun 12, 2006, 11:56:02 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
r8329 r8334 103 103 const void BspManager::tick(float time) 104 104 { 105 105 106 106 if(!this->bspFile->MovieMaterials.empty()) 107 107 { … … 109 109 while(it != this->bspFile->MovieMaterials.end()) 110 110 { 111 (*it)->tick(time); 111 (*it)->tick(time); 112 112 it++; 113 113 } 114 114 //this->bspFile->MovieMaterials.front()->tick(time ); 115 116 117 } 118 115 116 117 } 118 119 119 } 120 120 const void BspManager::draw() … … 319 319 if(this->bspFile->Materials[curFace.texture].animated) { 320 320 // glBlendFunc(GL_ZERO,GL_ONE); 321 322 323 321 322 323 324 324 if(this->bspFile->Materials[curFace.texture].aviMat->getStatus() == 2) this->bspFile->Materials[curFace.texture].aviMat->start(0); 325 325 //this->bspFile->Materials[curFace.texture].aviMat->tick(0.005); … … 328 328 glBindTexture(GL_TEXTURE_2D, n ); 329 329 this->lastTex = curFace.texture; 330 330 331 331 } else { 332 332 this->bspFile->Materials[curFace.texture].mat->select(); … … 755 755 756 756 float EPSILON = 0.000001; 757 float endDistance = (end)->x * (node->plane.x) +(end)->y * (node->plane.y) +(end)->z * (node->plane.z) - node->d; 758 float startDistance = (start)->x * (node->plane.x)+ (start)->y * (node->plane.y)+ (start)->z * (node->plane.z)- node->d; 759 760 761 if(node->isLeaf) { 757 758 float endDistance = end->dot(node->plane) - node->d; 759 float startDistance = start->dot(node->plane) - node->d; 760 761 762 if( node->isLeaf) { 762 763 leaf& curLeaf = this->bspFile->leaves[node->leafIndex]; 763 764 for (int i = 0; i < curLeaf.n_leafbrushes ; i++) { … … 812 813 813 814 // STEP 3: calculate the middle point for the first side 814 middleFraction = startFraction + 815 (endFraction - startFraction) * fraction1; 816 817 middle.x = start->x + fraction1 * (end->x - start->x); 818 middle.y = start->y + fraction1 * (end->y - start->y); 819 middle.z = start->z + fraction1 * (end->z - start->z); 815 middleFraction = startFraction + (endFraction - startFraction) * fraction1; 816 middle = (*start) + ((*end) - (*start)) * fraction1; 817 820 818 821 819 // STEP 4: check the first side … … 827 825 828 826 // STEP 5: calculate the middle point for the second side 829 middleFraction = startFraction + 830 (endFraction - startFraction) * fraction2; 831 832 middle.x = start->x + fraction2 * (end->x - start->x); 833 middle.y = start->y + fraction2 * (end->y - start->y); 834 middle.z = start->z + fraction2 * (end->z - start->z); 827 middleFraction = startFraction + (endFraction - startFraction) * fraction2; 828 middle = (*start) + ((*end) - (*start)) * fraction2; 835 829 836 830 // STEP 6: check the second side … … 886 880 dest.z += forwardDir.z; 887 881 */ 888 882 889 883 dest = worldEntity->getAbsCoor(); 890 884 Vector out = dest; 891 892 893 894 895 896 897 898 885 899 886 … … 913 900 Vector out1; 914 901 Vector out2; 915 /* 916 this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 ); 917 if(this->outputFraction == 1.0f) out1 = dest; 918 else {( 919 collision = true; 920 out1.x = position1.x + (dest1.x -position1.x) * this->outputFraction; 921 out1.y = position1.y + (dest1.y -position1.y) * this->outputFraction; 922 out1.z = position1.z + (dest1.z - position1.z) * this->outputFraction; 923 924 } 925 926 this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 ); 927 if(this->outputFraction == 1.0f) out2= dest; 928 else { 929 collision = true; 930 out2.x = position2.x + (dest2.x -position2.x) * this->outputFraction; 931 out2.y = position2.y + (dest2.y -position2.y) * this->outputFraction; 932 out2.z = position2.z + (dest2.z - position2.z) * this->outputFraction; 933 934 } 935 936 */ 902 937 903 938 904 float height = 40; … … 940 906 941 907 this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest ); 942 if(this->outputFraction == 1.0f) 908 909 if( this->outputFraction == 1.0f) 943 910 { 944 911 if(this->outputAllSolid) 945 912 { 913 PRINTF(0)("this output all solid\n"); 946 914 this->collPlane = new plane; 947 915 this->collPlane->x = 1.0f; … … 949 917 this->collPlane->z = 0.0f; 950 918 collision = true; 951 952 919 } 953 else collision = false; 920 else 921 collision = false; 922 923 954 924 out = dest; 955 956 925 } 957 926 else { 958 927 959 928 collision = true; 960 929 out.x = position.x + (dest.x -position.x) * this->outputFraction; … … 968 937 //this->drawDebugCube(&out1); 969 938 //this->drawDebugCube(&out2); 970 971 939 //this->drawDebugCube(&out3); 972 973 } 974 975 976 940 } 977 941 // Return the normal here: Normal's stored in this->collPlane; 978 979 942 if(collision ) { 980 943 PRINTF(0)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction); 981 944 worldEntity->registerCollision(this->parent, worldEntity, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out); 982 945 } 983 //worldEntity->collidesWithGround(out,out1,out2);984 // registerCollision(WorldEntity* entity, Vector(this->collPlane.x, ), Vector position);985 986 946 } 987 947
Note: See TracChangeset
for help on using the changeset viewer.