Anpassung Window Größe und Spielfeld
-> gleiche Ratio (16:9); Neue math_graphics.h Funktionen (Aufräumen); git-svn-id: svn://ammerhai.com/home/mike/pokemon_repo@20 24008968-59e6-ed4c-a10b-0b2c954b24ab
This commit is contained in:
@@ -8,6 +8,11 @@ struct VertexShaderInput {
|
||||
float4 pos_size : INSTANCE_POSITION_SIZE;
|
||||
uint tile_type : TILE_TYPE;
|
||||
float4 uv0uv1 : UV_INSTANCE;
|
||||
|
||||
};
|
||||
|
||||
cbuffer constants {
|
||||
float aspect_ratio;
|
||||
};
|
||||
|
||||
struct VertexShaderOutput {
|
||||
@@ -20,9 +25,6 @@ struct VertexShaderOutput {
|
||||
VertexShaderOutput main(VertexShaderInput input) {
|
||||
VertexShaderOutput output;
|
||||
|
||||
float2 rect_pos = input.pos_size.xy;
|
||||
float2 rect_size = input.pos_size.zw;
|
||||
|
||||
float3x3 coord_sys = {
|
||||
2, 0, -1,
|
||||
0, -2, 1,
|
||||
@@ -38,13 +40,19 @@ VertexShaderOutput main(VertexShaderInput input) {
|
||||
};
|
||||
|
||||
float3x3 size = {
|
||||
rect_size.x, 0, 0,
|
||||
0, rect_size.y, 0,
|
||||
input.pos_size.z, 0, 0,
|
||||
0, input.pos_size.w, 0,
|
||||
0, 0, 1
|
||||
};
|
||||
|
||||
output.pos.xy = mul(pos, mul(size, input.pos.xyz)).xy;
|
||||
//output.pos.xy = mul(pos, input.pos.xyz).xy;
|
||||
|
||||
float correction_factor = aspect_ratio / (16.0 / 9.0);
|
||||
if(correction_factor < 1)
|
||||
output.pos.y *= correction_factor;
|
||||
else
|
||||
output.pos.x /= correction_factor;
|
||||
|
||||
output.pos.zw = float2(0, 1);
|
||||
|
||||
output.uv0uv1.zw = float2(0, 0);
|
||||
|
||||
@@ -16,13 +16,14 @@ struct VertexShaderOutput {
|
||||
uint tile_type : TILE_TYPE;
|
||||
};
|
||||
|
||||
cbuffer constants {
|
||||
float aspect_ratio;
|
||||
};
|
||||
|
||||
|
||||
VertexShaderOutput main(VertexShaderInput input) {
|
||||
VertexShaderOutput output;
|
||||
|
||||
float2 rect_pos = input.pos_size.xy;
|
||||
float2 rect_size = input.pos_size.zw;
|
||||
|
||||
float3x3 coord_sys = {
|
||||
2, 0, -1,
|
||||
0, -2, 1,
|
||||
@@ -38,13 +39,19 @@ VertexShaderOutput main(VertexShaderInput input) {
|
||||
};
|
||||
|
||||
float3x3 size = {
|
||||
rect_size.x, 0, 0,
|
||||
0, rect_size.y, 0,
|
||||
input.pos_size.z, 0, 0,
|
||||
0, input.pos_size.w, 0,
|
||||
0, 0, 1
|
||||
};
|
||||
|
||||
output.pos.xy = mul(pos, mul(size, input.pos.xyz)).xy;
|
||||
//output.pos.xy = mul(pos, input.pos.xyz).xy;
|
||||
|
||||
float correction_factor = aspect_ratio / (16.0 / 9.0);
|
||||
if (correction_factor < 1)
|
||||
output.pos.y *= correction_factor;
|
||||
else
|
||||
output.pos.x /= correction_factor;
|
||||
|
||||
output.pos.zw = float2(0, 1);
|
||||
|
||||
output.uv0uv1.zw = float2(0, 0);
|
||||
|
||||
Reference in New Issue
Block a user