Problem with loading models using CreateFromCMO.

Mar 11, 2015 at 1:52 AM
Hi,

I use in my project a DirectXTK library and I load my 3D models thought function CreateFromCMO I have some models, that have the same verticles, but using different bitmaps. I noticed, that this library has some of cache error, because I have three models, that should have different colors, but they don't, they have colors of first loaded model. What is wrong? Can anybody help me?
Coordinator
Mar 11, 2015 at 4:19 AM
The texture/effect cache is based on the 'material' name in the model. If you want them to be different materials, you should use different names so you can keep the efficiency of shared shaders & textures.

Otherwise, you can disable the sharing on the EffectFactory or DGSLEffecFactory by calling this method before loading your models:
factory->SetSharing( false );
Marked as answer by walbourn on 3/10/2015 at 9:19 PM
Mar 11, 2015 at 6:34 PM
I have different names of materials in the models, but setting sharing on false works. I wonder, why I have this error. But thanks for help :)
Coordinator
Mar 12, 2015 at 5:56 PM
Try putting a break-point in the EffectFactory code and see what happens with the lookup. Let me know what you find!
Mar 12, 2015 at 7:09 PM
I put breakpoint in EffectFactory and I can only notice, that when I load similar models, but with different names of materials and cmo files, I see, that fuction CreateTexture doesn't run.
Coordinator
Mar 13, 2015 at 12:19 AM
Can you run the cmodump.cpp tool on a few of your .CMO files and put the results here?
Mar 14, 2015 at 7:23 PM
I cannot setup project with this file, can you give me complete vs project to run this program?
Coordinator
Mar 15, 2015 at 5:53 AM
Edited Mar 15, 2015 at 5:55 AM
Just run the "Developer Command Prompt" for VS 2012, 2013, or 2015, change to the directory where you have saved the cmodump.cpp file. Then type:
cl /EHsc cmodump.cpp
It will compile a cmodump.exe. You then run it as
cmodump filename.cmo