OLD | NEW |
1 /* | 1 /* |
2 * $Id$ | 2 * $Id$ |
3 * ***** BEGIN GPL LICENSE BLOCK ***** | 3 * ***** BEGIN GPL LICENSE BLOCK ***** |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or | 5 * This program is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU General Public License | 6 * modify it under the terms of the GNU General Public License |
7 * as published by the Free Software Foundation; either version 2 | 7 * as published by the Free Software Foundation; either version 2 |
8 * of the License, or (at your option) any later version. | 8 * of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This program is distributed in the hope that it will be useful, | 10 * This program is distributed in the hope that it will be useful, |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include <windows.h> | 41 #include <windows.h> |
42 #endif // WIN32 | 42 #endif // WIN32 |
43 | 43 |
44 #include "RAS_Polygon.h" | 44 #include "RAS_Polygon.h" |
45 #include "RAS_TexVert.h" | 45 #include "RAS_TexVert.h" |
46 #include "RAS_IRasterizer.h" | 46 #include "RAS_IRasterizer.h" |
47 #include "RAS_IRenderTools.h" | 47 #include "RAS_IRenderTools.h" |
48 #include "RAS_MeshObject.h" | 48 #include "RAS_MeshObject.h" |
49 #include "RAS_Deformer.h" // __NLA | 49 #include "RAS_Deformer.h" // __NLA |
50 | 50 |
| 51 |
51 /* mesh slot */ | 52 /* mesh slot */ |
52 | 53 |
53 RAS_MeshSlot::RAS_MeshSlot() : SG_QList() | 54 RAS_MeshSlot::RAS_MeshSlot() : SG_QList() |
54 { | 55 { |
55 m_clientObj = NULL; | 56 m_clientObj = NULL; |
56 m_pDeformer = NULL; | 57 m_pDeformer = NULL; |
57 m_OpenGLMatrix = NULL; | 58 m_OpenGLMatrix = NULL; |
58 m_mesh = NULL; | 59 m_mesh = NULL; |
59 m_bucket = NULL; | 60 m_bucket = NULL; |
60 m_bVisible = false; | 61 m_bVisible = false; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 RAS_DisplayArray *RAS_MeshSlot::CurrentDisplayArray() | 212 RAS_DisplayArray *RAS_MeshSlot::CurrentDisplayArray() |
212 { | 213 { |
213 return m_currentArray; | 214 return m_currentArray; |
214 } | 215 } |
215 | 216 |
216 void RAS_MeshSlot::SetDisplayArray(int numverts) | 217 void RAS_MeshSlot::SetDisplayArray(int numverts) |
217 { | 218 { |
218 RAS_DisplayArrayList::iterator it; | 219 RAS_DisplayArrayList::iterator it; |
219 RAS_DisplayArray *darray = NULL; | 220 RAS_DisplayArray *darray = NULL; |
220 ········ | 221 ········ |
| 222 // find an array which doesn't contain the max amount of indices/vertice
s |
221 for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { | 223 for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { |
222 darray = *it; | 224 darray = *it; |
223 | 225 |
224 if(darray->m_type == numverts) { | 226 if(darray->m_type == numverts) { |
225 if(darray->m_index.size()+numverts >= RAS_DisplayArray::
BUCKET_MAX_INDEX) | 227 if(darray->m_index.size()+numverts >= RAS_DisplayArray::
BUCKET_MAX_INDEX) |
226 darray = NULL; | 228 darray = NULL; |
227 else if(darray->m_vertex.size()+numverts >= RAS_DisplayA
rray::BUCKET_MAX_VERTEX) | 229 else if(darray->m_vertex.size()+numverts >= RAS_DisplayA
rray::BUCKET_MAX_VERTEX) |
228 darray = NULL; | 230 darray = NULL; |
229 else | 231 else |
230 break; | 232 break; |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 return true; | 601 return true; |
600 } | 602 } |
601 | 603 |
602 void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa
sterizer* rasty, | 604 void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa
sterizer* rasty, |
603 RAS_IRenderTools* rendertools, RAS_MeshSlot &ms) | 605 RAS_IRenderTools* rendertools, RAS_MeshSlot &ms) |
604 { | 606 { |
605 m_material->ActivateMeshSlot(ms, rasty); | 607 m_material->ActivateMeshSlot(ms, rasty); |
606 | 608 |
607 if (ms.m_pDeformer) | 609 if (ms.m_pDeformer) |
608 { | 610 { |
609 » » ms.m_pDeformer->Apply(m_material); | 611 » » if (ms.m_pDeformer->Apply(m_material)); |
| 612 » » » ms.m_mesh->SetMeshModified(true); |
610 // KX_ReInstanceShapeFromMesh(ms.m_mesh); // Recompute the physics
mesh. (Can't call KX_* from RAS_) | 613 // KX_ReInstanceShapeFromMesh(ms.m_mesh); // Recompute the physics
mesh. (Can't call KX_* from RAS_) |
611 } | 614 } |
612 ········ | 615 ········ |
613 if(IsZSort() && rasty->GetDrawingMode() >= RAS_IRasterizer::KX_SOLID) | 616 if(IsZSort() && rasty->GetDrawingMode() >= RAS_IRasterizer::KX_SOLID) |
614 ms.m_mesh->SortPolygons(ms, cameratrans*MT_Transform(ms.m_OpenGL
Matrix)); | 617 ms.m_mesh->SortPolygons(ms, cameratrans*MT_Transform(ms.m_OpenGL
Matrix)); |
615 | 618 |
616 rendertools->PushMatrix(); | 619 rendertools->PushMatrix(); |
617 if (!ms.m_pDeformer || !ms.m_pDeformer->SkipVertexTransform()) | 620 if (!ms.m_pDeformer || !ms.m_pDeformer->SkipVertexTransform()) |
618 { | 621 { |
619 rendertools->applyTransform(rasty,ms.m_OpenGLMatrix,m_material->
GetDrawingMode()); | 622 rendertools->applyTransform(rasty,ms.m_OpenGLMatrix,m_material->
GetDrawingMode()); |
(...skipping 22 matching lines...) Expand all Loading... |
642 // for text drawing using faces | 645 // for text drawing using faces |
643 if (m_material->GetDrawingMode() & RAS_IRasterizer::RAS_RENDER_3DPOLYGON
_TEXT) | 646 if (m_material->GetDrawingMode() & RAS_IRasterizer::RAS_RENDER_3DPOLYGON
_TEXT) |
644 rasty->IndexPrimitives_3DText(ms, m_material, rendertools); | 647 rasty->IndexPrimitives_3DText(ms, m_material, rendertools); |
645 // for multitexturing | 648 // for multitexturing |
646 else if((m_material->GetFlag() & (RAS_MULTITEX|RAS_BLENDERGLSL))) | 649 else if((m_material->GetFlag() & (RAS_MULTITEX|RAS_BLENDERGLSL))) |
647 rasty->IndexPrimitivesMulti(ms); | 650 rasty->IndexPrimitivesMulti(ms); |
648 // use normal IndexPrimitives | 651 // use normal IndexPrimitives |
649 else | 652 else |
650 rasty->IndexPrimitives(ms); | 653 rasty->IndexPrimitives(ms); |
651 | 654 |
652 » if(rasty->QueryLists()) | 655 |
653 » » if(ms.m_DisplayList) | 656 » ms.m_mesh->SetMeshModified(false); |
654 » » » ms.m_mesh->SetMeshModified(false); | |
655 | 657 |
656 rendertools->PopMatrix(); | 658 rendertools->PopMatrix(); |
657 } | 659 } |
658 | 660 |
659 void RAS_MaterialBucket::Optimize(MT_Scalar distance) | 661 void RAS_MaterialBucket::Optimize(MT_Scalar distance) |
660 { | 662 { |
661 /* TODO: still have to check before this works correct: | 663 /* TODO: still have to check before this works correct: |
662 * - lightlayer, frontface, text, billboard | 664 * - lightlayer, frontface, text, billboard |
663 * - make it work with physics */ | 665 * - make it work with physics */ |
664 ········ | 666 ········ |
665 #if 0 | 667 #if 0 |
666 list<RAS_MeshSlot>::iterator it; | 668 list<RAS_MeshSlot>::iterator it; |
667 list<RAS_MeshSlot>::iterator jt; | 669 list<RAS_MeshSlot>::iterator jt; |
668 | 670 |
669 // greed joining on all following buckets | 671 // greed joining on all following buckets |
670 for(it=m_meshSlots.begin(); it!=m_meshSlots.end(); it++) | 672 for(it=m_meshSlots.begin(); it!=m_meshSlots.end(); it++) |
671 for(jt=it, jt++; jt!=m_meshSlots.end(); jt++) | 673 for(jt=it, jt++; jt!=m_meshSlots.end(); jt++) |
672 jt->Join(&*it, distance); | 674 jt->Join(&*it, distance); |
673 #endif | 675 #endif |
674 } | 676 } |
675 | 677 |
OLD | NEW |