0

I know this question sounds stupid but, what's the syntax to make a list in HLSL ?
I found how to make an array (Type name[x]) but not how to make a list. :/

darky89
  • 1
  • 1
  • 2

3 Answers3

3

I don't think you can. You can make an array and keep track of a count in another variable though.

float3 points[12]; 
int pointCount;

Then in XNA you can set the array and then the count:

List<Vector3> vectors = new List<Vector3>();
vectors.Add(new Vector3(12, -13, 14));
effect.Parameters["points"].SetValue(vectors.ToArray());
effect.Parameters["pointCount"].SetValue(vectors.Count);
Jason Goemaat
  • 28,692
  • 15
  • 86
  • 113
-3

You can use ListOf<> to make a list. Hope it will helps you.

-3

Here's the MSDN Documentation on Lists in .NET.

Usage:

List<Type> listVariable = new List<Type>();

Example:

List<string> myList = new List<string>();

Additionally, you can use a Hashtable if you want to refer to the items in the list by a (unique) string.

Hashtable myHash = new Hashtable();

// Add item.
myHash.Add("item1", new HLSLShader());

// Remove item.
myHash.Remove("item1");
FreeAsInBeer
  • 12,937
  • 5
  • 50
  • 82