Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Phili
unregistriert
Phili
unregistriert
Quellcode |
|
1 |
Error X3503: 'main': fubnction return value missing semantics |
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
TEXTURE Tex; sampler LinearSampler = sampler_state { Texture=<Tex>; AdressU=Wrap; AdressV=Wrap; MipFilter=Linear; MagFilter=Linear; MinFilter=Linear; }; float4 main(float2 Texture : TEXCOORD0) { float4 Pixel=tex2D(LinearSampler, Texture); float4 Ret; Ret[0]=(Pixel[0]+Pixel[1]+Pixel[2])/3; Ret[1]=(Pixel[0]+Pixel[1]+Pixel[2])/3; Ret[2]=(Pixel[0]+Pixel[1]+Pixel[2])/3; return Ret; } |
Phili
unregistriert
Phili
unregistriert
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
TEXTURE Tex; sampler LinearSampler = sampler_state { Texture=<Tex>; AdressU=Wrap; AdressV=Wrap; MipFilter=Linear; MagFilter=Linear; MinFilter=Linear; }; float a; struct InPixel { float2 Texture : TEXCOORD0; }; struct OutPixel { float4 Color : COLOR0; }; OutPixel main(InPixel In) { OutPixel Pixel; Pixel.Color=tex2D(LinearSampler, In.Texture); float Color=(Pixel.Color[0]+Pixel.Color[1]+Pixel.Color[2])/3; Pixel.Color[0]=Pixel.Color[0]*a+Color*(1-a); Pixel.Color[1]=Pixel.Color[1]*a+Color*(1-a); Pixel.Color[2]=Pixel.Color[2]*a+Color*(1-a); Pixel.Color[3]=Pixel.Color[3]*a+Color*(1-a); return Pixel; } |
Phili
unregistriert
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
PHMAMatrix MatrixProjection(float Sichtwinkel, float VerhaeltnisXY, float Sichtweite) { float cosin = cosf(Sichtwinkel/2) / sinf(Sichtwinkel/2); PHMAMatrix A; A._11=cosin*VerhaeltnisXY; A._12=0; A._13=0; A._14=0; A._21=0; A._22=cosin; A._23=0; A._24=0; A._31=0; A._32=0; A._33=Sichtweite/(Sichtweite-0.1f); A._34=1.0f; A._41=0; A._42=0; A._43=Sichtweite/(Sichtweite-0.1f)*-0.1f; A._44=0; return A; } PHMAMatrix MatrixView(PHMAVektor3 Position, PHMAVektor3 Ziel, PHMAVektor3 Up) { PHMAVektor3 zaxis = VektorNormalisieren(Ziel - Position); PHMAVektor3 xaxis = VektorNormalisieren(VektorKreuz(Vektor3(0, 1, 0), zaxis)); PHMAVektor3 yaxis = VektorKreuz(zaxis, xaxis); PHMAMatrix A; A._11=xaxis.x; A._12=yaxis.x; A._13=zaxis.x; A._14=0; A._21=xaxis.y; A._22=yaxis.y; A._23=zaxis.y; A._24=0; A._31=xaxis.z; A._32=yaxis.z; A._33=zaxis.z; A._34=0; A._41=-VektorPunkt(xaxis, Position);A._42=-VektorPunkt(yaxis, Position);A._43=-VektorPunkt(zaxis, Position);A._44=1; return A; } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 |
float *MatrixToFloat(PHMAMatrix A) { float *B=new float[16]; B[0]=A._11;B[4]=A._12;B[8]=A._13;B[12]=A._14; B[1]=A._21;B[5]=A._22;B[9]=A._23;B[13]=A._24; B[2]=A._31;B[6]=A._32;B[10]=A._33;B[14]=A._34; B[3]=A._41;B[7]=A._42;B[11]=A._43;B[15]=A._44; return B; } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 |
void PH3DKamera::SetKamera(PHMAVektor3 Position, PHMAVektor3 Ziel, float Sichtweite) { PHMAMatrix A; A=MatrixView(Position, Ziel, Vektor3(0.0f, 1.0f, 0.0f)); PHMAMatrix B; B=MatrixProjection(1.2f, 1.333333f, Sichtweite); PH3DDev.D3DDev->SetVertexShaderConstantF(0, MatrixToFloat(A), 4); PH3DDev.D3DDev->SetVertexShaderConstantF(4, MatrixToFloat(A), 4); } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
struct InVertex { float4 Position : POSITION; float3 Normal : NORMAL; float2 Texture : TEXCOORD0; }; struct OutVertex { float4 Position : POSITION; float2 Texture : TEXCOORD0; float4 Diffuse : COLOR0; }; float4x4 View; float4x4 Projection; OutVertex main(InVertex In) { OutVertex Out=(OutVertex)(0); float3 Pos=mul(In.Position, (float4x3)(View)); Out.Position=mul(float4(Pos, 1.0f), Projection); Out.Texture=In.Texture; Out.Diffuse=(0, 0, 0, 1); return Out; } |
Alter Hase
Phili
unregistriert
Phili
unregistriert
C-/C++-Quelltext |
|
1 2 |
PH3DDev.D3DDev->SetVertexShaderConstantF(0, MatrixToFloat(A), 4); PH3DDev.D3DDev->SetVertexShaderConstantF(4, MatrixToFloat(A), 4); |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
float *MatrixToFloat(PHMAMatrix A, PHMAMatrix C) { float *B=new float[32]; B[0]=A._11;B[4]=A._12;B[8]=A._13;B[12]=A._14; B[1]=A._21;B[5]=A._22;B[9]=A._23;B[13]=A._24; B[2]=A._31;B[6]=A._32;B[10]=A._33;B[14]=A._34; B[3]=A._41;B[7]=A._42;B[11]=A._43;B[15]=A._44; B[16]=C._11;B[20]=C._12;B[24]=C._13;B[28]=C._14; B[17]=C._21;B[21]=C._22;B[25]=C._23;B[29]=C._24; B[18]=C._31;B[22]=C._32;B[26]=C._33;B[30]=C._34; B[19]=C._41;B[23]=C._42;B[27]=C._43;B[31]=C._44; return B; } |
Werbeanzeige