Skip to content
This repository has been archived by the owner on Dec 6, 2018. It is now read-only.

Commit

Permalink
Version 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dushan-google committed May 18, 2017
0 parents commit 630b927
Show file tree
Hide file tree
Showing 1,177 changed files with 138,526 additions and 0 deletions.
434 changes: 434 additions & 0 deletions Baking/Editor/VertexBaker.cs

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions Baking/Editor/VertexBaker.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions Baking/MeshDataContainer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
///////////////////////////////////////////////////////////////////////////////
//Copyright 2017 Google Inc.
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
///////////////////////////////////////////////////////////////////////////////
using UnityEngine;
using System.Collections;


[ExecuteInEditMode]
[RequireComponent(typeof(MeshRenderer))]
public class MeshDataContainer : MonoBehaviour
{
public Mesh m_mesh;
public MeshRenderer m_mr;

public void Awake()
{
}

public void Start()
{
LoadLightingMesh();
}

public void Update()
{
if (!Application.isPlaying)
{
m_mr = GetComponent<MeshRenderer>();
if (m_mr.additionalVertexStreams == null)
{
LoadLightingMesh();
}
}
}

public void LoadLightingMesh()
{

Debug.Assert(m_mesh != null, name + " missing baked lighting mesh");
if (m_mr == null)
{
m_mr = GetComponent<MeshRenderer>();
}
m_mesh.UploadMeshData(true);
m_mr.additionalVertexStreams = m_mesh;
}
}
12 changes: 12 additions & 0 deletions Baking/MeshDataContainer.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions Baking/MeshSOA.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
///////////////////////////////////////////////////////////////////////////////
//Copyright 2017 Google Inc.
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
///////////////////////////////////////////////////////////////////////////////
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
using System.Collections.Generic;

[StructLayout(LayoutKind.Sequential, Size = 16)]
public struct SOAVertex
{
public Vector3[] vertices;
public Vector3[] normals;
public Vector4[] tangents;
public SOAVertex(int size) {
vertices = new Vector3[size];
normals = new Vector3[size];
tangents = new Vector4[size];
}
}

[StructLayout(LayoutKind.Sequential, Size=16)]
public struct LightSOA {
public Vector4[] pos_range;
public Vector4[] dir_inten;
public Vector4[] spot_angle;
public Vector4[] color_types;

public LightSOA(List<Light> lights) {
int size = lights.Count;
pos_range = new Vector4[size];
dir_inten = new Vector4[size];
spot_angle = new Vector4[size];
color_types = new Vector4[size];
for (int i = 0; i < size; ++i) {
pos_range[i] = lights[i].transform.position.ToVector4(lights[i].range);
dir_inten[i] = lights[i].transform.forward.ToVector4(lights[i].intensity);
spot_angle[i] = new Vector4(0f, 0f, 0f, lights[i].spotAngle);
color_types[i] = lights[i].color.ToVector4((int)lights[i].type);
}
}
}


12 changes: 12 additions & 0 deletions Baking/MeshSOA.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions Baking/TypeExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
///////////////////////////////////////////////////////////////////////////////
//Copyright 2017 Google Inc.
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
///////////////////////////////////////////////////////////////////////////////
using UnityEngine;
using System.Collections;
using System.Reflection;

public static class TypeExtensions {

public static Vector3 ToVector3(this Color color) {
return new Vector3(color.r, color.g, color.b);
}

public static Vector4 ToVector4(this Color color) {
return new Vector4(color.r, color.g, color.b, color.a);
}

public static Vector4 ToVector4(this Color color, float w) {
return new Vector4(color.r, color.g, color.b, w);
}

public static Vector4 ToVector4(this Vector3 v, float w = 0f) {
return new Vector4(v.x, v.y, v.z, w);
}

//public static Vector4 ToVector4 (this Vector2 v, float z = 0f, float w = 0f) {
// return new Vector4(v.x, v.y, z, w);
//}

public static Vector4 ToVector4(this float v, float y = 0f, float z = 0f, float w = 0f) {
return new Vector4(v, y, z, w);
}

public static Vector3 ToVector3(this Vector4 v) {
return new Vector3(v.x, v.y, v.z);
}

public static Vector3 ToVector3(this Vector2 v, float z = 0f) {
return new Vector3(v.x, v.y, z);
}

public static Vector3 ToVector3(this float v, float y = 0f, float z = 0f) {
return new Vector3(v, y, z);
}

public static Vector2 ToVector2(this Vector3 v) {
return new Vector2(v.x, v.y);
}

public static Vector2 ToVector2(this Vector4 v) {
return new Vector2(v.x, v.y);
}

public static Vector2 ToVector2(this float v, float y = 0f) {
return new Vector2(v, y);
}
}
12 changes: 12 additions & 0 deletions Baking/TypeExtensions.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```
# How to Contribute
We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.
## Contributor License Agreement
Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution,
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to <https://cla.developers.google.com/> to see
your current agreements on file or to sign a new one.
You generally only need to submit a CLA once, so if you've already submitted one
(even if it was for a different project), you probably don't need to do it
again.
## Code reviews
All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.
```
9 changes: 9 additions & 0 deletions DaydreamRenderer/Assets/DaydreamRenderer.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions DaydreamRenderer/Assets/DaydreamRenderer/Baking.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions DaydreamRenderer/Assets/DaydreamRenderer/Baking/BakeFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
///////////////////////////////////////////////////////////////////////////////
//Copyright 2017 Google Inc.
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
///////////////////////////////////////////////////////////////////////////////

using UnityEngine;
using System.Collections;

namespace daydreamrenderer
{
public class BakeFilter : MonoBehaviour
{
public enum Filter
{
IncludeInBake, // default if filter is not applied
ExcludeFromBake, // skip during baking
}

public Filter m_bakeFilter;

}
}
12 changes: 12 additions & 0 deletions DaydreamRenderer/Assets/DaydreamRenderer/Baking/BakeFilter.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 630b927

Please sign in to comment.