From: <vk...@us...> - 2009-07-30 12:39:48
|
Revision: 32678 http://crystal.svn.sourceforge.net/crystal/?rev=32678&view=rev Author: vknecht Date: 2009-07-30 12:39:37 +0000 (Thu, 30 Jul 2009) Log Message: ----------- Merged revisions 32675,32677 via svnmerge from https://crystal.svn.sourceforge.net/svnroot/crystal/CS/trunk ........ r32675 | sueastside | 2009-07-30 04:20:15 +0200 (jeu., 30 juil. 2009) | 2 lines - Added support for multiple materials (with submeshes) to animesh. - Fixed a bug at animesh.cpp:873 ........ r32677 | sueastside | 2009-07-30 11:55:51 +0200 (jeu., 30 juil. 2009) | 3 lines - Added support for multiple materials (with submeshes) to animesh. - Fixed a bug at animesh.cpp:873 Forget a file :/ ........ Modified Paths: -------------- CS/branches/release/V1.4/include/imesh/animesh.h CS/branches/release/V1.4/plugins/mesh/animesh/object/animesh.cpp CS/branches/release/V1.4/plugins/mesh/animesh/object/animesh.h CS/branches/release/V1.4/plugins/mesh/animesh/persist/standard/animeshldr.cpp Property Changed: ---------------- CS/branches/release/V1.4/ Property changes on: CS/branches/release/V1.4 ___________________________________________________________________ Modified: svnmerge-integrated - /CS/branches/release/V1.4:1-29935,30181,30333,30463 /CS/branches/feature/newanim:1-29823,29839-29840,29842-29865,29944-29973,29976,29978-29981,29983-29996,29999-30013 /CS/branches/feature/rendermanager:1-29759,29761-29886 /CS/trunk:1-29873,29875-29886,29888,29891,29893-29895,29908,29911,29921,29929,29931-29932,29937-29938,29944-29945,29968-29970,29972-29975,29977,29979-29989,29991,29997-29999,30004-30006,30009-30015,30022,30025,30032-30040,30042,30047-30050,30052-30054,30065-30069,30077-30078,30082-30085,30092,30096,30101-30102,30107-30113,30115-30116,30118,30125-30129,30131-30132,30136,30145,30152,30163,30165-30166,30170,30174-30175,30180-30186,30194-30199,30204,30209,30215-30219,30222-30223,30225-30232,30234-30236,30239,30241-30245,30247-30248,30258,30261-30262,30268-30269,30274-30277,30279-30288,30291-30292,30294,30296-30300,30302-30303,30305,30307-30308,30310-30312,30316,30323,30325-30327,30329-30333,30335,30337-30346,30348-30354,30357-30379,30383-30385,30392,30395-30396,30407-30415,30417,30419-30422,30424-30426,30429-30431,30433-30435,30437,30441-30450,30452-30459,30463,30466-30468,30470-30471,30473-30487,30489-30491,30494-30495,30498-30503,30506,30509,30514,30516-30517,30524-30526,30528-30531,30536-30537,30539,30549,30551-30557,30563-30576,30578,30584,30586,30588-30589,30593-30599,30601-30603,30605-30606,30610-30611,30613-30615,30618,30620-30622,30627,30635,30640-30661,30663-30666,30671-30676,30678,30680-30681,30683-30687,30690-30718,30720-30722,30724-30727,30730,30732-30749,30751-30753,30755-30763,30766,30768-30797,30799-30807,30809-30817,30819-30826,30828,30832-30833,30835-30842,30844-30851,30855,30858-30859,30861-30864,30866-30868,30877-30878,30880-30898,30900-30903,30905-30915,30917-30919,30921,30923-30924,30927-30937,30939,30942,30944-30947,30949,30951,30953,30955,30957,30960,30964-30966,30968-30973,30975-30976,30979-30982,30985-30991,30994-30995,30997-30999,31001,31004-31005,31012-31013,31015,31017,31019,31021,31025,31028,31030,31036,31049-31050,31053-31054,31056-31063,31069-31072,31074-31076,31081,31083-31085,31087-31088,31090-31095,31102-31107,31119-31126,31129-31158,31162-31179,31235,31247,31251,31254-31255,31257,31264-31265,31268,31279,31295,31310-31316,31318,31320-31322,31328,31344,31349,31351-31354,31357,31360,31363-31365,31367-31371,31373-31374,31404,31420,31444-31451,31453-31456,31458,31474-31475,31478,31480,31482-31483,31485-31486,31488-31489,31499,31501,31504-31505,31512,31519,31521,31523-31531,31536-31537,31540,31542-31548,31550-31553,31560,31562,31564,31568-31571,31581-31586,31592,31596-31597,31599-31600,31602,31606-31609,31622-31625,31630,31632,31634-31635,31639-31647,31654,31667,31690-31691,31710,31713,31722-31723,31730,31763,31767,31779-31783,31793-31794,31810,31813,31819-31824,31827-31829,31831,31834-31835,31841-31842,31851-31854,31860,31862,31867,31875-31877,31879-31880,31882-31884,31886-31890,31892,31896,31903,31905-31906,31908,31911-31914,31935,31949,31951-31952,31955,31958-31959,31961,32015,32018,32037-32039,32041,32055,32072-32073,32075-32077,32079-32085,32087,32109,32114-32117,32139,32148,32150-32151,32155-32156,32193,32195-32196,32198,32202,32204,32206,32208,32213,32216-32236,32241,32251,32253,32259,32261,32277,32284-32285,32294,32305,32307,32309-32310,32316-32317,32320-32336,32339,32341-32342,32349-32359,32364-32366,32368,32370,32376-32377,32380-32381,32387,32389,32393-32395,32404-32405,32413,32418,32424-32425,32430-32432,32442-32444,32446-32452,32455,32529,32531-32535,32537,32539-32552,32559-32561,32564,32566,32570,32575,32580,32584-32594,32596,32599-32602,32604,32608-32609,32612,32618,32623-32624,32637 + /CS/branches/release/V1.4:1-29935,30181,30333,30463 /CS/branches/feature/newanim:1-29823,29839-29840,29842-29865,29944-29973,29976,29978-29981,29983-29996,29999-30013 /CS/branches/feature/rendermanager:1-29759,29761-29886 /CS/trunk:1-29873,29875-29886,29888,29891,29893-29895,29908,29911,29921,29929,29931-29932,29937-29938,29944-29945,29968-29970,29972-29975,29977,29979-29989,29991,29997-29999,30004-30006,30009-30015,30022,30025,30032-30040,30042,30047-30050,30052-30054,30065-30069,30077-30078,30082-30085,30092,30096,30101-30102,30107-30113,30115-30116,30118,30125-30129,30131-30132,30136,30145,30152,30163,30165-30166,30170,30174-30175,30180-30186,30194-30199,30204,30209,30215-30219,30222-30223,30225-30232,30234-30236,30239,30241-30245,30247-30248,30258,30261-30262,30268-30269,30274-30277,30279-30288,30291-30292,30294,30296-30300,30302-30303,30305,30307-30308,30310-30312,30316,30323,30325-30327,30329-30333,30335,30337-30346,30348-30354,30357-30379,30383-30385,30392,30395-30396,30407-30415,30417,30419-30422,30424-30426,30429-30431,30433-30435,30437,30441-30450,30452-30459,30463,30466-30468,30470-30471,30473-30487,30489-30491,30494-30495,30498-30503,30506,30509,30514,30516-30517,30524-30526,30528-30531,30536-30537,30539,30549,30551-30557,30563-30576,30578,30584,30586,30588-30589,30593-30599,30601-30603,30605-30606,30610-30611,30613-30615,30618,30620-30622,30627,30635,30640-30661,30663-30666,30671-30676,30678,30680-30681,30683-30687,30690-30718,30720-30722,30724-30727,30730,30732-30749,30751-30753,30755-30763,30766,30768-30797,30799-30807,30809-30817,30819-30826,30828,30832-30833,30835-30842,30844-30851,30855,30858-30859,30861-30864,30866-30868,30877-30878,30880-30898,30900-30903,30905-30915,30917-30919,30921,30923-30924,30927-30937,30939,30942,30944-30947,30949,30951,30953,30955,30957,30960,30964-30966,30968-30973,30975-30976,30979-30982,30985-30991,30994-30995,30997-30999,31001,31004-31005,31012-31013,31015,31017,31019,31021,31025,31028,31030,31036,31049-31050,31053-31054,31056-31063,31069-31072,31074-31076,31081,31083-31085,31087-31088,31090-31095,31102-31107,31119-31126,31129-31158,31162-31179,31235,31247,31251,31254-31255,31257,31264-31265,31268,31279,31295,31310-31316,31318,31320-31322,31328,31344,31349,31351-31354,31357,31360,31363-31365,31367-31371,31373-31374,31404,31420,31444-31451,31453-31456,31458,31474-31475,31478,31480,31482-31483,31485-31486,31488-31489,31499,31501,31504-31505,31512,31519,31521,31523-31531,31536-31537,31540,31542-31548,31550-31553,31560,31562,31564,31568-31571,31581-31586,31592,31596-31597,31599-31600,31602,31606-31609,31622-31625,31630,31632,31634-31635,31639-31647,31654,31667,31690-31691,31710,31713,31722-31723,31730,31763,31767,31779-31783,31793-31794,31810,31813,31819-31824,31827-31829,31831,31834-31835,31841-31842,31851-31854,31860,31862,31867,31875-31877,31879-31880,31882-31884,31886-31890,31892,31896,31903,31905-31906,31908,31911-31914,31935,31949,31951-31952,31955,31958-31959,31961,32015,32018,32037-32039,32041,32055,32072-32073,32075-32077,32079-32085,32087,32109,32114-32117,32139,32148,32150-32151,32155-32156,32193,32195-32196,32198,32202,32204,32206,32208,32213,32216-32236,32241,32251,32253,32259,32261,32277,32284-32285,32294,32305,32307,32309-32310,32316-32317,32320-32336,32339,32341-32342,32349-32359,32364-32366,32368,32370,32376-32377,32380-32381,32387,32389,32393-32395,32404-32405,32413,32418,32424-32425,32430-32432,32442-32444,32446-32452,32455,32529,32531-32535,32537,32539-32552,32559-32561,32564,32566,32570,32575,32580,32584-32594,32596,32599-32602,32604,32608-32609,32612,32618,32623-32624,32637,32675,32677 Modified: svn:mergeinfo - /CS/branches/feature/newanim:29839,29842-29865,29944,30013 /CS/branches/feature/plugin-merge:31103,31131-31137 /CS/branches/soc2008/threadcomm:30471,30486 /CS/trunk:29921,29991,30004,30048,30066,30165-30166,30232,30243,30262,30332,30350,30359-30360,30396,30408,30417,30419-30420,30424-30426,30441,30443-30450,30466,30473,30487,30489-30491,30495,30498-30503,30514,30539,30549,30551,30553-30557,30564,30570,30576,30586,30588-30589,30596-30599,30601,30605-30606,30610-30611,30614,30618,30620-30622,30627,30635,30643,30687,30698-30699,30710,30746-30749,30751,30755-30761,30771-30776,30784-30785,30793-30796,30799-30801,30805,30815,30819,30821-30822,30832,30837-30838,30846,30880,30897,30908-30910,30932-30937,30951,30953,30957,30960,30964-30966,30968-30970,30979-30980,30982,30985-30991,30995,30997-30999,31001,31015,31019,31021,31028,31050,31053-31054,31061,31070-31072,31076,31083-31085,31087,31090-31092,31095,31138-31139,31247,31251,31254-31255,31257,31264-31265,31279,31295,31310,31313-31315,31321-31322,31328,31344,31357,31360,31363-31365,31371,31404,31444,31447,31449,31453-31456,31474,31478,31501,31519,31523-31524,31526,31528-31530,31536,31543,31545,31547,31553,31560,31564,31568,31585-31586,31592,31599-31600,31602,31606-31609,31622-31625,31630,31632,31634-31635,31639,31641-31646,31667,31690,31710,31722,31730,31763,31767,31779-31783,31810,31813,31819,31821-31823,31827-31829,31831,31834,31841-31842,31892,31896,31903,31905-31906,31908,31911-31914,31935,31949,31951-31952,31955,31958-31959,31961,32015,32018,32037-32039,32041,32055,32072,32085,32087,32109,32114-32117,32139,32148,32155,32193,32195-32196,32198,32202,32204,32206,32208,32213,32225,32227-32229,32234,32236,32251,32259,32277,32284-32285,32294,32305,32307,32335-32336,32341,32349,32356,32358,32380,32387,32393-32394,32430,32446-32452,32455,32529,32531-32535,32537,32544-32549,32609,32612,32618,32623-32624,32637 + /CS/branches/feature/newanim:29839,29842-29865,29944,30013 /CS/branches/feature/plugin-merge:31103,31131-31137 /CS/branches/soc2008/threadcomm:30471,30486 /CS/trunk:29921,29991,30004,30048,30066,30165-30166,30232,30243,30262,30332,30350,30359-30360,30396,30408,30417,30419-30420,30424-30426,30441,30443-30450,30466,30473,30487,30489-30491,30495,30498-30503,30514,30539,30549,30551,30553-30557,30564,30570,30576,30586,30588-30589,30596-30599,30601,30605-30606,30610-30611,30614,30618,30620-30622,30627,30635,30643,30687,30698-30699,30710,30746-30749,30751,30755-30761,30771-30776,30784-30785,30793-30796,30799-30801,30805,30815,30819,30821-30822,30832,30837-30838,30846,30880,30897,30908-30910,30932-30937,30951,30953,30957,30960,30964-30966,30968-30970,30979-30980,30982,30985-30991,30995,30997-30999,31001,31015,31019,31021,31028,31050,31053-31054,31061,31070-31072,31076,31083-31085,31087,31090-31092,31095,31138-31139,31247,31251,31254-31255,31257,31264-31265,31279,31295,31310,31313-31315,31321-31322,31328,31344,31357,31360,31363-31365,31371,31404,31444,31447,31449,31453-31456,31474,31478,31501,31519,31523-31524,31526,31528-31530,31536,31543,31545,31547,31553,31560,31564,31568,31585-31586,31592,31599-31600,31602,31606-31609,31622-31625,31630,31632,31634-31635,31639,31641-31646,31667,31690,31710,31722,31730,31763,31767,31779-31783,31810,31813,31819,31821-31823,31827-31829,31831,31834,31841-31842,31892,31896,31903,31905-31906,31908,31911-31914,31935,31949,31951-31952,31955,31958-31959,31961,32015,32018,32037-32039,32041,32055,32072,32085,32087,32109,32114-32117,32139,32148,32155,32193,32195-32196,32198,32202,32204,32206,32208,32213,32225,32227-32229,32234,32236,32251,32259,32277,32284-32285,32294,32305,32307,32335-32336,32341,32349,32356,32358,32380,32387,32393-32394,32430,32446-32452,32455,32529,32531-32535,32537,32544-32549,32609,32612,32618,32623-32624,32637,32675,32677 Modified: CS/branches/release/V1.4/include/imesh/animesh.h =================================================================== --- CS/branches/release/V1.4/include/imesh/animesh.h 2009-07-30 09:55:51 UTC (rev 32677) +++ CS/branches/release/V1.4/include/imesh/animesh.h 2009-07-30 12:39:37 UTC (rev 32678) @@ -24,6 +24,7 @@ #include "imesh/skeleton2.h" struct iRenderBuffer; +struct iMaterialWrapper; struct iAnimatedMeshFactory; struct iAnimatedMeshFactorySubMesh; @@ -392,7 +393,7 @@ */ struct iAnimatedMeshFactorySubMesh : public virtual iBase { - SCF_INTERFACE(iAnimatedMeshFactorySubMesh, 1, 0, 0); + SCF_INTERFACE(iAnimatedMeshFactorySubMesh, 1, 1, 0); /** * Get the index buffer for this submesh. Defines a triangle list. @@ -408,6 +409,16 @@ * Get the bone indices used by a given index set */ virtual const csArray<unsigned int>& GetBoneIndices (size_t set) = 0; + + /** + * Get the material + */ + virtual iMaterialWrapper* GetMaterial () const = 0; + + /** + * Set the material, or 0 to use default. + */ + virtual void SetMaterial (iMaterialWrapper* material) = 0; }; Modified: CS/branches/release/V1.4/plugins/mesh/animesh/object/animesh.cpp =================================================================== --- CS/branches/release/V1.4/plugins/mesh/animesh/object/animesh.cpp 2009-07-30 09:55:51 UTC (rev 32677) +++ CS/branches/release/V1.4/plugins/mesh/animesh/object/animesh.cpp 2009-07-30 12:39:37 UTC (rev 32678) @@ -613,22 +613,7 @@ const csReversibleTransform o2wt = movable->GetFullTransform (); //const csVector3& wo = o2wt.GetOrigin (); - - - // Fetch the material - iMaterialWrapper* mat = material; - if (!mat) - mat = factory->material; - if (!mat) - { - csPrintf ("INTERNAL ERROR: mesh used without material!\n"); - return 0; - } - - if (mat->IsVisitRequired ()) - mat->Visit (); - uint frameNum = rview->GetCurrentFrameNumber (); // Iterate all submeshes... @@ -639,7 +624,22 @@ Submesh* sm = submeshes[i]; FactorySubmesh* fsm = factory->submeshes[i]; + + // Fetch the material + iMaterialWrapper* submat = sm->material; + if (!submat) submat = fsm->material; + if (!submat) submat = material; + if (!submat) submat = factory->material; + if (!submat) + { + csPrintf ("INTERNAL ERROR: mesh used without material!\n"); + return 0; + } + + if (submat->IsVisitRequired ()) + submat->Visit (); + for (size_t j = 0; j < fsm->indexBuffers.GetSize (); ++j) { bool rmCreated; @@ -654,7 +654,7 @@ meshPtr->meshtype = CS_MESHTYPE_TRIANGLES; meshPtr->indexstart = 0; meshPtr->indexend = (unsigned int)fsm->indexBuffers[j]->GetElementCount (); - meshPtr->material = mat; + meshPtr->material = submat; meshPtr->mixmode = mixMode; meshPtr->buffers = sm->bufferHolders[j]; @@ -872,7 +872,7 @@ for (size_t j = 0; j < fsm->bufferHolders.GetSize (); ++j) { csRef<csRenderBufferHolder> bufferHolder; - bufferHolder.AttachNew (new csRenderBufferHolder (*fsm->bufferHolders[i])); + bufferHolder.AttachNew (new csRenderBufferHolder (*fsm->bufferHolders[j])); // Setup the accessor to this mesh bufferHolder->SetAccessor (rba, Modified: CS/branches/release/V1.4/plugins/mesh/animesh/object/animesh.h =================================================================== --- CS/branches/release/V1.4/plugins/mesh/animesh/object/animesh.h 2009-07-30 09:55:51 UTC (rev 32677) +++ CS/branches/release/V1.4/plugins/mesh/animesh/object/animesh.h 2009-07-30 12:39:37 UTC (rev 32678) @@ -179,7 +179,7 @@ { public: FactorySubmesh () - : scfImplementationType (this) + : scfImplementationType (this), material(0) {} virtual iRenderBuffer* GetIndices (size_t set) @@ -218,6 +218,16 @@ csRef<iRenderBuffer> boneWeightAndIndexBuffer[2]; }; csArray<RemappedBones> boneMapping; + + iMaterialWrapper* material; + + /// Get the material + virtual iMaterialWrapper* GetMaterial () const { return material; } + + /// Set the material, or 0 to use default. + virtual void SetMaterial (iMaterialWrapper* m) { material = m; } + + }; @@ -365,7 +375,7 @@ public: Submesh (AnimeshObject* meshObject, FactorySubmesh* factorySubmesh) : scfImplementationType (this), meshObject (meshObject), - factorySubmesh (factorySubmesh), isRendering (true) + factorySubmesh (factorySubmesh), material(0), isRendering (true) {} virtual iAnimatedMeshFactorySubMesh* GetFactorySubMesh () @@ -385,6 +395,7 @@ AnimeshObject* meshObject; FactorySubmesh* factorySubmesh; + iMaterialWrapper* material; bool isRendering; csRefArray<csShaderVariableContext> svContexts; Modified: CS/branches/release/V1.4/plugins/mesh/animesh/persist/standard/animeshldr.cpp =================================================================== --- CS/branches/release/V1.4/plugins/mesh/animesh/persist/standard/animeshldr.cpp 2009-07-30 09:55:51 UTC (rev 32677) +++ CS/branches/release/V1.4/plugins/mesh/animesh/persist/standard/animeshldr.cpp 2009-07-30 12:39:37 UTC (rev 32678) @@ -219,6 +219,8 @@ { // Handle submesh csRef<iRenderBuffer> indexBuffer; + + csRef<iMaterialWrapper> material; csRef<iDocumentNodeIterator> it = child->GetNodes (); while (it->HasNext ()) @@ -239,16 +241,28 @@ } } break; + case XMLTOKEN_MATERIAL: + { + const char* matname = child2->GetContentsValue (); + material = ldr_context->FindMaterial (matname); + if (!material) + { + synldr->ReportError (msgidFactory, child2, "Couldn't find material '%s'!", + matname); + return 0; + } + } + break; default: synldr->ReportBadToken (child2); return 0; } } - if (indexBuffer) { - amfact->CreateSubMesh (indexBuffer); + iAnimatedMeshFactorySubMesh* smf = amfact->CreateSubMesh (indexBuffer); + smf->SetMaterial(material); } } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |