custom Model with Custom Effect?

Nov 1, 2009 at 11:01 PM

Hi all,

I'm having a hard time trying to add my own model in an Ox Game Project.

My basic Idea was to write my own model class for my specific model. I took the Ox-Class "StandardModel.cs" as a guideline and tried to change only the parts of the code, which would allow me to have my own model and my own effect.
It was easy for the model - I just had to replace the  model-Filename. But the effect is tricky: I started by writing a new Surface-class for my model and took "StandardSurface" as a reference respectively. There I added the code needed for my effect (set the specific parameters before drawing).

Right now I'm pretty much stuck at the implementation of "CreateSurface()" within my model class. It looks this way after copying from StandardModel.cs:

 

 

 private void CreateSurface(int meshIndex, int partIndex)

        {

            IStandardSurfaceFactory surfaceFactory = Engine.GetService<IStandardSurfaceFactory>();

            surfaceFactory.CreateStandardSurface(this, meshIndex, partIndex);

        }

so some fancy factory-class is responsible for creating the surface.... now... do I really have to write my own SurfaceFactory now?? 
That seems a bit exaggerated to me... So I rather guess I'm on the totally wrong way.
Any suggestions for an easier way of doing this?

 

 

 

 

 private void CreateSurface(int meshIndex, int partIndex)
        {
            IStandardSurfaceFactory surfaceFactory = Engine.GetService<IStandardSurfaceFactory>();
            surfaceFactory.CreateStandardSurface(this, meshIndex, partIndex);
        } private void CreateSurface(int meshIndex, int partIndex)
        {
            IStandardSurfaceFactory surfaceFactory = Engine.GetService<IStandardSurfaceFactory>();
            surfaceFactory.CreateStandardSurface(this, meshIndex, partIndex);
        }