Jump to content

  • Log In with Google      Sign In   
  • Create Account

Nicholas1991

Member Since 08 Jun 2010
Offline Last Active Apr 30 2013 01:38 PM

Posts I've Made

In Topic: Vertextypes with Array of unknown size during compiletime for VertexBuffer

16 April 2013 - 01:04 PM

OK. Thanks for your help!

I'll move on to the 3ds max forum ^^.

 

Best wishes

Nicholas


In Topic: Vertextypes with Array of unknown size during compiletime for VertexBuffer

16 April 2013 - 11:51 AM

Hm, the problem is, I'm no 3ds max expert. Until now I thought I would need separate UV-Coords for all 12 maps. But if I would use the same UV-Coords for all 12 maps, my problem would be solved. However, I don't know, if someone more experienced with 3ds max would appreciate the option of individual UV-Coords for all maps :/ (maybe some advanced techniques require a special UV arrangement). But that question should probably be posted in a different forum ^^.

 

But with such a small VertexFormat splitting the streams would then be unnecessary, wouldn't it?


In Topic: Vertextypes with Array of unknown size during compiletime for VertexBuffer

16 April 2013 - 05:23 AM

Your last suggestion is exactly what I am looking for.

So you suggest, I store the UV-Information in a texture-like-format and then access this information in the vertexshader via a texture sampler? So I guess my exporter for 3ds max could already store this information in the proper format. However, I read that sampling from a texture is slower than simply accessing data from the input struct. Is it true?

 

Thanks for your help so far, much appreciated

Nicholas


In Topic: Vertextypes with Array of unknown size during compiletime for VertexBuffer

15 April 2013 - 04:09 PM

Here is some more code to show what is frustrating me. I'm copy&past-ing a lot which is exactly what I want to avoid :/. (I have not yet compiled it (I'm in the middle of rewriting parts of my code :/), so there might be some minor errors.)

 

First the VertexTypes: 

        struct VERTEX1MAP
	{
			DirectX::XMFLOAT3 position;
			DirectX::XMFLOAT3 normal;
			DirectX::XMFLOAT2 mapcoord[1];
	};

	struct VERTEX2MAP
	{
			DirectX::XMFLOAT3 position;
			DirectX::XMFLOAT3 normal;
			DirectX::XMFLOAT2 mapcoord[2];
	};

	struct VERTEX3MAP
	{
			DirectX::XMFLOAT3 position;
			DirectX::XMFLOAT3 normal;
			DirectX::XMFLOAT2 mapcoord[3];
	};


... and so on

 

 

And here are the methods used to fill the VertexArrays:

VERTEX1MAP BinaryMeshExporter::getFilledVertexType1(const Point3& position, const Point3& normal, const UVVert* uv, const pair<int,int>& uvAccess)
{
	VERTEX1MAP out;
	out.position = Point3ToXMFLOAT3(position);
	out.normal = Point3ToXMFLOAT3(normal);
	out.mapcoord[0] = XMFLOAT2(uv[0][uvAccess.first], -uv[0][uvAccess.second]);
	return out;	
}

VERTEX2MAP BinaryMeshExporter::getFilledVertexType2(const Point3& position, const Point3& normal, const UVVert* uv, const pair<int,int>& uvAccess)
{
	VERTEX2MAP out;
	out.position = Point3ToXMFLOAT3(position);
	out.normal = Point3ToXMFLOAT3(normal);
	for ( int i=0; i<2; i++ )
		out.mapcoord[i] = XMFLOAT2(uv[i][uvAccess.first], -uv[i][uvAccess.second]);
	return out;
}

VERTEX3MAP BinaryMeshExporter::getFilledVertexType3(const Point3& position, const Point3& normal, const UVVert* uv, const pair<int,int>& uvAccess)
{
	VERTEX3MAP out;
	out.position = Point3ToXMFLOAT3(position);
	out.normal = Point3ToXMFLOAT3(normal);
	for ( int i=0; i<2; i++ )
		out.mapcoord[i] = XMFLOAT2(uv[i][uvAccess.first], -uv[i][uvAccess.second]);
	return out;
}


... And so on

 

Now as you can see, they are basically identical except for the array size of mapcoord. And also the fillmethods are identical except for the VertexType they use.

Is there any kind of polymorphic concept for structs (without changing the structs size)?

 

I'm really desperate to change the code above (for the better), but I do not see how :/.


In Topic: Vertextypes with Array of unknown size during compiletime for VertexBuffer

10 April 2013 - 02:02 PM

I know my English isn't the best at the moment so is anything confusing about my question? I mean, "it can't be done" is also ok, if that's the case ^^.

 

 

Thanks in advance

Nicholas


PARTNERS