Simple renderer in .net with SharpGL (openGL)


Re: Simple renderer in .net with direct3d
#9
I dug up some very old LD4DModeler code, which used DirectX

In it I do correction during the type 1 line loading.

Code:
//x y z
  matrix.m[3, 0]:=getvalue(line);
  matrix.m[3, 1]:=getvalue(line);
  matrix.m[3, 2]:=getvalue(line);
  matrix.m[3, 3]:=1;

  //a b c
  matrix.m[0, 0]:=getvalue(line);
  matrix.m[1, 0]:=getvalue(line);
  matrix.m[2, 0]:=getvalue(line);

  //d e f
  matrix.m[0, 1]:=getvalue(line);
  matrix.m[1, 1]:=getvalue(line);
  matrix.m[2, 1]:=getvalue(line);

  //g h i
  matrix.m[0, 2]:=getvalue(line);
  matrix.m[1, 2]:=getvalue(line);
  matrix.m[2, 2]:=getvalue(line);

  matrix.m[0, 3]:=0;
  matrix.m[1, 3]:=0;
  matrix.m[2, 3]:=0;        

  //rechthandig matrix -> linkshandige matrix
  //(T^-1)ST      waar s bron is en T rh2lhflip is

  //mat:=rh2lhflip^-1
  D3DXMatrixInverse(mat, @dummy, rh2lhflip);
  //mat:=(rh2lhflip^-1)*s
  D3DXMatrixMultiply(mat, mat, matrix);
  //s:=(rh2lhflip^-1)*s*rh2lhflip
  D3DXMatrixMultiply(matrix, mat, rh2lhflip);


rh2lhflip is inited elsewhere as D3DXMatrixScaling(rh2lhflip, 1, -1, 1);

Do note this is very (11 years!) old code, and I wasn't exactly an expert myself at that time Smile


edit: above code is less then correct and unnecessary overcomplicated. It's better to convert to lefthand/neg y axis at the model level.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Re: Simple renderer in .net with direct3d - by Roland Melkert - 2013-11-23, 19:22

Forum Jump:


Users browsing this thread: 7 Guest(s)