giugio

Member
  • Content count

    1193
  • Joined

  • Last visited

Community Reputation

246 Neutral

About giugio

  • Rank
    Contributor
  1. Hello. I created a list of classes from an xsd with xsd.exe utility. I'm looking for a way to expand the content of some deserialize xml in these classes in order to have a correct objects structure. My problem is that I have the xml and xsd that have ids and refs attributes and where for example I have a ref in the xml i get the classes that ignores it and I have a set incomplete classes with null in place of the entity corresponding to the ref. thank you. There is a method for deserialize a complete set of classes?Where the ref attributed class correspond to the id. Thanks.
  2. hello i'm searching for a fast method for transform a very big tabular data to an opencl buffer or texture. I use c# and i select two table. Now i can use datatable.net class or a cursor in java or c#. then what is a fast method for transform this tabular data to a buffer or texture? Because i must compare char to char these data and return where are the difference and all this in opencl. I have some doubt for the fields . how opencl kernel can find in what field is the compare? I can use a transcode bufffer? can you help me ? this can be useful also for other user. thanks
  3. hello. I have created with the xsd.exe any classes from a huge xsd.. Then i load  a my custom xmlreader I would create a custom xmlreader for make some little adjustment on the fly like sax to some xml files of size around 4 / 5 gb. The problem is that when i change an element on the fly in the custom xmlreader the next function that is triggered is the public override string NamespaceURI and any string i return in this function i get an error because the parser asks for an xmls= and i can't remove this xmls= that is proposed in all elements. How i can eliminate this xmlns=? thanks.
  4. i googoled and i saw a little of task programming. I have this scenario: i have many events that fire and i must create a task in response to them and launch the task if another single task of general importation has finished his work. When all the tasks of events have finished his work i can launch the general task and so one. I saw that the key commands are async and await , but i don't understand how get the response id from the launched task and insert it in a list, i saw that these task return a string or other generic type. thanks.
  5. Hello. I use c#. I created a system of push notifications with the microsoft exchange webservice exchange but may be any other webservice. Basically I have a method that responds to an event when I make a change on exchange. The problem is that I can have many events and each of these must play a "work" that is, put a id in 2 / 3 tables. I was wondering whether to start a thread or a task or an asynchronous function that creates a new connection and adds all ids in the db for each event. not know nothing of multitasking then i ask you. thank you.
  6. Hello. I have this problem: i try to import from an XML format (open format to xml ifc architecture) of which I have the xsd and its generated classes for deserialization / serialization, now unpickled / serialized properly. The problem is that some cad exports a little as they like especially the namespaces. I created inheriting an XmlReader a custom xmlreader that enumerates the namespaces , elements and attributes, but I doesn't replace the namespace with those of the CAD system that has different namespace. I would use a custom XmlReader for each CAD system in for adapt the xml to the standard xml . thank you.
  7. hello, i created a c#/c++cli/c++ application. in c++ i wrote a little opengl engine and in c# i implemented the ui interface. in cli i created the wrappers around c++ functions an i have imported it in c# in a managed dll. Now, what is the system for send/receive data as collections from and to c#? I can use a simple MVC or it can be slow? Thanks.
  8. thanks haegarr i use the word matrix = inverse of rotation an all works fine. thanks again.
  9. ab_next *= glm::normalize(glm::angleAxis((50), glm::vec3(1.0,0.0,0.0))); . . //this is called before draw the object and i'm set it to the prograsm shader like a matrix glm::mat3 mat = glm::toMat3(glm::normalize(ab_next)); glm::vec3 x1 = glm::vec3(mat[0].x,mat[0].y,mat[0].z); glm::vec3 y1 = glm::vec3(mat[1].x, mat[1].y, mat[1].z); glm::vec3 z1 = glm::vec3(mat[2].x, mat[2].y, mat[2].z); float x = glm::dot(x1, eye); float y= glm::dot(y1, eye); float z = glm::dot(z1, eye); glm::mat4x4 mview; mview[0].x = mat[0].x; mview[0].y = mat[0].y; mview[0].z = mat[0].z; mview[1].x = mat[1].x; mview[1].y = mat[1].y; mview[1].z = mat[1].z; mview[2].x = mat[2].x; mview[2].y = mat[2].y; mview[2].z = mat[2].z; mview[3].x = x; mview[3].y = y; mview[3].z = z; mview[3].w = 1; mVV = mview; return getPerspectiveMatrix() * mview; this is not related to the arcball camera i set the data at hand 50° degree around 1.0,0.0.0, but my problem is that this rotate the object around a sphere from me (eye) to the object and not around object .How i can rotate only the object around a little sphere that is his bounding box? is possible?     i'm try to convert from this code that is deprecated in my camera sorry if i don't posted it before this camera works /* Arcball, written by Bradley Smith, March 24, 2006 * arcball.cpp is free to use and modify for any purpose, with no * restrictions of copyright or license. * * See arcball.h for usage details. */ #include "arcball.h" #include <GL\gl.h> #include <GL\GLU.h> GLfloat ab_quat[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1}; GLfloat ab_last[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1}; GLfloat ab_next[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1}; // the distance from the origin to the eye GLfloat ab_zoom = 1.0; GLfloat ab_zoom2 = 1.0; // the radius of the arcball GLfloat ab_sphere = 1.0; GLfloat ab_sphere2 = 1.0; // the distance from the origin of the plane that intersects // the edge of the visible sphere (tangent to a ray from the eye) GLfloat ab_edge = 1.0; // whether we are using a sphere or plane bool ab_planar = false; GLfloat ab_planedist = 0.5; vec ab_start = vec(0,0,1); vec ab_curr = vec(0,0,1); vec ab_eye = vec(0,0,1); vec ab_eyedir = vec(0,0,1); vec ab_up = vec(0,1,0); vec ab_out = vec(1,0,0); GLdouble ab_glp[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1}; GLdouble ab_glm[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1}; int ab_glv[4] = {0,0,800,600}; void arcball_setzoom(float radius, vec eye, vec up) { ab_eye = eye; // store eye vector ab_zoom2 = ab_eye * ab_eye; ab_zoom = sqrt(ab_zoom2); // store eye distance ab_sphere = radius; // sphere radius ab_sphere2 = ab_sphere * ab_sphere; ab_eyedir = ab_eye * (1.0 / ab_zoom); // distance to eye ab_edge = ab_sphere2 / ab_zoom; // plane of visible edge if(ab_sphere <= 0.0) // trackball mode { ab_planar = true; ab_up = up; ab_out = ( ab_eyedir ^ ab_up ); ab_planedist = (0.0 - ab_sphere) * ab_zoom; } else ab_planar = false; glGetDoublev(GL_PROJECTION_MATRIX,ab_glp); glGetIntegerv(GL_VIEWPORT,ab_glv); } // affect the arcball's orientation on openGL void arcball_rotate() { glMultMatrixf(ab_quat); } // convert the quaternion into a rotation matrix static void quaternion(GLfloat* q, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GLfloat x2 = x*x; GLfloat y2 = y*y; GLfloat z2 = z*z; GLfloat xy = x*y; GLfloat xz = x*z; GLfloat yz = y*z; GLfloat wx = w*x; GLfloat wy = w*y; GLfloat wz = w*z; q[0] = 1 - 2*y2 - 2*z2; q[1] = 2*xy + 2*wz; q[2] = 2*xz - 2*wy; q[4] = 2*xy - 2*wz; q[5] = 1 - 2*x2 - 2*z2; q[6] = 2*yz + 2*wx; q[8] = 2*xz + 2*wy; q[9] = 2*yz - 2*wx; q[10]= 1 - 2*x2 - 2*y2; } // reset the rotation matrix static void quatidentity(GLfloat* q) { q[0]=1; q[1]=0; q[2]=0; q[3]=0; q[4]=0; q[5]=1; q[6]=0; q[7]=0; q[8]=0; q[9]=0; q[10]=1; q[11]=0; q[12]=0; q[13]=0; q[14]=0; q[15]=1; } // copy a rotation matrix static void quatcopy(GLfloat* dst, GLfloat* src) { dst[0]=src[0]; dst[1]=src[1]; dst[2]=src[2]; dst[4]=src[4]; dst[5]=src[5]; dst[6]=src[6]; dst[8]=src[8]; dst[9]=src[9]; dst[10]=src[10]; } // multiply two rotation matrices static void quatnext(GLfloat* dest, GLfloat* left, GLfloat* right) { dest[0] = left[0]*right[0] + left[1]*right[4] + left[2] *right[8]; dest[1] = left[0]*right[1] + left[1]*right[5] + left[2] *right[9]; dest[2] = left[0]*right[2] + left[1]*right[6] + left[2] *right[10]; dest[4] = left[4]*right[0] + left[5]*right[4] + left[6] *right[8]; dest[5] = left[4]*right[1] + left[5]*right[5] + left[6] *right[9]; dest[6] = left[4]*right[2] + left[5]*right[6] + left[6] *right[10]; dest[8] = left[8]*right[0] + left[9]*right[4] + left[10]*right[8]; dest[9] = left[8]*right[1] + left[9]*right[5] + left[10]*right[9]; dest[10]= left[8]*right[2] + left[9]*right[6] + left[10]*right[10]; } // find the intersection with the plane through the visible edge static vec edge_coords(vec m) { // find the intersection of the edge plane and the ray float t = (ab_edge - ab_zoom) / (ab_eyedir * m); vec a = ab_eye + (m*t); // find the direction of the eye-axis from that point // along the edge plane vec c = (ab_eyedir * ab_edge) - a; // find the intersection of the sphere with the ray going from // the plane outside the sphere toward the eye-axis. float ac = (a*c); float c2 = (c*c); float q = ( 0.0 - ac - sqrt( ac*ac - c2*((a*a)-ab_sphere2) ) ) / c2; return (a+(c*q)).unit(); } // find the intersection with the sphere static vec sphere_coords(GLdouble mx, GLdouble my) { GLdouble ax,ay,az; gluUnProject(mx,my,0,ab_glm,ab_glp,ab_glv,&ax,&ay,&az); vec m = vec((float)ax,(float)ay,(float)az) - ab_eye; // mouse position represents ray: eye + t*m // intersecting with a sphere centered at the origin GLfloat a = m*m; GLfloat b = (ab_eye*m); GLfloat root = (b*b) - a*(ab_zoom2 - ab_sphere2); if(root <= 0) return edge_coords(m); GLfloat t = (0.0 - b - sqrt(root)) / a; return (ab_eye+(m*t)).unit(); } // get intersection with plane for "trackball" style rotation static vec planar_coords(GLdouble mx, GLdouble my) { GLdouble ax,ay,az; gluUnProject(mx,my,0,ab_glm,ab_glp,ab_glv,&ax,&ay,&az); vec m = vec((float)ax,(float)ay,(float)az) - ab_eye; // intersect the point with the trackball plane GLfloat t = (ab_planedist - ab_zoom) / (ab_eyedir * m); vec d = ab_eye + m*t; return vec(d*ab_up,d*ab_out,0.0); } // reset the arcball void arcball_reset() { quatidentity(ab_quat); quatidentity(ab_last); } // begin arcball rotation void arcball_start(int mx, int my) { // saves a copy of the current rotation for comparison quatcopy(ab_last,ab_quat); if(ab_planar) ab_start = planar_coords((GLdouble)mx,(GLdouble)my); else ab_start = sphere_coords((GLdouble)mx,(GLdouble)my); } // update current arcball rotation void arcball_move(int mx, int my) { if(ab_planar) { ab_curr = planar_coords((GLdouble)mx,(GLdouble)my); if(ab_curr.equals(ab_start)) return; // d is motion since the last position vec d = ab_curr - ab_start; GLfloat angle = d.length() * 0.5; GLfloat cosa = cos( angle ); GLfloat sina = sin( angle ); // p is perpendicular to d vec p = ((ab_out*d.x)-(ab_up*d.y)).unit() * sina; quaternion(ab_next,p.x,p.y,p.z,cosa); quatnext(ab_quat,ab_last,ab_next); // planar style only ever relates to the last point quatcopy(ab_last,ab_quat); ab_start = ab_curr; } else { ab_curr = sphere_coords((GLdouble)mx,(GLdouble)my); if(ab_curr.equals(ab_start)) { // avoid potential rare divide by tiny quatcopy(ab_quat,ab_last); return; } // use a dot product to get the angle between them // use a cross product to get the vector to rotate around GLfloat cos2a = ab_start*ab_curr; GLfloat sina = sqrt((1.0 - cos2a)*0.5); GLfloat cosa = sqrt((1.0 + cos2a)*0.5); vec cross = (ab_start^ab_curr).unit() * sina; quaternion(ab_next,cross.x,cross.y,cross.z,cosa); // update the rotation matrix quatnext(ab_quat,ab_last,ab_next); } } thanks heagarr
  10. I sorry for my hurry, i stop and thinks, i have this code: ab_next is a quaternion ab_next *= glm::normalize(glm::angleAxis((angle), glm::vec3(1.0,0.0,0.0))); . . //this is called before draw the object and i'm set it to the prograsm shader like a matrix glm::mat3 mat = glm::toMat3(glm::normalize(ab_next)); glm::vec3 x1 = glm::vec3(mat[0].x,mat[0].y,mat[0].z); glm::vec3 y1 = glm::vec3(mat[1].x, mat[1].y, mat[1].z); glm::vec3 z1 = glm::vec3(mat[2].x, mat[2].y, mat[2].z); float x = glm::dot(x1, eye); float y= glm::dot(y1, eye); float z = glm::dot(z1, eye); glm::mat4x4 mview; mview[0].x = mat[0].x; mview[0].y = mat[0].y; mview[0].z = mat[0].z; mview[1].x = mat[1].x; mview[1].y = mat[1].y; mview[1].z = mat[1].z; mview[2].x = mat[2].x; mview[2].y = mat[2].y; mview[2].z = mat[2].z; mview[3].x = x; mview[3].y = y; mview[3].z = z; mview[3].w = 1; mVV = mview; return getPerspectiveMatrix() * mview; the object rotates around a big sphere and i would that the object rotating around itself. the object is at 10,5 of distance in the z axis. I don't know where comes this big sphere. thanks
  11.     a precisation : ab_next is a quaternion
  12. where mVV is the view matrix
  13. thanks, i change to : float cos2a = glm::dot(ab_start, ab_curr); float angle = glm::degrees(glm::acos(cos2a)); glm::vec3 cross = glm::normalize(glm::cross(ab_start, ab_curr)); ab_next = glm::normalize(glm::rotate(ab_next,angle,cross)); ab_start = ab_curr; and for explain i get the ab_start like: glm::vec3 CCameraEx::sphere_coords(GLdouble mx, GLdouble my) { GLdouble ax, ay, az; glm::mat4x4 mt = glm::mat4x4(1) * mVV; glm::vec3 m = glm::unProject(glm::vec3(mx, my,0.0),mt , mP, glm::vec4(0, 0, 800.0f, 600.0f)); m = m - ab_eye; // mouse position represents ray: eye + t*m // intersecting with a sphere centered at the origin GLfloat a = glm::dot(m,m); GLfloat b = glm::dot(ab_eye,m); GLfloat root = (b*b) - a*(ab_zoom2 - ab_sphere2); if (root <= 0) return edge_coords(m); GLfloat t = (0.0 - b - sqrt(root)) / a; return glm::normalize((ab_eye + (m*t))); } // find the intersection with the plane through the visible edge glm::vec3 CCameraEx::edge_coords(glm::vec3 m) { // find the intersection of the edge plane and the ray float t = ((ab_edge - ab_zoom) / (glm::dot<float>(ab_eyedir , m))); glm::vec3 a = ab_eye + (m*t); // find the direction of the eye-axis from that point // along the edge plane glm::vec3 c = (ab_eyedir * ab_edge) - a; // find the intersection of the sphere with the ray going from // the plane outside the sphere toward the eye-axis. float ac = glm::dot(a,c); float c2 = glm::dot(c,c); float q = (0.0 - ac - glm::sqrt(ac*ac - c2*((glm::dot(a,a)) - ab_sphere2))) / c2; return glm::normalize((a + (c*q))); }
  14. very thanks , but at the end this is the new viewmatrix?