Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for #declares #26

Merged
merged 1 commit into from
Feb 4, 2017
Merged

Add support for #declares #26

merged 1 commit into from
Feb 4, 2017

Conversation

mcorbe
Copy link

@mcorbe mcorbe commented Jun 28, 2016

I came across the same issue as #25 and gave it a shot.

It enables to do stuff like this:

#include "math.inc"
#include "finish.inc"
#include "transforms.inc"

background {color rgb 1}

light_source {
  <-500,500,400> 
  rgb 1
  shadowless        
}

global_settings {
  assumed_gamma 2
}

#declare __ascii__ = mesh {
  [..]
}
#declare Min_ext = min_extent(__ascii__);
#declare Max_ext = max_extent(__ascii__);

#declare X_len = Max_ext.x - Min_ext.x;
#declare Y_len = Max_ext.y - Min_ext.y;
#declare Z_len = Max_ext.z - Min_ext.z;

#declare Radius = max(X_len / atan(pi / 5), Y_len / atan(pi / 5), Z_len / atan(pi / 5));
#declare Theta = -pi / 2 * pow(2.71828, -Y_len / X_len);
#declare Phi = -pi / 2 * pow(2.71828, -Z_len / 2 / (X_len + Y_len));

#declare X_offset = Min_ext.x + X_len / 2;
#declare Y_offset = Min_ext.y + Y_len / 2;
#declare Z_offset = Min_ext.z;

#declare X_pos = Radius * sin(Theta) * cos(Phi) + X_offset;
#declare Y_pos = Radius * sin(Theta) * sin(Phi) + Y_offset;
#declare Z_pos = Radius * cos(Theta) + Z_offset;

#declare look_at_z = (Max_ext.z - Min_ext.z) / 4;

#debug concat("radius:", str(Radius, 5, 0))
#debug concat("theta:", str(Theta, 5, 0))
#debug concat("phi:", str(Phi, 5, 0))
#debug concat("look_at:", str(look_at_z, 5, 0))

camera {
  orthographic
  location <X_pos, Y_pos, Z_pos>
  sky <0, 0, 1>
  look_at <X_offset, Y_offset, look_at_z>
}

sky_sphere
{
    pigment
    {
        gradient y
        color_map
        {
            [0.0 rgb <1.0,1.0,1.0>]     //153, 178.5, 255   //150, 240, 192
            [0.7 rgb <0.9,0.9,0.9>]     //  0,  25.5, 204   //155, 240, 96
        }
        scale 2
        translate 1
    }
}

object {
  __ascii__
  texture {
    pigment {color <1,1,1>}
    finish {phong 0.0}
  }
}

@mcorbe
Copy link
Author

mcorbe commented Jul 26, 2016

ping

1 similar comment
@mcorbe
Copy link
Author

mcorbe commented Feb 3, 2017

ping

@Zulko Zulko merged commit 7d576a2 into Zulko:master Feb 4, 2017
@mcorbe
Copy link
Author

mcorbe commented Feb 5, 2017

Thanks @Zulko, you also probably close #25.

@DerOzean
Copy link

Hey Guys,
#25
i don't get it, how to create a spline/cable/wire, I just don't understand how I should create such a class
It would be great if you could help me
Or are there otherways to combine povray with a video, I just want that images I created in an video ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants