shadows basically works
This commit is contained in:
@@ -35,8 +35,8 @@ RendererBase::RendererBase(QGLView * view_)
|
||||
, buffer_materials(GL_UNIFORM_BUFFER, GL_STREAM_DRAW)
|
||||
, buffer_lights(GL_UNIFORM_BUFFER, GL_STREAM_DRAW)
|
||||
, buffer_lights_pos(GL_UNIFORM_BUFFER, GL_STREAM_DRAW)
|
||||
, textures_empty(false)
|
||||
, textures_maps(true) {
|
||||
, textures_empty(GL_RGBA, false)
|
||||
, textures_maps(GL_RGBA, true) {
|
||||
textures_manager = new TextureManager(view);
|
||||
maps_size = QSize(1024, 1024);
|
||||
maps_hash = 0;
|
||||
@@ -237,11 +237,12 @@ void RendererBase::reloadLightsPositions(Camera * cam) {
|
||||
QGLLightPosition & so(cur_lights_pos_[i]);
|
||||
Light * l = current_lights[i];
|
||||
QMatrix4x4 m = mat * l->worldTransform();
|
||||
QVector4D pos(0, 0, 0, 1.), dir(QVector3D(0, 0, -1), 1);
|
||||
QVector4D pos(0, 0, 0, 1.), dir(0, 0, -1, 1);
|
||||
pos = m * pos;
|
||||
dir = (m * QVector4D(QVector3D(0, 0, -1), 0)).normalized();
|
||||
dir = (m * QVector4D(0, 0, -1, 0)).normalized();
|
||||
so.position = pos;
|
||||
so.direction = dir;
|
||||
l->shadow_matrix.transposed().copyDataTo(so.shadowmatrix);
|
||||
}
|
||||
buffer_lights_pos.bind(view);
|
||||
buffer_lights_pos.resize(view, cur_lights_pos_.size() * sizeof(QGLLightPosition));
|
||||
|
||||
Reference in New Issue
Block a user