// main void main(void) { vec2 uv = gl_FragCoord.xy / iResolution.xy; uv = uv * 2.0 - 1.0; uv.x *= iResolution.x / iResolution.y; float time = iGlobalTime * 0.3; // ray vec3 ang = vec3(sin(time*3.0)*0.1,sin(time)*0.2+0.4,time); if(iMouse.z > 0.0) ang = vec3(0.0,clamp(2.0-iMouse.y*0.01,-0.3,PI),iMouse.x*0.01); mat4 rot = fromEuler(ang); vec3 ori = vec3(0.0,0.2,time*1.0); ori.y += abs(map_detailed(-ori)); vec3 dir = normalize(vec3(uv.xy,-1.0)); dir = rotate(normalize(dir),rot); // tracing vec3 p; float dens = hftracing(ori,dir,p); vec3 dist = p - ori; vec3 n = getNormal(p, dot(dist,dist)*EPSILON_NRM); // color vec3 color = sea_color(p,n,dir,dist); vec3 light = normalize(vec3(0.0,1.0,0.8)); color += vec3(diffuse(n,light,80.0) * SEA_WATER_COLOR) * 0.12; color += vec3(specular(n,light,dir,60.0)); // post color = mix(sky_color(dir),color, clamp(1.0-length(dist)/100.0,0.0,1.0)); color = pow(color,vec3(0.75)); gl_FragColor = vec4(color,1.0); }
void PropertyGrid::showCoreProperties(Lumix::Entity entity) { char name[256]; const char* tmp = m_editor.getUniverse()->getEntityName(entity); ImGui::LabelText("ID", "%d", entity.index); Lumix::copyString(name, tmp); if (ImGui::InputText("Name", name, sizeof(name))) m_editor.setEntityName(entity, name); auto pos = m_editor.getUniverse()->getPosition(entity); if (ImGui::DragFloat3("Position", &pos.x)) m_editor.setEntitiesPositions(&entity, &pos, 1); auto rot = m_editor.getUniverse()->getRotation(entity); auto euler = rot.toEuler(); euler.x = Lumix::Math::radiansToDegrees(fmodf(euler.x, Lumix::Math::PI)); euler.y = Lumix::Math::radiansToDegrees(fmodf(euler.y, Lumix::Math::PI)); euler.z = Lumix::Math::radiansToDegrees(fmodf(euler.z, Lumix::Math::PI)); if (ImGui::DragFloat3("Rotation", &euler.x)) { euler.x = Lumix::Math::degreesToRadians(fmodf(euler.x, 180)); euler.y = Lumix::Math::degreesToRadians(fmodf(euler.y, 180)); euler.z = Lumix::Math::degreesToRadians(fmodf(euler.z, 180)); rot.fromEuler(euler); m_editor.setEntitiesRotations(&entity, &rot, 1); } float scale = m_editor.getUniverse()->getScale(entity); if (ImGui::DragFloat("Scale", &scale, 0.1f)) { m_editor.setEntitiesScales(&entity, &scale, 1); } }
Isometry3d fromVectorET(const Vector6d& v) { Isometry3d t; t = fromEuler(v.block<3,1>(3,0)); t.translation() = v.block<3,1>(0,0); return t; }
// Euler -> Quaternion klQuat& klQuat::FromEuler(const double pitch, const double yaw, const double roll) { return *this = fromEuler(pitch, yaw, roll); }