Nhom9-Detai11-nha-cap-4

22 4 0
Nhom9-Detai11-nha-cap-4

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Đồ họa máy tính nhà cấp 4

BỘ CÔNG THƯỜNG TRƯỜNG ĐẠI HỌC CÔNG NGHIỆP HÀ NỘI BÀI TẬP NHĨM HỌC PHẦN ĐỒ HỌA MÁY TÍNH Đề tài : Mô cảnh quan hoạt động thiết bị nhà cấp Giáo viên: Vũ Minh Yến Nhóm: Phạm Thành Đơ – 201960 Nguyễn Văn Hải – 201960 Nguyễn Văn Hậu – 201960 Hà Nội – Năm 2021 Mở đầu Sự phát triển khoa học, kĩ thuật, nghệ thuật, kinh doanh công nghệ luôn phụ thuộc vào khả truyền đặt thông tin chúng ta, thông qua bit liệu lưu trữ microchip thông báo giao tiếp tiếng nói Câu châm ngơn từ xa xưa “Một hình ảnh có giá trị vạn lời” hay “Trăm nghe không thấy: cho thấy ý nghĩa lớn hình ảnh việc truyền tải thơng tin Hình ảnh bao giơi dược cảm nhận nhanh dễ dàng hơn, đặc biệt trường hợp bất đồng ngơn ngữ Do khơng có ngạc nhiên mà từ xuất máy tính, nhà nghiên cưu cố gắng sử dụng để phát sinh hình ảnh hình Trong suốt gần 50 năm pháp triển máy tính, khả phát sinh hình ảnh máy tính đạt tới mức mà tất cacsc máy tính có khả đồ họa Đồ họa máy tính lĩnh vực lí thú phát triển nhanh tin học Ngay từ xuất hiện, đồ họa máy tính có sức lơi mãnh liệt, hút nhiều người nhiều lĩnh vực khác : khoa học , nghệ thuật, kinh doanh, quản lí, Tính hấp dẫn đa dạng đồ họa máy tính minh họa trược quan thông qua việc khảo sát ứng dụng Và để hiểu rõ đồ họa máy tính chúng em tìm hiểu hồn thành tập lớn đề tài: “Mô cảnh quan hoạt động cácthiết bị nhà cấp 4.” Chương 1: Giới thiệu Yêu cầu đề tài - Mô nhà cấp đồ dùng nhà ngồi nhà bàn, ghế , tivi, kệ để tivi tủ sách , số đồ dùng khác chương trình - Mơ hiệu ứng đồ dùng kỹ thuật chuyện động, dịch chuyển đồ vật, hiệu ứng ánh sách màu sắc đồ vật chương trình - Thay đổi góc nhìn cho người dùng cảnh quan bên ngơi nhà Mơ tả chức chương trình : - Sử dùng Ctrl + B để chạy chương trình - Khi nhấn phím B để quay đồ vật chương trình  Khi nhấn phím dùng chuột chọn đồ vật  Đồ vật quay ngược chiều kim đồng hồ - Các phím dùng để di chuyển đồ vật :  X dùng để di chuyển sang phải  Y dùng để di chuyển lên  Z dùng để di chuyển sang trái Vị dụ mơ hình chạy chương chình : Dùng phím B để quay ngược kim đồng hồ đồ vật Dùng phím X di chuyển đồ vật sang bên phải Dùng phím Y đồ vật lên Dùng phím Z đồ vật sang trái Chương : Các hàm chương trình Các hàm chương trình lập phương Gọi đỉnh màu sắc hình: point4 points[NumPoints]; /* Danh sách đỉnh tam giác cần vẽ*/ color4 colors[NumPoints]; /* Danh sách màu tương ứng cho đỉnh trên*/ point4 vertices[8]; /* Danh sách đỉnh hình lập phương*/ color4 vertex_colors[8]; /*Danh sách màu tương ứng cho đỉnh hình lập phương*/ Hàm gán giá trị vị trí đỉnh gán màu sắc khối hình void initCube() { // Gán giá trị tọa độ vị trí cho đỉnh hình lập phương vertices[0] = point4(-0.5, -0.5, 0.5, 1.0); vertices[1] = point4(-0.5, 0.5, 0.5, 1.0); vertices[2] = point4(0.5, 0.5, 0.5, 1.0); vertices[3] = point4(0.5, -0.5, 0.5, 1.0); vertices[4] = point4(-0.5, -0.5, -0.5, 1.0); vertices[5] = point4(-0.5, 0.5, -0.5, 1.0); vertices[6] = point4(0.5, 0.5, -0.5, 1.0); vertices[7] = point4(0.5, -0.5, -0.5, 1.0); // Gán giá trị màu sắc cho đỉnh hình vertex_colors[0] = color4(0.0, 0.0, 0.0, 1.0); vertex_colors[1] = color4(1.0, 0.0, 0.0, 1.0); vertex_colors[2] = color4(1.0, 1.0, 0.0, 1.0); vertex_colors[3] = color4(0.0, 1.0, 0.0, 1.0); vertex_colors[4] = color4(0.0, 0.0, 1.0, 1.0); vertex_colors[5] = color4(1.0, 0.0, 1.0, 1.0); vertex_colors[6] = color4(1.0, 1.0, 1.0, 1.0); vertex_colors[7] = color4(0.0, 1.0, 1.0, 1.0); } lập phương // black // red // yellow // green // blue // magenta // white // cyan Hàm tạo khối hình lập phương int Index = 0; void quad(int a, int b, int c, int d) /*Tạo mặt hình lập phương = tam giác, gán màu cho đỉnh tương ứng mảng colors*/ { colors[Index] = vertex_colors[a]; points[Index] = vertices[a]; Index++; colors[Index] = vertex_colors[b]; points[Index] = vertices[b]; Index++; colors[Index] = vertex_colors[c]; points[Index] = vertices[c]; Index++; colors[Index] = vertex_colors[a]; points[Index] = vertices[a]; Index++; colors[Index] = vertex_colors[c]; points[Index] = vertices[c]; Index++; colors[Index] = vertex_colors[d]; points[Index] = vertices[d]; Index++; } Hàm tạo hình học void makeColorCube(void) /* Sinh 12 tam giác: 36 đỉnh, 36 màu*/ { quad(1, quad(2, quad(3, quad(6, quad(4, quad(5, 0, 3, 0, 5, 5, 4, 3, 7, 4, 1, 6, 0, 2); 6); 7); 2); 7); 1); } void generateGeometry( void ) { initCube(); makeColorCube(); } Hàm đệm GPU void initGPUBuffers( void ) { // Tạo VAO - vertex array object GLuint vao; glGenVertexArrays( 1, &vao ); glBindVertexArray( vao ); // Tạo khởi tạo buffer object GLuint buffer; glGenBuffers( 1, &buffer ); glBindBuffer( GL_ARRAY_BUFFER, buffer ); glBufferData( GL_ARRAY_BUFFER, sizeof(points)+sizeof(colors), NULL, GL_STATIC_DRAW ); glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(points), points); glBufferSubData(GL_ARRAY_BUFFER, sizeof(points), sizeof(colors), colors); } Hàm thiết lập Setup mà hình void shaderSetup( void ) { // Nạp shader sử dụng chương trình shader program = InitShader( "vshader1.glsl", "fshader1.glsl" ); // hàm InitShader khai báo Angel.h glUseProgram( program ); // Khởi tạo thuộc tính vị trí đỉnh từ vertex shader GLuint loc_vPosition = glGetAttribLocation( program, "vPosition" ); glEnableVertexAttribArray( loc_vPosition ); glVertexAttribPointer(loc_vPosition, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0) ); GLuint loc_vColor = glGetAttribLocation(program, "vColor"); glEnableVertexAttribArray(loc_vColor); glVertexAttribPointer(loc_vColor, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(sizeof(points))); glClearColor( 1.0, 1.0, 1.0, 1.0 ); hình*/ } /* Thiết lập màu trắng màu xóa void display( void ) { } glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT ); glDrawArrays( GL_TRIANGLES, 0, NumPoints ); /*Vẽ tam giác*/ glutSwapBuffers(); Hàm gắn phím void keyboard( unsigned char key, int x, int y ) { // keyboard handler switch ( key ) { case 033: exit(1); break; } // 033 is Escape key octal value // quit program } Hàm main int main( int argc, char **argv ) { // main function: program starts here glutInit( &argc, argv ); glutInitDisplayMode( GLUT_DOUBLE|GLUT_RGBA); glutInitWindowSize( 640, 640 ); glutInitWindowPosition(100,150); glutCreateWindow( "Drawing a Cube" ); glewInit(); generateGeometry( ); initGPUBuffers( ); shaderSetup( ); glutDisplayFunc( display ); glutKeyboardFunc( keyboard ); } glutMainLoop(); return 0; Hàm thiếp lập đề tài Mơ hình quạt Hàm tạo hình quạt void canhquat(GLfloat l, GLfloat h) { instance = instance*Scale(l, h, l); glUniformMatrix4fv(model_view_loc, 1, GL_TRUE, model_view * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); } void thanquat(GLfloat l, GLfloat h,GLfloat w) { instance = instance*Scale(l, h, w); glUniformMatrix4fv(model_view_loc, 1, GL_TRUE, model_view * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); } void longquat(GLfloat l, GLfloat h, GLfloat w) { instance = instance *Scale(l, h, w); glUniformMatrix4fv(model_view_loc, 1, GL_TRUE, model_view * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); } GLfloat ta[] = { 0,0,0,0 }; void canh() { instance = Identity(); instance = Translate(0.0f, 0.0f, 0.12f); longquat(0.1f, 0.1f, 0.1f); instance = RotateZ(240) * Translate(0.0f, 0.12f, 0.15f); canhquat(0.02f, 0.15f); instance = RotateZ(120) * Translate(0.0f, 0.12f, 0.15f); canhquat(0.02f, 0.15f); instance =RotateZ(360) * Translate(0.0f, 0.12f, 0.15f); canhquat(0.02f, 0.15f); } void quat() { instance = Identity(); /*Sửa identity() mat.h thành Identity()*/ thanquat(0.1f, 0.1f, 0.2f); instance = Translate(0.0f, 0.25f, -0.06f); thanquat(0.05f, 0.5f,0.05f); instance = Translate(0.0f, 0.55f, -0.02f); thanquat(0.1f, 0.1f,0.2f); } void cua() { model_view = RotateY(ta[1])* RotateX(ta[2]); quat(); model_view = model_view * Translate(0.0f, 0.55f, 0.0f) * RotateZ(ta[0]); canh(); } Mơ hình giường Hàm tạo giường void thangiuong() { mat4 instance; //Chan ban instance = Translate(-0.5 * (lg-wlg), -0.5 * hg, 0.5 * (wg - wlg)) * Scale(wlg, hg, wlg); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(-0.5 * (lg - wlg), -0.5 * hg, -0.5 * (wg - wlg)) * Scale(wlg, hg, wlg); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0.5 * (lg - wlg), -0.5 * hg, 0.5 * (wg - wlg)) * Scale(wlg, hg, wlg); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0.5 * (lg - wlg), -0.5 * hg, -0.5 * (wg - wlg)) * Scale(wlg, hg, wlg); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); //mat ban instance = Scale(lg, tg, wg); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); //vien giuong instance = Translate( 0, -0.5 * 0.2, -0.5 *0.75) * Scale(lg, 0.2, wlg); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0, -0.5 * 0.2, 0.5 * 0.75) * Scale(lg, 0.2, wlg); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0.5 * (lg - wlg+0.01), -0.5 * 0.2, 0.5 * 0) * Scale(wlg, 0.2, wg); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(-0.5 * (lg - wlg + 0.01), -0.5 * 0.1, 0.5 * 0) * Scale(wlg, 0.4, wg); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); } GLfloat h_nk = 0.15; GLfloat xx = 0, yy = 0, zz = 0, a = 0, b = 0, c = 0, z_nk = 0; void ban() { instance_giuong = Translate(xx, yy, zz) * RotateZ(c) * RotateY(b) * RotateX(a); thangiuong(); } Mơ hình tủ Hàm tạo tủ GLfloat lt = 0.8, tt = 1, wt = 0.01; GLfloat wlt = 0.2, ht = 0.4; void thantu() { mat4 instance; instance = Scale(lt, tt, wt); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0, 0.5 , -0.5 * wlt) * Scale(lt, wt, wlt); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0, 0.5*0.5, -0.5 * wlt) * Scale(lt, wt, wlt); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0, -0.5*0.8, -0.5 * wlt) * Scale(lt, wt, wlt); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0, -0.5 * 0.4, -0.5 * wlt) * Scale(lt, wt, wlt); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); wlt); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0.5*(tt-lt+0.1), 0.02 , -0.5 * wlt) * Scale((lt-0.3), wt, glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0.5* (lt-wt),0 , -0.5* wlt ) * Scale(wt, tt, wlt); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(-0.5 * (lt-wt ), ,-0.5*wlt ) * Scale(wt, tt, wlt); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(-0.5 * wlt, 0.02, -0.5 * wlt) * Scale(wt, 0.45, wlt); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(-0.5 * wlt, 0.37, -0.5 * wlt) * Scale(wt, 0.25, wlt); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0.5 * 0.3, 0.37, -0.5 * wlt) * Scale(wt, 0.25, wlt); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); } GLfloat h_nk = 0.15; GLfloat xx = 0, yy = 0, zz = 0, a = 0, b = 0, c = 0, z_nk = 0; void tu() { instance_giuong = Translate(xx, yy, zz) * RotateZ(c) * RotateY(b) * RotateX(a); thantu(); } Mơ hình tivi tủ kê tivi Hàm tạo tivi tủ để tivi GLfloat lg = 0.8, tg= 0.01, wg= 0.2; GLfloat wlg = 0.02, hg = 0.2; void thangiuong() { mat4 instance; //Chan ban instance = Translate(-0.5 * (lg-wlg), -0.5 * hg, 0.5 * (wg - wlg)) * Scale(wlg, hg, wlg); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(-0.5 * (lg - wlg), -0.5 * hg, -0.5 * (wg - wlg)) * Scale(wlg, hg, wlg); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0.5 * (lg - wlg), -0.5 * hg, 0.5 * (wg - wlg)) * Scale(wlg, hg, wlg); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0.5 * (lg - wlg), -0.5 * hg, -0.5 * (wg - wlg)) * Scale(wlg, hg, wlg); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); //mat ban instance = Scale(lg, tg, wg); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0.5 * (lg - wlg)*0, -0.5 * hg, 0) * Scale(lg, tg, wg); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0.5 * (lg - wlg) * 0, -0.5 * 0.1, 0) * Scale(0.01, 0.1, 0.2); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0, -0.5 * hg+0.4, -0.5 * (wg - wlg)+0.1) * Scale(0.5, 0.3, 0.01); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0, -0.5 * hg + 0.2, -0.5 * (wg - wlg) + 0.1) * Scale(0.02, 0.1, 0.01); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); instance = Translate(0, -0.5 * hg +0.15, -0.5 * (wg - wlg) + 0.1) * Scale(0.2, 0.01, 0.05); glUniformMatrix4fv(model_loc, 1, GL_TRUE, model * instance_giuong * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); } GLfloat h_nk = 0.15; GLfloat xx = 0, yy = 0, zz = 0, a = 0, b = 0, c = 0, z_nk = 0; void ban() { instance_giuong = Translate(xx, yy, zz) * RotateZ(c) * RotateY(b) * RotateX(a); thangiuong(); } Mơ hình tổng hợp đề tài nhìn từ xuống Hàm gồm mơ hình void nen(GLfloat l, GLfloat h, GLfloat r) { instance = instance*Scale(l, h, r); glUniformMatrix4fv(model_view_loc, 1, GL_TRUE, model_view * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); } void tuong(GLfloat l, GLfloat h, GLfloat r) { instance = instance * Scale(l, h, r); glUniformMatrix4fv(model_view_loc, 1, GL_TRUE, model_view * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); } void khungnha() { instance = Identity(); /*Sửa identity() mat.h thành Identity()*/ nen(0.5f, 0.02f, 0.4f); instance = Translate(-0.14f, -0.1f, -0.1f); tuong(0.2f, 0.2f, 0.02f); instance = Translate(-0.14f, -0.2f, 0.01f); tuong(0.2f, 0.01f, 0.2f); instance = Translate(-0.05f, -0.1f, -0.01f); tuong(0.01f, 0.2f, 0.2f); instance = Translate(-0.24f, -0.1f, 0.01f); tuong(0.01f, 0.2f, 0.2f); instance = Translate(-0.14f, -0.1f, 0.1f); tuong(0.2f, 0.2f, 0.02f); } void canhcua(GLfloat l, GLfloat h, GLfloat r) { instance = Scale(l, h, r); glUniformMatrix4fv(model_view_loc, 1, GL_TRUE, model_view * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); } void khungcua(GLfloat l, GLfloat h, GLfloat r, GLfloat x, GLfloat y, GLfloat z) { instance = Translate(x, y, z) * Scale(l, h, r); glUniformMatrix4fv(model_view_loc, 1, GL_TRUE, model_view * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); } void chotcua(GLfloat l, GLfloat h) { instance = Scale(l, h, l); glUniformMatrix4fv(model_view_loc, 1, GL_TRUE, model_view * instance); glDrawArrays(GL_TRIANGLES, 0, NumPoints); } void bocua() { instance = Identity(); /*Sửa identity() mat.h thành Identity()*/ canhcua(0.4f, 1.0f, 0.02f); khungcua(0.02f, 1.0f, 0.02f, 0.2f, 0.0f, 0.0f); khungcua(0.02f, 1.0f, 0.02f, -0.2f, 0.0f, 0.0f); khungcua(0.4f, 0.02f, 0.02f, 0.0f, 0.52f, 0.0f); khungcua(0.4f, 0.02f, 0.02f, 0.0f, -0.52f, 0.0f); } Hàm chỉnh góc ánh sáng mơ hình ( mặt mặt khác tương tự theo công thức) class mat3 { vec3 _m[3]; public: // // - Constructors and Destructors // mat3( const GLfloat d = GLfloat(1.0) ) // Create a diagonal matrix { _m[0].x = d; _m[1].y = d; _m[2].z = d; } mat3( const vec3& a, const vec3& b, const vec3& c ) { _m[0] = a; _m[1] = b; _m[2] = c; } mat3( GLfloat m00, GLfloat m01, GLfloat m02, GLfloat m10, GLfloat m11, GLfloat m12, GLfloat m20, GLfloat m21, GLfloat m22 ) { _m[0] = vec3( m00, m01, m02 ); _m[1] = vec3( m10, m11, m12 ); _m[2] = vec3( m20, m21, m22 ); } mat3( const mat3& m ) { if ( *this != m ) { _m[0] = m._m[0]; _m[1] = m._m[1]; _m[2] = m._m[2]; } } // // - Indexing Operator // vec3& operator [] ( int i ) { return _m[i]; } const vec3& operator [] ( int i ) const { return _m[i]; } // // - (non-modifying) Arithmatic Operators // mat3 operator + ( const mat3& m ) const { return mat3( _m[0]+m[0], _m[1]+m[1], _m[2]+m[2] ); } mat3 operator - ( const mat3& m ) const { return mat3( _m[0]-m[0], _m[1]-m[1], _m[2]-m[2] ); } mat3 operator * ( const GLfloat s ) const { return mat3( s*_m[0], s*_m[1], s*_m[2] ); } mat3 operator / ( const GLfloat s ) const { #ifdef DEBUG if ( std::fabs(s) < DivideByZeroTolerance ) { std::cerr

Ngày đăng: 30/11/2021, 23:19

Hình ảnh liên quan

Mô hình quạt - Nhom9-Detai11-nha-cap-4

h.

ình quạt Xem tại trang 9 của tài liệu.
Mô hình giường - Nhom9-Detai11-nha-cap-4

h.

ình giường Xem tại trang 10 của tài liệu.
Hàm gồm các mô hình - Nhom9-Detai11-nha-cap-4

m.

gồm các mô hình Xem tại trang 16 của tài liệu.

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan