Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


MahanGM

Member Since 31 Jul 2012
Offline Last Active Sep 11 2014 06:56 PM

Topics I've Started

asBEHAVE_ASSIGNMENT is missing

12 August 2014 - 04:46 PM

I was using angelscript version 2.23.1 and I had this problem when I wanted to register assignment behavior for one of my value types. I downloaded the 2.29.1 version and I still have the same problem. I've checked angelscript header file and this label is just not there.


How to use z axis as depth for 2d quads

25 June 2014 - 05:39 PM

I've been drawing primitives recently and I have problem with rendering order. I was expecting by setting different z values for my quads, I'd get a kind of depth system. I'm not sure what I'm doing wrong or even my theory is true.

 

I simply create my vertices:

Vertex2D vertices[] = {
    {0, 0, 0, color, 0, 0},
    {rect.Width(), 0, 0, color, 1, 0},
    {0, rect.Height(), 0, color, 0, 1},
    {rect.Width(), rect.Height(), 0, color, 1, 1},
    {rect.Width(), 0, 0, color, 1, 0},
};

Then I set translation for them:

D3DXMATRIX translationMatrix;
D3DXMatrixTranslation(&translationMatrix, rect.X() - 0.5f, rect.Y() - 0.5f, depth);

device->SetTransform(D3DTS_WORLD, &translationMatrix);

And finally draw.

 

Before this, I was using D3DXSprite to draw sprites and I was drawing shapes with the Direct3D device itself. There was a depth problem between primitives drawn by Direct3D device and sprites drawn by D3DXSprite so I decided to switch to textured quads for sprite drawing and eliminate D3DXSprite. D3DXSprite had a front to back depth sort flag that could manage different z values, I don't know if there is a magical way to achieve what D3DXSprite is offering or it's just a simple vector sort, I just need to know what's the solution.

 

Thanks.


Why am I getting a wrong color with blend mode enabled?

25 March 2014 - 12:54 PM

Hi. I've been working on a simple line draw and I can't get the colors to work. I want to draw a red line. This is my result:

 

VZnl3.png

 

I have defined two vertices with the same color (red with an alpha of 255). As you can see source color is completely black. If I disable blend mode, I'd still get this result, but if I enable it and play with D3DRS_SRCBLEND and D3DRS_DESTBLEND, I can change the result, but it never gets to the point that I want which is a full red line.

 

My vertex format is as follows:

 

D3DFVF_XYZ | D3DFVF_DIFFUSE

 

Someone said that it might be from vertices normal vectors, but I don't have any lighting in my scene so it's not that. However, if I change D3DFVF_XYZ to D3DFVF_XYZRHW and pass value 1 for rhw, it'll draw the line with correct color, but that's not the format I want. I want to be able to apply geometry changes to my vertices and I know RHW does not receive any of that. And, I have a totally bright material and even if I set D3DMCS_COLOR1 for D3DRS_DIFFUSEMATERIALSOURCE, I'd still get the same result in the picture above.


How to link std::map to Lua with LuaBind

08 July 2013 - 08:15 AM

Is this possible in lua to achieve?

player.scripts["movement"].properties["stat"] = "stand"
print (player.scripts["movement"].properties["stat"])

I've done the second line in c++ with this approach:

luabind::object FakeScript::getProp()
{
	luabind::object obj = luabind::newtable(L);

	for(auto i = this->properties.begin(); i != this->properties.end(); i++)
	{
		obj[i->first] = i->second;
	}

	return obj;
}

But I'm stuck with setter. The first line in lua code which I'm trying to set value "stand" for key "stat" is not going to work and it keep directing me to the getter method. Setter method only works when I drop `["stat"]` from `properties`.

 

I can do something like this in my script:

player.scripts["movement"].properties = {stat = "stand"}

But this isn't what I want because I have to go through my real keys in c++ to determine which one is placed in the setter method argument.

 

This is my map in class:

std::map<std::string, std::string> properties;

PARTNERS