if(((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[5].__anon1.__anon1.dataTypeClass->type == 1)
size += ((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[5].__anon1.__anon1.dataTypeClass->typeSize - sizeof node->key;
if(((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[6].__anon1.__anon1.dataTypeClass->type == 1)
-size += ((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[6].__anon1.__anon1.dataTypeClass->typeSize - sizeof (((((((struct __ecereNameSpace__ecere__com__Instance * )(char * )this)->_class->templateArgs[6].__anon1.__anon1.dataTypeClass->type == 1) ? ((uint64)(uintptr_t)&node->value) : ((((struct __ecereNameSpace__ecere__com__Instance * )(char * )this)->_class->templateArgs[6].__anon1.__anon1.dataTypeClass->typeSize == 1) ? *((unsigned char *)&node->value) : ((((struct __ecereNameSpace__ecere__com__Instance * )(char * )this)->_class->templateArgs[6].__anon1.__anon1.dataTypeClass->typeSize == 2) ? *((unsigned short *)&node->value) : ((((struct __ecereNameSpace__ecere__com__Instance * )(char * )this)->_class->templateArgs[6].__anon1.__anon1.dataTypeClass->typeSize == 4) ? *((unsigned int *)&node->value) : *(&node->value))))))));
+size += ((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[6].__anon1.__anon1.dataTypeClass->typeSize - sizeof(uint64);
node = (struct __ecereNameSpace__ecere__com__MapNode *)__ecereNameSpace__ecere__com__eSystem_New0(sizeof(unsigned char) * (size));
}
else
uint size = sizeof(class MapNode<MT, V>);
if(class(MT).type == structClass) size += class(MT).typeSize - sizeof(node.AVLNode::key);
- if(class(V).type == structClass) size += class(V).typeSize - sizeof(*&node.value);
+ if(class(V).type == structClass)
+ size += class(V).typeSize - sizeof(uint64); //sizeof(*&node.value); // TODO: Simplify code generation for this sizeof
node = (MapNode<MT, V>)new0 byte[size];
}
else
public enum RenderState { fillMode = 1, depthTest, depthWrite, fogDensity, fogColor, blend, ambient, alphaWrite, antiAlias, vSync };
+public union RenderStateFloat { float f; uint ui; };
+
public enum FillModeValue { solid, wireframe };
public class DisplayFlags
property FillModeValue fillMode { set { displaySystem.driver.SetRenderState(this, fillMode, value); } };
property bool depthTest { set { displaySystem.driver.SetRenderState(this, depthTest, value); } };
property bool depthWrite { set { displaySystem.driver.SetRenderState(this, depthWrite, value); } };
- property float fogDensity { set { displaySystem.driver.SetRenderState(this, fogDensity, *(uint *)(void *)&value); } };
+ property float fogDensity { set { displaySystem.driver.SetRenderState(this, fogDensity, RenderStateFloat { value }.ui); } };
property Color fogColor { set { displaySystem.driver.SetRenderState(this, fogColor, value); } };
property bool blend { set { displaySystem.driver.SetRenderState(this, blend, value); } };
property Color ambient { set { displaySystem.driver.SetRenderState(this, ambient, value); } };
IDirect3DDevice8_SetRenderState(d3dDevice, D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
IDirect3DDevice8_SetRenderState(d3dDevice, D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
IDirect3DDevice8_SetRenderState(d3dDevice, D3DRS_FOGTABLEMODE, D3DFOG_EXP);
- IDirect3DDevice8_SetRenderState(d3dDevice, D3DRS_FOGDENSITY, *(uint *)(void *)&fogDensity);
+ IDirect3DDevice8_SetRenderState(d3dDevice, D3DRS_FOGDENSITY, RenderStateFloat { fogDensity }.ui);
display.ambient = Color { 50,50,50 };
IDirect3DDevice8_SetRenderState(d3dDevice, D3DRS_NORMALIZENORMALS, TRUE);
IDirect3DDevice8_SetRenderState(d3dSystem.d3dDevice, D3DRS_MULTISAMPLEANTIALIAS, FALSE);
break;
case fogDensity:
{
- float fogDensity = *(float *)(void *)&value;
- IDirect3DDevice8_SetRenderState(d3dSystem.d3dDevice, D3DRS_FOGDENSITY, *(uint *)(void *)&fogDensity);
+ float fogDensity = RenderStateFloat { ui = value }.f;
+ IDirect3DDevice8_SetRenderState(d3dSystem.d3dDevice, D3DRS_FOGDENSITY, RenderStateFloat { fogDensity }.ui);
break;
}
case blend:
{ light.specular.r, light.specular.g, light.specular.b, 1.0f },
{ light.ambient.r, light.ambient.g, light.ambient.b, 1.0f }
};
+ Vector3Df * lightDirection;
Vector3Df vector {0,0,1};
Vector3Df vectorPI {0,0,-1};
Vector3Df direction;
Matrix mat;
+ lightDirection = (Vector3Df *)&d3dLight.Direction;
mat.RotationQuaternion(light.orientation);
d3dLight.Direction.z =-direction.z;
}
else
- {
- ((Vector3Df *)&d3dLight.Direction)->MultMatrix(direction, d3dDisplay.worldMatrix);
- }
+ lightDirection->MultMatrix(direction, d3dDisplay.worldMatrix);
d3dDisplay.lights[id] = d3dLight;
IDirect3DDevice8_SetLight(d3dSystem.d3dDevice, id, &d3dDisplay.lights[id]);
direction.MultMatrix(vectorPI, mat);
- ((Vector3Df *)&d3dLight.Direction)->MultMatrix(direction, d3dDisplay.worldMatrix);
+ lightDirection->MultMatrix(direction, d3dDisplay.worldMatrix);
d3dDisplay.lightsPI[id] = d3dLight;
}
IDirect3DDevice9_SetRenderState(d3dDevice, D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
IDirect3DDevice9_SetRenderState(d3dDevice, D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
IDirect3DDevice9_SetRenderState(d3dDevice, D3DRS_FOGTABLEMODE, D3DFOG_EXP);
- IDirect3DDevice9_SetRenderState(d3dDevice, D3DRS_FOGDENSITY, *(uint *)(void *)&fogDensity);
+ IDirect3DDevice9_SetRenderState(d3dDevice, D3DRS_FOGDENSITY, RenderStateFloat { fogDensity }.ui);
display.ambient = Color { 50,50,50 };
IDirect3DDevice9_SetRenderState(d3dDevice, D3DRS_NORMALIZENORMALS, TRUE);
IDirect3DDevice9_SetRenderState(d3dSystem.d3dDevice, D3DRS_MULTISAMPLEANTIALIAS, FALSE);
break;
case fogDensity:
{
- float fogDensity = *(float *)(void *)&value;
- IDirect3DDevice9_SetRenderState(d3dSystem.d3dDevice, D3DRS_FOGDENSITY, *(uint *)(void *)&fogDensity);
+ float fogDensity = RenderStateFloat { ui = value }.f;
+ IDirect3DDevice9_SetRenderState(d3dSystem.d3dDevice, D3DRS_FOGDENSITY, RenderStateFloat { fogDensity }.ui);
break;
}
case blend:
Vector3Df vectorPI {0,0,-1};
Vector3Df direction;
Matrix mat;
+ Vector3Df * lightDirection = (Vector3Df *)&d3dLight.Direction;
mat.RotationQuaternion(light.orientation);
d3dLight.Direction.z =-direction.z;
}
else
- {
- // TODO: Precomp problem without the { }
- ((Vector3Df *)&d3dLight.Direction)->MultMatrix(direction, d3dDisplay.worldMatrix);
- }
+ lightDirection->MultMatrix(direction, d3dDisplay.worldMatrix);
d3dDisplay.lights[id] = d3dLight;
IDirect3DDevice9_SetLight(d3dSystem.d3dDevice, id, &d3dDisplay.lights[id] /*d3dLight*/);
direction.MultMatrix(vectorPI, mat);
- ((Vector3Df *)&d3dLight.Direction)->MultMatrix(direction, d3dDisplay.worldMatrix);
+ lightDirection->MultMatrix(direction, d3dDisplay.worldMatrix);
d3dDisplay.lightsPI[id] = d3dLight;
}
break;
}
case fogDensity:
- value *= nearPlane;
- glFogf(GL_FOG_DENSITY, *(float *)(void *)&value);
+ glFogf(GL_FOG_DENSITY, (float)(RenderStateFloat { value }.f * nearPlane));
break;
case blend:
if(value) glEnable(GL_BLEND); else glDisable(GL_BLEND);
}
else if(arrayType == class(double) || !strcmp(arrayType.dataTypeString, "double"))
{
- t = *(uint64 *)&value.d;
+ t = value.ui64; //*(uint64 *)&value.d;
}
else if(arrayType == class(float) || !strcmp(arrayType.dataTypeString, "float"))
{
- t = *(uint *)&value.f;
+ t = value.ui; //f*(uint *)&value.f;
}
else if(arrayType.typeSize == sizeof(int64) || !strcmp(arrayType.dataTypeString, "int64") ||
!strcmp(arrayType.dataTypeString, "unsigned int64") || !strcmp(arrayType.dataTypeString, "uint64"))
}
else if(arrayType == class(double) || !strcmp(arrayType.dataTypeString, "double"))
{
- value.d = *(double *)&t;
+ value.ui64 = t;
+ //value.d = *(double *)&t;
}
else if(arrayType == class(float) || !strcmp(arrayType.dataTypeString, "float"))
{
- value.f = *(float *)&t;
+ value.ui = (uint)t;
+ //value.f = *(float *)&t;
}
else if(arrayType.typeSize == sizeof(int64) || !strcmp(arrayType.dataTypeString, "int64") ||
!strcmp(arrayType.dataTypeString, "unsigned int64") || !strcmp(arrayType.dataTypeString, "uint64"))