Skip to main content
GameDev.net gamedev.net
🔒 Locked

Model world and effect file.

Started by lyzerk Aug 29, 2012 at 1:49 PM 4 replies 1.2k views
Original Post
lyzerk
lyzerk
Hello,

I was working with XNA a couple month ago, there is was BasicEffect. With that basiceffect we can give place of model. But with c++ and directx 9.
I cant found any tutorial about that but i have found that

call it;
pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );

after render model

call it;
pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld2 );

after render model

and now i have 2 model on screen.

i can't understand that, its not logic for me. How can i do BasicEffect in c++ directx9 ?


Sorry for my english, im just trying for learn :/
kauna
kauna
Well that is the way it works.

You set the transform matrix and then draw the model, which uses then the transform matrix. Logically, using 2 different matrices, your model will show at 2 different locations.

If I understand correctly, Basic Effect is a simple frame work which implements certain effect functionality.
I think that you may find a shader which implements most of the functionality here:

http://developer.amd.com/archive/gpusamples/fixedfuncshader/Pages/default.aspx

Cheers!
CC Ricers
CC Ricers
The function calls you listed are not enough to render a second model. Your models are rendered through DrawIndexedPrimitives or similar other functions. Unless I read your message wrong and you are saying you are trying to render two models with different matrices assigned to them?

BasicEffect object helps abstract away most of the effect work to make it easier for beginners to do (plus on certain platforms you're just limited to using built-in effects). You can also work with custom effects in XNA, and there are enough tutorials such as this one to show you how. I would imagine it may be better to use XNA to understand how implementing your own effects work in general so the transition to using them in DX9 becomes easier.
kauna
kauna

The function calls you listed are not enough to render a second model.


On the contrary. It is enough to just set another world matrix and call the required rendering functions. The given functions are rather pseudo of course.

However, I'm thinking that there is some ambiguity in the OPs message. I'm not sure whether he managed to draw something or not.

Cheers!
CC Ricers
CC Ricers

[quote name='CC Ricers' timestamp='1346252038' post='4974448']
The function calls you listed are not enough to render a second model.


On the contrary. It is enough to just set another world matrix and call the required rendering functions. The given functions are rather pseudo of course.
[/quote]

Oh, I must have missed that those short statements were meant to be pseudo code.
lyzerk
lyzerk
Thanks for answers. But now i have problem. here is link.

http://www.gamedev.net/topic/630488-terrain-texture-problem/

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.