Sign in to follow this  
Mathy

[SlimDX] CustomVertex.TransformedTextured?

Recommended Posts

Mathy    104
How can I create the equivalent of MDX's CustomVertex.TransformedTextured object in SlimDX? [Edited by - Mathy on March 17, 2010 10:51:07 AM]

Share this post


Link to post
Share on other sites
jpetrie    13159
There is no such object in native D3D, so SlimDX doesn't have an equivalent. You need to create the structure manually, something like:

struct PretransformedVertex {
public Vector4 Position;
public Vector2 Texcoord;
}

Et cetera. The FVF values are represented by the VertexFormat enumeration in SlimDX, so you can use those to create the FVF for this vertex structure. There are examples of this process in the SDK samples (MiniTri, for example).

Share this post


Link to post
Share on other sites
Mathy    104
That's not correct it seems.

The TransformedTextured class in MDX has 6 creation arguments.

As an example:

new CustomVertex.TransformedTextured(-0.5f, -0.5f, 0.0f, 1.0f,0.0f, 0.0f)

Whereas your class has none, and only 4 for the Vector class on it.

[Edited by - Mathy on March 17, 2010 10:50:17 AM]

Share this post


Link to post
Share on other sites
Mike.Popoloski    3258
Quote:
Original post by Mathy
That's not correct it seems.

The TransformedTextured class in MDX has 5 creation arguments.

As an example:

new CustomVertex.TransformedTextured(-0.5f, -0.5f, 0.0f, 1.0f,0.0f, 0.0f)

Whereas your class has none, and only 4 for the Vector class on it.


In case you can't count, you've listed six arguments in that constructor. Josh wasn't posting a complete drop-in replacement for the vertex type, just an example of how it could be done. Not being willing to add some of the niceties yourself is just pure laziness on your part.

Share this post


Link to post
Share on other sites
Mathy    104
Wow wow wow wow. What's up with the hatred?

I am sorry I somehow pissed everyone off or made them mad.

Mike, that was a typo, and has been corrected now. Also, I didn't expect him to post anything different. I thought there was a difference. I am a beginner, and I didn't know that a TransformedTextured's ctor's last two arguments were for the texture coordinate positions.

Zao, I am not expecting MDX to be SlimDX. I'm simply just asking for help since MDX is what I am used to. Did I say any different?

MaulingMonkey, your help is perfect. Just what I needed. I now understand that the two last arguments are for the texture coordinates. Makes much more sense now. More rating for you!

Share this post


Link to post
Share on other sites
jpetrie    13159
Quote:

Wow wow wow wow. What's up with the hatred?

Probably because of your attitude -- you can't really use the "I'm a beginner" defense if you're going to make accusations that the answers you receive on the topic are "not correct." Your presentation in that post also implies that you expected to get a complete solution without demonstrating what you've tried, which tends to put a lot of people off because it's insulting.

Share this post


Link to post
Share on other sites
Mathy    104
There's a huge difference between "That's not correct", and "That's not correct it seems".

By saying "That's not correct it seems", I wasn't accusing anyone. I was simply saying that my results were inaccurate compared to the expectations I had.

Share this post


Link to post
Share on other sites
jpetrie    13159
Quote:

There's a huge difference between "That's not correct", and "That's not correct it seems".

By saying "That's not correct it seems", I wasn't accusing anyone. I was simply saying that my results were inaccurate compared to the expectations I had.

Yes, but you should pick your words more carefully, because they are still open to interpretation. Especially given the brevity of most of your posts and the nature of your post history. You appear to be on the way to earning yourself the reputation of somebody who doesn't do their own research, who puts no thought into their work, and just comes here and asks questions expecting full and complete answers to be handed to them on a silver platter.

That's probably not what you're intending to do, but that's how you're being perceived.

Share this post


Link to post
Share on other sites
Mathy    104
Quote:
Original post by jpetrie
Quote:

There's a huge difference between "That's not correct", and "That's not correct it seems".

By saying "That's not correct it seems", I wasn't accusing anyone. I was simply saying that my results were inaccurate compared to the expectations I had.

Yes, but you should pick your words more carefully, because they are still open to interpretation. Especially given the brevity of most of your posts and the nature of your post history. You appear to be on the way to earning yourself the reputation of somebody who doesn't do their own research, who puts no thought into their work, and just comes here and asks questions expecting full and complete answers to be handed to them on a silver platter.

That's probably not what you're intending to do, but that's how you're being perceived.


That's not what I've done either. I always go here once I've done several hours of research and searching online. I've been a software developer for about 9 years. I know a lot about developing normal Windows applications in several languages, but the whole 3D environment is new to me. When I first joined this forum, I didn't even know what a vertice was, whereas you probably have an education that has tought you all this plenty of times.

Normally I go here to get some idea of how to do things, mostly because I don't know the right term to use. I didn't know that outline stroking was also known as Cell Shading, and it took me a long time to figure out. It also took me 7 hours to understand what a shader is, and what it can actually be used for, as well as what it does.

I'm used to implicit mode programming, meaning that "if this is a string, it can be assigned to this variable over here, which is also a string". I'm not used to SlimDX somehow magically figuring out how to use my own custom built vertex class. I admire however it does that, and respect it, but you must understand that it is new to me.

I understand that I should pick my words more carefully.

Share this post


Link to post
Share on other sites
jpetrie    13159
FYI:
Quote:

vertice

Vertex, singular. Vertices, plural.

Quote:

Cell Shading

The term is "cel shading," one L, no capitalization necessary. "Cel" is short for "celluloid," and refers to a material that was used to create hand-drawn animations.

Quote:

I'm not used to SlimDX somehow magically figuring out how to use my own custom built vertex class. I admire however it does that

It doesn't do that; I'm not sure what gave you the impression that it does.

Share this post


Link to post
Share on other sites
Mathy    104
Quote:
Original post by jpetrie
Quote:

I'm not used to SlimDX somehow magically figuring out how to use my own custom built vertex class. I admire however it does that

It doesn't do that; I'm not sure what gave you the impression that it does.


Well, normally I'm used to a function that accepts only 1 type of class, where building your own one is not possible, unless you inherit or implement another class.

Share this post


Link to post
Share on other sites
adt7    751
Quote:
Original post by Mathy
Quote:
Original post by jpetrie
Quote:

I'm not used to SlimDX somehow magically figuring out how to use my own custom built vertex class. I admire however it does that

It doesn't do that; I'm not sure what gave you the impression that it does.


Well, normally I'm used to a function that accepts only 1 type of class, where building your own one is not possible, unless you inherit or implement another class.


Then read up on Generics in .Net. Although I find it really hard to believe that after being in software development for 9 years you've not come across them or something similar in another language.

Not seeing the missing constructor and being able to tie up the 6 arguments to the 6 components of the two Vectors present in the struct seems odd too.

To elaborate on what jpertie said though, you need to provide the graphics pipeline with a set of VertexFormat flags, or preferably with a VertexDeclaration so that it can understand your custom vertex struct (which can be literally anything you like).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this