Browse Source

开始摄像机

master
blobt 5 years ago
parent
commit
0cb6a4f5dd
  1. 2
      src/7threed/Raster.cc
  2. 13
      src/7threed/threed.cc

2
src/7threed/Raster.cc

@ -270,7 +270,7 @@ void Raster::drawTriangle(Ege eges[3], Image* image) {
//printf("sho:%d (%d,%d) (%d,%d) (%d,%d,%d) (%d,%d,%d)\n", iShort1,eges[iShort1].x1, eges[iShort1].y1, eges[iShort1].x2, eges[iShort1].y2, eges[iShort1].color1._r, eges[iShort1].color1._g, eges[iShort1].color1._b, eges[iShort1].color2._r, eges[iShort1].color2._g, eges[iShort1].color2._b);
drawEge(eges[iMax], eges[iShort1], image);
//drawEge(eges[iMax], eges[iShort2], image);
drawEge(eges[iMax], eges[iShort2], image);
}
void Raster::drawTriangle(const Vertex& vertex, Image* image) {

13
src/7threed/threed.cc

@ -21,15 +21,24 @@ struct Vertex {
void example3() {
Vertex vertexs[] = {
{-1.0f, 0.0f, -2.0f, 0.0f, 0.0f, Rgba(255, 0, 0, 255)},
{-1.0f, 0.0f, -9.0f, 0.0f, 0.0f, Rgba(255, 0, 0, 255)},
{ 0.0f, 1.0f, -9.0f, 1.0f, 1.0f, Rgba(0, 255, 0, 255)},
{ 1.0f, 0.0f, -2.0f, 1.0f, 0.0f, Rgba(0, 0, 255, 255)}
{ 1.0f, 0.0f, -9.0f, 1.0f, 0.0f, Rgba(0, 0, 255, 255)}
};
raster.loadIdentity();
Image* image = Image::loadFromFile("/home/blobt/Documents/dev/cpp/3dbase/image/scale.jpg");
matrix4 matScale;
matScale.scale(2,2,1);
matrix4 matTran;
matTran.translate(-1,-1,0);
matrix4 mat = matScale * matTran;
raster.loadMatrix(mat);
raster.bindTexture(image);

Loading…
Cancel
Save