Changeset 2685 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 05/17/08 01:15:07 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2680 r2685 1509 1509 int pvsSize; 1510 1510 1511 float error = GetPixelError(pvsSize); 1512 1513 mPvsErrorBuffer[i].mError = error; 1511 mPvsErrorBuffer[i].mError = GetPixelError(pvsSize); 1514 1512 mPvsErrorBuffer[i].mPvsSize = pvsSize; 1515 1513 … … 1587 1585 //cout << "\n\nvp: " << (*sit) << endl; 1588 1586 SimpleRay sray = *sit; 1589 int pvsSize = 0;1587 int pvsSize = -1; 1590 1588 1591 1589 // set frame id for saving the error buffer … … 1599 1597 { 1600 1598 // compute the pixel error 1601 const float error = GetPixelError(pvsSize); 1602 1603 mPvsErrorBuffer[i].mError = error; 1599 mPvsErrorBuffer[i].mError = GetPixelError(pvsSize); 1604 1600 mPvsErrorBuffer[i].mPvsSize = pvsSize; 1605 1601 1606 const int pixelError = (int)mPvsErrorBuffer[i].mError * GetWidth() * GetHeight(); 1607 1608 if (0 && (pixelError > 0) && (pvsSize > 0)) 1602 if (0 && (mPvsErrorBuffer[i].mError * GetWidth() * GetHeight() > 0) && (pvsSize > 0)) 1609 1603 { 1610 cout << "err :" << i << "," << mViewPoint << "," << mViewDirection << " "1604 cout << "error in frame " << i << "," << mViewPoint << "," << mViewDirection << " " 1611 1605 << mPvsErrorBuffer[i].mError * GetWidth() * GetHeight() << endl; 1612 1606 } … … 1620 1614 1621 1615 if (//(mFrame > 0) && 1622 (err >= 0.0f) && (err < (1.0f - 1e-6f)) && (pvsSize >0))1616 (err >= -1e-6f) && (err < (1.0f - 1e-6f)) && (pvsSize != 0)) 1623 1617 { 1624 1618 if (err > mPvsStat.maxError) 1625 1619 { 1626 1620 mPvsStat.maxError = err; 1627 1628 1621 cout << "new max error: " << mPvsStat.maxError * GetWidth() * GetHeight() << endl; 1629 1622 } … … 1638 1631 // moved it back here not to count frames with negative err (backfacing triangle) 1639 1632 ++ mPvsStat.frames; 1633 } 1634 else 1635 { 1636 cerr << "warning: negative error " << err << " at pvs size " << pvsSize << endl; 1640 1637 } 1641 1638 … … 1843 1840 } 1844 1841 1842 1845 1843 void GlRenderer::_UpdatePvsIndices(KdNode *node, int &indexBufferSize) 1846 1844 { … … 1872 1870 { 1873 1871 obj->mRenderedFrame = mCurrentFrame; 1874 1875 mIndices[indexBufferSize + 0] = (obj->GetId() - 1) * 3 + 0; 1876 mIndices[indexBufferSize + 1] = (obj->GetId() - 1) * 3 + 1; 1877 mIndices[indexBufferSize + 2] = (obj->GetId() - 1) * 3 + 2; 1872 1873 const int id = obj->GetId() * 3; 1874 1875 mIndices[indexBufferSize + 0] = id + 0; 1876 mIndices[indexBufferSize + 1] = id + 1; 1877 mIndices[indexBufferSize + 2] = id + 2; 1878 1878 1879 1879 indexBufferSize += 3; … … 1890 1890 void GlRenderer::CreateVertexArrays(SceneGraphLeaf *leaf) 1891 1891 { 1892 mData = new Vector3[leaf->mGeometry.size() * 6];1893 mIndices = new unsigned int[leaf->mGeometry.size() * 3];1894 1895 1892 size_t offset = leaf->mGeometry.size() * 3; 1893 1894 mData = new Vector3[offset * 2]; 1895 mIndices = new unsigned int[offset]; 1896 1896 1897 1897 1898 for (size_t i = 0; i < leaf->mGeometry.size(); ++ i) … … 1909 1910 mData[offset + i * 3 + 1] = n; 1910 1911 mData[offset + i * 3 + 2] = n; 1912 1913 mIndices[i * 3 + 0] = 0; 1914 mIndices[i * 3 + 1] = 0; 1915 mIndices[i * 3 + 2] = 0; 1911 1916 } 1912 1917 … … 1921 1926 glNormalPointer(GL_FLOAT, 0, (char *)NULL + offset * sizeof(Vector3)); 1922 1927 1923 glBufferDataARB(GL_ARRAY_BUFFER_ARB, leaf->mGeometry.size() * 6* sizeof(Vector3), mData, GL_STATIC_DRAW_ARB);1928 glBufferDataARB(GL_ARRAY_BUFFER_ARB, offset * 2 * sizeof(Vector3), mData, GL_STATIC_DRAW_ARB); 1924 1929 glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); 1925 1930 -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2682 r2685 1535 1535 } 1536 1536 #else 1537 return mObjects[id - 1];1537 return mObjects[id]; 1538 1538 #endif 1539 1539 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2683 r2685 581 581 glDrawElements(GL_TRIANGLES, mIndexBufferSize, GL_UNSIGNED_INT, mIndices); 582 582 583 #if 0//DYNAMIC_OBJECTS_HACK583 #if DYNAMIC_OBJECTS_HACK 584 584 // handle dynamic objects 585 585 DynamicObjectsContainer::const_iterator dit, dit_end = mDynamicObjects.end(); … … 819 819 if (e->modifiers() & Qt::AltModifier) 820 820 if (mCurrentDynamicObjectIdx >= 0) { 821 // 821 // preprocessor->ScheduleUpdateDynamicObjects(); 822 822 } 823 823 } … … 829 829 float TURN_SENSITIVITY = 0.1f; 830 830 float TILT_SENSITIVITY = 32.0 ; 831 float TURN_ANGLE= M_PI /36.0 ;831 float TURN_ANGLE= M_PI / 36.0 ; 832 832 833 833 int x = e->pos().x(); … … 843 843 mViewPoint.y += (y-mousePoint.y)*MOVE_SENSITIVITY / 2.0; 844 844 mViewPoint.x += (x-mousePoint.x)*MOVE_SENSITIVITY / 2.0; 845 } 845 } 846 846 #if DYNAMIC_OBJECTS_HACK 847 847 else if (e->modifiers() & Qt::AltModifier) … … 883 883 } 884 884 885 #if USE_TRANSFORMED_MESH_INSTANCE_HACK886 TransformedMeshInstance *tmi = mViewCellsManager->GetPreprocessor()->mDynamicObjects[mCurrentDynamicObjectIdx];887 tmi->ApplyWorldTransform(tm);888 #else889 885 SceneGraphLeaf *l = 890 886 mViewCellsManager->GetPreprocessor()->mDynamicObjects[mCurrentDynamicObjectIdx]; 891 887 l->ApplyTransform(tm); 892 888 893 #endif894 889 updateGL(); 895 890 } -
GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor05.vcproj
r2680 r2685 157 157 LinkIncremental="1" 158 158 AdditionalLibraryDirectories=""$(QTDIR)\lib";..\src\GL;"..\lib05\$(ConfigurationName)";..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;"..\MultiLevelRayTracing\RTScene\$(ConfigurationName)";"..\MultiLevelRayTracing\RTWorld\$(ConfigurationName)";"QtInterface\$(ConfigurationName)";"..\..\..\..\..\..\NonGTP\Xerces\xerces-c_2_8_0\lib";"$(CG_LIB_PATH)"" 159 GenerateDebugInformation=" true"159 GenerateDebugInformation="false" 160 160 SubSystem="1" 161 161 LargeAddressAware="2"
Note: See TracChangeset
for help on using the changeset viewer.