| Christopher's profilelogin: charrisPhotosBlogLists | Help |
login: charrisI lost my sammwich somewhere in this software. |
|||||||||||||||||
|
December 08 Zigmund Studios is now Open!August 22 Drawing a Model with a Custom EffectThis wasn't so straight forward for me to figure out the first time around, so I thought this might help some others out. I wanted to draw a model I imported from XSI with a custom effect, not one already created for the model itself. This is mainly because I wanted to play around with some HLSL effects but with a model of interest to me I already had going.
Basically, the idea is fairly simple, but again wasn't obvious to me at first pass. For each mesh, take each mesh part, set your effect, for each pass of the effect's technique, draw the mesh by hand. I missed the one important part, Begin() not only the effect, but the effect pass.
private void DrawSkullUsingMeshParts() { SetBasicEffect(basicEffect); ModelMesh mesh = skull.Meshes[0]; foreach (ModelMeshPart part in mesh.MeshParts) { GraphicsDevice.VertexDeclaration = part.VertexDeclaration; GraphicsDevice.Vertices[0].SetSource(mesh.VertexBuffer, part.StreamOffset, part.VertexStride); GraphicsDevice.Indices = mesh.IndexBuffer; basicEffect.World = Matrix.CreateRotationZ(MathHelper.ToRadians(skullRotation)); basicEffect.Begin(); foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes) { pass.Begin(); GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, part.BaseVertex, 0, part.NumVertices, part.StartIndex, part.PrimitiveCount); pass.End(); } basicEffect.End(); } } The only part I couldn't figure out was how to determine the primitive type. I just guessed that XSI was publishing with TriangleList. June 12 There is No LateHi. I moved. Just to let ya know. Yeah in the last month or so I've moved from Then after that point that's when I stopped taking cell phone pictures because my phone does not breath underwater as I had often wondered. That's how it's all gone down the last couple of weeks. Huge change of pace, but I think it's really one of the best decisions me and Kamila have ever made. I can lose myself for hours looking out my apartment window into the nearby tree line. Best yet, a new bands in town... Keep posted. March 14 Introductions. An uncomfortable neccessity."There are no blog entries. Click Add to add an entry." Hey, I'll miss you introductory warning message. It's a shame your usefulness is so short lived. At least you can go nag someone else now because I'm going to post this great introductory blog that will really convince everyone we really are living in the matrix. What I'll actually post I have no idea. I'll probably write a lot of weird stuff, make lots of references to food. Have the random blurb about how I hate working on AIX operating systems. Complain about other blogs that are lame and such. Write about how .NET will take over the world of software development. Maybe I'll even state a feeling or two, probably put you to sleep writing about how awesome my wife is. Did you know she speak Polish? Chyea, that's pretty awesome. My dog is awesome. My computer is pretty awesome (needs a new video card). My work PC....... not awesome. Chalk boards....not awesome. Dry erase boards..... awesome. Too bad there's no paid gigs for being a professional dry erase board doodler. Ok time to make my random blurb of the day: I cake when I hit then scream. Did you hear that scream, oh my goodness it's kind of like butter falling from jolly green giant's nose. I love you nose dropping, please, please color my book with crayons, and do not favor the lip of a golden retreiver attempting to ride a dirt bike. |
||||||||||||||||
|
|